chore: Initial clean commit
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
This commit is contained in:
21
YuMi/Appdelegate/AppDelegate+ThirdConfig.h
Normal file
21
YuMi/Appdelegate/AppDelegate+ThirdConfig.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// AppDelegate+ThirdConfig.h
|
||||
// YUMI
|
||||
//
|
||||
// Created by YUMI on 2021/9/13.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AppDelegate (ThirdConfig)
|
||||
/// 初始化一些第三方配置
|
||||
- (void)initThirdConfig;
|
||||
/**
|
||||
设置广告页
|
||||
*/
|
||||
- (void)setupLaunchADView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
243
YuMi/Appdelegate/AppDelegate+ThirdConfig.m
Normal file
243
YuMi/Appdelegate/AppDelegate+ThirdConfig.m
Normal file
@@ -0,0 +1,243 @@
|
||||
//
|
||||
// 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 {
|
||||
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
|
20
YuMi/Appdelegate/AppDelegate.h
Normal file
20
YuMi/Appdelegate/AppDelegate.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// AppDelegate.h
|
||||
// YUMI
|
||||
//
|
||||
// Created by admin on 2023/3/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
@property(nonatomic,strong,readonly)NSManagedObjectContext *managedObjectContext;
|
||||
@property(nonatomic,strong,readonly)NSManagedObjectModel *managedObjectModel;
|
||||
@property(nonatomic,strong,readonly)NSPersistentStoreCoordinator *persistentStoreCoordinator;
|
||||
|
||||
- (void)saveContext;
|
||||
- (NSURL *)applicationDocumentsDirectory;
|
||||
@end
|
||||
|
326
YuMi/Appdelegate/AppDelegate.m
Normal file
326
YuMi/Appdelegate/AppDelegate.m
Normal file
@@ -0,0 +1,326 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
// YUMI
|
||||
//
|
||||
// Created by admin on 2023/3/9.
|
||||
//
|
||||
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import <UMCommon/UMCommon.h>
|
||||
#import <MobLinkPro/MobLink.h>
|
||||
#import <MobLinkPro/MLSDKScene.h>
|
||||
#import "TabbarViewController.h"
|
||||
#import "BaseNavigationController.h"
|
||||
#import "AppDelegate+ThirdConfig.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <AppTrackingTransparency/AppTrackingTransparency.h>
|
||||
#import "ClientConfig.h"
|
||||
#import <GoogleSignIn/GoogleSignIn.h>
|
||||
#import <GoogleSignIn/GoogleSignIn.h>
|
||||
#import "LoginViewController.h"
|
||||
#import "AccountModel.h"
|
||||
#import "YuMi-swift.h"
|
||||
#import "SessionViewController.h"
|
||||
#import "LoginFullInfoViewController.h"
|
||||
#import "UIView+VAP.h"
|
||||
#import "SocialShareManager.h"
|
||||
|
||||
UIKIT_EXTERN NSString * const kOpenRoomNotification;
|
||||
|
||||
@interface AppDelegate ()<IMLSDKRestoreDelegate>
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
//日志接口
|
||||
void qg_VAP_Logger_handler(VAPLogLevel level, const char* file, int line, const char* func, NSString *module, NSString *format, ...) {
|
||||
|
||||
// 屏蔽 MP4 播放 log
|
||||
return;
|
||||
|
||||
// if (format.UTF8String == nil) {
|
||||
// NSLog(@"log包含非utf-8字符");
|
||||
// return;
|
||||
// }
|
||||
// if (level > VAPLogLevelDebug) {
|
||||
// va_list argList;
|
||||
// va_start(argList, format);
|
||||
// NSString* message = [[NSString alloc] initWithFormat:format arguments:argList];
|
||||
// file = [NSString stringWithUTF8String:file].lastPathComponent.UTF8String;
|
||||
// NSLog(@"<%@> %s(%@):%s [%@] - %@",@(level), file, @(line), func, module, message);
|
||||
// va_end(argList);
|
||||
// }
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
|
||||
UIStoryboard *launchStoryboard = [UIStoryboard storyboardWithName:@"Launch Screen" bundle:nil];
|
||||
UIViewController *launchScreenVC = [launchStoryboard instantiateInitialViewController];
|
||||
self.window.rootViewController = launchScreenVC;
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
[VAPView registerHWDLog:qg_VAP_Logger_handler];
|
||||
|
||||
///初始化一些 sdk配置
|
||||
[self initThirdConfig];
|
||||
[self initUM:application launchOptions:launchOptions];
|
||||
|
||||
@kWeakify(self);
|
||||
[[ClientConfig shareConfig] clientConfig:^{
|
||||
@kStrongify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self loadMainPage];
|
||||
[self setupLaunchADView];
|
||||
});
|
||||
}];
|
||||
|
||||
if (@available(iOS 15, *)) {
|
||||
[[UITableView appearance] setSectionHeaderTopPadding:0];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)initUM:(UIApplication *)application
|
||||
launchOptions:(NSDictionary *)launchOptions {
|
||||
// 只有同意过了隐私协议 才初始化
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"kYouMinumbernnagna"]) {
|
||||
///初始化友盟
|
||||
[UMConfigure initWithAppkey:@"6434c6dfd64e686139618269"
|
||||
channel:@"appstore"];
|
||||
}
|
||||
[MobLink setDelegate:self];
|
||||
}
|
||||
|
||||
- (void)loadMainPage {
|
||||
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
|
||||
if (accountModel == nil ||
|
||||
accountModel.uid == nil ||
|
||||
accountModel.access_token == nil) {
|
||||
[self toLoginPage];
|
||||
}else{
|
||||
[self toHomeTabbarPage];
|
||||
}
|
||||
|
||||
[[ClientConfig shareConfig] clientInit];
|
||||
}
|
||||
|
||||
- (void)toLoginPage {
|
||||
LoginViewController *lvc = [[LoginViewController alloc] init];
|
||||
BaseNavigationController * navigationController = [[BaseNavigationController alloc] initWithRootViewController:lvc];
|
||||
navigationController.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
self.window.rootViewController = navigationController;
|
||||
}
|
||||
|
||||
- (void)toHomeTabbarPage {
|
||||
TabbarViewController *vc = [[TabbarViewController alloc] init];
|
||||
BaseNavigationController *navigationController = [[BaseNavigationController alloc] initWithRootViewController:vc];
|
||||
self.window.rootViewController = navigationController;
|
||||
}
|
||||
|
||||
- (void)IMLSDKWillRestoreScene:(MLSDKScene *)scene
|
||||
Restore:(void (^)(BOOL, RestoreStyle))restoreHandler {
|
||||
NSString *inviteCode = scene.params[@"inviteCode"];
|
||||
if (inviteCode != nil && [[AccountInfoStorage instance]getUid].length == 0){
|
||||
ClientConfig *config = [ClientConfig shareConfig];
|
||||
config.inviteCode = inviteCode;
|
||||
}
|
||||
restoreHandler(YES, MLDefault);
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
NSInteger count = [NIMSDK sharedSDK].conversationManager.allUnreadCount;
|
||||
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
[self getAdvertisingTrackingAuthority];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kAppDidBecomeActive" object:nil];
|
||||
}
|
||||
|
||||
- (void)getAdvertisingTrackingAuthority {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
if (@available(iOS 14, *)) {
|
||||
ATTrackingManagerAuthorizationStatus status = ATTrackingManager.trackingAuthorizationStatus;
|
||||
switch (status) {
|
||||
case ATTrackingManagerAuthorizationStatusDenied:
|
||||
// NSLog(@"用户拒绝IDFA");
|
||||
break;
|
||||
case ATTrackingManagerAuthorizationStatusAuthorized:
|
||||
// NSLog(@"用户允许IDFA");
|
||||
break;
|
||||
case ATTrackingManagerAuthorizationStatusNotDetermined: {
|
||||
// NSLog(@"用户未做选择或未弹窗IDFA");
|
||||
//请求弹出用户授权框,只会在程序运行是弹框1次,除非卸载app重装,通地图、相机等权限弹框一样
|
||||
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
|
||||
// NSLog(@"app追踪IDFA权限:%lu",(unsigned long)status);
|
||||
}];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
||||
// 上传devicetoken至云信服务器。
|
||||
[[NIMSDK sharedSDK] updateApnsToken:deviceToken ];
|
||||
}
|
||||
|
||||
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
|
||||
|
||||
NSString *data = userInfo[@"data"];
|
||||
if(data){
|
||||
NSDictionary *dataDic = [data mj_JSONObject];
|
||||
NSString *userId = dataDic[@"uid"];
|
||||
if(userId){
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"type":@"kOpenChat",@"uid":userId,@"isNoAttention":@(YES)}];
|
||||
ClientConfig *config = [ClientConfig shareConfig];
|
||||
config.pushChatId = userId;
|
||||
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSString *userId = userInfo[@"uid"];
|
||||
if(userId){
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"type":@"kOpenChat",@"uid":userId,@"isNoAttention":@(YES)}];
|
||||
ClientConfig *config = [ClientConfig shareConfig];
|
||||
config.pushChatId = userId;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
///URL Scheme跳转
|
||||
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options{
|
||||
[[SocialShareManager sharedManager] handleURL:url];
|
||||
|
||||
return [GIDSignIn.sharedInstance handleURL:url];
|
||||
}
|
||||
|
||||
//- (void)__oldApplicationOpenURLMethod:(NSURL *)url {
|
||||
// NSString *text = [url query];
|
||||
// if(text.length){
|
||||
// NSMutableDictionary *paramsDict = [NSMutableDictionary dictionary];
|
||||
// NSArray *paramArray = [text componentsSeparatedByString:@"&"];
|
||||
// for (NSString *param in paramArray) {
|
||||
// if (param && param.length) {
|
||||
// NSArray *parArr = [param componentsSeparatedByString:@"="];
|
||||
// if (parArr.count == 2) {
|
||||
// [paramsDict setObject:parArr[1] forKey:parArr[0]];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(paramsDict[@"type"] != nil){
|
||||
// NSInteger type = [paramsDict[@"type"] integerValue];
|
||||
// if (type == 2) {
|
||||
// NSString *uid = [NSString stringWithFormat:@"%@",paramsDict[@"uid"]];
|
||||
// [[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"uid":uid}];
|
||||
// ClientConfig *config = [ClientConfig shareConfig];
|
||||
// config.roomId = uid;
|
||||
// }else if(type == 7){
|
||||
// NSString *uid = [NSString stringWithFormat:@"%@",paramsDict[@"uid"]];
|
||||
// [[NSNotificationCenter defaultCenter]postNotificationName:kOpenRoomNotification object:nil userInfo:@{@"type":@"kOpenChat",@"uid":uid}];
|
||||
// ClientConfig *config = [ClientConfig shareConfig];
|
||||
// config.chatId = uid;
|
||||
// }else if (type == 8){
|
||||
// NSString *inviteCode = paramsDict[@"inviteCode"];
|
||||
// if (inviteCode != nil && [[AccountInfoStorage instance]getUid].length == 0){
|
||||
// ClientConfig *config = [ClientConfig shareConfig];
|
||||
// config.inviteCode = inviteCode;
|
||||
// }
|
||||
// }
|
||||
//// return YES;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
#pragma mark - Core Data stack
|
||||
@synthesize managedObjectContext = _managedObjectContext;
|
||||
@synthesize managedObjectModel = _managedObjectModel;
|
||||
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;
|
||||
|
||||
-(NSURL *)applicationDocumentsDirectory{
|
||||
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
|
||||
}
|
||||
|
||||
- (NSManagedObjectModel *)managedObjectModel {
|
||||
// The managed object model for the application. It is a fatal error for the application not to be able to find and load its model.
|
||||
if (_managedObjectModel != nil) {
|
||||
return _managedObjectModel;
|
||||
}
|
||||
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"_1_______" withExtension:@"momd"];
|
||||
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
|
||||
return _managedObjectModel;
|
||||
}
|
||||
|
||||
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
|
||||
// The persistent store coordinator for the application. This implementation creates and returns a coordinator, having added the store for the application to it.
|
||||
if (_persistentStoreCoordinator != nil) {
|
||||
return _persistentStoreCoordinator;
|
||||
}
|
||||
|
||||
// Create the coordinator and store
|
||||
|
||||
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
|
||||
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"_1_______.sqlite"];
|
||||
NSError *error = nil;
|
||||
NSString *failureReason = @"There was an error creating or loading the application's saved data.";
|
||||
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
|
||||
// Report any error we got.
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
||||
dict[NSLocalizedDescriptionKey] = @"Failed to initialize the application's saved data";
|
||||
dict[NSLocalizedFailureReasonErrorKey] = failureReason;
|
||||
dict[NSUnderlyingErrorKey] = error;
|
||||
error = [NSError errorWithDomain:@"YOUR_ERROR_DOMAIN" code:9999 userInfo:dict];
|
||||
// Replace this with code to handle the error appropriately.
|
||||
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
|
||||
// NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
|
||||
abort();
|
||||
}
|
||||
|
||||
return _persistentStoreCoordinator;
|
||||
}
|
||||
|
||||
|
||||
- (NSManagedObjectContext *)managedObjectContext {
|
||||
// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.)
|
||||
if (_managedObjectContext != nil) {
|
||||
return _managedObjectContext;
|
||||
}
|
||||
|
||||
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
|
||||
if (!coordinator) {
|
||||
return nil;
|
||||
}
|
||||
_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
|
||||
[_managedObjectContext setPersistentStoreCoordinator:coordinator];
|
||||
return _managedObjectContext;
|
||||
}
|
||||
|
||||
#pragma mark - Core Data Saving support
|
||||
|
||||
- (void)saveContext {
|
||||
NSManagedObjectContext *managedObjectContext = self.managedObjectContext;
|
||||
if (managedObjectContext != nil) {
|
||||
NSError *error = nil;
|
||||
if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
|
||||
// Replace this implementation with code to handle the error appropriately.
|
||||
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
|
||||
// NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
16
YuMi/Appdelegate/YYTextAsyncLayer+PITextAsyncLayer.h
Normal file
16
YuMi/Appdelegate/YYTextAsyncLayer+PITextAsyncLayer.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// YYTextAsyncLayer+PITextAsyncLayer.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2023/10/28.
|
||||
//
|
||||
|
||||
#import <YYText/YYTextAsyncLayer.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface YYTextAsyncLayer (PITextAsyncLayer)
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
26
YuMi/Appdelegate/YYTextAsyncLayer+PITextAsyncLayer.m
Normal file
26
YuMi/Appdelegate/YYTextAsyncLayer+PITextAsyncLayer.m
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// YYTextAsyncLayer+PITextAsyncLayer.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2023/10/28.
|
||||
//
|
||||
|
||||
#import "YYTextAsyncLayer+PITextAsyncLayer.h"
|
||||
|
||||
@implementation YYTextAsyncLayer (PITextAsyncLayer)
|
||||
///iOS17bug,如果不把方法替换会闪退
|
||||
+(void)load {
|
||||
Method displayMethod = class_getInstanceMethod(self, @selector(display));
|
||||
Method swizzingMethod = class_getInstanceMethod(self, @selector(swizzing_display));
|
||||
method_exchangeImplementations(displayMethod, swizzingMethod);
|
||||
}
|
||||
-(void)swizzing_display{
|
||||
//通过变量名称获取类中的实例成员变量
|
||||
if (self.bounds.size.width <= 0 || self.bounds.size.height <= 0) {
|
||||
self.contents = nil;
|
||||
return;
|
||||
} else {
|
||||
[self swizzing_display];
|
||||
}
|
||||
}
|
||||
@end
|
Reference in New Issue
Block a user