YMChatNotificationSectionViewModel.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // YMChatNotificationSectionViewModel.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/2/21.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMChatNotificationSectionViewModel.h"
  9. @interface YMChatNotificationSectionViewModel()
  10. /// 分组头标题
  11. @property (nonatomic, copy, readwrite) NSString *sectionHeader;
  12. /// 分组脚标题
  13. @property (nonatomic, copy, readwrite) NSString *sectionFooter;
  14. /// 是否隐藏分组头
  15. @property (nonatomic, assign, readwrite) BOOL isHideSectionHeader;
  16. /// 是否隐藏分组脚
  17. @property (nonatomic, assign, readwrite) BOOL isHideSectionFooter;
  18. /// 分组数据
  19. @property (nonatomic, strong, readwrite) NSArray <YMChatNotificationCellViewModel*>*rowDataArray;
  20. @end
  21. @implementation YMChatNotificationSectionViewModel
  22. - (void)ym_initialize{
  23. [super ym_initialize];
  24. NSDictionary *dic = [self.params dictionaryValueForKey:ParamsModel defaultValue:@{}];
  25. self.sectionHeader = [dic stringValueForKey:@"sectionHeader" defaultValue:@""];
  26. self.sectionFooter = [dic stringValueForKey:@"sectionFooter" defaultValue:@""];
  27. self.isHideSectionHeader = [dic boolValueForKey:@"isHideSectionHeader" defaultValue:NO];
  28. self.isHideSectionFooter = [dic boolValueForKey:@"isHideSectionFooter" defaultValue:NO];
  29. self.rowDataArray = [[dic arrayValueForKey:@"dataSource" defaultValue:@[]].rac_sequence map:^(NSDictionary * _Nullable dic) {
  30. YMChatNotificationCellViewModel *viewModel = [[YMChatNotificationCellViewModel alloc]initWithParams:@{
  31. ParamsModel:dic
  32. }];
  33. return viewModel;
  34. }].array;
  35. }
  36. @end