TIMCommonModel.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. //
  2. // TIMCommonModel.h
  3. // TIMCommon
  4. //
  5. // Created by cologne on 2023/3/14.
  6. // Copyright © 2023 Tencent. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <TUICore/TUICommonModel.h>
  10. #import "TIMDefine.h"
  11. NS_ASSUME_NONNULL_BEGIN
  12. ////////////////////////////////////////////////////////////////////////////////
  13. //
  14. // TUIPopView
  15. //
  16. /////////////////////////////////////////////////////////////////////////////////
  17. @class TUIPopView;
  18. @protocol TUIPopViewDelegate <NSObject>
  19. - (void)popView:(TUIPopView *)popView didSelectRowAtIndex:(NSInteger)index;
  20. @end
  21. @interface TUIPopView : UIView
  22. @property(nonatomic, strong) UITableView *tableView;
  23. @property(nonatomic, assign) CGPoint arrowPoint;
  24. @property(nonatomic, weak) id<TUIPopViewDelegate> delegate;
  25. - (void)setData:(NSMutableArray *)data;
  26. - (void)showInWindow:(UIWindow *)window;
  27. @end
  28. @interface TUIPopCellData : NSObject
  29. @property(nonatomic, strong) UIImage *image;
  30. @property(nonatomic, strong) NSString *title;
  31. @end
  32. @interface TUIPopCell : UITableViewCell
  33. @property(nonatomic, strong) UIImageView *image;
  34. @property(nonatomic, strong) UILabel *title;
  35. + (CGFloat)getHeight;
  36. - (void)setData:(TUIPopCellData *)data;
  37. @end
  38. /////////////////////////////////////////////////////////////////////////////////
  39. //
  40. // TUIModifyView
  41. //
  42. /////////////////////////////////////////////////////////////////////////////////
  43. @class TUIModifyView;
  44. @protocol TUIModifyViewDelegate <NSObject>
  45. - (void)modifyView:(TUIModifyView *)modifyView didModiyContent:(NSString *)content;
  46. @end
  47. @interface TUIModifyViewData : NSObject
  48. @property(nonatomic, strong) NSString *title;
  49. @property(nonatomic, strong) NSString *content;
  50. @property(nonatomic, strong) NSString *desc;
  51. @property(nonatomic, assign) BOOL enableNull;
  52. @end
  53. @interface TUIModifyView : UIView
  54. @property(nonatomic, strong) UIView *container;
  55. @property(nonatomic, strong) UILabel *title;
  56. @property(nonatomic, strong) UITextField *content;
  57. @property(nonatomic, strong) UILabel *descLabel;
  58. @property(nonatomic, strong) UIButton *confirm;
  59. @property(nonatomic, strong) UIView *hLine;
  60. @property(nonatomic, weak) id<TUIModifyViewDelegate> delegate;
  61. - (void)setData:(TUIModifyViewData *)data;
  62. - (void)showInWindow:(UIWindow *)window;
  63. @end
  64. /////////////////////////////////////////////////////////////////////////////////
  65. //
  66. // TUINaviBarIndicatorView
  67. //
  68. /////////////////////////////////////////////////////////////////////////////////
  69. @interface TUINaviBarIndicatorView : UIView
  70. @property(nonatomic, strong) UIActivityIndicatorView *indicator;
  71. @property(nonatomic, strong) UILabel *label;
  72. @property(nonatomic, assign) CGFloat maxLabelLength;
  73. - (void)setTitle:(NSString *)title;
  74. - (void)startAnimating;
  75. - (void)stopAnimating;
  76. @end
  77. /////////////////////////////////////////////////////////////////////////////////
  78. //
  79. // TUICommonCell & data
  80. //
  81. /////////////////////////////////////////////////////////////////////////////////
  82. @interface TUICommonCellData : NSObject
  83. @property(strong) NSString *reuseId;
  84. @property(nonatomic, assign) SEL cselector;
  85. @property(nonatomic, strong) NSDictionary *ext;
  86. - (CGFloat)heightOfWidth:(CGFloat)width;
  87. - (CGFloat)estimatedHeight;
  88. @end
  89. @interface TUICommonTableViewCell : UITableViewCell
  90. @property(readonly) TUICommonCellData *data;
  91. @property UIColor *colorWhenTouched;
  92. @property BOOL changeColorWhenTouched;
  93. - (void)fillWithData:(TUICommonCellData *)data;
  94. @end
  95. /////////////////////////////////////////////////////////////////////////////////
  96. //
  97. // TUICommonTextCell & data
  98. //
  99. /////////////////////////////////////////////////////////////////////////////////
  100. @interface TUICommonTextCellData : TUICommonCellData
  101. @property NSString *key;
  102. @property NSString *value;
  103. @property BOOL showAccessory;
  104. @property UIColor *keyColor;
  105. @property UIColor *valueColor;
  106. @property BOOL enableMultiLineValue;
  107. @property(nonatomic, assign) UIEdgeInsets keyEdgeInsets;
  108. @end
  109. @interface TUICommonTextCell : TUICommonTableViewCell
  110. @property UILabel *keyLabel;
  111. @property UILabel *valueLabel;
  112. @property(readonly) TUICommonTextCellData *textData;
  113. - (void)fillWithData:(TUICommonTextCellData *)data;
  114. @end
  115. /////////////////////////////////////////////////////////////////////////////////
  116. //
  117. // TUICommonSwitchCell & data
  118. //
  119. /////////////////////////////////////////////////////////////////////////////////
  120. @interface TUICommonSwitchCellData : TUICommonCellData
  121. @property NSString *title;
  122. @property NSString *desc;
  123. @property(getter=isOn) BOOL on;
  124. @property CGFloat margin;
  125. @property SEL cswitchSelector;
  126. @property(nonatomic, assign) BOOL displaySeparatorLine;
  127. @property(nonatomic, assign) BOOL disableChecked;
  128. @end
  129. @interface TUICommonSwitchCell : TUICommonTableViewCell
  130. @property UILabel *titleLabel; // main title label
  131. @property UILabel *descLabel; // detail title label below the main title label, used for explaining details
  132. @property UISwitch *switcher;
  133. @property(readonly) TUICommonSwitchCellData *switchData;
  134. - (void)fillWithData:(TUICommonSwitchCellData *)data;
  135. @end
  136. /////////////////////////////////////////////////////////////////////////////////
  137. //
  138. // TUIButtonCell & data
  139. //
  140. /////////////////////////////////////////////////////////////////////////////////
  141. typedef enum : NSUInteger {
  142. ButtonGreen,
  143. ButtonWhite,
  144. ButtonRedText,
  145. ButtonBule,
  146. } TUIButtonStyle;
  147. @interface TUIButtonCellData : TUICommonCellData
  148. @property(nonatomic, strong) NSString *title;
  149. @property SEL cbuttonSelector;
  150. @property TUIButtonStyle style;
  151. @property(nonatomic, strong) UIColor *textColor;
  152. @property(nonatomic, assign) BOOL hideSeparatorLine;
  153. @end
  154. @interface TUIButtonCell : TUICommonTableViewCell
  155. @property(nonatomic, strong) UIButton *button;
  156. @property TUIButtonCellData *buttonData;
  157. - (void)fillWithData:(TUIButtonCellData *)data;
  158. @end
  159. /////////////////////////////////////////////////////////////////////////////////
  160. //
  161. // TUIGroupPendencyCell & data
  162. //
  163. /////////////////////////////////////////////////////////////////////////////////
  164. #define TUIGroupPendencyCellData_onPendencyChanged @"TUIGroupPendencyCellData_onPendencyChanged"
  165. @interface TUIGroupPendencyCellData : TUICommonCellData
  166. @property(nonatomic, strong) NSString *groupId;
  167. @property(nonatomic, strong) NSString *fromUser;
  168. @property(nonatomic, strong) NSString *toUser;
  169. @property(readonly) V2TIMGroupApplication *pendencyItem;
  170. @property NSURL *avatarUrl;
  171. @property NSString *title;
  172. /**
  173. * The joining group introduction of the requester. Such as "Xiao Ming applied to join the group".
  174. */
  175. @property NSString *requestMsg;
  176. /**
  177. * Agree or Not
  178. * YES: Agree; NO: Indicates that the current request was not granted, but does not mean that the request has been denied.
  179. */
  180. @property BOOL isAccepted;
  181. /**
  182. *
  183. * Refuse or Not
  184. * YES: Refuse; NO: Indicates that the current request is not denied, but does not mean that the request has been granted.
  185. */
  186. @property BOOL isRejectd;
  187. @property SEL cbuttonSelector;
  188. - (instancetype)initWithPendency:(V2TIMGroupApplication *)args;
  189. typedef void (^TUIGroupPendencyCellDataSuccessCallback)(void);
  190. typedef void (^TUIGroupPendencyCellDataFailureCallback)(int code, NSString *msg);
  191. - (void)agreeWithSuccess:(TUIGroupPendencyCellDataSuccessCallback)success
  192. failure:(TUIGroupPendencyCellDataFailureCallback)failure;
  193. - (void)rejectWithSuccess:(TUIGroupPendencyCellDataSuccessCallback)success
  194. failure:(TUIGroupPendencyCellDataFailureCallback)failure;
  195. - (void)accept;
  196. - (void)reject;
  197. @end
  198. @interface TUIGroupPendencyCell : TUICommonTableViewCell
  199. @property UIImageView *avatarView;
  200. @property UILabel *titleLabel;
  201. @property UILabel *addWordingLabel;
  202. @property UIButton *agreeButton;
  203. @property TUIGroupPendencyCellData *pendencyData;
  204. - (void)fillWithData:(TUIGroupPendencyCellData *)pendencyData;
  205. @end
  206. /////////////////////////////////////////////////////////////////////////////////
  207. //
  208. // TUIFaceCell & data
  209. //
  210. /////////////////////////////////////////////////////////////////////////////////
  211. /**
  212. * 【Module name】 TUIFaceCellData
  213. * 【Function description]】The name and local storage path of the stored emoticon.
  214. */
  215. @interface TUIFaceCellData : NSObject
  216. /**
  217. * The name of emoticon
  218. */
  219. @property(nonatomic, strong) NSString *name;
  220. /**
  221. * The localized name of the emoticon (the attribute used for internationalization, if it is empty or the length is 0, the name is displayed by default)
  222. */
  223. @property(nonatomic, copy) NSString *localizableName;
  224. /**
  225. * The storage path of the emoticon cached locally.
  226. */
  227. @property(nonatomic, strong) NSString *path;
  228. @end
  229. /**
  230. * 【Module name】TUIFaceCell
  231. * 【Function description】 Store the image of the emoticon, and initialize the Cell according to TUIFaceCellData.
  232. * In the emoticon view, TUIFaceCell is the unit displayed on the interface.
  233. */
  234. @interface TUIFaceCell : UICollectionViewCell
  235. /**
  236. * The image view for displaying emoticon
  237. */
  238. @property(nonatomic, strong) UIImageView *face;
  239. @property(nonatomic, strong) UIImage *staicImage;
  240. @property(nonatomic, strong) UIImage *gifImage;
  241. @property(nonatomic, copy) void(^longPressCallback)(UILongPressGestureRecognizer *recognizer);
  242. - (void)setData:(TUIFaceCellData *)data;
  243. @end
  244. /////////////////////////////////////////////////////////////////////////////////
  245. //
  246. // TUIFaceGroup
  247. //
  248. /////////////////////////////////////////////////////////////////////////////////
  249. /**
  250. * 【Module name】 TUIFaceGroup
  251. * 【Function description】 It is used to realize the grouping of emoticon, which is convenient for users to browse and select under different emoticon themes.
  252. * This class stores the index of each emoticon group, so that FaceView can locate each emoticon group.
  253. * At the same time, this class stores the path of all emoticon pictures in an emoticon group, and provides data such as the number of lines, the number of
  254. * emoticons in each line, etc., to locate specific emoticons
  255. */
  256. @interface TUIFaceGroup : NSObject
  257. /**
  258. * Index of emoticons group, begining with zero.
  259. */
  260. @property(nonatomic, assign) int groupIndex;
  261. /**
  262. * The resource path of the entire expression group
  263. */
  264. @property(nonatomic, strong) NSString *groupPath;
  265. /**
  266. * The number of lines of emoticons in the emoticon group
  267. */
  268. @property(nonatomic, assign) int rowCount;
  269. /**
  270. * The number of emoticons contained in each line
  271. */
  272. @property(nonatomic, assign) int itemCountPerRow;
  273. @property(nonatomic, strong) NSMutableArray *faces;
  274. @property(nonatomic, strong) NSDictionary *facesMap;
  275. /**
  276. * The flag of indicating whether to display the delete button
  277. * When set to YES, FaceView will display a "delete" icon in the lower right corner of the emoticon view. Clicking the icon can delete the entered emoticon
  278. * directly without evoking the keyboard.
  279. */
  280. @property(nonatomic, assign) BOOL needBackDelete;
  281. /**
  282. * The path to the cover image of the emoticon group
  283. */
  284. @property(nonatomic, strong) NSString *menuPath;
  285. @property(nonatomic, strong) TUIFaceGroup *recentGroup;
  286. @property(nonatomic, assign) BOOL isNeedAddInInputBar;
  287. @property(nonatomic, copy) NSString *groupName;
  288. @end
  289. @interface TUIEmojiTextAttachment : NSTextAttachment
  290. @property(nonatomic, strong) TUIFaceCellData *faceCellData;
  291. @property(nonatomic, copy) NSString *emojiTag;
  292. @property(nonatomic, assign) CGSize emojiSize; // For emoji image size
  293. @end
  294. /////////////////////////////////////////////////////////////////////////////////
  295. //
  296. // TUIUnReadView
  297. //
  298. /////////////////////////////////////////////////////////////////////////////////
  299. @interface TUIUnReadView : UIView
  300. /**
  301. * The label of displaying unread message count
  302. */
  303. @property(nonatomic, strong) UILabel *unReadLabel;
  304. /**
  305. * Set the unread message count
  306. */
  307. - (void)setNum:(NSInteger)num;
  308. @end
  309. /////////////////////////////////////////////////////////////////////////////////
  310. //
  311. // TUIConversationPin
  312. //
  313. /////////////////////////////////////////////////////////////////////////////////
  314. extern NSString *kTopConversationListChangedNotification;
  315. @interface TUIConversationPin : NSObject
  316. + (instancetype)sharedInstance;
  317. /**
  318. *
  319. * Getting the list of pinned conversations
  320. */
  321. - (NSArray *)topConversationList;
  322. /**
  323. *
  324. * Pin the conversation
  325. */
  326. - (void)addTopConversation:(NSString *)conv callback:(void (^__nullable)(BOOL success, NSString *__nullable errorMessage))callback;
  327. /**
  328. *
  329. * Remove pinned conversations
  330. */
  331. - (void)removeTopConversation:(NSString *)conv callback:(void (^__nullable)(BOOL success, NSString *__nullable errorMessage))callback;
  332. @end
  333. /////////////////////////////////////////////////////////////////////////////////
  334. //
  335. // TUICommonContactSelectCellData
  336. //
  337. /////////////////////////////////////////////////////////////////////////////////
  338. @interface TUICommonContactSelectCellData : TUICommonCellData
  339. @property(nonatomic, strong) NSString *identifier;
  340. @property(nonatomic, strong) NSString *title;
  341. @property(nonatomic, strong) NSURL *avatarUrl;
  342. @property(nonatomic, strong) UIImage *avatarImage;
  343. @property(nonatomic, getter=isSelected) BOOL selected;
  344. @property(nonatomic, getter=isEnabled) BOOL enabled;
  345. @end
  346. /////////////////////////////////////////////////////////////////////////////////
  347. //
  348. // TUICommonContactListPickerCell
  349. //
  350. /////////////////////////////////////////////////////////////////////////////////
  351. @interface TUICommonContactListPickerCell : UICollectionViewCell
  352. @property UIImageView *avatar;
  353. @end
  354. /////////////////////////////////////////////////////////////////////////////////
  355. //
  356. // TUIContactListPickerOnCancel
  357. //
  358. /////////////////////////////////////////////////////////////////////////////////
  359. typedef void (^TUIContactListPickerOnCancel)(TUICommonContactSelectCellData *data);
  360. @interface TUIContactListPicker : UIControl
  361. @property(nonatomic, strong, readonly) UIButton *accessoryBtn;
  362. @property(nonatomic, strong) NSArray<TUICommonContactSelectCellData *> *selectArray;
  363. @property(nonatomic, copy) TUIContactListPickerOnCancel onCancel;
  364. @end
  365. /////////////////////////////////////////////////////////////////////////////////
  366. //
  367. // TUIProfileCardCell & vc
  368. //
  369. /////////////////////////////////////////////////////////////////////////////////
  370. @class TUIProfileCardCell;
  371. @protocol TUIProfileCardDelegate <NSObject>
  372. - (void)didTapOnAvatar:(TUIProfileCardCell *)cell;
  373. @end
  374. @interface TUIProfileCardCellData : TUICommonCellData
  375. @property(nonatomic, strong) UIImage *avatarImage;
  376. @property(nonatomic, strong) NSURL *avatarUrl;
  377. @property(nonatomic, strong) NSString *name;
  378. @property(nonatomic, strong) NSString *identifier;
  379. @property(nonatomic, strong) NSString *signature;
  380. @property(nonatomic, strong) UIImage *genderIconImage;
  381. @property(nonatomic, strong) NSString *genderString;
  382. @property BOOL showAccessory;
  383. @property BOOL showSignature;
  384. @end
  385. @interface TUIProfileCardCell : TUICommonTableViewCell
  386. @property(nonatomic, strong) UIImageView *avatar;
  387. @property(nonatomic, strong) UILabel *name;
  388. @property(nonatomic, strong) UILabel *identifier;
  389. @property(nonatomic, strong) UILabel *signature;
  390. @property(nonatomic, strong) UIImageView *genderIcon;
  391. @property(nonatomic, strong) TUIProfileCardCellData *cardData;
  392. @property(nonatomic, weak) id<TUIProfileCardDelegate> delegate;
  393. - (void)fillWithData:(TUIProfileCardCellData *)data;
  394. @end
  395. @interface TUIAvatarViewController : UIViewController
  396. @property(nonatomic, strong) TUIProfileCardCellData *avatarData;
  397. @end
  398. typedef NS_ENUM(NSUInteger, TUISelectAvatarType) {
  399. TUISelectAvatarTypeUserAvatar,
  400. TUISelectAvatarTypeGroupAvatar,
  401. TUISelectAvatarTypeCover,
  402. TUISelectAvatarTypeConversationBackGroundCover,
  403. };
  404. @interface TUISelectAvatarCardItem : NSObject
  405. @property(nonatomic, strong) NSString *posterUrlStr;
  406. @property(nonatomic, assign) BOOL isSelect;
  407. @property(nonatomic, copy) NSString *fullUrlStr;
  408. @property(nonatomic, assign) BOOL isDefaultBackgroundItem;
  409. @property(nonatomic, assign) BOOL isGroupGridAvatar;
  410. @property(nonatomic, copy) NSString *createGroupType;
  411. @property(nonatomic, strong) UIImage *cacheGroupGridAvatarImage;
  412. @end
  413. @interface TUISelectAvatarController : UIViewController
  414. @property(nonatomic, copy) void (^selectCallBack)(NSString *urlStr);
  415. @property(nonatomic, assign) TUISelectAvatarType selectAvatarType;
  416. @property(nonatomic, copy) NSString *profilFaceURL;
  417. @property(nonatomic, strong) UIImage *cacheGroupGridAvatarImage;
  418. @property(nonatomic, copy) NSString *createGroupType;
  419. @end
  420. /////////////////////////////////////////////////////////////////////////////////
  421. //
  422. // TUICommonAvatarCell & Data
  423. //
  424. /////////////////////////////////////////////////////////////////////////////////
  425. @interface TUICommonAvatarCellData : TUICommonCellData
  426. ;
  427. @property(nonatomic, strong) NSString *key;
  428. @property(nonatomic, strong) NSString *value;
  429. @property BOOL showAccessory;
  430. @property(nonatomic, strong) UIImage *avatarImage;
  431. @property(nonatomic, strong) NSURL *avatarUrl;
  432. @end
  433. @interface TUICommonAvatarCell : TUICommonTableViewCell
  434. @property UILabel *keyLabel;
  435. @property UILabel *valueLabel;
  436. @property UIImageView *avatar;
  437. @property(readonly) TUICommonAvatarCellData *avatarData;
  438. - (void)fillWithData:(TUICommonAvatarCellData *)avatarData;
  439. @end
  440. /////////////////////////////////////////////////////////////////////////////////
  441. //
  442. // TUIConversationGroupItem
  443. //
  444. /////////////////////////////////////////////////////////////////////////////////
  445. extern NSUInteger kConversationMarkStarType;
  446. @interface TUIConversationGroupItem : NSObject
  447. @property(nonatomic, strong) NSString *groupName;
  448. @property(nonatomic, assign) NSInteger unreadCount;
  449. @property(nonatomic, assign) NSInteger groupIndex;
  450. @property(nonatomic, assign) BOOL isShow;
  451. @property(nonatomic, strong) UIButton *groupBtn;
  452. @end
  453. @interface TUISendMessageAppendParams : NSObject
  454. @property (nonatomic, assign) BOOL isSendPushInfo;
  455. @property (nonatomic, assign) BOOL isOnlineUserOnly;
  456. @property (nonatomic, assign) V2TIMMessagePriority priority;
  457. + (instancetype)defaultConfig;
  458. @end
  459. NS_ASSUME_NONNULL_END