更换项目
This commit is contained in:
@@ -10,9 +10,12 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AppDelegate (ThirdConfig)
|
||||
- (void)initTertiusDisposition;
|
||||
|
||||
- (void)setupLaunchADRegard;
|
||||
/// 初始化一些第三方配置
|
||||
- (void)initThirdConfig;
|
||||
/**
|
||||
设置广告页
|
||||
*/
|
||||
- (void)setupLaunchADView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -6,20 +6,22 @@
|
||||
//
|
||||
|
||||
#import "AppDelegate+ThirdConfig.h"
|
||||
///Third
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <ShareSDK/ShareSDK.h>
|
||||
#import <UserNotifications/UNUserNotificationCenter.h>
|
||||
///Tool
|
||||
#import "YUMIConstant.h"
|
||||
#import "CustomAttachmentDecoder.h"
|
||||
#import "MHTSpiritFacilitater.h"
|
||||
#import "YUMIAdvertiseRegard.h"
|
||||
#import "YUMIAdIndicateTool.h"
|
||||
#import "QEmotionHelper.h"
|
||||
#import "XPAdvertiseView.h"
|
||||
#import "XPAdImageTool.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
#import "AdvertiseMatrix.h"
|
||||
#import "YUMITissueRegardGovernancer.h"
|
||||
#import "YUMIChamberRegardGovernancer.h"
|
||||
#import "XCCurrentVCStackExecutive.h"
|
||||
#import "ClientDisposition.h"
|
||||
#import "AdvertiseModel.h"
|
||||
#import "XPWebViewController.h"
|
||||
#import "XPRoomViewController.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "ClientConfig.h"
|
||||
|
||||
UIKIT_EXTERN NSString * kYouMiNumberCountKey;
|
||||
UIKIT_EXTERN NSString * adImageName;
|
||||
@@ -27,22 +29,23 @@ UIKIT_EXTERN NSString * adImageName;
|
||||
@implementation AppDelegate (ThirdConfig)
|
||||
|
||||
|
||||
- (void)initTertiusDisposition {
|
||||
[self prohibitipositionPartowardsiciptowardsionSDK];
|
||||
[self prohibitipositionNEMCSDK];
|
||||
[self initEmojiTowardsoloudspeaker];
|
||||
/// 初始化一些第三方配置
|
||||
- (void)initThirdConfig {
|
||||
[self configShareSDK];
|
||||
[self configNIMSDK];
|
||||
[self initEmojiData];
|
||||
}
|
||||
|
||||
- (void)prohibitipositionNEMCSDK {
|
||||
|
||||
NSString *appKey = KeyWithType(KeyGenre_NetEase);
|
||||
- (void)configNIMSDK {
|
||||
//推荐在程序启动的时候初始化 NIMSDK
|
||||
NSString *appKey = KeyWithType(KeyType_NetEase);
|
||||
NIMSDKOption *option = [NIMSDKOption optionWithAppKey:appKey];
|
||||
[[NIMSDK sharedSDK] registerWithOption:option];
|
||||
|
||||
|
||||
// NIM SDK初始化
|
||||
[NIMCustomObject registerCustomDecoder:[[CustomAttachmentDecoder alloc] init]];
|
||||
[NIMSDKConfig sharedConfig].shouldConsiderRevokedMessageUnreadCount = YES;
|
||||
|
||||
///置顶会话同步
|
||||
[[NIMSDKConfig sharedConfig] setShouldSyncStickTopSessionInfos:YES];
|
||||
#ifdef DEBUG
|
||||
[NIMSDKConfig sharedConfig].enabledHttpsForInfo = NO;
|
||||
@@ -51,16 +54,16 @@ UIKIT_EXTERN NSString * adImageName;
|
||||
}
|
||||
|
||||
|
||||
- (void)prohibitipositionPartowardsiciptowardsionSDK {
|
||||
- (void)configShareSDK {
|
||||
[ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) {
|
||||
|
||||
[platformsRegister setupFacebookWithAppkey:@"1266232494209868" appSecret:@"c9b170b383f8be9cdf118823b8632821" displayName:YMLocalizedString(@"App_Delegate__Third_Config_0")];
|
||||
///faceBook
|
||||
[platformsRegister setupFacebookWithAppkey:@"1266232494209868" appSecret:@"c9b170b383f8be9cdf118823b8632821" displayName:YMLocalizedString(@"AppDelegate_ThirdConfig0")];
|
||||
[platformsRegister setupLineAuthType:SSDKAuthorizeTypeBoth];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 表情
|
||||
- (void)initEmojiTowardsoloudspeaker {
|
||||
- (void)initEmojiData {
|
||||
NSArray * dicArray = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"emoji" ofType:@"plist"]];
|
||||
NSDictionary * dic = [dicArray firstObject];
|
||||
NSArray * emojiArray = dic[@"data"];
|
||||
@@ -68,25 +71,27 @@ UIKIT_EXTERN NSString * adImageName;
|
||||
for (int i = 0; i < emojiArray.count; i++) {
|
||||
NSDictionary * dic = [emojiArray objectAtIndex:i];
|
||||
UIImage * image = [UIImage imageNamed:dic[@"file"]];
|
||||
MHTSpirit * info = [[MHTSpirit alloc] init];
|
||||
QEmotion * info = [[QEmotion alloc] init];
|
||||
info.identifier = dic[@"id"];
|
||||
info.image = image;
|
||||
info.displayName = dic[@"tag"];
|
||||
[array addObject:info];
|
||||
}
|
||||
|
||||
MHTSpiritFacilitater *faceManager = [MHTSpiritFacilitater partowardsiciptowardsiondSenintrtowardsemporalntFacilittowardseer];
|
||||
faceManager.senintratemporalntGarment = array;
|
||||
//在这里强烈建议先预加载一下表情
|
||||
QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper];
|
||||
faceManager.emotionArray = array;
|
||||
}
|
||||
|
||||
#pragma mark - 广告
|
||||
|
||||
|
||||
- (void)setupLaunchADRegard {
|
||||
/**
|
||||
设置广告页
|
||||
*/
|
||||
- (void)setupLaunchADView {
|
||||
NSUserDefaults * kUserDefaults = NSUserDefaults.standardUserDefaults;
|
||||
|
||||
NSString *filePath = [YUMIAdIndicateTool.partowardsiciptowardsionIndictowardseUtensil acquireAccurtowardseRouteAboutIndictowardseConstitute:[kUserDefaults valueForKey:adImageName]];
|
||||
BOOL isExist = [YUMIAdIndicateTool.partowardsiciptowardsionIndictowardseUtensil isAccurtowardseExistAboutAccurtowardseRoute:filePath];
|
||||
// 判断沙盒中是否存在广告图片,如果存在,直接显示
|
||||
NSString *filePath = [XPAdImageTool.shareImageTool getFilePathWithImageName:[kUserDefaults valueForKey:adImageName]];
|
||||
BOOL isExist = [XPAdImageTool.shareImageTool isFileExistWithFilePath:filePath];
|
||||
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([userDefault integerForKey:@"adShow"]) {
|
||||
@@ -95,20 +100,20 @@ UIKIT_EXTERN NSString * adImageName;
|
||||
[userDefault setInteger:1 forKey:@"adShow"];
|
||||
}
|
||||
|
||||
if (isExist) {
|
||||
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];
|
||||
AdvertiseModel *info = [XPAdImageTool.shareImageTool getAdInfoFromCacheInMainWith:imageName];
|
||||
XPAdvertiseView *advertiseView = [[XPAdvertiseView alloc] initWithFrame:self.window.bounds];
|
||||
advertiseView.filePath = filePath;
|
||||
advertiseView.disappearHandler = ^(BOOL shouldJump) {
|
||||
advertiseView.dismissHandler = ^(BOOL shouldJump) {
|
||||
@kStrongify(self)
|
||||
if (!shouldJump || info == nil) {
|
||||
return;
|
||||
}
|
||||
[self performSelectorOnMainThread:@selector(advertiseJumpShankAboutAbstract:) withObject:info waitUntilDone:NO];
|
||||
[self performSelectorOnMainThread:@selector(advertiseJumpHandleWithInfo:) withObject:info waitUntilDone:NO];
|
||||
};
|
||||
[advertiseView show];
|
||||
}
|
||||
@@ -116,32 +121,33 @@ UIKIT_EXTERN NSString * adImageName;
|
||||
}
|
||||
|
||||
|
||||
- (void)advertiseJumpShankAboutAbstract:(AdvertiseMatrix *)info {
|
||||
if (![ClientDisposition partowardsiciptowardsionDisposition].canUnfoild) {
|
||||
/// 闪屏广告跳转处理
|
||||
- (void)advertiseJumpHandleWithInfo:(AdvertiseModel *)info {
|
||||
if (![ClientConfig shareConfig].canOpen) {
|
||||
return;
|
||||
}
|
||||
if (UIApplication.sharedApplication.keyWindow != self.window) {
|
||||
|
||||
//当前窗口不是主控制器所在窗口时,拦截跳转(目前可能情况时,闪屏后出现新人引导
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info.type) {
|
||||
case SplashAbstractSkipGenreRoom: {
|
||||
if (![[YUMIAdIndicateTool partowardsiciptowardsionIndictowardseUtensil] isImSurmount]) {
|
||||
return;
|
||||
case SplashInfoSkipTypeRoom: {
|
||||
if (![[XPAdImageTool shareImageTool] isImLogin]) {
|
||||
return; // 必须登录后才可以跳转
|
||||
}
|
||||
|
||||
// 跳转房间
|
||||
if (info.link.length > 0) {
|
||||
[YUMIChamberRegardGovernancer unfoildChamber:info.link viewController:[XCCurrentVCStackExecutive shareManager].getCurrentVC];
|
||||
[XPRoomViewController openRoom:info.link viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SplashAbstractSkipGenreWeb: {
|
||||
|
||||
case SplashInfoSkipTypeWeb: {
|
||||
// 跳转 H5
|
||||
if (info.link.length > 0) {
|
||||
YUMITissueRegardGovernancer *webView = [[YUMITissueRegardGovernancer alloc]init];
|
||||
XPWebViewController *webView = [[XPWebViewController alloc]init];
|
||||
webView.url = info.link;
|
||||
[[[XCCurrentVCStackExecutive shareManager]universalBreeadcrumbGovernancer] pushViewController:webView animated:YES];
|
||||
[[[XCCurrentVCStackManager shareManager]currentNavigationController] pushViewController:webView animated:YES];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
@property(nonatomic,strong,readonly)NSManagedObjectModel *managedObjectModel;
|
||||
@property(nonatomic,strong,readonly)NSPersistentStoreCoordinator *persistentStoreCoordinator;
|
||||
|
||||
- (void)preserveConessay;
|
||||
- (NSURL *)aplictowardsionlictowardsionDocumentsDirectoryvisory;
|
||||
- (void)saveContext;
|
||||
- (NSURL *)applicationDocumentsDirectory;
|
||||
@end
|
||||
|
||||
|
@@ -6,8 +6,8 @@
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "TabbarRegardGovernancer.h"
|
||||
#import "BaseNevigationGovernancer.h"
|
||||
#import "TabbarViewController.h"
|
||||
#import "BaseNavigationController.h"
|
||||
#import "AppDelegate+ThirdConfig.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <UMCommon/UMCommon.h>
|
||||
@@ -18,18 +18,18 @@
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
TabbarRegardGovernancer *vc = [[TabbarRegardGovernancer alloc] init];
|
||||
BaseNevigationGovernancer *bnc = [[BaseNevigationGovernancer alloc] initWithRootViewController:vc];
|
||||
TabbarViewController *vc = [[TabbarViewController alloc] init];
|
||||
BaseNavigationController *bnc = [[BaseNavigationController alloc] initWithRootViewController:vc];
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
self.window.rootViewController = bnc;
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
[self setupLaunchADRegard];
|
||||
|
||||
[self initTertiusDisposition];
|
||||
|
||||
///设置广告页
|
||||
[self setupLaunchADView];
|
||||
///初始化一些 sdk配置
|
||||
[self initThirdConfig];
|
||||
// 只有同意过了隐私协议 才初始化
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"kYouMinumbernnagna"]) {
|
||||
|
||||
///初始化友盟
|
||||
[UMConfigure initWithAppkey:@"6434c6dfd64e686139618269" channel:@"yumi_appstore"];
|
||||
}
|
||||
return YES;
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
||||
|
||||
// 上传devicetoken至云信服务器。
|
||||
[[NIMSDK sharedSDK] updateApnsToken:deviceToken];
|
||||
}
|
||||
|
||||
@@ -52,12 +52,12 @@
|
||||
@synthesize managedObjectModel = _managedObjectModel;
|
||||
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator;
|
||||
|
||||
-(NSURL *)aplictowardsionlictowardsionDocumentsDirectoryvisory{
|
||||
-(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;
|
||||
}
|
||||
@@ -67,26 +67,26 @@
|
||||
}
|
||||
|
||||
- (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 aplictowardsionlictowardsionDocumentsDirectoryvisory] URLByAppendingPathComponent:@"_1_______.sqlite"];
|
||||
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();
|
||||
}
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
|
||||
- (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;
|
||||
}
|
||||
@@ -112,13 +112,13 @@
|
||||
|
||||
#pragma mark - Core Data Saving support
|
||||
|
||||
- (void)preserveConessay {
|
||||
- (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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user