处理再次进入弹起权限弹窗
This commit is contained in:
@@ -37,7 +37,7 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
[Bugly startWithAppId:BuglyId config:buglyConfig];
|
||||
/// 判断获取键盘权限(统一管理):
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIViewController *top = [self kb_topMostViewController];
|
||||
UIViewController *top = [UIViewController kb_topMostViewController];
|
||||
if (top) {
|
||||
Class mgrCls = NSClassFromString(@"KBKeyboardPermissionManager");
|
||||
if (mgrCls && [mgrCls respondsToSelector:@selector(shared)]) {
|
||||
@@ -56,6 +56,15 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application{
|
||||
// When returning from Settings, re-check the keyboard enable state
|
||||
// and hide the guide if the user has enabled our keyboard.
|
||||
// Also shows the guide again if still not enabled.
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self kb_presentPermissionIfNeeded];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
- (void)setupRootVC{
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
@@ -67,17 +76,6 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
|
||||
#pragma mark - Permission presentation
|
||||
|
||||
- (UIViewController *)kb_topMostViewController
|
||||
{
|
||||
UIViewController *root = self.window.rootViewController;
|
||||
if (!root) return nil;
|
||||
UIViewController *top = root;
|
||||
while (top.presentedViewController) {
|
||||
top = top.presentedViewController;
|
||||
}
|
||||
return top;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Deep Link
|
||||
|
||||
@@ -103,7 +101,7 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
// 已登录则不提示
|
||||
BOOL loggedIn = ([AppleSignInManager shared].storedUserIdentifier.length > 0);
|
||||
if (loggedIn) return;
|
||||
UIViewController *top = [self kb_topMostViewController];
|
||||
UIViewController *top = [UIViewController kb_topMostViewController];
|
||||
if (!top) return;
|
||||
[KBLoginSheetViewController presentIfNeededFrom:top];
|
||||
}
|
||||
@@ -123,7 +121,7 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
- (void)kb_presentPermissionIfNeeded
|
||||
{
|
||||
BOOL enabled = KBIsKeyboardEnabled();
|
||||
UIViewController *top = [self kb_topMostViewController];
|
||||
UIViewController *top = [UIViewController kb_topMostViewController];
|
||||
if (!top) return;
|
||||
if ([top isKindOfClass:[KBPermissionViewController class]]) {
|
||||
if (enabled) {
|
||||
|
||||
Reference in New Issue
Block a user