处理键盘语音svip权限弹窗,跳转主app充值

This commit is contained in:
2026-02-05 14:10:24 +08:00
parent faccf6f10f
commit 750b391100
2 changed files with 42 additions and 28 deletions

View File

@@ -1421,7 +1421,15 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
- (void)chatLimitPopViewDidTapRecharge:(KBChatLimitPopView *)view { - (void)chatLimitPopViewDidTapRecharge:(KBChatLimitPopView *)view {
[self kb_dismissChatLimitPop]; [self kb_dismissChatLimitPop];
[self showSubscriptionPanel]; NSString *urlString =
[NSString stringWithFormat:@"%@://recharge?src=keyboard&vipType=svip",
KB_APP_SCHEME];
NSURL *scheme = [NSURL URLWithString:urlString];
BOOL success = [KBHostAppLauncher openHostAppURL:scheme
fromResponder:self.view];
if (!success) {
[KBHUD showInfo:KBLocalized(@"Please open the App to finish purchase")];
}
} }
#pragma mark - lazy #pragma mark - lazy

View File

@@ -192,6 +192,9 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
return YES; return YES;
} else if ([host isEqualToString:@"recharge"]) { // kbkeyboard://recharge } else if ([host isEqualToString:@"recharge"]) { // kbkeyboard://recharge
NSDictionary<NSString *, NSString *> *params = [self kb_queryParametersFromURL:url]; NSDictionary<NSString *, NSString *> *params = [self kb_queryParametersFromURL:url];
NSString *vipType = [params[@"vipType"] lowercaseString];
BOOL preferSvip = ([vipType isKindOfClass:NSString.class] && vipType.length > 0 &&
([vipType isEqualToString:@"svip"] || [vipType isEqualToString:@"1"]));
NSString *productId = params[@"productId"]; NSString *productId = params[@"productId"];
BOOL autoPay = NO; BOOL autoPay = NO;
NSString *autoFlag = params[@"autoPay"]; NSString *autoFlag = params[@"autoPay"];
@@ -203,6 +206,9 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
autoPay = YES; autoPay = YES;
} }
KBPayMainVC *vc = [[KBPayMainVC alloc] init];
vc.initialSelectedIndex = preferSvip ? 1 : 0;
if (!preferSvip) {
BOOL wantsPrefill = NO; BOOL wantsPrefill = NO;
NSString *prefillFlag = params[@"prefill"]; NSString *prefillFlag = params[@"prefill"];
if ([prefillFlag respondsToSelector:@selector(boolValue)] && prefillFlag.boolValue) { if ([prefillFlag respondsToSelector:@selector(boolValue)] && prefillFlag.boolValue) {
@@ -220,7 +226,6 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
} }
} }
KBPayMainVC *vc = [[KBPayMainVC alloc] init];
if ([prefillPayload isKindOfClass:NSDictionary.class]) { if ([prefillPayload isKindOfClass:NSDictionary.class]) {
NSArray *productsJSON = prefillPayload[@"products"]; NSArray *productsJSON = prefillPayload[@"products"];
NSNumber *selectedIndexNumber = prefillPayload[@"selectedIndex"]; NSNumber *selectedIndexNumber = prefillPayload[@"selectedIndex"];
@@ -232,6 +237,7 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
} else { } else {
[vc configureWithProductId:productId autoPurchase:autoPay]; [vc configureWithProductId:productId autoPurchase:autoPay];
} }
}
[KB_CURRENT_NAV pushViewController:vc animated:true]; [KB_CURRENT_NAV pushViewController:vc animated:true];
return YES; return YES;
} }