ProjectInfoSave.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // ProjectInfoSave.m
  3. // UUTUtils
  4. //
  5. // Created by zhuge on 2017/12/22.
  6. // Copyright © 2017年 zhuge. All rights reserved.
  7. //
  8. #import "ProjectInfoSave.h"
  9. #import "EditProjectWC.h"
  10. @implementation ProjectInfoSave
  11. - (instancetype)init
  12. {
  13. self = [super init];
  14. if (self) {
  15. // self.adIdIndexArray = [[NSMutableArray alloc] init];
  16. self.adIdIndexDictionary = [[NSMutableDictionary alloc] init];
  17. }
  18. return self;
  19. }
  20. + (ProjectInfoSave *)share{
  21. static ProjectInfoSave * s_instance_ProjectInfoSave = nil ;
  22. if (s_instance_ProjectInfoSave == nil) {
  23. s_instance_ProjectInfoSave = [[ProjectInfoSave alloc] init];
  24. }
  25. return (ProjectInfoSave *)s_instance_ProjectInfoSave;
  26. }
  27. //- (void)addAdIdIndex:(NSString*) adIdIndex{
  28. // [_adIdIndexArray addObject:adIdIndex];
  29. //}
  30. //- (BOOL)isAdIdIndexSave:(NSString*) adIdIndex{
  31. // return [_adIdIndexArray containsObject:adIdIndex];
  32. //}
  33. - (void)clearAdIdIndex{
  34. // [_adIdIndexArray removeAllObjects];
  35. [_adIdIndexDictionary removeAllObjects];
  36. }
  37. - (void)setCurAdIdNeedType:(int) adType{
  38. _curAdType = adType;
  39. }
  40. - (BOOL)isSameTypeForAdIdIndex:(NSString*) adIdIndex{
  41. NSNumber* adIdType = [_adIdIndexDictionary objectForKey:adIdIndex];
  42. if(adIdType==nil){
  43. NSString* mes = [NSString stringWithFormat:@"\n\n使用了不存在的广告id:%@",adIdIndex];
  44. [EditProjectWC alertWithError:mes];
  45. return false;
  46. }
  47. int curIdType = (int)[adIdType integerValue]/100;
  48. if(_curAdType == curIdType){
  49. return true;
  50. }else if(curIdType == 1 && _curAdType==2){
  51. return true;
  52. }
  53. NSString* mes = [NSString stringWithFormat:@"\n\n使用的广告id:%@与版位类型不匹配",adIdIndex];
  54. [EditProjectWC alertWithError:mes];
  55. return false;
  56. }
  57. - (BOOL)isBannerTimeOk:(int) bannerSec{
  58. if(bannerSec<30 || bannerSec > 90){
  59. NSString* mes = [NSString stringWithFormat:@"\n\nBanner刷新时间不能低于30秒或者大于90秒。当前Banner刷新时间:%d",bannerSec];
  60. [EditProjectWC alertWithError:mes];
  61. return false;
  62. }
  63. return true;
  64. }
  65. - (void)addAdIdIndexType:(NSString*) adIdIndex :(NSNumber*)adIdType{
  66. [_adIdIndexDictionary setObject:adIdType forKey:adIdIndex];
  67. }
  68. @end