// // AppDelegate+ThirdConfig.m // YUMI // // Created by YUMI on 2021/9/13. // #import "AppDelegate+ThirdConfig.h" #import #import #import #import "YUMIConstant.h" #import "CustomAttachmentDecoder.h" #import "MHTSpiritFacilitater.h" #import "YUMIAdvertiseRegard.h" #import "YUMIAdIndicateTool.h" #import "YUMIMacroUitls.h" #import "AdvertiseMatrix.h" #import "YUMITissueRegardGovernancer.h" #import "YUMIChamberRegardGovernancer.h" #import "XCCurrentVCStackExecutive.h" #import "ClientDisposition.h" UIKIT_EXTERN NSString * kYouMiNumberCountKey; UIKIT_EXTERN NSString * adImageName; @implementation AppDelegate (ThirdConfig) - (void)initTertiusDisposition { [self prohibitipositionPartowardsiciptowardsionSDK]; [self prohibitipositionNEMCSDK]; [self initEmojiTowardsoloudspeaker]; } - (void)prohibitipositionNEMCSDK { NSString *appKey = KeyWithType(KeyGenre_NetEase); NIMSDKOption *option = [NIMSDKOption optionWithAppKey:appKey]; [[NIMSDK sharedSDK] registerWithOption:option]; [NIMCustomObject registerCustomDecoder:[[CustomAttachmentDecoder alloc] init]]; [NIMSDKConfig sharedConfig].shouldConsiderRevokedMessageUnreadCount = YES; [[NIMSDKConfig sharedConfig] setShouldSyncStickTopSessionInfos:YES]; #ifdef DEBUG [NIMSDKConfig sharedConfig].enabledHttpsForInfo = NO; [NIMSDKConfig sharedConfig].enabledHttpsForMessage = NO; #endif } - (void)prohibitipositionPartowardsiciptowardsionSDK { [ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) { [platformsRegister setupFacebookWithAppkey:@"1266232494209868" appSecret:@"c9b170b383f8be9cdf118823b8632821" displayName:YMLocalizedString(@"App_Delegate__Third_Config_0")]; [platformsRegister setupLineAuthType:SSDKAuthorizeTypeBoth]; }]; } #pragma mark - 表情 - (void)initEmojiTowardsoloudspeaker { NSArray * dicArray = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"emoji" ofType:@"plist"]]; NSDictionary * dic = [dicArray firstObject]; NSArray * emojiArray = dic[@"data"]; NSMutableArray * array = [NSMutableArray array]; for (int i = 0; i < emojiArray.count; i++) { NSDictionary * dic = [emojiArray objectAtIndex:i]; UIImage * image = [UIImage imageNamed:dic[@"file"]]; MHTSpirit * info = [[MHTSpirit alloc] init]; info.identifier = dic[@"id"]; info.image = image; info.displayName = dic[@"tag"]; [array addObject:info]; } MHTSpiritFacilitater *faceManager = [MHTSpiritFacilitater partowardsiciptowardsiondSenintrtowardsemporalntFacilittowardseer]; faceManager.senintratemporalntGarment = array; } #pragma mark - 广告 - (void)setupLaunchADRegard { NSUserDefaults * kUserDefaults = NSUserDefaults.standardUserDefaults; NSString *filePath = [YUMIAdIndicateTool.partowardsiciptowardsionIndictowardseUtensil acquireAccurtowardseRouteAboutIndictowardseConstitute:[kUserDefaults valueForKey:adImageName]]; BOOL isExist = [YUMIAdIndicateTool.partowardsiciptowardsionIndictowardseUtensil isAccurtowardseExistAboutAccurtowardseRoute:filePath]; NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults]; if ([userDefault integerForKey:@"adShow"]) { [userDefault setInteger:[userDefault integerForKey:@"adShow"]+1 forKey:@"adShow"]; } else { [userDefault setInteger:1 forKey:@"adShow"]; } if (isExist) { if ([userDefault integerForKey:@"adShow"] > 4) { @kWeakify(self); NSString *imageName = [kUserDefaults valueForKey:adImageName]; AdvertiseMatrix *info = [YUMIAdIndicateTool.partowardsiciptowardsionIndictowardseUtensil acquireDirectoryAbstractByvirtueofConcealInMainAbout:imageName]; YUMIAdvertiseRegard *advertiseView = [[YUMIAdvertiseRegard alloc] initWithFrame:self.window.bounds]; advertiseView.filePath = filePath; advertiseView.disappearHandler = ^(BOOL shouldJump) { @kStrongify(self) if (!shouldJump || info == nil) { return; } [self performSelectorOnMainThread:@selector(advertiseJumpShankAboutAbstract:) withObject:info waitUntilDone:NO]; }; [advertiseView show]; } } } - (void)advertiseJumpShankAboutAbstract:(AdvertiseMatrix *)info { if (![ClientDisposition partowardsiciptowardsionDisposition].canUnfoild) { return; } if (UIApplication.sharedApplication.keyWindow != self.window) { return; } switch (info.type) { case SplashAbstractSkipGenreRoom: { if (![[YUMIAdIndicateTool partowardsiciptowardsionIndictowardseUtensil] isImSurmount]) { return; } if (info.link.length > 0) { [YUMIChamberRegardGovernancer unfoildChamber:info.link viewController:[XCCurrentVCStackExecutive shareManager].getCurrentVC]; } } break; case SplashAbstractSkipGenreWeb: { if (info.link.length > 0) { YUMITissueRegardGovernancer *webView = [[YUMITissueRegardGovernancer alloc]init]; webView.url = info.link; [[[XCCurrentVCStackExecutive shareManager]universalBreeadcrumbGovernancer] pushViewController:webView animated:YES]; } } break; default: break; } } @end