封装跨应用拉起,
This commit is contained in:
@@ -6,29 +6,27 @@
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "KBPermissionViewController.h"
|
||||
//#import "KBPermissionViewController.h"
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
#if !DEBUG
|
||||
#import <Bugly/Bugly.h>
|
||||
#endif
|
||||
#import "BaseTabBarController.h"
|
||||
#import "LoginViewController.h"
|
||||
#import "KBLoginSheetViewController.h"
|
||||
#import "AppleSignInManager.h"
|
||||
#import <objc/message.h>
|
||||
#import "KBULBridge.h" // Darwin 通知常量:用于通知扩展“UL已处理”
|
||||
//#import "LoginViewController.h"
|
||||
//#import "KBLoginSheetViewController.h"
|
||||
//#import "AppleSignInManager.h"
|
||||
//#import <objc/message.h>
|
||||
#import "KBULBridgeNotification.h" // Darwin 通知常量:用于通知扩展“UL已处理”
|
||||
#import "LSTPopView.h"
|
||||
#import "KBLoginPopView.h"
|
||||
#import "IAPVerifyTransactionObj.h"
|
||||
#import "FGIAPManager.h"
|
||||
#import "KBSexSelVC.h"
|
||||
#import <SystemConfiguration/CaptiveNetwork.h>
|
||||
#import <CoreTelephony/CTCellularData.h>
|
||||
|
||||
// 注意:用于判断系统已启用本输入法扩展的 bundle id 需与扩展 target 的
|
||||
// PRODUCT_BUNDLE_IDENTIFIER 完全一致。
|
||||
// 当前工程的 CustomKeyboard target 为 com.loveKey.nyx.CustomKeyboard
|
||||
static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomKeyboard";
|
||||
//static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomKeyboard";
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
@@ -143,6 +141,10 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomK
|
||||
} else if ([host isEqualToString:@"settings"]) { // kbkeyboard://settings
|
||||
[self kb_openAppSettings];
|
||||
return YES;
|
||||
}else if ([host isEqualToString:@"recharge"]) { // kbkeyboard://settings
|
||||
// [self kb_openAppSettings];
|
||||
[KBHUD showInfo:@"去充值"];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@@ -244,26 +246,27 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomK
|
||||
// [PublicObj saveNetReachability:@"wwan"];
|
||||
}else{
|
||||
// [PublicObj saveNetReachability:@"unknown"];
|
||||
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
static BOOL KBIsKeyboardEnabled(void) {
|
||||
for (UITextInputMode *mode in [UITextInputMode activeInputModes]) {
|
||||
NSString *identifier = nil;
|
||||
@try {
|
||||
identifier = [mode valueForKey:@"identifier"]; // not a public API
|
||||
} @catch (__unused NSException *e) {
|
||||
identifier = nil;
|
||||
}
|
||||
if ([identifier isKindOfClass:[NSString class]] &&
|
||||
[identifier rangeOfString:kKBKeyboardExtensionBundleId].location != NSNotFound) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
//static BOOL KBIsKeyboardEnabled(void) {
|
||||
// for (UITextInputMode *mode in [UITextInputMode activeInputModes]) {
|
||||
// NSString *identifier = nil;
|
||||
// @try {
|
||||
// identifier = [mode valueForKey:@"identifier"]; // not a public API
|
||||
// } @catch (__unused NSException *e) {
|
||||
// identifier = nil;
|
||||
// }
|
||||
// if ([identifier isKindOfClass:[NSString class]] &&
|
||||
// [identifier rangeOfString:kKBKeyboardExtensionBundleId].location != NSNotFound) {
|
||||
// return YES;
|
||||
// }
|
||||
// }
|
||||
// return NO;
|
||||
//}
|
||||
|
||||
#pragma mark - Network check & alert
|
||||
|
||||
@@ -306,86 +309,4 @@ static BOOL KBIsKeyboardEnabled(void) {
|
||||
[rootVC presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
|
||||
///*
|
||||
// 获取网络权限状态
|
||||
// */
|
||||
//- (void)networkStatus:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// //2.根据权限执行相应的交互
|
||||
// CTCellularData *cellularData = [[CTCellularData alloc] init];
|
||||
// /*
|
||||
// 此函数会在网络权限改变时再次调用
|
||||
// */
|
||||
// cellularData.cellularDataRestrictionDidUpdateNotifier = ^(CTCellularDataRestrictedState state) {
|
||||
// switch (state) {
|
||||
// case kCTCellularDataRestricted:
|
||||
//
|
||||
// NSLog(@"Restricted");
|
||||
// //2.1权限关闭的情况下 再次请求网络数据会弹出设置网络提示
|
||||
//
|
||||
// break;
|
||||
// case kCTCellularDataNotRestricted:
|
||||
//
|
||||
// NSLog(@"NotRestricted");
|
||||
// //2.2已经开启网络权限 监听网络状态
|
||||
// [self addReachabilityManager:application didFinishLaunchingWithOptions:launchOptions];
|
||||
// break;
|
||||
// case kCTCellularDataRestrictedStateUnknown:
|
||||
//
|
||||
// NSLog(@"Unknown");
|
||||
//
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// };
|
||||
//}
|
||||
//
|
||||
///**
|
||||
// 实时检查当前网络状态
|
||||
// */
|
||||
//- (void)addReachabilityManager:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// AFNetworkReachabilityManager *afNetworkReachabilityManager = [AFNetworkReachabilityManager sharedManager];
|
||||
//
|
||||
//
|
||||
// [afNetworkReachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
|
||||
// switch (status) {
|
||||
// case AFNetworkReachabilityStatusNotReachable:{
|
||||
// NSLog(@"网络不通:%@",@(status) );
|
||||
// break;
|
||||
// }
|
||||
// case AFNetworkReachabilityStatusReachableViaWiFi:{
|
||||
// NSLog(@"网络通过WIFI连接:%@",@(status));
|
||||
//
|
||||
// [self getInfo_application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// case AFNetworkReachabilityStatusReachableViaWWAN:{
|
||||
// NSLog(@"网络通过无线连接:%@",@(status) );
|
||||
//
|
||||
// [self getInfo_application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }];
|
||||
//
|
||||
// [afNetworkReachabilityManager startMonitoring]; //开启网络监视器;
|
||||
//}
|
||||
//
|
||||
////把以前写在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions里面的一些初始化操作放在该方法
|
||||
//- (void)getInfo_application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
//
|
||||
//// [self.updateBusiness checkUpdateWithBothApi];//检查app更新
|
||||
//
|
||||
////发送通知给APP首屏页面,让其有网络时重新请求
|
||||
// [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil];
|
||||
//}
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user