This commit is contained in:
2026-03-08 21:29:10 +08:00
parent 9fb2e2e694
commit c1ace5f53e
34 changed files with 870 additions and 1930 deletions

View File

@@ -30,6 +30,7 @@
#import "KBSkinManager.h"
#import "KBAppUpdateView.h"
#import "KBInputProfileManager.h"
#import "KBWebViewViewController.h"
static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
@@ -355,6 +356,21 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
}
return YES;
}
if ([path hasPrefix:@"/ul/legal"]) {
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(),
(__bridge CFStringRef)KBDarwinULHandled,
NULL, NULL, true);
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
NSString *typeValue = nil;
for (NSURLQueryItem *item in components.queryItems ?: @[]) {
if ([item.name isEqualToString:@"type"]) {
typeValue = item.value;
break;
}
}
[self kb_presentLegalDocumentWithTypeValue:typeValue];
return YES;
}
if ([path hasPrefix:@"/ul/login"]) {
// query entry=recharge
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
@@ -457,6 +473,10 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
}
[KB_CURRENT_NAV pushViewController:vc animated:true];
return YES;
} else if ([host isEqualToString:@"legal"]) { // kbkeyboard://legal?type=privacy
NSDictionary<NSString *, NSString *> *params = [self kb_queryParametersFromURL:url];
[self kb_presentLegalDocumentWithTypeValue:params[@"type"]];
return YES;
}
return NO;
}
@@ -537,7 +557,14 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
// [pop pop];
// });
}
- (void)kb_presentLegalDocumentWithTypeValue:(NSString *)typeValue {
NSNumber *typeNumber = [KBWebViewViewController legalDocumentTypeNumberFromQueryValue:typeValue ?: @""];
KBLegalDocumentType type = typeNumber ? typeNumber.integerValue : KBLegalDocumentTypeTermsOfService;
KBWebViewViewController *vc = [KBWebViewViewController legalViewControllerWithType:type];
[KB_CURRENT_NAV pushViewController:vc animated:true];
}
- (void)kb_openAppSettings {