YOUPAIBBNIMSessionListViewController.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // YOUPAIBBNIMSessionListViewController.h
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/10/22.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "NIMCellConfig.h"
  10. #import <NIMSDK/NIMSDK.h>
  11. @class NIMRecentSession;
  12. @interface YOUPAIBBNIMSessionListViewController : UIViewController<UITableViewDataSource,UITableViewDelegate,NIMLoginManagerDelegate,NIMConversationManagerDelegate>
  13. /**
  14. * 会话列表tableView
  15. */
  16. @property (nonatomic,strong) UITableView *tableView;
  17. /**
  18. * 最近会话集合
  19. */
  20. @property (nonatomic,strong) NSMutableArray * recentSessions;
  21. /**
  22. * 删除会话时是不是也同时删除服务器会话 (防止漫游)
  23. */
  24. @property (nonatomic,assign) BOOL autoRemoveRemoteSession;
  25. /**
  26. * 选中某一条最近会话时触发的事件回调
  27. *
  28. * @param recent 最近会话
  29. * @param indexPath 最近会话cell所在的位置
  30. * @discussion 默认将进入会话界面
  31. */
  32. - (void)onSelectedRecent:(NIMRecentSession *)recent
  33. atIndexPath:(NSIndexPath *)indexPath;
  34. /**
  35. * 选中某一条最近会话的头像控件,触发的事件回调
  36. *
  37. * @param recent 最近会话
  38. * @param indexPath 最近会话cell所在的位置
  39. * @discussion 默认将进入会话界面
  40. */
  41. - (void)onSelectedAvatar:(NIMRecentSession *)recent
  42. atIndexPath:(NSIndexPath *)indexPath;
  43. /**
  44. * cell显示的会话名
  45. *
  46. * @param recent 最近会话
  47. *
  48. * @return 会话名
  49. *
  50. * @discussion 默认实现为:点对点会话,显示聊天对象的昵称(没有昵称则显示账号);群聊会话,显示群名称。
  51. */
  52. - (NSString *)nameForRecentSession:(NIMRecentSession *)recent;
  53. /**
  54. * cell显示的最近会话具体内容
  55. *
  56. * @param recent 最近会话
  57. *
  58. * @return 具体内容名
  59. *
  60. * @discussion 默认实现为:显示最近一条消息的内容,文本消息则显示文本信息,其他类型消息详见本类中 - (NSAttributedString *)messageContent:(NIMMessage *)lastMessage 方法的实现。
  61. */
  62. - (NSAttributedString *)contentForRecentSession:(NIMRecentSession *)recent;
  63. /**
  64. * cell显示的最近会话时间戳
  65. *
  66. * @param recent 最近会话
  67. *
  68. * @return 时间戳格式化后的字符串
  69. *
  70. * @discussion 默认实现为:最后一条消息的时间戳,具体时间戳消息格式详见NIMKitUtil中, + (NSString*)showTime:(NSTimeInterval) msglastTime showDetail:(BOOL)showDetail 方法的实现。
  71. */
  72. - (NSString *)timestampDescriptionForRecentSession:(NIMRecentSession *)recent;
  73. /**
  74. * 重新加载所有数据,调用时必须先调用父类方法
  75. */
  76. - (void)refresh;
  77. /**
  78. * 自定义最近会话排序,上层可以重写这个方法对最近会话重新排序
  79. */
  80. - (NSMutableArray *)customSortRecents:(NSMutableArray *)recentSessions;
  81. - (NSString *)messageContent:(NIMMessage*)lastMessage;
  82. @end