封装跨应用拉起,

This commit is contained in:
2025-11-21 18:26:02 +08:00
parent 0f4ca89060
commit fc87c545a0
11 changed files with 251 additions and 295 deletions

View File

@@ -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