Files
yinmeng-ios/xplan-ios/Appdelegate/AppDelegate+ThirdConfig.m

94 lines
3.1 KiB
Mathematica
Raw Normal View History

2021-09-13 18:56:16 +08:00
//
// AppDelegate+ThirdConfig.m
// xplan-ios
//
// Created by on 2021/9/13.
//
#import "AppDelegate+ThirdConfig.h"
///Third
#import <ShareSDK/ShareSDK.h>
2021-10-21 12:01:21 +08:00
#import <NIMSDK/NIMSDK.h>
2021-12-06 17:31:52 +08:00
#import <UMCommon/UMCommon.h>
2021-12-08 16:43:26 +08:00
#import <UserNotifications/UNUserNotificationCenter.h>
2021-09-13 18:56:16 +08:00
///Tool
#import "XPConstant.h"
2021-11-16 19:56:37 +08:00
#import "CustomAttachmentDecoder.h"
2022-08-17 18:55:45 +08:00
#import "QEmotionHelper.h"
2021-09-13 18:56:16 +08:00
2021-12-06 17:31:52 +08:00
UIKIT_EXTERN NSString * kYinyouPrivateKey;
2021-09-13 18:56:16 +08:00
@implementation AppDelegate (ThirdConfig)
///
- (void)initThirdConfig {
[self configShareSDK];
2021-10-21 12:01:21 +08:00
[self configNIMSDK];
2021-12-06 17:31:52 +08:00
[self configUMengSDK];
2022-08-17 18:55:45 +08:00
[self initEmojiData];
2021-09-13 18:56:16 +08:00
}
- (void)configShareSDK {
[ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) {
//QQ
2022-09-23 18:12:28 +08:00
NSString *universalLink = @"https://a6lno.share2dlink.com/";
NSString *qqUniversalLink = @"https://a6lno.share2dlink.com/qq_conn/101902443";
[platformsRegister setupQQWithAppId:KeyWithType(KeyType_QQAppid) appkey:KeyWithType(KeyType_QQSecret) enableUniversalLink:YES universalLink:qqUniversalLink];
[platformsRegister setupWeChatWithAppId:KeyWithType(KeyType_WechatAppid) appSecret:KeyWithType(KeyType_WechatSecret) universalLink:universalLink];
}];
2021-09-13 18:56:16 +08:00
}
2021-10-21 12:01:21 +08:00
- (void)configNIMSDK {
// NIMSDK
NSString *appKey = KeyWithType(KeyType_NetEase);
NIMSDKOption *option = [NIMSDKOption optionWithAppKey:appKey];
option.apnsCername = KeyWithType(KeyType_APNSCer);
[[NIMSDK sharedSDK] registerWithOption:option];
2021-11-16 19:56:37 +08:00
// NIM SDK
2021-11-26 20:25:23 +08:00
[NIMCustomObject registerCustomDecoder:[[CustomAttachmentDecoder alloc] init]];
#ifdef DEBUG
[NIMSDKConfig sharedConfig].enabledHttpsForInfo = NO;
[NIMSDKConfig sharedConfig].enabledHttpsForMessage = NO;
#endif
2021-12-08 16:43:26 +08:00
if (@available(iOS 11.0, *)){
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
[center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) {
}];
}
[[UIApplication sharedApplication] registerForRemoteNotifications];
2021-10-21 12:01:21 +08:00
}
2021-12-06 17:31:52 +08:00
#pragma mark - SDK
- (void)configUMengSDK {
//
if ([[NSUserDefaults standardUserDefaults] objectForKey:kYinyouPrivateKey]) {
[UMConfigure initWithAppkey:KeyWithType(keyType_UMengAppKey) channel:KeyWithType(keyType_UMengAppChannel)];
}
}
2022-08-17 18:55:45 +08:00
#pragma mark -
- (void)initEmojiData {
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"]];
QEmotion * info = [[QEmotion alloc] init];
info.identifier = dic[@"id"];
info.image = image;
info.displayName = dic[@"tag"];
[array addObject:info];
}
//
QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper];
faceManager.emotionArray = array;
}
2021-09-13 18:56:16 +08:00
@end