1
This commit is contained in:
@@ -35,35 +35,11 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
/// 设置GroupID进行配置
|
||||
// buglyConfig.applicationGroupIdentifier = @"";
|
||||
[Bugly startWithAppId:BuglyId config:buglyConfig];
|
||||
/// 判断获取键盘权限(统一管理):
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIViewController *top = [UIViewController kb_topMostViewController];
|
||||
if (top) {
|
||||
Class mgrCls = NSClassFromString(@"KBKeyboardPermissionManager");
|
||||
if (mgrCls && [mgrCls respondsToSelector:@selector(shared)]) {
|
||||
id mgr = [mgrCls performSelector:@selector(shared)];
|
||||
if ([mgr respondsToSelector:@selector(presentPermissionIfNeededFrom:)]) {
|
||||
// 避免私有 API 静态链接,运行时调用
|
||||
void (*func)(id, SEL, UIViewController *) = (void (*)(id, SEL, UIViewController *))objc_msgSend;
|
||||
func(mgr, @selector(presentPermissionIfNeededFrom:), top);
|
||||
}
|
||||
} else {
|
||||
// 兜底走原有逻辑(仅判断是否启用键盘)
|
||||
[self kb_presentPermissionIfNeeded];
|
||||
}
|
||||
}
|
||||
});
|
||||
// 键盘权限引导改由 KBGuideVC 内部负责;此处不主动弹出。
|
||||
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)applicationDidBecomeActive:(UIApplication *)application{}
|
||||
|
||||
|
||||
- (void)setupRootVC{
|
||||
@@ -120,20 +96,7 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoardst.CustomKe
|
||||
|
||||
- (void)kb_presentPermissionIfNeeded
|
||||
{
|
||||
BOOL enabled = KBIsKeyboardEnabled();
|
||||
UIViewController *top = [UIViewController kb_topMostViewController];
|
||||
if (!top) return;
|
||||
if ([top isKindOfClass:[KBPermissionViewController class]]) {
|
||||
if (enabled) {
|
||||
[top dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!enabled) {
|
||||
KBPermissionViewController *guide = [KBPermissionViewController new];
|
||||
guide.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[top presentViewController:guide animated:YES completion:nil];
|
||||
}
|
||||
// 该逻辑已迁移到 KBGuideVC,保留占位以兼容旧调用,但不再执行任何操作
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user