添加键盘里的充值界面
This commit is contained in:
@@ -187,10 +187,20 @@
|
||||
} else if ([host isEqualToString:@"settings"]) { // kbkeyboard://settings
|
||||
[self kb_openAppSettings];
|
||||
return YES;
|
||||
}else if ([host isEqualToString:@"recharge"]) { // kbkeyboard://settings
|
||||
// [self kb_openAppSettings];
|
||||
// [KBHUD showInfo:@"去充值"];
|
||||
}else if ([host isEqualToString:@"recharge"]) { // kbkeyboard://recharge
|
||||
NSDictionary<NSString *, NSString *> *params = [self kb_queryParametersFromURL:url];
|
||||
NSString *productId = params[@"productId"];
|
||||
BOOL autoPay = NO;
|
||||
NSString *autoFlag = params[@"autoPay"];
|
||||
if ([autoFlag respondsToSelector:@selector(boolValue)]) {
|
||||
autoPay = autoFlag.boolValue;
|
||||
}
|
||||
NSString *action = params[@"action"].lowercaseString;
|
||||
if ([action isEqualToString:@"autopay"]) {
|
||||
autoPay = YES;
|
||||
}
|
||||
KBVipPay *vc = [[KBVipPay alloc] init];
|
||||
[vc configureWithProductId:productId autoPurchase:autoPay];
|
||||
[KB_CURRENT_NAV pushViewController:vc animated:true];
|
||||
return YES;
|
||||
}
|
||||
@@ -199,6 +209,19 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSDictionary<NSString *, NSString *> *)kb_queryParametersFromURL:(NSURL *)url {
|
||||
if (!url) { return @{}; }
|
||||
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
|
||||
NSArray<NSURLQueryItem *> *items = components.queryItems ?: @[];
|
||||
if (items.count == 0) { return @{}; }
|
||||
NSMutableDictionary<NSString *, NSString *> *dict = [NSMutableDictionary dictionaryWithCapacity:items.count];
|
||||
for (NSURLQueryItem *item in items) {
|
||||
if (item.name.length == 0) { continue; }
|
||||
dict[item.name] = item.value ?: @"";
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
|
||||
- (void)kb_presentLoginSheetIfNeeded {
|
||||
// 已登录则不提示
|
||||
// BOOL loggedIn = ([AppleSignInManager shared].storedUserIdentifier.length > 0);
|
||||
|
||||
Reference in New Issue
Block a user