3
This commit is contained in:
@@ -70,10 +70,14 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
||||
if (!url) return NO;
|
||||
if ([[url.scheme lowercaseString] isEqualToString:@"kbkeyboard"]) {
|
||||
// 路由:kbkeyboard://login
|
||||
if ([[url.host lowercaseString] isEqualToString:@"login"]) {
|
||||
NSString *urlHost = url.host ?: @"";
|
||||
NSString *host = [urlHost lowercaseString];
|
||||
if ([host isEqualToString:@"login"]) { // kbkeyboard://login
|
||||
[self kb_presentLoginSheetIfNeeded];
|
||||
return YES;
|
||||
} else if ([host isEqualToString:@"settings"]) { // kbkeyboard://settings
|
||||
[self kb_openAppSettings];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@@ -89,6 +93,18 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
[KBLoginSheetViewController presentIfNeededFrom:top];
|
||||
}
|
||||
|
||||
- (void)kb_openAppSettings {
|
||||
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
|
||||
UIApplication *app = [UIApplication sharedApplication];
|
||||
if ([app canOpenURL:url]) {
|
||||
if (@available(iOS 10.0, *)) {
|
||||
[app openURL:url options:@{} completionHandler:nil];
|
||||
} else {
|
||||
[app openURL:url];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)kb_presentPermissionIfNeeded
|
||||
{
|
||||
BOOL enabled = KBIsKeyboardEnabled();
|
||||
|
||||
Reference in New Issue
Block a user