1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- //
- // RQQuestionModule.m
- // SDJK
- //
- // Created by 张嵘 on 2022/1/11.
- //
- #import "RQQuestionModule.h"
- float progress = 0;
- @interface RQQuestionModule ()
- @property (nonatomic, readwrite, strong) NSString *downloadUrl;
- @end
- @implementation RQQuestionModule
- @def_singleton(RQQuestionModule);
- /// 更新题库
- - (void)rq_updateQuestion {
- @weakify(self)
- [[RQ_HTTP_Service getVersionList] subscribeNext:^(NSArray *arr) {
- if (!RQObjectIsNil(arr)) {
- if (arr.count > 0) {
- [[[arr.rac_sequence.signal deliverOnMainThread] filter:^BOOL(RQDictInfoModel *dictInfoModel) {
- return [dictInfoModel.dictLabel isEqualToString:[RQ_YDTQuestion_Module getCarTypeCNNameWithCarType:RQ_YDTQuestion_Module.carType]];
- }] subscribeNext:^(RQDictInfoModel *dictInfoModel) {
- @strongify(self)
- self.downloadUrl = dictInfoModel.dictValue;
- if (dictInfoModel.remark.integerValue > [RQ_YDTQuestion_Module getQuestionVersion]) {
- NSLog(@"更新!");
- [self rq_showDBUpdateView];
- } else {
- NSLog(@"不更新!");
- }
- }];
- }
-
- }
- } error:^(NSError * _Nullable error) {
-
- }];
- }
- - (void)rq_showDBUpdateView {
- RQUpdateView *dbUpdateView = [RQUpdateView updateView];
- dbUpdateView.questionUpdateViewType = RQQuestionUpdateViewType_LibDownload;
- dbUpdateView.downloadUrl = self.downloadUrl;
- QMUIModalPresentationViewController *dbModalViewController = [[QMUIModalPresentationViewController alloc] init];
- dbModalViewController.contentView = dbUpdateView;
- dbModalViewController.contentViewMargins = UIEdgeInsetsMake(0, 0, 0, 0);
- dbModalViewController.modal = YES;
-
- dbUpdateView.modalViewController = dbModalViewController;
- [dbModalViewController showWithAnimated:YES completion:nil];
- }
- - (void)rq_showAppUpdateView {
- RQUpdateView *appUpdateView = [RQUpdateView updateView];
- appUpdateView.questionUpdateViewType = RQQuestionUpdateViewType_Default;
-
- QMUIModalPresentationViewController *appModalViewController = [[QMUIModalPresentationViewController alloc] init];
- appModalViewController.contentView = appUpdateView;
- appModalViewController.contentViewMargins = UIEdgeInsetsMake(0, 0, 0, 0);
- appModalViewController.modal = YES;
-
- appUpdateView.modalViewController = appModalViewController;
- [appModalViewController showWithAnimated:YES completion:nil];
- }
- @end
|