TUIGroupPendencyDataProvider.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Created by Tencent on 2023/06/09.
  2. // Copyright © 2023 Tencent. All rights reserved.
  3. #import <Foundation/Foundation.h>
  4. @class TUIGroupPendencyCellData;
  5. NS_ASSUME_NONNULL_BEGIN
  6. /**
  7. *
  8. * 【Module name】 TUIGroupPendencyViewModel
  9. * 【Function description】Group request view model
  10. * This view model is responsible for unified processing of group request messages. For example, a series of logics such as obtaining the unread count,
  11. * receiving new request messages and updating them, agreeing/removing data in the existing data queue, etc.
  12. */
  13. @interface TUIGroupPendencyDataProvider : NSObject
  14. /**
  15. * Request data list
  16. * The object type stored in this list is TUIGroupPendencyCellData.
  17. * That is, this array stores all pending request data of the current group, and this attribute is read-only and cannot be modified.
  18. */
  19. @property(readonly) NSArray *dataList;
  20. /**
  21. *
  22. * Whether to have next request data.
  23. * When loading data, hasNextData is YES when the request list of the current group has not been read out.
  24. */
  25. @property BOOL hasNextData;
  26. /**
  27. *
  28. * Loading identifier
  29. * When the current view model is loading data, this property is YES. At this time, loading again is not allowed until the current loading process is
  30. * completed.
  31. */
  32. @property BOOL isLoading;
  33. /**
  34. *
  35. * Unread count, that is, the number of outstanding requests for the current group.
  36. */
  37. @property int unReadCnt;
  38. /**
  39. *
  40. * group ID
  41. * It is used to identify the current group and determine whether the request to join the group is a request for this group.
  42. */
  43. @property NSString *groupId;
  44. /**
  45. *
  46. * Load data
  47. * 1. First determine whether it is currently loading, and if so, terminate this loading.
  48. * 2. Pull the request data from the server through the getPendencyFromServer interface provided by the TIMGroupManager class in the IM SDK. The default is 100
  49. * requests per page.
  50. * 3. For the pulled data, determine whether the group ID corresponding to the request is the same as this group, and if so, convert the request to
  51. * TUIGroupPendencyCellData and store it in the datalist. (The request object pulled from the server is TIMGroupPendencyItem).
  52. */
  53. - (void)loadData;
  54. /**
  55. * Approve current request data.
  56. * This function directly calls accept implemented in TUIGroupPendencyCellData, and the unread count is decremented by 1.
  57. */
  58. - (void)acceptData:(TUIGroupPendencyCellData *)data;
  59. /**
  60. * Deny the current request data.
  61. * Remove the data in the parameter from the datalist, and call reject implemented in TUIGroupPendencyCellData, while the unread count is decremented by 1.
  62. */
  63. - (void)removeData:(TUIGroupPendencyCellData *)data;
  64. @end
  65. NS_ASSUME_NONNULL_END