diff --git a/CustomKeyboard/KeyboardViewController.m b/CustomKeyboard/KeyboardViewController.m index dd148ec..109164e 100644 --- a/CustomKeyboard/KeyboardViewController.m +++ b/CustomKeyboard/KeyboardViewController.m @@ -192,6 +192,22 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center, } - (void)showSubscriptionPanel { + // 1) 先判断权限:未开启“完全访问”则走引导逻辑 + if (![[KBFullAccessManager shared] hasFullAccess]) { + // 未开启完全访问:保持原有引导路径 +// [KBHUD showInfo:KBLocalized(@"处理中…")]; + [[KBFullAccessManager shared] ensureFullAccessOrGuideInView:self.view]; + return; + } + // 点击充值要先判断是否登录 + // 2) 权限没问题,再判断是否登录:未登录 -> 直接拉起主 App,由主 App 负责完成登录 + if (!KBAuthManager.shared.isLoggedIn) { + NSString *schemeStr = [NSString stringWithFormat:@"%@://login?src=keyboard", KB_APP_SCHEME]; + NSURL *scheme = [NSURL URLWithString:schemeStr]; + // 从当前视图作为起点,通过响应链找到 UIApplication 再调起主 App + BOOL ok = [KBHostAppLauncher openHostAppURL:scheme fromResponder:self.view]; + return; + } [self showFunctionPanel:NO]; KBKeyboardSubscriptionView *panel = self.subscriptionView; if (!panel.superview) {