3
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#import "KBKeyBoardMainView.h"
|
||||
#import "KBKeyboardSubscriptionView.h"
|
||||
#import "KBLocalizationManager.h"
|
||||
#import "KBSettingView.h"
|
||||
#import "KBSkinManager.h"
|
||||
#import "KBSkinInstallBridge.h"
|
||||
#import "KBSuggestionEngine.h"
|
||||
@@ -296,10 +295,6 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
[_functionView removeFromSuperview];
|
||||
_functionView = nil;
|
||||
}
|
||||
if (_settingView) {
|
||||
[_settingView removeFromSuperview];
|
||||
_settingView = nil;
|
||||
}
|
||||
if (_subscriptionView) {
|
||||
[_subscriptionView removeFromSuperview];
|
||||
_subscriptionView = nil;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#import "KBKey.h"
|
||||
#import "KBKeyboardSubscriptionProduct.h"
|
||||
#import "KBKeyboardSubscriptionView.h"
|
||||
#import "KBSettingView.h"
|
||||
#import "KBChatMessage.h"
|
||||
#import "KBChatPanelView.h"
|
||||
#import "KBChatLimitPopView.h"
|
||||
@@ -79,7 +78,6 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
|
||||
*keyBoardMainView; // 功能面板视图(点击工具栏第0个时显示)
|
||||
@property(nonatomic, strong)
|
||||
KBFunctionView *functionView; // 功能面板视图(点击工具栏第0个时显示)
|
||||
@property(nonatomic, strong) KBSettingView *settingView; // 设置页
|
||||
@property(nonatomic, strong) UIImageView *bgImageView; // 背景图(在底层)
|
||||
@property(nonatomic, strong) KBChatPanelView *chatPanelView;
|
||||
@property(nonatomic, strong) KBKeyboardSubscriptionView *subscriptionView;
|
||||
@@ -539,68 +537,6 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
}
|
||||
}
|
||||
|
||||
/// 显示/隐藏设置页(高度与 keyBoardMainView 一致),右侧滑入/滑出
|
||||
- (void)showSettingView:(BOOL)show {
|
||||
if (show) {
|
||||
[self showChatPanel:NO];
|
||||
[[KBMaiPointReporter sharedReporter]
|
||||
reportPageExposureWithEventName:@"enter_keyboard_settings"
|
||||
pageId:@"keyboard_settings"
|
||||
extra:nil
|
||||
completion:nil];
|
||||
KBSettingView *settingView = self.settingView;
|
||||
if (!settingView.superview) {
|
||||
settingView.hidden = YES;
|
||||
[self.contentView addSubview:settingView];
|
||||
[settingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.contentView);
|
||||
}];
|
||||
[settingView.backButton addTarget:self
|
||||
action:@selector(onTapSettingsBack)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
[self.contentView bringSubviewToFront:settingView];
|
||||
// 以 keyBoardMainView 的实际宽度为准,避免首次添加时 self.view 宽度尚未计算
|
||||
[self.contentView layoutIfNeeded];
|
||||
CGFloat w = CGRectGetWidth(self.keyBoardMainView.bounds);
|
||||
if (w <= 0) {
|
||||
w = CGRectGetWidth(self.contentView.bounds);
|
||||
}
|
||||
if (w <= 0) {
|
||||
w = [self kb_portraitWidth];
|
||||
}
|
||||
settingView.transform = CGAffineTransformMakeTranslation(w, 0);
|
||||
settingView.hidden = NO;
|
||||
[UIView animateWithDuration:0.25
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseOut
|
||||
animations:^{
|
||||
settingView.transform = CGAffineTransformIdentity;
|
||||
}
|
||||
completion:nil];
|
||||
} else {
|
||||
KBSettingView *settingView = self.settingView;
|
||||
if (!settingView.superview || settingView.hidden)
|
||||
return;
|
||||
CGFloat w = CGRectGetWidth(self.keyBoardMainView.bounds);
|
||||
if (w <= 0) {
|
||||
w = CGRectGetWidth(self.contentView.bounds);
|
||||
}
|
||||
if (w <= 0) {
|
||||
w = [self kb_portraitWidth];
|
||||
}
|
||||
[UIView animateWithDuration:0.22
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseIn
|
||||
animations:^{
|
||||
settingView.transform = CGAffineTransformMakeTranslation(w, 0);
|
||||
}
|
||||
completion:^(BOOL finished) {
|
||||
settingView.hidden = YES;
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
/// 显示/隐藏聊天面板(覆盖整个键盘区域)
|
||||
- (void)showChatPanel:(BOOL)show {
|
||||
if (show == self.chatPanelVisible) {
|
||||
@@ -619,7 +555,6 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
_functionView.hidden = YES;
|
||||
}
|
||||
[self hideSubscriptionPanel];
|
||||
[self showSettingView:NO];
|
||||
[UIView animateWithDuration:0.2
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseOut
|
||||
@@ -748,10 +683,6 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
[_subscriptionView removeFromSuperview];
|
||||
_subscriptionView = nil;
|
||||
}
|
||||
if (_settingView) {
|
||||
[_settingView removeFromSuperview];
|
||||
_settingView = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showSubscriptionPanel {
|
||||
@@ -915,16 +846,6 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
[self showChatPanel:NO];
|
||||
}
|
||||
|
||||
- (void)keyBoardMainViewDidTapSettings:(KBKeyBoardMainView *)keyBoardMainView {
|
||||
[[KBMaiPointReporter sharedReporter]
|
||||
reportClickWithEventName:@"click_keyboard_settings_btn"
|
||||
pageId:@"keyboard_main_panel"
|
||||
elementId:@"settings_btn"
|
||||
extra:nil
|
||||
completion:nil];
|
||||
[self showSettingView:YES];
|
||||
}
|
||||
|
||||
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView
|
||||
didSelectEmoji:(NSString *)emoji {
|
||||
if (emoji.length == 0) {
|
||||
@@ -947,17 +868,6 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
[self kb_scheduleContextRefreshResetSuppression:YES];
|
||||
}
|
||||
|
||||
- (void)keyBoardMainViewDidTapEmojiSearch:
|
||||
(KBKeyBoardMainView *)keyBoardMainView {
|
||||
// [[KBMaiPointReporter sharedReporter]
|
||||
// reportClickWithEventName:@"click_keyboard_emoji_search_btn"
|
||||
// pageId:@"keyboard_main_panel"
|
||||
// elementId:@"emoji_search_btn"
|
||||
// extra:nil
|
||||
// completion:nil];
|
||||
[KBHUD showInfo:KBLocalized(@"Search coming soon")];
|
||||
}
|
||||
|
||||
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView
|
||||
didSelectSuggestion:(NSString *)suggestion {
|
||||
if (suggestion.length == 0) {
|
||||
@@ -1032,7 +942,7 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
return;
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[KBHUD showInfo:@"当前应用不允许键盘直接唤起App,请回到桌面手动打开App进行充值"];
|
||||
[KBHUD showInfo:KBLocalized(@"This app does not allow the keyboard to open the main app directly. Please return to the Home screen and open the app manually to recharge")];
|
||||
});
|
||||
}];
|
||||
}
|
||||
@@ -1745,13 +1655,6 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
return _functionView;
|
||||
}
|
||||
|
||||
- (KBSettingView *)settingView {
|
||||
if (!_settingView) {
|
||||
_settingView = [[KBSettingView alloc] init];
|
||||
}
|
||||
return _settingView;
|
||||
}
|
||||
|
||||
- (KBChatPanelView *)chatPanelView {
|
||||
if (!_chatPanelView) {
|
||||
NSLog(@"[Keyboard] ⚠️ chatPanelView 被创建!");
|
||||
@@ -1831,16 +1734,6 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
?: @"";
|
||||
}
|
||||
|
||||
- (void)onTapSettingsBack {
|
||||
[[KBMaiPointReporter sharedReporter]
|
||||
reportClickWithEventName:@"click_keyboard_settings_back_btn"
|
||||
pageId:@"keyboard_settings"
|
||||
elementId:@"back_btn"
|
||||
extra:nil
|
||||
completion:nil];
|
||||
[self showSettingView:NO];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
if (self.kb_fullAccessObserverToken) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
@@ -2187,15 +2080,14 @@ static NSString *KBFormatMB(uint64_t bytes) {
|
||||
NSLog(@"[Keyboard] skin request failed: %@",
|
||||
error);
|
||||
[KBHUD
|
||||
showInfo:
|
||||
KBLocalized(
|
||||
@"皮肤资源准备失败,请稍后再试")];
|
||||
showInfo:KBLocalized(
|
||||
@"Theme resource preparation failed, please try again later")];
|
||||
}
|
||||
return;
|
||||
}
|
||||
[weakSelf kb_applyTheme];
|
||||
[KBHUD showInfo:KBLocalized(
|
||||
@"皮肤已更新,立即体验吧")];
|
||||
@"Theme updated, try it now")];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#import "KBKey.h"
|
||||
#import "KBKeyBoardMainView.h"
|
||||
#import "KBKeyboardSubscriptionView.h"
|
||||
#import "KBSettingView.h"
|
||||
#import "Masonry.h"
|
||||
#import <SDWebImage/SDWebImage.h>
|
||||
#import <AVFoundation/AVAudioPlayer.h>
|
||||
@@ -81,7 +80,6 @@
|
||||
|
||||
// 1) 先收起所有面板(再展开目标面板),避免互相调用导致漏关/层级错乱
|
||||
[self kb_setSubscriptionPanelVisible:NO animated:animated];
|
||||
[self kb_setSettingViewVisible:NO animated:animated];
|
||||
[self kb_setChatPanelVisible:NO animated:animated];
|
||||
[self kb_setFunctionPanelVisible:NO];
|
||||
|
||||
@@ -93,9 +91,6 @@
|
||||
case KBKeyboardPanelModeChat:
|
||||
[self kb_setChatPanelVisible:YES animated:animated];
|
||||
break;
|
||||
case KBKeyboardPanelModeSettings:
|
||||
[self kb_setSettingViewVisible:YES animated:animated];
|
||||
break;
|
||||
case KBKeyboardPanelModeSubscription:
|
||||
[self kb_setSubscriptionPanelVisible:YES animated:animated];
|
||||
break;
|
||||
@@ -118,12 +113,6 @@
|
||||
pageId:@"keyboard_main_panel"
|
||||
extra:nil
|
||||
completion:nil];
|
||||
} else if (mode == KBKeyboardPanelModeSettings) {
|
||||
[[KBMaiPointReporter sharedReporter]
|
||||
reportPageExposureWithEventName:@"enter_keyboard_settings"
|
||||
pageId:@"keyboard_settings"
|
||||
extra:nil
|
||||
completion:nil];
|
||||
} else if (mode == KBKeyboardPanelModeSubscription) {
|
||||
[[KBMaiPointReporter sharedReporter]
|
||||
reportPageExposureWithEventName:@"enter_keyboard_subscription_panel"
|
||||
@@ -135,8 +124,6 @@
|
||||
// 4) 层级:保证当前面板在最上层
|
||||
if (mode == KBKeyboardPanelModeSubscription) {
|
||||
[self.contentView bringSubviewToFront:self.subscriptionView];
|
||||
} else if (mode == KBKeyboardPanelModeSettings) {
|
||||
[self.contentView bringSubviewToFront:self.settingView];
|
||||
} else if (mode == KBKeyboardPanelModeChat) {
|
||||
[self.contentView bringSubviewToFront:self.chatPanelView];
|
||||
} else if (mode == KBKeyboardPanelModeFunction) {
|
||||
@@ -157,17 +144,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// 对外兼容:显示/隐藏设置页(高度与 keyBoardMainView 一致),右侧滑入/滑出
|
||||
- (void)showSettingView:(BOOL)show {
|
||||
if (show) {
|
||||
[self kb_setPanelMode:KBKeyboardPanelModeSettings animated:YES];
|
||||
return;
|
||||
}
|
||||
if (self.kb_panelMode == KBKeyboardPanelModeSettings) {
|
||||
[self kb_setPanelMode:KBKeyboardPanelModeMain animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
/// 对外兼容:显示/隐藏聊天面板(覆盖整个键盘区域)
|
||||
- (void)showChatPanel:(BOOL)show {
|
||||
if (show) {
|
||||
@@ -241,74 +217,6 @@
|
||||
[self kb_updateKeyboardLayoutIfNeeded];
|
||||
}
|
||||
|
||||
- (void)kb_setSettingViewVisible:(BOOL)visible animated:(BOOL)animated {
|
||||
if (visible) {
|
||||
KBSettingView *settingView = self.settingView;
|
||||
if (!settingView.superview) {
|
||||
settingView.hidden = YES;
|
||||
[self.contentView addSubview:settingView];
|
||||
[settingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.contentView);
|
||||
}];
|
||||
[settingView.backButton addTarget:self
|
||||
action:@selector(onTapSettingsBack)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
[self.contentView bringSubviewToFront:settingView];
|
||||
// 以 keyBoardMainView 的实际宽度为准,避免首次添加时 self.view 宽度尚未计算
|
||||
[self.contentView layoutIfNeeded];
|
||||
CGFloat w = CGRectGetWidth(self.keyBoardMainView.bounds);
|
||||
if (w <= 0) {
|
||||
w = CGRectGetWidth(self.contentView.bounds);
|
||||
}
|
||||
if (w <= 0) {
|
||||
w = [self kb_portraitWidth];
|
||||
}
|
||||
settingView.transform = CGAffineTransformMakeTranslation(w, 0);
|
||||
settingView.hidden = NO;
|
||||
if (animated) {
|
||||
[UIView animateWithDuration:0.25
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseOut
|
||||
animations:^{
|
||||
settingView.transform = CGAffineTransformIdentity;
|
||||
}
|
||||
completion:nil];
|
||||
} else {
|
||||
settingView.transform = CGAffineTransformIdentity;
|
||||
}
|
||||
} else {
|
||||
KBSettingView *settingView = _settingView;
|
||||
if (!settingView) {
|
||||
return;
|
||||
}
|
||||
if (!settingView.superview || settingView.hidden) {
|
||||
return;
|
||||
}
|
||||
CGFloat w = CGRectGetWidth(self.keyBoardMainView.bounds);
|
||||
if (w <= 0) {
|
||||
w = CGRectGetWidth(self.contentView.bounds);
|
||||
}
|
||||
if (w <= 0) {
|
||||
w = [self kb_portraitWidth];
|
||||
}
|
||||
if (animated) {
|
||||
[UIView animateWithDuration:0.22
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseIn
|
||||
animations:^{
|
||||
settingView.transform = CGAffineTransformMakeTranslation(w, 0);
|
||||
}
|
||||
completion:^(BOOL finished) {
|
||||
settingView.hidden = YES;
|
||||
}];
|
||||
} else {
|
||||
settingView.transform = CGAffineTransformMakeTranslation(w, 0);
|
||||
settingView.hidden = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)kb_setSubscriptionPanelVisible:(BOOL)visible animated:(BOOL)animated {
|
||||
if (visible) {
|
||||
KBKeyboardSubscriptionView *panel = self.subscriptionView;
|
||||
@@ -478,10 +386,6 @@
|
||||
[_subscriptionView removeFromSuperview];
|
||||
_subscriptionView = nil;
|
||||
}
|
||||
if (_settingView) {
|
||||
[_settingView removeFromSuperview];
|
||||
_settingView = nil;
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - KBKeyBoardMainViewDelegate
|
||||
@@ -564,16 +468,6 @@
|
||||
[self kb_setPanelMode:KBKeyboardPanelModeMain animated:YES];
|
||||
}
|
||||
|
||||
- (void)keyBoardMainViewDidTapSettings:(KBKeyBoardMainView *)keyBoardMainView {
|
||||
[[KBMaiPointReporter sharedReporter]
|
||||
reportClickWithEventName:@"click_keyboard_settings_btn"
|
||||
pageId:@"keyboard_main_panel"
|
||||
elementId:@"settings_btn"
|
||||
extra:nil
|
||||
completion:nil];
|
||||
[self kb_setPanelMode:KBKeyboardPanelModeSettings animated:YES];
|
||||
}
|
||||
|
||||
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView
|
||||
didSelectEmoji:(NSString *)emoji {
|
||||
if (emoji.length == 0) {
|
||||
@@ -596,17 +490,6 @@
|
||||
[self kb_scheduleContextRefreshResetSuppression:YES];
|
||||
}
|
||||
|
||||
- (void)keyBoardMainViewDidTapEmojiSearch:
|
||||
(KBKeyBoardMainView *)keyBoardMainView {
|
||||
// [[KBMaiPointReporter sharedReporter]
|
||||
// reportClickWithEventName:@"click_keyboard_emoji_search_btn"
|
||||
// pageId:@"keyboard_main_panel"
|
||||
// elementId:@"emoji_search_btn"
|
||||
// extra:nil
|
||||
// completion:nil];
|
||||
[KBHUD showInfo:KBLocalized(@"Search coming soon")];
|
||||
}
|
||||
|
||||
// MARK: - KBFunctionViewDelegate
|
||||
|
||||
- (void)functionView:(KBFunctionView *)functionView
|
||||
@@ -650,7 +533,7 @@
|
||||
return;
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[KBHUD showInfo:@"当前应用不允许键盘直接唤起App,请回到桌面手动打开App进行充值"];
|
||||
[KBHUD showInfo:KBLocalized(@"This app does not allow the keyboard to open the main app directly. Please return to the Home screen and open the app manually to recharge")];
|
||||
});
|
||||
}];
|
||||
}
|
||||
@@ -659,16 +542,4 @@
|
||||
[self showSubscriptionPanel];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (void)onTapSettingsBack {
|
||||
[[KBMaiPointReporter sharedReporter]
|
||||
reportClickWithEventName:@"click_keyboard_settings_back_btn"
|
||||
pageId:@"keyboard_settings"
|
||||
elementId:@"back_btn"
|
||||
extra:nil
|
||||
completion:nil];
|
||||
[self kb_setPanelMode:KBKeyboardPanelModeMain animated:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
@class KBFunctionView;
|
||||
@class KBKeyBoardMainView;
|
||||
@class KBKeyboardSubscriptionView;
|
||||
@class KBSettingView;
|
||||
@class KBSuggestionEngine;
|
||||
|
||||
@protocol KBChatLimitPopViewDelegate;
|
||||
@@ -28,7 +27,6 @@ typedef NS_ENUM(NSInteger, KBKeyboardPanelMode) {
|
||||
KBKeyboardPanelModeMain = 0,
|
||||
KBKeyboardPanelModeFunction,
|
||||
KBKeyboardPanelModeChat,
|
||||
KBKeyboardPanelModeSettings,
|
||||
KBKeyboardPanelModeSubscription,
|
||||
};
|
||||
|
||||
@@ -42,7 +40,6 @@ typedef NS_ENUM(NSInteger, KBKeyboardPanelMode) {
|
||||
UIView *_contentView;
|
||||
KBKeyBoardMainView *_keyBoardMainView;
|
||||
KBFunctionView *_functionView;
|
||||
KBSettingView *_settingView;
|
||||
UIImageView *_bgImageView;
|
||||
KBChatPanelView *_chatPanelView;
|
||||
KBKeyboardSubscriptionView *_subscriptionView;
|
||||
@@ -79,7 +76,6 @@ typedef NS_ENUM(NSInteger, KBKeyboardPanelMode) {
|
||||
*keyBoardMainView; // 功能面板视图(点击工具栏第0个时显示)
|
||||
@property(nonatomic, strong)
|
||||
KBFunctionView *functionView; // 功能面板视图(点击工具栏第0个时显示)
|
||||
@property(nonatomic, strong) KBSettingView *settingView; // 设置页
|
||||
@property(nonatomic, strong) UIImageView *bgImageView; // 背景图(在底层)
|
||||
@property(nonatomic, strong) KBChatPanelView *chatPanelView;
|
||||
@property(nonatomic, strong) KBKeyboardSubscriptionView *subscriptionView;
|
||||
@@ -119,7 +115,6 @@ typedef NS_ENUM(NSInteger, KBKeyboardPanelMode) {
|
||||
|
||||
// Panels
|
||||
- (void)showFunctionPanel:(BOOL)show;
|
||||
- (void)showSettingView:(BOOL)show;
|
||||
- (void)showChatPanel:(BOOL)show;
|
||||
- (void)showSubscriptionPanel;
|
||||
- (void)hideSubscriptionPanel;
|
||||
|
||||
@@ -322,15 +322,14 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
|
||||
NSLog(@"[Keyboard] skin request failed: %@",
|
||||
error);
|
||||
[KBHUD
|
||||
showInfo:
|
||||
KBLocalized(
|
||||
@"皮肤资源准备失败,请稍后再试")];
|
||||
showInfo:KBLocalized(
|
||||
@"Theme resource preparation failed, please try again later")];
|
||||
}
|
||||
return;
|
||||
}
|
||||
[weakSelf kb_applyTheme];
|
||||
[KBHUD showInfo:KBLocalized(
|
||||
@"皮肤已更新,立即体验吧")];
|
||||
@"Theme updated, try it now")];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#import "KBFunctionView.h"
|
||||
#import "KBKeyBoardMainView.h"
|
||||
#import "KBKeyboardSubscriptionView.h"
|
||||
#import "KBSettingView.h"
|
||||
#import "Masonry.h"
|
||||
|
||||
@implementation KeyboardViewController (UI)
|
||||
@@ -115,13 +114,6 @@
|
||||
return _functionView;
|
||||
}
|
||||
|
||||
- (KBSettingView *)settingView {
|
||||
if (!_settingView) {
|
||||
_settingView = [[KBSettingView alloc] init];
|
||||
}
|
||||
return _settingView;
|
||||
}
|
||||
|
||||
- (KBChatPanelView *)chatPanelView {
|
||||
if (!_chatPanelView) {
|
||||
NSLog(@"[Keyboard] ⚠️ chatPanelView 被创建!");
|
||||
|
||||
@@ -34,10 +34,8 @@
|
||||
// 说明:
|
||||
// - `extensionContext openURL:` 是 Apple 官方推荐方式,但部分宿主 App(尤其是“B 类应用”)
|
||||
// 可能会拦截该调用,导致无法直接唤起容器 App;
|
||||
// - 行业内不少键盘会加“响应链 openURL”兜底来提升唤起成功率,但该方式存在上架审核风险。
|
||||
// 如你要走更稳妥的上架策略:把该宏改为 0(仅保留 extensionContext 方案)。
|
||||
#ifndef KB_URL_BRIDGE_ENABLE
|
||||
// 上架建议:Release 关闭“响应链 openURL”兜底,避免审核风险。
|
||||
#if DEBUG
|
||||
#define KB_URL_BRIDGE_ENABLE 1
|
||||
#else
|
||||
|
||||
@@ -8,6 +8,19 @@
|
||||
<array/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeUserID</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeOtherUserContent</string>
|
||||
@@ -20,6 +33,18 @@
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeProductInteraction</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
if (completion) {
|
||||
KBChatResponse *response = [[KBChatResponse alloc] init];
|
||||
response.success = NO;
|
||||
response.message = @"内容为空";
|
||||
response.message = KBLocalized(@"Content is empty");
|
||||
completion(response);
|
||||
}
|
||||
return;
|
||||
@@ -101,7 +101,7 @@
|
||||
if (completion) {
|
||||
KBAudioResponse *response = [[KBAudioResponse alloc] init];
|
||||
response.success = NO;
|
||||
response.errorMessage = @"audioId 为空";
|
||||
response.errorMessage = KBLocalized(@"audioId is empty");
|
||||
completion(response);
|
||||
}
|
||||
return;
|
||||
@@ -171,7 +171,7 @@
|
||||
// 达到最大重试次数
|
||||
KBAudioResponse *failResponse = [[KBAudioResponse alloc] init];
|
||||
failResponse.success = NO;
|
||||
failResponse.errorMessage = [NSString stringWithFormat:@"轮询失败,已重试 %ld 次", (long)maxRetries];
|
||||
failResponse.errorMessage = [NSString stringWithFormat:KBLocalized(@"Polling failed after %ld retries"), (long)maxRetries];
|
||||
if (completion) completion(failResponse);
|
||||
}
|
||||
}];
|
||||
@@ -183,7 +183,7 @@
|
||||
if (completion) {
|
||||
KBAudioResponse *response = [[KBAudioResponse alloc] init];
|
||||
response.success = NO;
|
||||
response.errorMessage = @"URL 为空";
|
||||
response.errorMessage = KBLocalized(@"URL is empty");
|
||||
completion(response);
|
||||
}
|
||||
return;
|
||||
@@ -198,7 +198,7 @@
|
||||
|
||||
if (error || !data || data.length == 0) {
|
||||
audioResponse.success = NO;
|
||||
audioResponse.errorMessage = error.localizedDescription ?: @"下载失败";
|
||||
audioResponse.errorMessage = error.localizedDescription ?: KBLocalized(@"Download failed");
|
||||
if (completion) completion(audioResponse);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol KBEmojiPanelViewDelegate <NSObject>
|
||||
- (void)emojiPanelView:(KBEmojiPanelView *)panel didSelectEmoji:(NSString *)emoji;
|
||||
- (void)emojiPanelViewDidRequestClose:(KBEmojiPanelView *)panel;
|
||||
- (void)emojiPanelViewDidTapSearch:(KBEmojiPanelView *)panel;
|
||||
@optional
|
||||
- (void)emojiPanelViewDidTapDelete:(KBEmojiPanelView *)panel;
|
||||
@end
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
@property (nonatomic, strong) UIButton *backButton;
|
||||
@property (nonatomic, strong) UICollectionView *collectionView;
|
||||
@property (nonatomic, strong) KBEmojiBottomBarView *bottomBar;
|
||||
//@property (nonatomic, strong) UIButton *searchButton;
|
||||
@property (nonatomic, strong) NSArray<UIButton *> *tabButtons;
|
||||
@property (nonatomic, strong) KBEmojiDataProvider *dataProvider;
|
||||
@property (nonatomic, copy) NSArray<KBEmojiCategory *> *categories;
|
||||
@@ -100,14 +99,6 @@
|
||||
[self addSubview:self.bottomBar];
|
||||
[self.bottomBar.deleteButton addTarget:self action:@selector(onDelete) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
// self.searchButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
// self.searchButton.layer.cornerRadius = 20;
|
||||
// self.searchButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold];
|
||||
// [self.searchButton setTitle:KBLocalized(@"Search") forState:UIControlStateNormal];
|
||||
// [self.searchButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
// [self.searchButton addTarget:self action:@selector(onSearch) forControlEvents:UIControlEventTouchUpInside];
|
||||
// [self.bottomBar addSubview:self.searchButton];
|
||||
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.mas_left).offset(12);
|
||||
make.right.equalTo(self.mas_right).offset(-12);
|
||||
@@ -269,12 +260,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onSearch {
|
||||
if ([self.delegate respondsToSelector:@selector(emojiPanelViewDidTapSearch:)]) {
|
||||
[self.delegate emojiPanelViewDidTapSearch:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onDelete {
|
||||
if ([self.delegate respondsToSelector:@selector(emojiPanelViewDidTapDelete:)]) {
|
||||
[self.delegate emojiPanelViewDidTapDelete:self];
|
||||
@@ -303,7 +288,6 @@
|
||||
}
|
||||
|
||||
- (void)onLocalizationChanged {
|
||||
// [self.searchButton setTitle:KBLocalized(@"Search") forState:UIControlStateNormal];
|
||||
[self reloadData];
|
||||
}
|
||||
|
||||
@@ -314,8 +298,6 @@
|
||||
self.backgroundColor = bg;
|
||||
self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
self.titleLabel.textColor = theme.keyTextColor ?: [UIColor whiteColor];
|
||||
UIColor *searchColor = theme.accentColor ?: [UIColor colorWithRed:0.35 green:0.35 blue:0.95 alpha:1];
|
||||
// self.searchButton.backgroundColor = searchColor;
|
||||
self.tabNormalColor = [UIColor colorWithWhite:1 alpha:0.08];
|
||||
self.tabSelectedColor = theme.accentColor ?: [UIColor colorWithWhite:1 alpha:0.25];
|
||||
[self updateTabHighlightStates];
|
||||
|
||||
@@ -21,17 +21,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 需求:当 index == 0 时,由外部(KeyboardViewController)决定是否切换到功能面板
|
||||
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView didTapToolActionAtIndex:(NSInteger)index;
|
||||
|
||||
/// 点击了右侧设置按钮
|
||||
- (void)keyBoardMainViewDidTapSettings:(KBKeyBoardMainView *)keyBoardMainView;
|
||||
/// 点击了撤销删除按钮
|
||||
- (void)keyBoardMainViewDidTapUndo:(KBKeyBoardMainView *)keyBoardMainView;
|
||||
|
||||
/// emoji 视图里选择了一个表情
|
||||
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView didSelectEmoji:(NSString *)emoji;
|
||||
|
||||
/// emoji 面板点击搜索
|
||||
- (void)keyBoardMainViewDidTapEmojiSearch:(KBKeyBoardMainView *)keyBoardMainView;
|
||||
|
||||
/// 选择了联想词
|
||||
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView didSelectSuggestion:(NSString *)suggestion;
|
||||
@end
|
||||
|
||||
@@ -183,12 +183,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)toolBarDidTapSettings:(KBToolBar *)toolBar {
|
||||
if ([self.delegate respondsToSelector:@selector(keyBoardMainViewDidTapSettings:)]) {
|
||||
[self.delegate keyBoardMainViewDidTapSettings:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)toolBarDidTapUndo:(KBToolBar *)toolBar {
|
||||
if ([self.delegate respondsToSelector:@selector(keyBoardMainViewDidTapUndo:)]) {
|
||||
[self.delegate keyBoardMainViewDidTapUndo:self];
|
||||
@@ -261,12 +255,6 @@
|
||||
[self setEmojiPanelVisible:NO animated:YES];
|
||||
}
|
||||
|
||||
- (void)emojiPanelViewDidTapSearch:(KBEmojiPanelView *)panel {
|
||||
if ([self.delegate respondsToSelector:@selector(keyBoardMainViewDidTapEmojiSearch:)]) {
|
||||
[self.delegate keyBoardMainViewDidTapEmojiSearch:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)emojiPanelViewDidTapDelete:(KBEmojiPanelView *)panel {
|
||||
if ([self.delegate respondsToSelector:@selector(keyBoardMainView:didTapKey:)]) {
|
||||
KBKey *backspace = [KBKey keyWithTitle:@"" type:KBKeyTypeBackspace];
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
//
|
||||
// KBSettingView.h
|
||||
// CustomKeyboard
|
||||
//
|
||||
// 简单的设置页面:左上角返回箭头按钮 + 占位内容区域。
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface KBSettingView : UIView
|
||||
|
||||
/// 左上角返回按钮(外部添加 target 实现返回)
|
||||
@property (nonatomic, strong, readonly) UIButton *backButton;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
//
|
||||
// KBSettingView.m
|
||||
// CustomKeyboard
|
||||
//
|
||||
|
||||
#import "KBSettingView.h"
|
||||
#import "Masonry.h"
|
||||
|
||||
@interface KBSettingView ()
|
||||
@property (nonatomic, strong) UIButton *backButtonInternal;
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
@end
|
||||
|
||||
@implementation KBSettingView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
// 背景做成淡色,和主界面区分
|
||||
self.backgroundColor = [UIColor colorWithWhite:1 alpha:0.96];
|
||||
|
||||
[self addSubview:self.backButtonInternal];
|
||||
[self.backButtonInternal mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.mas_left).offset(10);
|
||||
make.top.equalTo(self.mas_top).offset(8);
|
||||
make.width.height.mas_equalTo(32);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.text = KBLocalized(@"Settings");
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
self.titleLabel.textColor = [UIColor blackColor];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.backButtonInternal.mas_centerY);
|
||||
make.centerX.equalTo(self.mas_centerX);
|
||||
}];
|
||||
|
||||
// 占位内容
|
||||
UILabel *place = [[UILabel alloc] init];
|
||||
place.text = KBLocalized(@"Settings content placeholder");
|
||||
place.textColor = [UIColor darkGrayColor];
|
||||
place.font = [UIFont systemFontOfSize:14];
|
||||
[self addSubview:place];
|
||||
[place mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.equalTo(self);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Lazy
|
||||
|
||||
- (UIButton *)backButtonInternal {
|
||||
if (!_backButtonInternal) {
|
||||
_backButtonInternal = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
_backButtonInternal.layer.cornerRadius = 16;
|
||||
_backButtonInternal.layer.masksToBounds = YES;
|
||||
_backButtonInternal.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1.0];
|
||||
[_backButtonInternal setTitle:@"←" forState:UIControlStateNormal]; // 返回箭头
|
||||
[_backButtonInternal setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
|
||||
_backButtonInternal.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
|
||||
}
|
||||
return _backButtonInternal;
|
||||
}
|
||||
|
||||
#pragma mark - Expose
|
||||
|
||||
- (UIButton *)backButton { return self.backButtonInternal; }
|
||||
|
||||
@end
|
||||
@@ -15,8 +15,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@optional
|
||||
/// 左侧功能按钮点击(index 从 0 开始)
|
||||
- (void)toolBar:(KBToolBar *)toolBar didTapActionAtIndex:(NSInteger)index;
|
||||
/// 右侧设置按钮点击
|
||||
- (void)toolBarDidTapSettings:(KBToolBar *)toolBar;
|
||||
/// 右侧撤销删除按钮点击
|
||||
- (void)toolBarDidTapUndo:(KBToolBar *)toolBar;
|
||||
@end
|
||||
@@ -31,7 +29,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 暴露按钮以便外部定制(只读;首次访问时懒加载创建)
|
||||
@property (nonatomic, strong, readonly) NSArray<UIButton *> *leftButtons;
|
||||
@property (nonatomic, strong, readonly) UIButton *settingsButton;
|
||||
@property (nonatomic, strong, readonly) UIButton *undoButton;
|
||||
|
||||
/// 应用皮肤(更新 AI 按钮背景图)
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
@interface KBToolBar ()
|
||||
@property (nonatomic, strong) UIView *leftContainer;
|
||||
@property (nonatomic, strong) NSArray<UIButton *> *leftButtonsInternal;
|
||||
//@property (nonatomic, strong) UIButton *settingsButtonInternal;
|
||||
@property (nonatomic, strong) UIButton *globeButtonInternal; // 可选:系统“切换输入法”键
|
||||
@property (nonatomic, strong) UIImageView *avatarImageView; // 右侧头像(AppGroup persona_cover.jpg)
|
||||
@property (nonatomic, strong) UIButton *undoButtonInternal; // 右侧撤销删除
|
||||
@@ -65,10 +64,6 @@
|
||||
return self.undoButtonInternal;
|
||||
}
|
||||
|
||||
//- (UIButton *)settingsButton {
|
||||
// return self.settingsButtonInternal;
|
||||
//}
|
||||
|
||||
- (void)setLeftButtonTitles:(NSArray<NSString *> *)leftButtonTitles {
|
||||
_leftButtonTitles = [leftButtonTitles copy];
|
||||
// Update titles if buttons already exist
|
||||
@@ -84,18 +79,10 @@
|
||||
|
||||
- (void)setupUI {
|
||||
[self addSubview:self.leftContainer];
|
||||
// [self addSubview:self.settingsButtonInternal];
|
||||
[self addSubview:self.globeButtonInternal];
|
||||
[self addSubview:self.undoButtonInternal];
|
||||
[self addSubview:self.avatarImageView];
|
||||
|
||||
// 右侧设置按钮
|
||||
// [self.settingsButtonInternal mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.right.equalTo(self.mas_right).offset(-12);
|
||||
// make.centerY.equalTo(self.mas_centerY);
|
||||
// make.width.height.mas_equalTo(32);
|
||||
// }];
|
||||
|
||||
// 左侧地球键(按需显示)
|
||||
[self.globeButtonInternal mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.mas_left).offset(12);
|
||||
@@ -313,12 +300,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onSettings {
|
||||
if ([self.delegate respondsToSelector:@selector(toolBarDidTapSettings:)]) {
|
||||
[self.delegate toolBarDidTapSettings:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onUndo {
|
||||
if ([self.delegate respondsToSelector:@selector(toolBarDidTapUndo:)]) {
|
||||
[self.delegate toolBarDidTapUndo:self];
|
||||
@@ -362,19 +343,6 @@
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
||||
//- (UIButton *)settingsButtonInternal {
|
||||
// if (!_settingsButtonInternal) {
|
||||
// _settingsButtonInternal = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
// _settingsButtonInternal.layer.cornerRadius = 16;
|
||||
// _settingsButtonInternal.layer.masksToBounds = YES;
|
||||
// _settingsButtonInternal.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9];
|
||||
// [_settingsButtonInternal setTitle:@"⚙︎" forState:UIControlStateNormal]; // 简单的齿轮符号
|
||||
// [_settingsButtonInternal setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
|
||||
// [_settingsButtonInternal addTarget:self action:@selector(onSettings) forControlEvents:UIControlEventTouchUpInside];
|
||||
// }
|
||||
// return _settingsButtonInternal;
|
||||
//}
|
||||
|
||||
- (UIButton *)globeButtonInternal {
|
||||
if (!_globeButtonInternal) {
|
||||
_globeButtonInternal = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
|
||||
Reference in New Issue
Block a user