AppDelegate+SPSBConfiguration.m 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. //
  2. // AppDelegate+SPSBConfiguration.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/4/20.
  6. //
  7. #import "AppDelegate+SPSBConfiguration.h"
  8. #import "AppDelegate+SPSBRootViewController.h"
  9. #import "SPSBInfoSteamADManager.h"
  10. #import "YYKeychain.h"
  11. #import "SPSBKeyProfile.h"
  12. #import <JXHGeneralTools.h>
  13. #import <CL_ShanYanSDK/CL_ShanYanSDK.h>
  14. #import "SPSBKeyboardManager.h"
  15. #import "SPSBAppDifferenceProfile.h"
  16. #import <BMKLocationkit/BMKLocationAuth.h>
  17. #import <UMCommon/UMCommon.h>
  18. #import <UMCommon/MobClick.h>
  19. #import <JXHSystemShortcut.h>
  20. #import "SPSBKeyProfile.h"
  21. #import <SobotKit/SobotKit.h>
  22. #import "WXApi.h"
  23. #import <MOBFoundation/MobSDK+Privacy.h>
  24. #import <ShareSDK/ShareSDK.h>
  25. #import "SPSBConstantProfile.h"
  26. #import "SPSBOpenADManager.h"
  27. #import "SPSBCustomerServiceManager.h"
  28. @interface AppDelegate ()<BMKLocationAuthDelegate>
  29. @end
  30. @implementation AppDelegate (SPSBConfiguration)
  31. - (void)localConfiguration {
  32. spsb_openADManager().spsb_switchStatus = SPSBOpenAdSwitchStatusUnknow;
  33. spsb_infoSteamAdManager().spsb_isShowSteamInfo = false;
  34. spsb_customerServiceManager().spsb_isChecking = false;
  35. spsb_customerServiceManager().spsb_notificationNum = 0;
  36. [self judgeIsFirstInstall];
  37. [SPSBKeyboardManager shareManager];
  38. [self creatDefinedTabbar];
  39. }
  40. - (void)thirdPartConfiguration {
  41. [self SYConfiguration];
  42. [self BUAdconfiguration];
  43. [self baiduConfiguration];
  44. [self zhichiConfiguration];
  45. [self wechatConfiguration];
  46. [self UMConfiguration];
  47. [self shareFiguration];
  48. }
  49. #pragma mark - 判断第一次安装
  50. - (void)judgeIsFirstInstall {
  51. //保存一个唯一码
  52. if (![YYKeychain getPasswordForService:SPSBJudgeFirstInstallKeychainServiece account:SPSBJudgeFirstInstallKeyKeychainAccount]) {
  53. NSString *UUID = jxh_getUUID(true);
  54. [YYKeychain setPassword:UUID forService:SPSBJudgeFirstInstallKeychainServiece account:SPSBJudgeFirstInstallKeyKeychainAccount];
  55. debugLog(@"新加UUID");
  56. }
  57. if (![jxh_userDefaults() objectForKey:SPSBVerifyCodeTime]) {
  58. //验证时间码标识符
  59. //读取当前时间 - 60s
  60. NSDate* date = [NSDate dateWithTimeIntervalSinceNow:- 60];
  61. NSString* dateString = [jxh_dateFormatter() stringFromDate:date];
  62. [jxh_userDefaults() setObject:dateString forKey:SPSBVerifyCodeTime];
  63. }
  64. //账号密码
  65. [self setUserDefultsWithValue:@"" key:SPSBUserCode];
  66. [self setUserDefultsWithValue:@"" key:SPSBUser];
  67. [self setUserDefultsWithValue:@"" key:SPSBUserName];
  68. [self setUserDefultsWithValue:@"1001" key:SPSBPurchaseCity];
  69. [self setUserDefultsWithValue:@"1001" key:SPSBPurchaseDataCity];
  70. [self setUserDefultsWithValue:@"400-062-2002" key:SPSBCustomerServicePhone];
  71. [self setUserDefultsWithValue:@[] key:SPSBBarImageList];
  72. [self setUserDefultsWithValue:@"2015-10-01 00:00:00" key:SPSBShebaoNormalRefreshTime];
  73. [self setUserDefultsWithValue:@"2016-09-22 00:00:00" key:SPSBShebaoSupplementaryPayRefreshTime];
  74. [self setUserDefultsWithValue:@{@"query" : @"1", @"home": @"0"} key:SPSBTipsMark];
  75. [jxh_userDefaults() synchronize];
  76. }
  77. - (void)setUserDefultsWithValue:(id)value key:(NSString *)key {
  78. if (![jxh_userDefaults() objectForKey:key]) {
  79. [jxh_userDefaults() setObject:value forKey:key];
  80. }
  81. }
  82. #pragma mark - 微信
  83. - (void)wechatConfiguration {
  84. [WXApi registerApp:SPSBWeChatAppKey universalLink:SPSBUniversalLink];
  85. }
  86. #pragma mark - Share
  87. - (void)shareFiguration {
  88. [MobSDK uploadPrivacyPermissionStatus:true onResult:^(BOOL success) {
  89. }];
  90. [ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) {
  91. [platformsRegister setupSinaWeiboWithAppkey:SPSBSinaWeiboAppKey appSecret:SPSBSinaWeiboAppSecret redirectUrl:SPSBSinaWeiboRedirectUri universalLink:SPSBUniversalLink];
  92. [platformsRegister setupWeChatWithAppId:SPSBWeChatAppKey appSecret:SPSBWeChatAppSecret universalLink:SPSBUniversalLink];
  93. [platformsRegister setupQQWithAppId:SPSBQQAppKey appkey:SPSBQQAppSecret enableUniversalLink:true universalLink:SPSBUniversalLink];
  94. }];
  95. }
  96. #pragma mark - 智齿
  97. - (void)zhichiConfiguration {
  98. // 添加用户画像
  99. [[ZCLibClient getZCLibClient] initSobotSDK:SPSBSobotAppKey host:nil result:^(id object) {
  100. }];
  101. // 是否自动提醒
  102. [[ZCLibClient getZCLibClient] setAutoNotification:true];
  103. #ifdef DEBUG
  104. [[ZCLibClient getZCLibClient] setIsDebugMode:true];
  105. #endif
  106. // 错误日志收集
  107. [ZCLibClient setZCLibUncaughtExceptionHandler];
  108. }
  109. #pragma mark - 百度定位
  110. - (void)baiduConfiguration {
  111. [[BMKLocationAuth sharedInstance] checkPermisionWithKey:SPSBBaiduKey authDelegate:self];
  112. }
  113. #pragma mark - 闪验
  114. - (void)SYConfiguration {
  115. [CLShanYanSDKManager initWithAppId:@"WGc6f7Ie" complete:^(CLCompleteResult * _Nonnull completeResult) {
  116. //预取号
  117. [CLShanYanSDKManager preGetPhonenumber:nil];
  118. }];
  119. }
  120. #pragma mark - 友盟
  121. - (void)UMConfiguration {
  122. [UMConfigure initWithAppkey:SPSBUMAppKey channel:@"App Store"];
  123. #ifdef DEBUG
  124. [UMConfigure setLogEnabled:true];
  125. [UMConfigure setAnalyticsEnabled:false];
  126. #endif
  127. }
  128. #pragma mark - 穿山甲
  129. - (void)BUAdconfiguration {
  130. [BUAdSDKManager setAppID:@"5328072"];
  131. debugLog(@"-----------%@", [BUAdSDKManager SDKVersion]);
  132. // [BUAdSDKManager setIsPaidApp:false];
  133. #if DEBUG
  134. //Whether to open log. default is none.
  135. // [BUAdSDKManager setLoglevel:BUAdSDKLogLevelDebug];
  136. #endif
  137. }
  138. @end