2
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
#import <Bugly/Bugly.h>
|
||||
#import "BaseTabBarController.h"
|
||||
#import "LoginViewController.h"
|
||||
#import "KBLoginSheetViewController.h"
|
||||
#import "AppleSignInManager.h"
|
||||
|
||||
// 注意:用于判断系统已启用本输入法扩展的 bundle id 需与扩展 target 的
|
||||
// PRODUCT_BUNDLE_IDENTIFIER 完全一致。
|
||||
@@ -44,7 +46,7 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
self.window.backgroundColor = [UIColor whiteColor];
|
||||
[self.window makeKeyAndVisible];
|
||||
LoginViewController *vc = [[LoginViewController alloc] init];
|
||||
BaseTabBarController *vc = [[BaseTabBarController alloc] init];
|
||||
self.window.rootViewController = vc;
|
||||
}
|
||||
|
||||
@@ -61,6 +63,32 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
return top;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Deep Link
|
||||
|
||||
// iOS 9+
|
||||
- (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"]) {
|
||||
[self kb_presentLoginSheetIfNeeded];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)kb_presentLoginSheetIfNeeded {
|
||||
// 已登录则不提示
|
||||
BOOL loggedIn = ([AppleSignInManager shared].storedUserIdentifier.length > 0);
|
||||
if (loggedIn) return;
|
||||
UIViewController *top = [self kb_topMostViewController];
|
||||
if (!top) return;
|
||||
[KBLoginSheetViewController presentIfNeededFrom:top];
|
||||
}
|
||||
|
||||
- (void)kb_presentPermissionIfNeeded
|
||||
{
|
||||
BOOL enabled = KBIsKeyboardEnabled();
|
||||
|
||||
Reference in New Issue
Block a user