// // RQDspVideoDetailViewModel.m // SDJK // // Created by RONGQING on 2022/1/19. // #import "RQDspVideoDetailViewModel.h" @interface RQDspVideoDetailViewModel () @property (nonatomic, readwrite, strong) NSArray *videoArr; @property (nonatomic, readwrite, strong) NSIndexPath *indexPath; @end @implementation RQDspVideoDetailViewModel #pragma mark - Public Method - (instancetype)initWithServices:(id)services params:(NSDictionary *)params { if (self = [super initWithServices:services params:params]) { self.videoArr = RQ_COMMON_MANAGER.dspListArr; self.indexPath = params[RQViewCommonValueKey]; } return self; } - (void)initialize { [super initialize]; self.prefersNavigationBarHidden = YES; [self rq_configureData]; } #pragma mark - PrivateMethod - (void)rq_configureData { // @weakify(self); /// 第零组 RQCommonGroupViewModel *group0 = [RQCommonGroupViewModel groupViewModel]; group0.headerHeight = CGFLOAT_MIN; group0.footerHeight = CGFLOAT_MIN; NSMutableArray *itemMutableArr = @[].mutableCopy; [self.videoArr.rac_sequence.signal subscribeNext:^(VideosItem *videosItem) { videosItem.index = [self.videoArr indexOfObject:videosItem] + 1; videosItem.totalNum = self.videoArr.count; RQDspVideoDetailItemViewModel *dspVideoDetailItemViewModel = [[RQDspVideoDetailItemViewModel alloc] initWithVideosItem:videosItem]; dspVideoDetailItemViewModel.rowHeight = RQ_SCREEN_HEIGHT; dspVideoDetailItemViewModel.operation = ^{ // @strongify(self); // [RQNotificationCenter postNotificationName:RQPlayVideoUrlNotification object:@{ // RQPlayVideoItemKey : videosItem, // RQPlayVideoItemArrKey : self.videoArr, // }]; }; [itemMutableArr addObject:dspVideoDetailItemViewModel]; } completed:^{ group0.itemViewModels = itemMutableArr.copy; self.dataSource = @[group0]; }]; } @end