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

@@ -7,7 +7,7 @@
<string>kbkeyboardAppExtension</string>
</array>
<key>NSMicrophoneUsageDescription</key>
<string>需要使用麦克风进行语音输入</string>
<string>Microphone access is required for voice input and speech transcription.</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>

View File

@@ -1675,6 +1675,31 @@ static NSString *KBFormatMB(uint64_t bytes) {
[self kb_openRechargeForProduct:product];
}
- (void)subscriptionViewDidTapAgreement:(KBKeyboardSubscriptionView *)view {
(void)view;
[self hideSubscriptionPanel];
NSString *query = [NSString stringWithFormat:@"type=%@&src=keyboard",
@"membership"];
NSString *ulString = [NSString stringWithFormat:@"%@?%@", KB_UL_LEGAL, query];
NSString *schemeString =
[NSString stringWithFormat:@"%@://legal?%@", KB_APP_SCHEME, query];
NSURL *ul = [NSURL URLWithString:ulString];
NSURL *scheme = [NSURL URLWithString:schemeString];
__weak typeof(self) weakSelf = self;
[KBExtensionAppLauncher openPrimaryURL:ul
fallbackURL:scheme
usingInputController:self
source:(self.view ?: (UIResponder *)weakSelf)
completion:^(BOOL success) {
if (success) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[KBHUD showInfo:KBLocalized(@"Please open the App to view the agreement")];
});
}];
}
#pragma mark - KBChatLimitPopViewDelegate
- (void)chatLimitPopViewDidTapCancel:(KBChatLimitPopView *)view {

View File

@@ -76,6 +76,31 @@
[self kb_openRechargeForProduct:product];
}
- (void)subscriptionViewDidTapAgreement:(KBKeyboardSubscriptionView *)view {
(void)view;
[self hideSubscriptionPanel];
NSString *query = [NSString stringWithFormat:@"type=%@&src=keyboard",
@"membership"];
NSString *ulString = [NSString stringWithFormat:@"%@?%@", KB_UL_LEGAL, query];
NSString *schemeString =
[NSString stringWithFormat:@"%@://legal?%@", KB_APP_SCHEME, query];
NSURL *ul = [NSURL URLWithString:ulString];
NSURL *scheme = [NSURL URLWithString:schemeString];
__weak typeof(self) weakSelf = self;
[KBExtensionAppLauncher openPrimaryURL:ul
fallbackURL:scheme
usingInputController:self
source:(self.view ?: (UIResponder *)weakSelf)
completion:^(BOOL success) {
if (success) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[KBHUD showInfo:KBLocalized(@"Please open the App to view the agreement")];
});
}];
}
#pragma mark - Actions
- (void)kb_openRechargeForProduct:(KBKeyboardSubscriptionProduct *)product {

View File

@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@optional
- (void)subscriptionViewDidTapClose:(KBKeyboardSubscriptionView *)view;
- (void)subscriptionView:(KBKeyboardSubscriptionView *)view didTapPurchaseForProduct:(KBKeyboardSubscriptionProduct *)product;
- (void)subscriptionViewDidTapAgreement:(KBKeyboardSubscriptionView *)view;
@end
/// 键盘内的订阅弹层

View File

@@ -192,7 +192,11 @@ static id KBKeyboardSubscriptionSanitizeJSON(id obj) {
}
- (void)onTapAgreement {
[KBHUD showInfo:KBLocalized(@"Agreement coming soon")];
if ([self.delegate respondsToSelector:@selector(subscriptionViewDidTapAgreement:)]) {
[self.delegate subscriptionViewDidTapAgreement:self];
return;
}
[KBHUD showInfo:KBLocalized(@"Please open the App to view the agreement")];
}
#pragma mark - Data