XYAboutViewModel.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // XYAboutViewModel.m
  3. // Timi
  4. //
  5. // Created by 翟玉磊 on 2021/4/13.
  6. //
  7. #import "XYAboutViewModel.h"
  8. @implementation XYAboutViewModel
  9. - (instancetype)init
  10. {
  11. self = [super init];
  12. if (self) {
  13. if ([ZYLService currentService].environment == ZYLServiceEnvironmentTest || [ZYLService currentService].environment == ZYLServiceEnvironmentDevelop || [ZYLService currentService].environment == ZYLServiceEnvironmentTestGy) {
  14. self.developmentMode = YES;
  15. }
  16. }
  17. return self;
  18. }
  19. - (void)initValue {
  20. [self.dataSource removeAllObjects];
  21. if (!ApplicationDelegate.isVersionStatus) {
  22. EmptyCellModel *updateModel = [EmptyCellModel createModelWithIsShowTopLine:NO isShowBottomLine:NO cellHeight:44];
  23. updateModel.title = @"软件更新";
  24. [self.dataSource addObject:updateModel];
  25. }
  26. if (self.developmentMode) {
  27. EmptyCellModel *developmentModel = [EmptyCellModel createModelWithIsShowTopLine:YES isShowBottomLine:YES cellHeight:44];
  28. developmentModel.title = @"开发模式";
  29. [self.dataSource addObject:developmentModel];
  30. }
  31. }
  32. - (void)loadData:(SuccessHandler)success failure:(FailureHandler)failure {
  33. [self initValue];
  34. !success?:success(self.dataSource);
  35. }
  36. @end