Files
real-e-party-iOS/YuMi/Appdelegate/AppDelegate+ThirdConfig.m
edwinQQQ 2d0063396c feat: 添加 E-Parti 启动画面及情绪颜色引导功能
主要变更:
1. 新增 ep_splash.png 作为应用启动时的展示图像。
2. 更新 Info.plist 中的应用名称和相关描述,替换为 "E-Parti"。
3. 引入 EPSignatureColorGuideView 和 EPEmotionColorStorage,支持用户选择和保存专属情绪颜色。
4. 在 AppDelegate 中集成情绪颜色引导逻辑,确保用户首次登录时能够选择专属颜色。

此更新旨在提升用户体验,增强应用的品牌识别度,并提供个性化的情绪表达功能。
2025-10-15 15:56:32 +08:00

246 lines
8.0 KiB
Objective-C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// AppDelegate+ThirdConfig.m
// YUMI
//
// Created by YUMI on 2021/9/13.
//
#import "AppDelegate+ThirdConfig.h"
///Third
#import <NIMSDK/NIMSDK.h>
#import <ShareSDK/ShareSDK.h>
#import <UserNotifications/UNUserNotificationCenter.h>
#import <UserNotifications/UserNotifications.h>
#import <MOBFoundation/MobSDK+Privacy.h>
///Tool
#import "YUMIConstant.h"
#import "CustomAttachmentDecoder.h"
#import "QEmotionHelper.h"
#import "XPAdvertiseView.h"
#import "XPAdImageTool.h"
#import "YUMIMacroUitls.h"
#import "AdvertiseModel.h"
#import "XPWebViewController.h"
#import "XPRoomViewController.h"
#import "XCCurrentVCStackManager.h"
#import "ClientConfig.h"
#import <UserNotifications/UserNotifications.h>
#import <Bugly/Bugly.h>
#import "BuglyManager.h"
#import <UIKit/UIDevice.h>
#import "YuMi-swift.h"
UIKIT_EXTERN NSString * kYouMiNumberCountKey;
UIKIT_EXTERN NSString * adImageName;
@implementation AppDelegate (ThirdConfig)
/// 初始化一些第三方配置
- (void)initThirdConfig{
[self setLanguage];
[self configShareSDK];
[self configNIMSDK];
[self configBugly];
[self registerNot];
[self initEmojiData];
}
-(void)setLanguage{
UISemanticContentAttribute attribute = UISemanticContentAttributeForceLeftToRight;
if (isMSRTL()) {
attribute = UISemanticContentAttributeForceRightToLeft;
}
[UIView appearance].semanticContentAttribute = attribute;
[UISearchBar appearance].semanticContentAttribute = attribute;
}
-(void)registerNot{
if (@available(iOS 10.0, *)) {
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionBadge | UNAuthorizationOptionSound) completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (granted) {
[center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
if (settings.authorizationStatus == UNAuthorizationStatusAuthorized){
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] registerForRemoteNotifications];
});
}
}];
}
}];
}
}
/**
崩溃收集 Bugly
*/
- (void) configBugly {
// 使用 BuglyManager 统一管理 Bugly 配置
#ifdef DEBUG
[[BuglyManager sharedManager] configureWithAppId:@"c937fd00f7" debug:YES];
#else
[[BuglyManager sharedManager] configureWithAppId:@"8627948559" debug:NO];
#endif
}
- (void)configNIMSDK {
//推荐在程序启动的时候初始化 NIMSDK
NSString *appKey = [[ClientConfig shareConfig].configInfo nimKey];
if ([NSString isEmpty:appKey]) {
appKey = KeyWithType(KeyType_NetEase);
}
NIMSDKOption *option = [NIMSDKOption optionWithAppKey:appKey];
#ifdef DEBUG
option.apnsCername = @"pikoDevelopPush";
#else
option.apnsCername = @"newPiko";
#endif
[[NIMSDK sharedSDK] registerWithOption:option];
// NIM SDK初始化
[NIMCustomObject registerCustomDecoder:[[CustomAttachmentDecoder alloc] init]];
[[NIMSDKConfig sharedConfig] setShouldSyncStickTopSessionInfos:YES];
[NIMSDKConfig sharedConfig].shouldConsiderRevokedMessageUnreadCount = YES;
// cdn统计回调不触发
[NIMSDKConfig sharedConfig].cdnTrackInterval = 0;
// 最小时间间隔设置为最小边界值
[NIMSDKConfig sharedConfig].chatroomMessageReceiveMinInterval = 50;
#ifdef DEBUG
[NIMSDKConfig sharedConfig].enabledHttpsForInfo = NO;
[NIMSDKConfig sharedConfig].enabledHttpsForMessage = NO;
#else
// 生产环境启用HTTPS
[NIMSDKConfig sharedConfig].enabledHttpsForInfo = YES;
[NIMSDKConfig sharedConfig].enabledHttpsForMessage = YES;
#endif
}
- (void)configShareSDK {
// [PILineLoginManager registerLine];
[ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) {
///faceBook
// [platformsRegister setupFacebookWithAppkey:@"1266232494209868" appSecret:@"c9b170b383f8be9cdf118823b8632821" displayName:YMLocalizedString(@"AppDelegate_ThirdConfig0")];
[platformsRegister setupLineAuthType:SSDKAuthorizeTypeBoth];
}];
NSString *isUpload = [[NSUserDefaults standardUserDefaults]valueForKey:@"kMobLinkUploadPrivacy"];
if (isUpload == nil){
[MobSDK uploadPrivacyPermissionStatus:YES onResult:nil];
[[NSUserDefaults standardUserDefaults] setValue:@"YES" forKey:@"kMobLinkUploadPrivacy"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
#pragma mark - 表情
- (void)initEmojiData {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
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 * emotionDic = [emojiArray xpSafeObjectAtIndex:i];
if (!emotionDic) continue;
UIImage * image = [UIImage imageNamed:emotionDic[@"file"]];
QEmotion * info = [[QEmotion alloc] init];
info.displayName = emotionDic[@"tag"];
info.identifier = emotionDic[@"id"];
info.image = image;
[array addObject:info];
}
//在这里强烈建议先预加载一下表情
QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper];
faceManager.emotionArray = array;
// 清理 emoji 缓存,确保新的尺寸设置生效
[QEmotionHelper clearEmojiCache];
});
}
#pragma mark - 广告
/**
设置广告页
*/
- (void)setupLaunchADView {
return;
NSUserDefaults * kUserDefaults = NSUserDefaults.standardUserDefaults;
// 判断沙盒中是否存在广告图片,如果存在,直接显示
NSString *adName = [kUserDefaults stringForKey:adImageName];
NSString *filePath = [XPAdImageTool.shareImageTool getFilePathWithImageName:adName];
BOOL isExist = [XPAdImageTool.shareImageTool isFileExistWithFilePath:filePath];
if (isExist) {// 图片存在
// if ([kUserDefaults integerForKey:@"adShow"] > 4) {
@kWeakify(self);
AdvertiseModel *info = [XPAdImageTool.shareImageTool getAdInfoFromCacheInMainWith:adName];
XPAdvertiseView *advertiseView = [[XPAdvertiseView alloc] initWithFrame:self.window.bounds];
advertiseView.type = info.type;
advertiseView.fileModel = info.fillVo;
advertiseView.filePath = filePath;
advertiseView.dismissHandler = ^(BOOL shouldJump) {
@kStrongify(self)
if (!shouldJump || info == nil) {
return;
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self advertiseJumpHandleWithInfo:info];
});
};
[advertiseView show];
// }
}
}
/// 闪屏广告跳转处理
- (void)advertiseJumpHandleWithInfo:(AdvertiseModel *)info {
if (UIApplication.sharedApplication.keyWindow != self.window) {
//当前窗口不是主控制器所在窗口时,拦截跳转(目前可能情况时,闪屏后出现新人引导
return;
}
switch (info.type) {
case SplashInfoSkipTypeRoom: {
if (![[XPAdImageTool shareImageTool] isImLogin]) {
return; // 必须登录后才可以跳转
}
// 跳转房间
if (info.link.length > 0) {
[XPRoomViewController openRoom:info.link viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
}
}
break;
case SplashInfoSkipTypeWeb:
case SplashInfoSkipTypeWeb_CP:
case SplashInfoSkipTypeWeb_Custom:
case SplashInfoSkipTypeWeb_WeekStar: {
// 跳转 H5
if (info.link.length > 0) {
XPWebViewController *webView = [[XPWebViewController alloc] initWithRoomUID:nil];
webView.url = info.link;
[[[XCCurrentVCStackManager shareManager]currentNavigationController] pushViewController:webView animated:YES];
}
}
break;
default:
break;
}
}
@end