key缺少,添加权限多语言
This commit is contained in:
@@ -940,7 +940,7 @@ static NSString * const KBChatSessionDidResetNotification = @"KBChatSessionDidRe
|
||||
case KBChatMessageActionTypeCopy: {
|
||||
if (message.text.length > 0) {
|
||||
[UIPasteboard generalPasteboard].string = message.text;
|
||||
[KBHUD showSuccess:KBLocalized(@"复制成功")];
|
||||
[KBHUD showSuccess:KBLocalized(@"Copied")];
|
||||
}
|
||||
} break;
|
||||
case KBChatMessageActionTypeDelete: {
|
||||
@@ -973,7 +973,7 @@ static NSString * const KBChatSessionDidResetNotification = @"KBChatSessionDidRe
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[KBHUD dismiss];
|
||||
if (!success || error) {
|
||||
NSString *msg = error.localizedDescription ?: KBLocalized(@"删除失败,请重试");
|
||||
NSString *msg = error.localizedDescription ?: KBLocalized(@"Delete failed, please try again");
|
||||
[KBHUD showError:msg];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@
|
||||
_goChatButton.layer.cornerRadius = 25;
|
||||
}
|
||||
|
||||
[_goChatButton setTitle:KBLocalized(@"Go Chatting") forState:UIControlStateNormal];
|
||||
[_goChatButton setTitle:KBLocalized(@"Chatting") forState:UIControlStateNormal];
|
||||
[_goChatButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
|
||||
_goChatButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
[_goChatButton addTarget:self action:@selector(goChatButtonTapped) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
@@ -548,7 +548,7 @@
|
||||
- (UILabel *)contentTitleLabel {
|
||||
if (!_contentTitleLabel) {
|
||||
_contentTitleLabel = [[UILabel alloc] init];
|
||||
_contentTitleLabel.text = KBLocalized(@"selection content");
|
||||
_contentTitleLabel.text = KBLocalized(@"Selection Content");
|
||||
_contentTitleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||||
_contentTitleLabel.textColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1.0];
|
||||
}
|
||||
|
||||
@@ -1272,9 +1272,9 @@ static void KBChatUpdatedDarwinCallback(CFNotificationCenterRef center,
|
||||
}
|
||||
|
||||
NSLog(@"[KBAIHomeVC] 语音转文字失败:%@", error.localizedDescription);
|
||||
[KBHUD showError:KBLocalized(@"语音转文字失败,请重试")];
|
||||
[KBHUD showError:KBLocalized(@"Voice-to-text failed, please try again")];
|
||||
if (cell) {
|
||||
[cell updateLastUserMessage:KBLocalized(@"语音识别失败")];
|
||||
[cell updateLastUserMessage:KBLocalized(@"Voice recognition failed")];
|
||||
}
|
||||
strongSelf.isVoiceProcessing = NO;
|
||||
[strongSelf updateCollectionViewScrollState];
|
||||
@@ -1284,7 +1284,7 @@ static void KBChatUpdatedDarwinCallback(CFNotificationCenterRef center,
|
||||
NSString *transcript = response.data.transcript ?: @"";
|
||||
if (transcript.length == 0) {
|
||||
NSLog(@"[KBAIHomeVC] 语音转文字结果为空");
|
||||
[KBHUD showError:KBLocalized(@"未识别到语音内容")];
|
||||
[KBHUD showError:KBLocalized(@"No speech content recognized")];
|
||||
if (cell) {
|
||||
[cell removeLoadingUserMessage];
|
||||
}
|
||||
@@ -1305,7 +1305,7 @@ static void KBChatUpdatedDarwinCallback(CFNotificationCenterRef center,
|
||||
|
||||
- (void)voiceRecordManagerDidRecordTooShort:(KBVoiceRecordManager *)manager {
|
||||
NSLog(@"[KBAIHomeVC] 录音过短,已忽略");
|
||||
[KBHUD showError:KBLocalized(@"录音时间过短,请重新录音")];
|
||||
[KBHUD showError:KBLocalized(@"Recording too short, please try again")];
|
||||
}
|
||||
|
||||
- (void)voiceRecordManager:(KBVoiceRecordManager *)manager
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#import "KBVoiceToTextManager.h"
|
||||
#import "DeepgramStreamingManager.h"
|
||||
#import "KBVoiceInputBar.h"
|
||||
#import "KBLocalizationManager.h"
|
||||
|
||||
@interface KBVoiceToTextManager () <KBVoiceInputBarDelegate,
|
||||
DeepgramStreamingManagerDelegate>
|
||||
@@ -55,6 +56,7 @@
|
||||
if (!self.deepgramEnabled) {
|
||||
return;
|
||||
}
|
||||
[self kb_refreshDeepgramLanguage];
|
||||
[self.deepgramManager prepareConnection];
|
||||
}
|
||||
|
||||
@@ -72,7 +74,7 @@
|
||||
self.deepgramManager.delegate = self;
|
||||
self.deepgramManager.serverURL = @"wss://api.deepgram.com/v1/listen";
|
||||
self.deepgramManager.apiKey = @"9c792eb63a65d644cbc95785155754cd1e84f8cf";
|
||||
self.deepgramManager.language = @"en";
|
||||
[self kb_refreshDeepgramLanguage];
|
||||
self.deepgramManager.model = @"nova-3";
|
||||
self.deepgramManager.punctuate = YES;
|
||||
self.deepgramManager.smartFormat = YES;
|
||||
@@ -86,15 +88,35 @@
|
||||
[self.fullText setString:@""];
|
||||
}
|
||||
|
||||
- (void)kb_refreshDeepgramLanguage {
|
||||
self.deepgramManager.language = [self kb_currentDeepgramLanguageCode];
|
||||
}
|
||||
|
||||
- (NSString *)kb_currentDeepgramLanguageCode {
|
||||
NSString *languageCode = [KBLocalizationManager shared].currentLanguageCode ?: @"en";
|
||||
NSString *lc = languageCode.lowercaseString;
|
||||
if ([lc hasPrefix:@"es"]) { return @"es"; }
|
||||
if ([lc hasPrefix:@"id"]) { return @"id"; }
|
||||
if ([lc hasPrefix:@"pt"]) { return @"pt"; }
|
||||
if ([lc hasPrefix:@"zh-hant"] || [lc hasPrefix:@"zh_tw"] || [lc hasPrefix:@"zh-tw"] || [lc hasPrefix:@"zh-hk"]) {
|
||||
return @"zh-TW";
|
||||
}
|
||||
if ([lc hasPrefix:@"zh-hans"] || [lc hasPrefix:@"zh_cn"] || [lc hasPrefix:@"zh-cn"]) {
|
||||
return @"zh-CN";
|
||||
}
|
||||
return @"en";
|
||||
}
|
||||
|
||||
#pragma mark - KBVoiceInputBarDelegate
|
||||
|
||||
- (void)voiceInputBarDidBeginRecording:(KBVoiceInputBar *)inputBar {
|
||||
[self resetTranscript];
|
||||
if (self.deepgramEnabled) {
|
||||
inputBar.statusText = @"正在连接...";
|
||||
[self kb_refreshDeepgramLanguage];
|
||||
inputBar.statusText = KBLocalized(@"Voice Connecting...");
|
||||
[self.deepgramManager start];
|
||||
} else {
|
||||
inputBar.statusText = @"正在录音...";
|
||||
inputBar.statusText = KBLocalized(@"Voice Recording...");
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector
|
||||
@@ -105,10 +127,10 @@
|
||||
|
||||
- (void)voiceInputBarDidEndRecording:(KBVoiceInputBar *)inputBar {
|
||||
if (self.deepgramEnabled) {
|
||||
inputBar.statusText = @"正在识别...";
|
||||
inputBar.statusText = KBLocalized(@"Voice Recognizing...");
|
||||
[self.deepgramManager stopAndFinalize];
|
||||
} else {
|
||||
inputBar.statusText = @"录音结束";
|
||||
inputBar.statusText = KBLocalized(@"Voice Recording Ended");
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector
|
||||
@@ -118,7 +140,7 @@
|
||||
}
|
||||
|
||||
- (void)voiceInputBarDidCancelRecording:(KBVoiceInputBar *)inputBar {
|
||||
inputBar.statusText = @"已取消";
|
||||
inputBar.statusText = KBLocalized(@"Voice Cancelled");
|
||||
[self resetTranscript];
|
||||
if (self.deepgramEnabled) {
|
||||
[self.deepgramManager cancel];
|
||||
@@ -136,7 +158,7 @@
|
||||
if (!self.deepgramEnabled) {
|
||||
return;
|
||||
}
|
||||
self.inputBar.statusText = @"正在聆听...";
|
||||
self.inputBar.statusText = KBLocalized(@"Voice Listening...");
|
||||
}
|
||||
|
||||
- (void)deepgramStreamingManagerDidDisconnect:(NSError *_Nullable)error {
|
||||
@@ -147,7 +169,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
self.inputBar.statusText = @"识别失败";
|
||||
self.inputBar.statusText = KBLocalized(@"Voice Recognition Failed");
|
||||
if ([self.delegate respondsToSelector:@selector
|
||||
(voiceToTextManager:didFailWithError:)]) {
|
||||
[self.delegate voiceToTextManager:self didFailWithError:error];
|
||||
@@ -174,7 +196,7 @@
|
||||
}
|
||||
|
||||
self.inputBar.statusText =
|
||||
displayText.length > 0 ? displayText : @"正在识别...";
|
||||
displayText.length > 0 ? displayText : KBLocalized(@"Voice Recognizing...");
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector
|
||||
(voiceToTextManager:didUpdateInterimText:)]) {
|
||||
@@ -195,7 +217,7 @@
|
||||
|
||||
NSString *finalText = [self.fullText copy];
|
||||
self.inputBar.statusText =
|
||||
finalText.length > 0 ? finalText : @"识别完成";
|
||||
finalText.length > 0 ? finalText : KBLocalized(@"Voice Recognition Completed");
|
||||
|
||||
if (finalText.length > 0 &&
|
||||
[self.delegate respondsToSelector:@selector
|
||||
@@ -208,7 +230,7 @@
|
||||
if (!self.deepgramEnabled) {
|
||||
return;
|
||||
}
|
||||
self.inputBar.statusText = @"识别失败";
|
||||
self.inputBar.statusText = KBLocalized(@"Voice Recognition Failed");
|
||||
if ([self.delegate respondsToSelector:@selector
|
||||
(voiceToTextManager:didFailWithError:)]) {
|
||||
[self.delegate voiceToTextManager:self didFailWithError:error];
|
||||
|
||||
@@ -102,15 +102,13 @@
|
||||
}
|
||||
|
||||
- (void)applyDefaultTexts {
|
||||
self.titleText = KBLocalized(@"");
|
||||
self.titleText = @"";
|
||||
self.versionText = @"V1.1.4";
|
||||
self.contentTitleText = KBLocalized(@"Ver. Update Content");
|
||||
self.contentTitleText = KBLocalized(@"Update content");
|
||||
self.contentItems = @[
|
||||
KBLocalized(@"AAAAAAAAAAAAAAAAAAA"),
|
||||
KBLocalized(@"SSSSSSSSSSSSSSSSSSS")
|
||||
];
|
||||
self.upgradeButtonTitle = KBLocalized(@"立即升级");
|
||||
self.cancelButtonTitle = KBLocalized(@"取消");
|
||||
];
|
||||
self.upgradeButtonTitle = KBLocalized(@"Upgrade now");
|
||||
self.cancelButtonTitle = KBLocalized(@"Cancel");
|
||||
self.showsCancelButton = NO;
|
||||
}
|
||||
|
||||
@@ -179,10 +177,10 @@
|
||||
if (!updateInfo) { return; }
|
||||
self.showsCancelButton = !updateInfo.forceUpdate;
|
||||
if (!updateInfo.forceUpdate) {
|
||||
self.cancelButtonTitle = KBLocalized(@"取消");
|
||||
self.cancelButtonTitle = KBLocalized(@"Cancel");
|
||||
}
|
||||
self.upgradeButtonTitle = KBLocalized(@"更新");
|
||||
self.contentTitleText = KBLocalized(@"更新内容");
|
||||
self.upgradeButtonTitle = KBLocalized(@"Update");
|
||||
self.contentTitleText = KBLocalized(@"Update content");
|
||||
NSString *versionName = updateInfo.latestVersionName ?: @"";
|
||||
if (versionName.length > 0 && ![versionName hasPrefix:@"V"] && ![versionName hasPrefix:@"v"]) {
|
||||
versionName = [NSString stringWithFormat:@"V%@", versionName];
|
||||
|
||||
@@ -284,7 +284,7 @@ typedef NS_ENUM(NSInteger, KBSexOption) {
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = @"Please Select Your Gender";
|
||||
_titleLabel.text = KBLocalized(@"Please Select Your Gender");
|
||||
_titleLabel.font = [KBFont medium:20];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_titleLabel.numberOfLines = 1;
|
||||
@@ -305,7 +305,7 @@ typedef NS_ENUM(NSInteger, KBSexOption) {
|
||||
- (UIButton *)skipButton {
|
||||
if (!_skipButton) {
|
||||
_skipButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_skipButton setTitle:@"Skip" forState:UIControlStateNormal];
|
||||
[_skipButton setTitle:KBLocalized(@"Skip") forState:UIControlStateNormal];
|
||||
[_skipButton setTitleColor:[UIColor colorWithHex:KBBlackValue] forState:UIControlStateNormal];
|
||||
_skipButton.titleLabel.font = [KBFont medium:12];
|
||||
_skipButton.backgroundColor = [UIColor colorWithHex:0xE9F7F4];
|
||||
@@ -341,7 +341,7 @@ typedef NS_ENUM(NSInteger, KBSexOption) {
|
||||
- (UILabel *)maleLabel {
|
||||
if (!_maleLabel) {
|
||||
_maleLabel = [UILabel new];
|
||||
_maleLabel.text = @"Male";
|
||||
_maleLabel.text = KBLocalized(@"Male");
|
||||
_maleLabel.font = [KBFont medium:20];
|
||||
_maleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
}
|
||||
@@ -369,7 +369,7 @@ typedef NS_ENUM(NSInteger, KBSexOption) {
|
||||
- (UILabel *)femaleLabel {
|
||||
if (!_femaleLabel) {
|
||||
_femaleLabel = [UILabel new];
|
||||
_femaleLabel.text = @"Female";
|
||||
_femaleLabel.text = KBLocalized(@"Female");
|
||||
_femaleLabel.font = [KBFont medium:20];
|
||||
_femaleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
}
|
||||
@@ -405,7 +405,7 @@ typedef NS_ENUM(NSInteger, KBSexOption) {
|
||||
- (UILabel *)otherLabel {
|
||||
if (!_otherLabel) {
|
||||
_otherLabel = [UILabel new];
|
||||
_otherLabel.text = @"The Third Gender";
|
||||
_otherLabel.text = KBLocalized(@"The Third Gender");
|
||||
_otherLabel.font = [KBFont medium:20];
|
||||
_otherLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
}
|
||||
@@ -415,7 +415,7 @@ typedef NS_ENUM(NSInteger, KBSexOption) {
|
||||
- (UIButton *)confirmButton {
|
||||
if (!_confirmButton) {
|
||||
_confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_confirmButton setTitle:@"Turn On The Keyboard" forState:UIControlStateNormal];
|
||||
[_confirmButton setTitle:KBLocalized(@"Turn On The Keyboard") forState:UIControlStateNormal];
|
||||
[_confirmButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_confirmButton.titleLabel.font = [KBFont bold:16];
|
||||
_confirmButton.backgroundColor = [UIColor blackColor];
|
||||
|
||||
@@ -133,13 +133,13 @@
|
||||
|
||||
- (void)defaultData {
|
||||
// 默认文案(使用英文,便于与示例图一致)
|
||||
self.titleLabel.text = @"Become A Member Of Love Key";
|
||||
self.subTitleLabel.text = @"Unlock All Functions";
|
||||
self.titleLabel.text = KBLocalized(@"Become A Member Of Love Key");
|
||||
self.subTitleLabel.text = KBLocalized(@"Unlock All Functions");
|
||||
|
||||
NSArray *titles = @[@"Wireless Sub-ai Dialogue",
|
||||
@"Personalized\nKeyboard",
|
||||
@"Chat\nPersona",
|
||||
@"Emotional\nCounseling"];
|
||||
NSArray *titles = @[KBLocalized(@"Wireless Sub-ai Dialogue"),
|
||||
KBLocalized(@"Personalized\nKeyboard"),
|
||||
KBLocalized(@"Chat\nPersona"),
|
||||
KBLocalized(@"Emotional\nCounseling")];
|
||||
NSArray *images = @[[UIImage imageNamed:@"home_ai_icon"],
|
||||
[UIImage imageNamed:@"home_keyboard_icon"],
|
||||
[UIImage imageNamed:@"home_chat_icon"],
|
||||
|
||||
@@ -45,12 +45,12 @@
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// self.title = KBLocalized(@"皮肤中心");
|
||||
// self.title = KBLocalized(@"Skin Center");
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.skins = @[
|
||||
@{
|
||||
@"id": @"local本地",
|
||||
@"name": KBLocalized(@"粉色皮肤"),
|
||||
@"name": KBLocalized(@"Pink skin"),
|
||||
// 关键:zip_url 写成 bundle:// 前缀 + 文件名
|
||||
@"zip_url": @"bundle://fense.zip",
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
},
|
||||
@{
|
||||
@"id": @"remote002",
|
||||
@"name": KBLocalized(@"远程皮肤"),
|
||||
@"name": KBLocalized(@"Remote skin"),
|
||||
// 关键:zip_url 写成 bundle:// 前缀 + 文件名
|
||||
@"zip_url": @"http://gx.zhukeping.com/download/Christmas.zip",
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
// 底部添加“恢复默认皮肤”测试按钮
|
||||
UIButton *reset = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[reset setTitle:KBLocalized(@"恢复默认皮肤") forState:UIControlStateNormal];
|
||||
[reset setTitle:KBLocalized(@"Restore default skin") forState:UIControlStateNormal];
|
||||
reset.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
||||
reset.layer.cornerRadius = 8.0;
|
||||
reset.layer.borderWidth = 1.0;
|
||||
@@ -138,14 +138,13 @@
|
||||
NSDictionary *skin = self.skins[idx];
|
||||
if (!skin) return;
|
||||
if (idx == 0) {
|
||||
// NSString *title = (indexPath.item < self.dataSource.count) ? self.dataSource[indexPath.item] : KBLocalized(@"专属皮肤002");
|
||||
// 将需求固定到 002.zip,本地写死皮肤 id,便于键盘扩展识别并解压。
|
||||
static NSString * const kKBBundleSkinId002 = @"bundle_skin_fense";
|
||||
[KBSkinInstallBridge publishBundleSkinRequestWithId:kKBBundleSkinId002
|
||||
name:@"" ?: kKBBundleSkinId002
|
||||
zipName:@"fense.zip"
|
||||
iconShortNames:nil];
|
||||
[KBHUD showInfo:KBLocalized(@"已通知键盘解压,切换到自定义键盘即可生效")];
|
||||
[KBHUD showInfo:KBLocalized(@"Keyboard has been notified to unzip. Switch to the custom keyboard to apply.")];
|
||||
}else if (idx == 1){
|
||||
[[KBSkinService shared] applySkinWithJSON:skin
|
||||
fromViewController:self
|
||||
@@ -161,7 +160,7 @@
|
||||
name:@"" ?: kKBBundleSkinId002
|
||||
zipName:@"Christmas.zip"
|
||||
iconShortNames:nil];
|
||||
[KBHUD showInfo:KBLocalized(@"已通知键盘解压,切换到自定义键盘即可生效")];
|
||||
[KBHUD showInfo:KBLocalized(@"Keyboard has been notified to unzip. Switch to the custom keyboard to apply.")];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
self.tableView.tableHeaderView = header;
|
||||
[self.view addSubview:self.tableView];
|
||||
|
||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"皮肤中心"), KBLocalized(@"苹果登录") ];
|
||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"Skin Center"), KBLocalized(@"Sign in with Apple") ];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{ [self.textView becomeFirstResponder]; });
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
- (void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
self.title = KBLocalized(@"Test");
|
||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"皮肤中心"), KBLocalized(@"苹果登录") ];
|
||||
self.items = @[ KBLocalized(@"home_item_lang_test"), KBLocalized(@"home_item_keyboard_permission"), KBLocalized(@"Skin Center"), KBLocalized(@"Sign in with Apple") ];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
}];
|
||||
} else {
|
||||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[btn setTitle:KBLocalized(@"需要 iOS13+ 才能使用 Apple 登录") forState:UIControlStateNormal];
|
||||
[btn setTitle:KBLocalized(@"Sign in with Apple requires iOS 13+") forState:UIControlStateNormal];
|
||||
btn.enabled = NO;
|
||||
btn.layer.cornerRadius = 8.0;
|
||||
btn.layer.borderWidth = 1.0;
|
||||
|
||||
@@ -304,8 +304,10 @@
|
||||
NSUInteger charIndex = [layoutManager characterIndexForGlyphAtIndex:glyphIndex];
|
||||
|
||||
NSString *lowerFull = textView.text.lowercaseString ?: @"";
|
||||
NSRange termsRange = [lowerFull rangeOfString:@"terms of service"];
|
||||
NSRange privacyRange = [lowerFull rangeOfString:@"privacy policy"];
|
||||
NSString *termsText = [KBLocalized(@"terms of service") lowercaseString];
|
||||
NSString *privacyText = [KBLocalized(@"privacy policy") lowercaseString];
|
||||
NSRange termsRange = [lowerFull rangeOfString:termsText];
|
||||
NSRange privacyRange = [lowerFull rangeOfString:privacyText];
|
||||
|
||||
BOOL hitTerms = (termsRange.location != NSNotFound && NSLocationInRange(charIndex, termsRange));
|
||||
BOOL hitPrivacy = (privacyRange.location != NSNotFound && NSLocationInRange(charIndex, privacyRange));
|
||||
@@ -513,9 +515,9 @@
|
||||
_agreementTextView.textContainerInset = UIEdgeInsetsZero;
|
||||
_agreementTextView.textContainer.lineFragmentPadding = 0;
|
||||
|
||||
NSString *fullText = @"By continuing, you agree to our terms of service and confirm that you have read our privacy policy";
|
||||
NSString *termsText = @"terms of service";
|
||||
NSString *privacyText = @"privacy policy";
|
||||
NSString *fullText = KBLocalized(@"By continuing, you agree to our terms of service and confirm that you have read our privacy policy");
|
||||
NSString *termsText = KBLocalized(@"terms of service");
|
||||
NSString *privacyText = KBLocalized(@"privacy policy");
|
||||
|
||||
NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
|
||||
paragraph.alignment = NSTextAlignmentCenter;
|
||||
|
||||
@@ -386,19 +386,17 @@
|
||||
NSUInteger charIndex = [layoutManager characterIndexForGlyphAtIndex:glyphIndex];
|
||||
|
||||
NSString *lowerFull = textView.text.lowercaseString ?: @"";
|
||||
NSRange termsRange = [lowerFull rangeOfString:@"terms of service"];
|
||||
NSRange privacyRange = [lowerFull rangeOfString:@"privacy policy"];
|
||||
NSString *termsText = [KBLocalized(@"terms of service") lowercaseString];
|
||||
NSString *privacyText = [KBLocalized(@"privacy policy") lowercaseString];
|
||||
NSRange termsRange = [lowerFull rangeOfString:termsText];
|
||||
NSRange privacyRange = [lowerFull rangeOfString:privacyText];
|
||||
|
||||
BOOL hitTerms = (termsRange.location != NSNotFound && NSLocationInRange(charIndex, termsRange));
|
||||
BOOL hitPrivacy = (privacyRange.location != NSNotFound && NSLocationInRange(charIndex, privacyRange));
|
||||
if (hitTerms || hitPrivacy) {
|
||||
KBLOG(@"tap policy in KBEmailRegistVC");
|
||||
// 后续可统一跳转到协议页
|
||||
if (hitTerms == true) {
|
||||
[KBHUD showInfo:@"hitTerms"];
|
||||
}else{
|
||||
[KBHUD showInfo:@"hitPrivacy"];
|
||||
}
|
||||
[KBHUD showInfo:KBLocalized(@"Open agreement")];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,9 +721,9 @@
|
||||
_agreementTextView.textContainerInset = UIEdgeInsetsZero;
|
||||
_agreementTextView.textContainer.lineFragmentPadding = 0;
|
||||
|
||||
NSString *fullText = @"By continuing, you agree to our terms of service and confirm that you have read our privacy policy";
|
||||
NSString *termsText = @"terms of service";
|
||||
NSString *privacyText = @"privacy policy";
|
||||
NSString *fullText = KBLocalized(@"By continuing, you agree to our terms of service and confirm that you have read our privacy policy");
|
||||
NSString *termsText = KBLocalized(@"terms of service");
|
||||
NSString *privacyText = KBLocalized(@"privacy policy");
|
||||
|
||||
NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
|
||||
paragraph.alignment = NSTextAlignmentCenter;
|
||||
|
||||
@@ -372,9 +372,9 @@
|
||||
_agreementTextView.textContainer.lineFragmentPadding = 0;
|
||||
|
||||
// 协议文案:terms of service / privacy policy 为纯黑色并可点击,其余为 #717171
|
||||
NSString *fullText = @"By continuing, you agree to our terms of service and confirm that you have read our privacy policy";
|
||||
NSString *termsText = @"terms of service";
|
||||
NSString *privacyText = @"privacy policy";
|
||||
NSString *fullText = KBLocalized(@"By continuing, you agree to our terms of service and confirm that you have read our privacy policy");
|
||||
NSString *termsText = KBLocalized(@"terms of service");
|
||||
NSString *privacyText = KBLocalized(@"privacy policy");
|
||||
|
||||
NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
|
||||
paragraph.alignment = NSTextAlignmentCenter; // 多行文本整体居中
|
||||
@@ -488,8 +488,10 @@
|
||||
NSUInteger charIndex = [layoutManager characterIndexForGlyphAtIndex:glyphIndex];
|
||||
|
||||
NSString *lowerFull = textView.text.lowercaseString ?: @"";
|
||||
NSRange termsRange = [lowerFull rangeOfString:@"terms of service"];
|
||||
NSRange privacyRange = [lowerFull rangeOfString:@"privacy policy"];
|
||||
NSString *termsText = [KBLocalized(@"terms of service") lowercaseString];
|
||||
NSString *privacyText = [KBLocalized(@"privacy policy") lowercaseString];
|
||||
NSRange termsRange = [lowerFull rangeOfString:termsText];
|
||||
NSRange privacyRange = [lowerFull rangeOfString:privacyText];
|
||||
|
||||
BOOL hitTerms = (termsRange.location != NSNotFound && NSLocationInRange(charIndex, termsRange));
|
||||
BOOL hitPrivacy = (privacyRange.location != NSNotFound && NSLocationInRange(charIndex, privacyRange));
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
- (UIButton *)compatHintButton {
|
||||
if (!_compatHintButton) {
|
||||
_compatHintButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[_compatHintButton setTitle:KBLocalized(@"需要 iOS13+ 才能使用 Apple 登录") forState:UIControlStateNormal];
|
||||
[_compatHintButton setTitle:KBLocalized(@"Sign in with Apple requires iOS 13+") forState:UIControlStateNormal];
|
||||
_compatHintButton.enabled = NO;
|
||||
}
|
||||
return _compatHintButton;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
if (mode == KBSkinSourceModeResetToDefault) {
|
||||
[[KBSkinManager shared] resetToDefault];
|
||||
if (completion) completion(YES);
|
||||
[KBHUD showInfo:KBLocalized(@"已恢复默认键盘皮肤")];
|
||||
[KBHUD showInfo:KBLocalized(@"Default keyboard skin restored")];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
// [perm presentPermissionIfNeededFrom:presenting];
|
||||
//
|
||||
// // 简单提示:皮肤可以应用,但未开启完全访问时扩展无法读取 App Group 中的图片。
|
||||
// [KBHUD showInfo:KBLocalized(@"皮肤已应用,键盘需开启“允许完全访问”后才能显示图片")];
|
||||
// }
|
||||
|
||||
switch (mode) {
|
||||
@@ -106,9 +105,9 @@
|
||||
message = KBLocalized(@"Applied. Switch to the keyboard to view.");
|
||||
} else if ([error.domain isEqualToString:KBSkinBridgeErrorDomain] &&
|
||||
error.code == KBSkinBridgeErrorContainerUnavailable) {
|
||||
message = KBLocalized(@"无法访问共享容器,应用皮肤失败");
|
||||
message = KBLocalized(@"Unable to access shared container, failed to apply skin");
|
||||
} else {
|
||||
message = KBLocalized(@"应用皮肤失败");
|
||||
message = KBLocalized(@"Failed to apply skin");
|
||||
}
|
||||
[KBHUD showInfo:message];
|
||||
}];
|
||||
@@ -132,7 +131,7 @@
|
||||
NSURL *containerURL = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:AppGroup];
|
||||
if (!containerURL) {
|
||||
if (completion) completion(NO);
|
||||
[KBHUD showInfo:KBLocalized(@"无法访问共享容器,应用皮肤失败")];
|
||||
[KBHUD showInfo:KBLocalized(@"Unable to access shared container, failed to apply skin")];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
|
||||
- (void)config:(NSString *)title {
|
||||
self.titleLabel.text = title ?: @"Recommended Skin";
|
||||
self.titleLabel.text = title ?: KBLocalized(@"Recommended Skin");
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
@@ -29,7 +29,7 @@
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.textColor = [UIColor colorWithHex:0x1B1F1A];
|
||||
_titleLabel.font = [KBFont medium:14];
|
||||
_titleLabel.text = @"Recommended Skin";
|
||||
_titleLabel.text = KBLocalized(@"Recommended Skin");
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ static NSString * const kMySkinCellId = @"kMySkinCellId";
|
||||
[self.collectionView kb_makeDefaultEmptyViewWithImage:nil
|
||||
title:KBLocalized(@"No data")
|
||||
detail:KBLocalized(@"Pull down to refresh")
|
||||
buttonTitle:KBLocalized(@"")
|
||||
buttonTitle:@""
|
||||
tapHandler:nil
|
||||
buttonHandler:^{ [weakSelf.collectionView.mj_header beginRefreshing]; }];
|
||||
[self.collectionView kb_setLYAutoShowEnabled:NO]; // 采用手动控制显隐
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
}
|
||||
|
||||
- (void)configTitle:(NSString *)title price:(NSString *)price strike:(nullable NSString *)strike {
|
||||
self.titleLabel.text = title.length ? title : @"Monthly Subscription";
|
||||
self.titleLabel.text = title.length ? title : KBLocalized(@"Monthly Subscription");
|
||||
self.priceLabel.text = price.length ? price : @"$4.49";
|
||||
self.strikeLabel.hidden = (strike.length == 0);
|
||||
if (strike.length) {
|
||||
@@ -115,7 +115,7 @@
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = @"Monthly Subscription";
|
||||
_titleLabel.text = KBLocalized(@"Monthly Subscription");
|
||||
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_titleLabel.font = [KBFont medium:13];
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
|
||||
- (UIButton *)agreementButton {
|
||||
if (!_agreementButton) {
|
||||
_agreementButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_agreementButton setTitle:KBLocalized(@"《Embership Agreement》") forState:UIControlStateNormal];
|
||||
[_agreementButton setTitle:KBLocalized(@"Membership Agreement") forState:UIControlStateNormal];
|
||||
[_agreementButton setTitleColor:[UIColor colorWithHex:KBColorValue] forState:UIControlStateNormal];
|
||||
// _agreementButton.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightSemibold];
|
||||
_agreementButton.titleLabel.font = [KBFont regular:12];
|
||||
|
||||
@@ -425,7 +425,7 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
- (UILabel *)agreementLabel {
|
||||
if (!_agreementLabel) {
|
||||
_agreementLabel = [UILabel new];
|
||||
_agreementLabel.text = KBLocalized(@"By Clicking \"pay\", You Indicate Your Agreement To The");
|
||||
_agreementLabel.text = KBLocalized(@"By clicking Pay, you indicate your agreement to the");
|
||||
_agreementLabel.font = [KBFont regular:12];
|
||||
_agreementLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
}
|
||||
@@ -435,7 +435,7 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
- (UIButton *)agreementButton {
|
||||
if (!_agreementButton) {
|
||||
_agreementButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_agreementButton setTitle:KBLocalized(@"《Embership Agreement》") forState:UIControlStateNormal];
|
||||
[_agreementButton setTitle:KBLocalized(@"Membership Agreement") forState:UIControlStateNormal];
|
||||
[_agreementButton setTitleColor:[UIColor colorWithHex:KBColorValue] forState:UIControlStateNormal];
|
||||
_agreementButton.titleLabel.font = [KBFont regular:12];
|
||||
[_agreementButton addTarget:self action:@selector(onTapAgreementButton) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
@@ -69,9 +69,9 @@ static NSString * const kKBSvipBenefitHeaderId = @"kKBSvipBenefitHeaderId";
|
||||
// 权益列表数据(使用现有图标资源)
|
||||
self.benefits = @[
|
||||
@{@"icon": @"pay_ais_icon", @"title": KBLocalized(@"Wireless Sub-ai Dialogue")},
|
||||
@{@"icon": @"pay_keyboards_icon", @"title": KBLocalized(@"Personalized Keyboard")},
|
||||
@{@"icon": @"pay_person_icon", @"title": KBLocalized(@"Chat Persona")},
|
||||
@{@"icon": @"pay_phone_icon", @"title": KBLocalized(@"Emotional Counseling")},
|
||||
@{@"icon": @"pay_keyboards_icon", @"title": KBLocalized(@"Personalized\nKeyboard")},
|
||||
@{@"icon": @"pay_person_icon", @"title": KBLocalized(@"Chat\nPersona")},
|
||||
@{@"icon": @"pay_phone_icon", @"title": KBLocalized(@"Emotional\nCounseling")},
|
||||
@{@"icon": @"pay_history_icon", @"title": KBLocalized(@"Longer Chat History")},
|
||||
@{@"icon": @"pay_chats_icon", @"title": KBLocalized(@"Unlimited Chatting")},
|
||||
@{@"icon": @"pay_speed_icon", @"title": KBLocalized(@"Chat Without Speed Limits")},
|
||||
|
||||
@@ -186,16 +186,6 @@
|
||||
KBSkinDetailVC *vc = [[KBSkinDetailVC alloc] init];
|
||||
vc.themeId = selTheme.themeId;
|
||||
[self.navigationController pushViewController:vc animated:true];
|
||||
return;
|
||||
KBShopThemeModel *theme = (indexPath.item < self.dataSource.count) ? self.dataSource[indexPath.item] : nil;
|
||||
NSString *title = theme.themeName.length ? theme.themeName : KBLocalized(@"专属皮肤002");
|
||||
// 将需求固定到 002.zip,本地写死皮肤 id,便于键盘扩展识别并解压。
|
||||
static NSString * const kKBBundleSkinId002 = @"bundle_skin_fense";
|
||||
[KBSkinInstallBridge publishBundleSkinRequestWithId:kKBBundleSkinId002
|
||||
name:title ?: kKBBundleSkinId002
|
||||
zipName:@"fense.zip"
|
||||
iconShortNames:nil];
|
||||
[KBHUD showInfo:KBLocalized(@"已通知键盘解压,切换到自定义键盘即可生效")];
|
||||
}
|
||||
|
||||
- (void)setStyle:(KBShopStyleModel *)style {
|
||||
|
||||
@@ -105,7 +105,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
}
|
||||
case KBSkinDetailSectionTitle: {
|
||||
KBSkinSectionTitleCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kSectionTitleCellId forIndexPath:indexPath];
|
||||
[cell config:@"Recommended Skin"];
|
||||
[cell config:KBLocalized(@"Recommended Skin")];
|
||||
return cell;
|
||||
}
|
||||
case KBSkinDetailSectionGrid: {
|
||||
@@ -248,11 +248,11 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
- (void)handleDownloadAction {
|
||||
// if (self.isProcessingAction) { return; }
|
||||
if (self.themeId.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"主题信息缺失")];
|
||||
[KBHUD showInfo:KBLocalized(@"Theme information missing")];
|
||||
return;
|
||||
}
|
||||
if (!self.detailModel) {
|
||||
[KBHUD showInfo:KBLocalized(@"正在加载主题详情")];
|
||||
[KBHUD showInfo:KBLocalized(@"Loading theme details")];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
// weakSelf.isProcessingAction = NO;
|
||||
[KBHUD dismiss];
|
||||
if (error || !success) {
|
||||
NSString *msg = error.localizedDescription ?: KBLocalized(@"购买失败");
|
||||
NSString *msg = error.localizedDescription ?: KBLocalized(@"Purchase failed");
|
||||
[KBHUD showInfo:msg];
|
||||
return;
|
||||
}
|
||||
@@ -310,7 +310,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
NSString *zipURL = [skin[@"zip_url"] isKindOfClass:NSString.class] ? skin[@"zip_url"] : @"";
|
||||
if (skin.count == 0 || zipURL.length == 0) {
|
||||
[KBHUD dismiss];
|
||||
[KBHUD showInfo:KBLocalized(@"下载信息缺失")];
|
||||
[KBHUD showInfo:KBLocalized(@"Download information missing")];
|
||||
return;
|
||||
}
|
||||
NSLog(@"⬇️[SkinDetail] download request id=%@ zip=%@ force=YES",
|
||||
@@ -329,7 +329,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
[strongSelf.shopVM restoreThemeWithId:themeId completion:nil];
|
||||
}
|
||||
} else {
|
||||
[KBHUD showInfo:KBLocalized(@"下载失败")];
|
||||
[KBHUD showInfo:KBLocalized(@"Download failed")];
|
||||
}
|
||||
}];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user