1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- //
- // RQExerciseSettingViewModel.m
- // JSJP
- //
- // Created by RONGQING on 2022/1/14.
- //
- #import "RQExerciseSettingViewModel.h"
- @implementation RQExerciseSettingViewModel
- #pragma mark - Public Method
- - (instancetype)initWithServices:(id<RQViewModelServices>)services params:(NSDictionary *)params {
- if (self = [super initWithServices:services params:params]) {
- }
- return self;
- }
- - (void)initialize {
- [super initialize];
-
- self.title = @"";
- /// 隐藏导航栏的细线
- self.prefersNavigationBarBottomLineHidden = YES;
-
- ///配置数据
- [self rq_configureData];
- }
- #pragma mark - PrivateMethod
- - (void)rq_configureData {
- /// 第零组
- RQCommonGroupViewModel *group0 = [RQCommonGroupViewModel groupViewModel];
- /// 用户信息
- group0.headerHeight = CGFLOAT_MIN;
- group0.footerHeight = CGFLOAT_MIN;
- RQCommonSwitchItemViewModel *item0 = [[RQCommonSwitchItemViewModel alloc] init];
- item0.title = @"答对跳转下一题";
- item0.off = !RQ_Exercise_Module.isRightAutoJumpToNext;
- [[RACObserve(item0, off) takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id _Nullable x) {
- if (item0.off) {
- NSLog(@"答对跳转下一题关闭");
- } else {
- NSLog(@"答对跳转下一题开启");
- }
- RQ_Exercise_Module.isRightAutoJumpToNext = !item0.off;
- }];
- RQCommonSwitchItemViewModel *item1 = [[RQCommonSwitchItemViewModel alloc] init];
- item1.title = @"答题音效提示";
- item1.off = !RQ_Exercise_Module.isExerciseSound;
- [[RACObserve(item1, off) takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id _Nullable x) {
- if (item1.off) {
- NSLog(@"答题音效提示关闭");
- } else {
- NSLog(@"答题音效提示开启");
- }
- RQ_Exercise_Module.isExerciseSound = !item1.off;
- }];
- RQExerciseSettingItemViewModel *item2 = [[RQExerciseSettingItemViewModel alloc] init];
- item2.title = @"字体大小";
- group0.itemViewModels = @[item0, item2];
- self.dataSource = @[group0];
- }
- @end
|