Compare commits
23 Commits
2d5919016f
...
dev_修改键盘UI
| Author | SHA1 | Date | |
|---|---|---|---|
| 85dcd72a5d | |||
| 21fcbe3665 | |||
| 1b6724f043 | |||
| ef332ecaa1 | |||
| 3d6d673c0b | |||
| 674f09d5b6 | |||
| 11d8f78b1b | |||
| bbacef4ff7 | |||
| 8e692647d3 | |||
| 6f80f969a4 | |||
| bdf2a9af80 | |||
| e858d35722 | |||
| f2d5210313 | |||
| 1b0af3e2d6 | |||
| 0965cd3c7e | |||
| c3909d63da | |||
| 1096f24c57 | |||
| 7ed84fd445 | |||
| 4e2d7d2908 | |||
| 34089ddeea | |||
| 6ec98468de | |||
| ae37730da6 | |||
| 203f104ece |
@@ -5,12 +5,12 @@
|
|||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "切图 270@2x.png",
|
"filename" : "切图 271@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "切图 270@3x.png",
|
"filename" : "切图 271@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 11 KiB |
BIN
CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/切图 271@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/切图 271@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
@@ -4,15 +4,79 @@
|
|||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "light"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"filename" : "kb_del_icon@2x.png",
|
"filename" : "kb_del_icon@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "light"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filename" : "kb_del_icon@2x 1.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filename" : "切图 256@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"filename" : "kb_del_icon@3x.png",
|
"filename" : "kb_del_icon@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "light"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filename" : "kb_del_icon@3x 1.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filename" : "切图 256@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
|
|||||||
BIN
CustomKeyboard/KeyboardAssets.xcassets/kb_del_icon.imageset/kb_del_icon@2x 1.png
vendored
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
CustomKeyboard/KeyboardAssets.xcassets/kb_del_icon.imageset/kb_del_icon@3x 1.png
vendored
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
CustomKeyboard/KeyboardAssets.xcassets/kb_del_icon.imageset/切图 256@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 1008 B |
BIN
CustomKeyboard/KeyboardAssets.xcassets/kb_del_icon.imageset/切图 256@3x.png
vendored
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
96
CustomKeyboard/Model/KBKeyboardLayoutConfig.h
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
//
|
||||||
|
// KBKeyboardLayoutConfig.h
|
||||||
|
// CustomKeyboard
|
||||||
|
//
|
||||||
|
// 键盘布局配置模型(由 JSON 驱动)
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface KBKeyboardLayoutMetrics : NSObject
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *rowSpacing;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *topInset;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *bottomInset;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *keyHeight;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *edgeInset;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *gap;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *letterWidth;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *controlWidth;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *sendWidth;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *symbolsWideWidth;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *symbolsSideWidth;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface KBKeyboardLayoutFonts : NSObject
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *letter;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *digit;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *symbol;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *mode;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *space;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *send;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface KBKeyboardKeyDef : NSObject
|
||||||
|
@property (nonatomic, copy, nullable) NSString *type;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *title;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *selectedTitle;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *symbolName;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *selectedSymbolName;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *font;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *width;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *widthValue;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *backgroundColor;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface KBKeyboardRowItem : NSObject
|
||||||
|
@property (nonatomic, copy, nullable) NSString *itemId;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *width;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *widthValue;
|
||||||
|
+ (NSArray<KBKeyboardRowItem *> *)itemsFromRawArray:(NSArray *)raw;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface KBKeyboardRowSegments : NSObject
|
||||||
|
@property (nonatomic, strong, nullable) NSArray *left;
|
||||||
|
@property (nonatomic, strong, nullable) NSArray *center;
|
||||||
|
@property (nonatomic, strong, nullable) NSArray *right;
|
||||||
|
- (NSArray<KBKeyboardRowItem *> *)leftItems;
|
||||||
|
- (NSArray<KBKeyboardRowItem *> *)centerItems;
|
||||||
|
- (NSArray<KBKeyboardRowItem *> *)rightItems;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface KBKeyboardRowConfig : NSObject
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *height;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *insetLeft;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *insetRight;
|
||||||
|
@property (nonatomic, strong, nullable) NSNumber *gap;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *align;
|
||||||
|
@property (nonatomic, strong, nullable) NSArray *items;
|
||||||
|
@property (nonatomic, strong, nullable) KBKeyboardRowSegments *segments;
|
||||||
|
- (NSArray<KBKeyboardRowItem *> *)resolvedItems;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface KBKeyboardLayout : NSObject
|
||||||
|
@property (nonatomic, strong, nullable) NSArray<KBKeyboardRowConfig *> *rows;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface KBKeyboardLayoutConfig : NSObject
|
||||||
|
@property (nonatomic, assign) CGFloat designWidth;
|
||||||
|
@property (nonatomic, strong, nullable) KBKeyboardLayoutMetrics *metrics;
|
||||||
|
@property (nonatomic, strong, nullable) KBKeyboardLayoutFonts *fonts;
|
||||||
|
@property (nonatomic, copy, nullable) NSString *defaultKeyBackground;
|
||||||
|
@property (nonatomic, strong, nullable) NSDictionary<NSString *, KBKeyboardKeyDef *> *keyDefs;
|
||||||
|
@property (nonatomic, strong, nullable) NSDictionary<NSString *, KBKeyboardLayout *> *layouts;
|
||||||
|
|
||||||
|
+ (nullable instancetype)sharedConfig;
|
||||||
|
+ (nullable instancetype)configFromJSONData:(NSData *)data;
|
||||||
|
- (CGFloat)scaledValue:(CGFloat)designValue;
|
||||||
|
- (CGFloat)keyboardAreaDesignHeight;
|
||||||
|
- (CGFloat)keyboardAreaScaledHeight;
|
||||||
|
- (nullable KBKeyboardLayout *)layoutForName:(NSString *)name;
|
||||||
|
- (nullable KBKeyboardKeyDef *)keyDefForIdentifier:(NSString *)identifier;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
187
CustomKeyboard/Model/KBKeyboardLayoutConfig.m
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
//
|
||||||
|
// KBKeyboardLayoutConfig.m
|
||||||
|
// CustomKeyboard
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "KBKeyboardLayoutConfig.h"
|
||||||
|
#import <MJExtension/MJExtension.h>
|
||||||
|
#import "KBConfig.h"
|
||||||
|
|
||||||
|
static NSString * const kKBKeyboardLayoutConfigFileName = @"kb_keyboard_layout_config";
|
||||||
|
|
||||||
|
@implementation KBKeyboardLayoutMetrics
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation KBKeyboardLayoutFonts
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation KBKeyboardKeyDef
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation KBKeyboardRowItem
|
||||||
|
|
||||||
|
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
|
||||||
|
return @{ @"itemId": @"id" };
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSArray<KBKeyboardRowItem *> *)itemsFromRawArray:(NSArray *)raw {
|
||||||
|
if (![raw isKindOfClass:[NSArray class]] || raw.count == 0) {
|
||||||
|
return @[];
|
||||||
|
}
|
||||||
|
NSMutableArray<KBKeyboardRowItem *> *items = [NSMutableArray arrayWithCapacity:raw.count];
|
||||||
|
for (id obj in raw) {
|
||||||
|
if ([obj isKindOfClass:[NSString class]]) {
|
||||||
|
KBKeyboardRowItem *item = [KBKeyboardRowItem new];
|
||||||
|
item.itemId = (NSString *)obj;
|
||||||
|
[items addObject:item];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ([obj isKindOfClass:[NSDictionary class]]) {
|
||||||
|
KBKeyboardRowItem *item = [KBKeyboardRowItem mj_objectWithKeyValues:obj];
|
||||||
|
if (item.itemId.length == 0) {
|
||||||
|
NSString *fallback = ((NSDictionary *)obj)[@"id"];
|
||||||
|
if ([fallback isKindOfClass:[NSString class]]) {
|
||||||
|
item.itemId = fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item.itemId.length > 0) {
|
||||||
|
[items addObject:item];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return items.copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation KBKeyboardRowSegments
|
||||||
|
|
||||||
|
- (NSArray<KBKeyboardRowItem *> *)leftItems {
|
||||||
|
return [KBKeyboardRowItem itemsFromRawArray:self.left ?: @[]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray<KBKeyboardRowItem *> *)centerItems {
|
||||||
|
return [KBKeyboardRowItem itemsFromRawArray:self.center ?: @[]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray<KBKeyboardRowItem *> *)rightItems {
|
||||||
|
return [KBKeyboardRowItem itemsFromRawArray:self.right ?: @[]];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation KBKeyboardRowConfig
|
||||||
|
|
||||||
|
- (NSArray<KBKeyboardRowItem *> *)resolvedItems {
|
||||||
|
return [KBKeyboardRowItem itemsFromRawArray:self.items ?: @[]];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation KBKeyboardLayout
|
||||||
|
|
||||||
|
+ (NSDictionary *)mj_objectClassInArray {
|
||||||
|
return @{ @"rows": [KBKeyboardRowConfig class] };
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation KBKeyboardLayoutConfig
|
||||||
|
|
||||||
|
+ (instancetype)sharedConfig {
|
||||||
|
static KBKeyboardLayoutConfig *config = nil;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
NSString *path = [[NSBundle mainBundle] pathForResource:kKBKeyboardLayoutConfigFileName ofType:@"json"];
|
||||||
|
NSData *data = path.length ? [NSData dataWithContentsOfFile:path] : nil;
|
||||||
|
config = data ? [KBKeyboardLayoutConfig configFromJSONData:data] : nil;
|
||||||
|
});
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (instancetype)configFromJSONData:(NSData *)data {
|
||||||
|
if (data.length == 0) { return nil; }
|
||||||
|
NSError *error = nil;
|
||||||
|
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
||||||
|
if (error || ![json isKindOfClass:[NSDictionary class]]) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
NSDictionary *dict = (NSDictionary *)json;
|
||||||
|
KBKeyboardLayoutConfig *config = [KBKeyboardLayoutConfig mj_objectWithKeyValues:dict];
|
||||||
|
|
||||||
|
NSDictionary *keyDefsRaw = dict[@"keyDefs"];
|
||||||
|
if ([keyDefsRaw isKindOfClass:[NSDictionary class]]) {
|
||||||
|
NSMutableDictionary<NSString *, KBKeyboardKeyDef *> *defs = [NSMutableDictionary dictionaryWithCapacity:keyDefsRaw.count];
|
||||||
|
[keyDefsRaw enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||||
|
if (![key isKindOfClass:[NSString class]] || ![obj isKindOfClass:[NSDictionary class]]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
KBKeyboardKeyDef *def = [KBKeyboardKeyDef mj_objectWithKeyValues:obj];
|
||||||
|
if (def) {
|
||||||
|
defs[key] = def;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
config.keyDefs = defs.copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSDictionary *layoutsRaw = dict[@"layouts"];
|
||||||
|
if ([layoutsRaw isKindOfClass:[NSDictionary class]]) {
|
||||||
|
NSMutableDictionary<NSString *, KBKeyboardLayout *> *layouts = [NSMutableDictionary dictionaryWithCapacity:layoutsRaw.count];
|
||||||
|
[layoutsRaw enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||||
|
if (![key isKindOfClass:[NSString class]] || ![obj isKindOfClass:[NSDictionary class]]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
KBKeyboardLayout *layout = [KBKeyboardLayout mj_objectWithKeyValues:obj];
|
||||||
|
if (layout) {
|
||||||
|
layouts[key] = layout;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
config.layouts = layouts.copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)scaledValue:(CGFloat)designValue {
|
||||||
|
CGFloat baseWidth = (self.designWidth > 0.0) ? self.designWidth : KB_DESIGN_WIDTH;
|
||||||
|
CGFloat scale = KBScreenWidth() / baseWidth;
|
||||||
|
return designValue * scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)keyboardAreaDesignHeight {
|
||||||
|
KBKeyboardLayout *layout = [self layoutForName:@"letters"] ?: self.layouts.allValues.firstObject;
|
||||||
|
NSUInteger rowCount = layout.rows.count;
|
||||||
|
if (rowCount == 0) { return 0.0; }
|
||||||
|
|
||||||
|
CGFloat rowSpacing = self.metrics.rowSpacing.doubleValue;
|
||||||
|
CGFloat topInset = self.metrics.topInset.doubleValue;
|
||||||
|
CGFloat bottomInset = self.metrics.bottomInset.doubleValue;
|
||||||
|
|
||||||
|
CGFloat total = topInset + bottomInset + rowSpacing * (rowCount - 1);
|
||||||
|
for (KBKeyboardRowConfig *row in layout.rows) {
|
||||||
|
CGFloat height = row.height.doubleValue;
|
||||||
|
if (height <= 0.0) {
|
||||||
|
height = self.metrics.keyHeight.doubleValue;
|
||||||
|
}
|
||||||
|
if (height <= 0.0) { height = 40.0; }
|
||||||
|
total += height;
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)keyboardAreaScaledHeight {
|
||||||
|
CGFloat designHeight = [self keyboardAreaDesignHeight];
|
||||||
|
return designHeight > 0.0 ? [self scaledValue:designHeight] : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KBKeyboardLayout *)layoutForName:(NSString *)name {
|
||||||
|
if (name.length == 0) { return nil; }
|
||||||
|
return self.layouts[name];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KBKeyboardKeyDef *)keyDefForIdentifier:(NSString *)identifier {
|
||||||
|
if (identifier.length == 0) { return nil; }
|
||||||
|
return self.keyDefs[identifier];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
// - 兼容后端“/t”作为分段标记:可自动替换为制表符“\t”
|
// - 兼容后端“/t”作为分段标记:可自动替换为制表符“\t”
|
||||||
// - 首段去首个“\t”:若首次正文以一个制表符起始(允许前导空白),可只移除“一个”\t
|
// - 首段去首个“\t”:若首次正文以一个制表符起始(允许前导空白),可只移除“一个”\t
|
||||||
//
|
//
|
||||||
|
// 暂未使用
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
// Created by Mac on 2025/11/12.
|
// Created by Mac on 2025/11/12.
|
||||||
//
|
//
|
||||||
|
// 暂未使用
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#import "KBHUD.h" // 复用 App 内的 HUD 封装
|
#import "KBHUD.h" // 复用 App 内的 HUD 封装
|
||||||
#import "KBLocalizationManager.h" // 复用多语言封装(可在扩展内使用)
|
#import "KBLocalizationManager.h" // 复用多语言封装(可在扩展内使用)
|
||||||
#import "KBMaiPointReporter.h"
|
#import "KBMaiPointReporter.h"
|
||||||
|
//#import "KBLog.h"
|
||||||
|
|
||||||
|
|
||||||
// 通用链接(Universal Links)统一配置
|
// 通用链接(Universal Links)统一配置
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
/* 字母 g(小写) */
|
/* 字母 g(小写) */
|
||||||
"letter_g_lower" = "key_g";
|
"letter_g_lower" = "key_g";
|
||||||
/* 字母 G(大写) */
|
/* 字母 G(大写) */
|
||||||
"letter_g_upper" = "key_f_up";
|
"letter_g_upper" = "key_g_up";
|
||||||
|
|
||||||
/* 字母 h(小写) */
|
/* 字母 h(小写) */
|
||||||
"letter_h_lower" = "key_h";
|
"letter_h_lower" = "key_h";
|
||||||
@@ -246,4 +246,3 @@
|
|||||||
"emoji_panel" = "key_emoji";
|
"emoji_panel" = "key_emoji";
|
||||||
/* 发送/换行键 */
|
/* 发送/换行键 */
|
||||||
"return" = "key_send";
|
"return" = "key_send";
|
||||||
|
|
||||||
|
|||||||
414
CustomKeyboard/Resource/kb_keyboard_layout_config.json
Normal file
@@ -0,0 +1,414 @@
|
|||||||
|
{
|
||||||
|
"__comment": "键盘布局配置:所有尺寸为设计稿值(会按 designWidth 等比缩放)",
|
||||||
|
"designWidth": 375,
|
||||||
|
"__comment_designWidth": "设计稿宽度(如 375),用于计算缩放比例",
|
||||||
|
"defaultKeyBackground": "#FFFFFF",
|
||||||
|
"__comment_defaultKeyBackground": "无皮肤时按键默认背景色",
|
||||||
|
"metrics": {
|
||||||
|
"__comment": "全局尺寸参数(单位:pt,按 designWidth 缩放)",
|
||||||
|
"rowSpacing": 8,
|
||||||
|
"__comment_rowSpacing": "行间距(垂直)",
|
||||||
|
"topInset": 8,
|
||||||
|
"__comment_topInset": "键盘顶部内边距",
|
||||||
|
"bottomInset": 6,
|
||||||
|
"__comment_bottomInset": "键盘底部内边距",
|
||||||
|
"keyHeight": 41,
|
||||||
|
"__comment_keyHeight": "默认按键高度",
|
||||||
|
"edgeInset": 4,
|
||||||
|
"__comment_edgeInset": "行左右内边距(默认)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "按键之间水平间距",
|
||||||
|
"letterWidth": 32,
|
||||||
|
"__comment_letterWidth": "字母键默认宽度",
|
||||||
|
"controlWidth": 41,
|
||||||
|
"__comment_controlWidth": "控制键宽度(如 shift/backspace/123)",
|
||||||
|
"sendWidth": 88,
|
||||||
|
"__comment_sendWidth": "send 键宽度",
|
||||||
|
"symbolsWideWidth": 47,
|
||||||
|
"__comment_symbolsWideWidth": "符号第3行中间大键宽度",
|
||||||
|
"symbolsSideWidth": 41,
|
||||||
|
"__comment_symbolsSideWidth": "符号第3行左右控制键宽度"
|
||||||
|
},
|
||||||
|
"fonts": {
|
||||||
|
"__comment": "字体大小(pt)",
|
||||||
|
"letter": 20,
|
||||||
|
"__comment_letter": "字母键字体大小",
|
||||||
|
"digit": 20,
|
||||||
|
"__comment_digit": "数字键字体大小",
|
||||||
|
"symbol": 18,
|
||||||
|
"__comment_symbol": "符号键字体大小",
|
||||||
|
"mode": 14,
|
||||||
|
"__comment_mode": "模式切换键字体大小(ABC/#+=/123)",
|
||||||
|
"space": 18,
|
||||||
|
"__comment_space": "空格键字体大小",
|
||||||
|
"send": 18,
|
||||||
|
"__comment_send": "发送键字体大小"
|
||||||
|
},
|
||||||
|
"keyDefs": {
|
||||||
|
"__comment": "特殊功能键配置(id 对应布局中的 item)",
|
||||||
|
"shift": {
|
||||||
|
"__comment": "大小写切换键",
|
||||||
|
"type": "shift",
|
||||||
|
"__comment_type": "类型:shift/backspace/mode/symbolsToggle/space/return/custom",
|
||||||
|
"title": "⇧",
|
||||||
|
"__comment_title": "按钮文本(无皮肤时显示)",
|
||||||
|
"symbolName": "shift",
|
||||||
|
"__comment_symbolName": "无皮肤时使用 SF Symbol 名称",
|
||||||
|
"selectedSymbolName": "shift.fill",
|
||||||
|
"__comment_selectedSymbolName": "选中态 SF Symbol 名称",
|
||||||
|
"font": "symbol",
|
||||||
|
"__comment_font": "使用 fonts 中哪一类字号",
|
||||||
|
"width": "controlWidth",
|
||||||
|
"__comment_width": "宽度:引用 metrics 中字段或具体数值",
|
||||||
|
"backgroundColor": "#B7BBC4",
|
||||||
|
"__comment_backgroundColor": "按键背景色"
|
||||||
|
},
|
||||||
|
"backspace": {
|
||||||
|
"__comment": "删除键",
|
||||||
|
"type": "backspace",
|
||||||
|
"__comment_type": "类型:shift/backspace/mode/symbolsToggle/space/return/custom",
|
||||||
|
"title": "⌫",
|
||||||
|
"__comment_title": "按钮文本(无皮肤时显示)",
|
||||||
|
"font": "symbol",
|
||||||
|
"__comment_font": "使用 fonts 中哪一类字号",
|
||||||
|
"width": "controlWidth",
|
||||||
|
"__comment_width": "宽度:引用 metrics 中字段或具体数值",
|
||||||
|
"backgroundColor": "#B7BBC4",
|
||||||
|
"__comment_backgroundColor": "按键背景色"
|
||||||
|
},
|
||||||
|
"mode_123": {
|
||||||
|
"__comment": "字母面板左下角 123",
|
||||||
|
"type": "mode",
|
||||||
|
"__comment_type": "类型:shift/backspace/mode/symbolsToggle/space/return/custom",
|
||||||
|
"title": "123",
|
||||||
|
"__comment_title": "按钮文本(无皮肤时显示)",
|
||||||
|
"font": "mode",
|
||||||
|
"__comment_font": "使用 fonts 中哪一类字号",
|
||||||
|
"width": "controlWidth",
|
||||||
|
"__comment_width": "宽度:引用 metrics 中字段或具体数值",
|
||||||
|
"backgroundColor": "#B7BBC4",
|
||||||
|
"__comment_backgroundColor": "按键背景色"
|
||||||
|
},
|
||||||
|
"mode_abc": {
|
||||||
|
"__comment": "数字面板左下角 ABC",
|
||||||
|
"type": "mode",
|
||||||
|
"__comment_type": "类型:shift/backspace/mode/symbolsToggle/space/return/custom",
|
||||||
|
"title": "ABC",
|
||||||
|
"__comment_title": "按钮文本(无皮肤时显示)",
|
||||||
|
"font": "mode",
|
||||||
|
"__comment_font": "使用 fonts 中哪一类字号",
|
||||||
|
"width": "controlWidth",
|
||||||
|
"__comment_width": "宽度:引用 metrics 中字段或具体数值",
|
||||||
|
"backgroundColor": "#B7BBC4",
|
||||||
|
"__comment_backgroundColor": "按键背景色"
|
||||||
|
},
|
||||||
|
"symbols_toggle_more": {
|
||||||
|
"__comment": "数字面板内 123 -> #+=",
|
||||||
|
"type": "symbolsToggle",
|
||||||
|
"__comment_type": "类型:shift/backspace/mode/symbolsToggle/space/return/custom",
|
||||||
|
"title": "#+=",
|
||||||
|
"__comment_title": "按钮文本(无皮肤时显示)",
|
||||||
|
"font": "mode",
|
||||||
|
"__comment_font": "使用 fonts 中哪一类字号",
|
||||||
|
"width": "symbolsSideWidth",
|
||||||
|
"__comment_width": "宽度:引用 metrics 中字段或具体数值",
|
||||||
|
"backgroundColor": "#B7BBC4",
|
||||||
|
"__comment_backgroundColor": "按键背景色"
|
||||||
|
},
|
||||||
|
"symbols_toggle_123": {
|
||||||
|
"__comment": "数字面板内 #+= -> 123",
|
||||||
|
"type": "symbolsToggle",
|
||||||
|
"__comment_type": "类型:shift/backspace/mode/symbolsToggle/space/return/custom",
|
||||||
|
"title": "123",
|
||||||
|
"__comment_title": "按钮文本(无皮肤时显示)",
|
||||||
|
"font": "mode",
|
||||||
|
"__comment_font": "使用 fonts 中哪一类字号",
|
||||||
|
"width": "symbolsSideWidth",
|
||||||
|
"__comment_width": "宽度:引用 metrics 中字段或具体数值",
|
||||||
|
"backgroundColor": "#B7BBC4",
|
||||||
|
"__comment_backgroundColor": "按键背景色"
|
||||||
|
},
|
||||||
|
"emoji": {
|
||||||
|
"__comment": "emoji 功能键",
|
||||||
|
"type": "custom",
|
||||||
|
"__comment_type": "类型:shift/backspace/mode/symbolsToggle/space/return/custom",
|
||||||
|
"title": "😁",
|
||||||
|
"__comment_title": "按钮文本(无皮肤时显示)",
|
||||||
|
"font": "symbol",
|
||||||
|
"__comment_font": "使用 fonts 中哪一类字号",
|
||||||
|
"width": "controlWidth",
|
||||||
|
"__comment_width": "宽度:引用 metrics 中字段或具体数值",
|
||||||
|
"backgroundColor": "#B7BBC4",
|
||||||
|
"__comment_backgroundColor": "按键背景色"
|
||||||
|
},
|
||||||
|
"space": {
|
||||||
|
"__comment": "空格键",
|
||||||
|
"type": "space",
|
||||||
|
"__comment_type": "类型:shift/backspace/mode/symbolsToggle/space/return/custom",
|
||||||
|
"title": "space",
|
||||||
|
"__comment_title": "按钮文本(无皮肤时显示)",
|
||||||
|
"font": "space",
|
||||||
|
"__comment_font": "使用 fonts 中哪一类字号",
|
||||||
|
"width": "flex",
|
||||||
|
"__comment_width": "flex 表示自动占满剩余空间"
|
||||||
|
},
|
||||||
|
"send": {
|
||||||
|
"__comment": "发送键",
|
||||||
|
"type": "return",
|
||||||
|
"__comment_type": "类型:shift/backspace/mode/symbolsToggle/space/return/custom",
|
||||||
|
"title": "send",
|
||||||
|
"__comment_title": "按钮文本(无皮肤时显示)",
|
||||||
|
"font": "send",
|
||||||
|
"__comment_font": "使用 fonts 中哪一类字号",
|
||||||
|
"width": "sendWidth",
|
||||||
|
"__comment_width": "宽度:引用 metrics 中字段或具体数值",
|
||||||
|
"backgroundColor": "#B7BBC4",
|
||||||
|
"__comment_backgroundColor": "按键背景色"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"layouts": {
|
||||||
|
"__comment": "布局集合:letters/numbers/symbolsMore",
|
||||||
|
"letters": {
|
||||||
|
"__comment": "字母布局(小写/大写共用)",
|
||||||
|
"rows": [
|
||||||
|
{
|
||||||
|
"__comment": "字母第一行 qwertyuiop",
|
||||||
|
"align": "left",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"items": [
|
||||||
|
"letter:q", "letter:w", "letter:e", "letter:r", "letter:t",
|
||||||
|
"letter:y", "letter:u", "letter:i", "letter:o", "letter:p"
|
||||||
|
],
|
||||||
|
"__comment_items": "本行按键列表;letter:x/digit:x/sym:x 或 keyDefs 中的 id"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "字母第二行 asdfghjkl",
|
||||||
|
"align": "center",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 0,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 0,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"items": [
|
||||||
|
"letter:a", "letter:s", "letter:d", "letter:f", "letter:g",
|
||||||
|
"letter:h", "letter:j", "letter:k", "letter:l"
|
||||||
|
],
|
||||||
|
"__comment_items": "本行按键列表;letter:x/digit:x/sym:x 或 keyDefs 中的 id"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "字母第三行:左 shift,中间字母,右 backspace",
|
||||||
|
"align": "left",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"segments": {
|
||||||
|
"__comment": "分段布局:left/center/right",
|
||||||
|
"left": [
|
||||||
|
{ "id": "shift", "width": "controlWidth", "__comment_id": "引用 keyDefs 的 id", "__comment_width": "宽度引用 metrics.controlWidth" }
|
||||||
|
],
|
||||||
|
"__comment_left": "左侧固定按钮",
|
||||||
|
"center": [
|
||||||
|
"letter:z", "letter:x", "letter:c", "letter:v", "letter:b", "letter:n", "letter:m"
|
||||||
|
],
|
||||||
|
"__comment_center": "中间字母键集合,整体居中",
|
||||||
|
"right": [
|
||||||
|
{ "id": "backspace", "width": "controlWidth", "__comment_id": "引用 keyDefs 的 id", "__comment_width": "宽度引用 metrics.controlWidth" }
|
||||||
|
],
|
||||||
|
"__comment_right": "右侧固定按钮"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "字母第四行:123/emoji/space/send",
|
||||||
|
"align": "left",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"items": [
|
||||||
|
"mode_123", "emoji", "space", "send"
|
||||||
|
],
|
||||||
|
"__comment_items": "本行按键列表;letter:x/digit:x/sym:x 或 keyDefs 中的 id"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"numbers": {
|
||||||
|
"__comment": "数字面板布局(123 页)",
|
||||||
|
"rows": [
|
||||||
|
{
|
||||||
|
"__comment": "数字第一行 1234567890",
|
||||||
|
"align": "left",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"items": [
|
||||||
|
"digit:1", "digit:2", "digit:3", "digit:4", "digit:5",
|
||||||
|
"digit:6", "digit:7", "digit:8", "digit:9", "digit:0"
|
||||||
|
],
|
||||||
|
"__comment_items": "本行按键列表;letter:x/digit:x/sym:x 或 keyDefs 中的 id"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "数字第二行 - / : ; ( ) ¥ & @ “",
|
||||||
|
"align": "left",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"items": [
|
||||||
|
"sym:-", "sym:/", "sym::", "sym:;", "sym:(",
|
||||||
|
"sym:)", "sym:¥", "sym:&", "sym:@", "sym:“"
|
||||||
|
],
|
||||||
|
"__comment_items": "本行按键列表;letter:x/digit:x/sym:x 或 keyDefs 中的 id"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "数字第三行:#+= / 中间符号 / 删除",
|
||||||
|
"align": "center",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"segments": {
|
||||||
|
"__comment": "分段布局:left/center/right",
|
||||||
|
"left": [
|
||||||
|
{ "id": "symbols_toggle_more", "width": "symbolsSideWidth", "__comment_id": "引用 keyDefs 的 id", "__comment_width": "宽度引用 metrics.symbolsSideWidth" }
|
||||||
|
],
|
||||||
|
"__comment_left": "左侧切换按钮",
|
||||||
|
"center": [
|
||||||
|
{ "id": "sym:.", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" },
|
||||||
|
{ "id": "sym:,", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" },
|
||||||
|
{ "id": "sym:?", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" },
|
||||||
|
{ "id": "sym:!", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" },
|
||||||
|
{ "id": "sym:‘", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" }
|
||||||
|
],
|
||||||
|
"__comment_center": "中间符号键集合,整体居中",
|
||||||
|
"right": [
|
||||||
|
{ "id": "backspace", "width": "symbolsSideWidth", "__comment_id": "引用 keyDefs 的 id", "__comment_width": "宽度引用 metrics.symbolsSideWidth" }
|
||||||
|
],
|
||||||
|
"__comment_right": "右侧删除键"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "数字第四行:ABC/emoji/space/send",
|
||||||
|
"align": "left",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"items": [
|
||||||
|
"mode_abc", "emoji", "space", "send"
|
||||||
|
],
|
||||||
|
"__comment_items": "本行按键列表;letter:x/digit:x/sym:x 或 keyDefs 中的 id"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"symbolsMore": {
|
||||||
|
"__comment": "符号面板布局(#+= 页)",
|
||||||
|
"rows": [
|
||||||
|
{
|
||||||
|
"__comment": "符号第一行 [ ] { } # % ^ * + =",
|
||||||
|
"align": "left",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"items": [
|
||||||
|
"sym:[", "sym:]", "sym:{", "sym:}", "sym:#",
|
||||||
|
"sym:%", "sym:^", "sym:*", "sym:+", "sym:="
|
||||||
|
],
|
||||||
|
"__comment_items": "本行按键列表;letter:x/digit:x/sym:x 或 keyDefs 中的 id"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "符号第二行 _ \\ | ~ < > € ¥ $ ·",
|
||||||
|
"align": "left",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"items": [
|
||||||
|
"sym:_", "sym:\\", "sym:|", "sym:~", "sym:<",
|
||||||
|
"sym:>", "sym:€", "sym:¥", "sym:$", "sym:·"
|
||||||
|
],
|
||||||
|
"__comment_items": "本行按键列表;letter:x/digit:x/sym:x 或 keyDefs 中的 id"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "符号第三行:123 / 中间符号 / 删除",
|
||||||
|
"align": "center",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"segments": {
|
||||||
|
"__comment": "分段布局:left/center/right",
|
||||||
|
"left": [
|
||||||
|
{ "id": "symbols_toggle_123", "width": "symbolsSideWidth", "__comment_id": "引用 keyDefs 的 id", "__comment_width": "宽度引用 metrics.symbolsSideWidth" }
|
||||||
|
],
|
||||||
|
"__comment_left": "左侧切换按钮",
|
||||||
|
"center": [
|
||||||
|
{ "id": "sym:.", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" },
|
||||||
|
{ "id": "sym:,", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" },
|
||||||
|
{ "id": "sym:?", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" },
|
||||||
|
{ "id": "sym:!", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" },
|
||||||
|
{ "id": "sym:‘", "width": "symbolsWideWidth", "__comment_id": "符号键 id", "__comment_width": "宽度引用 metrics.symbolsWideWidth" }
|
||||||
|
],
|
||||||
|
"__comment_center": "中间符号键集合,整体居中",
|
||||||
|
"right": [
|
||||||
|
{ "id": "backspace", "width": "symbolsSideWidth", "__comment_id": "引用 keyDefs 的 id", "__comment_width": "宽度引用 metrics.symbolsSideWidth" }
|
||||||
|
],
|
||||||
|
"__comment_right": "右侧删除键"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "符号第四行:ABC/emoji/space/send",
|
||||||
|
"align": "left",
|
||||||
|
"__comment_align": "对齐方式:left/center",
|
||||||
|
"insetLeft": 4,
|
||||||
|
"__comment_insetLeft": "本行左边距(覆盖 metrics.edgeInset)",
|
||||||
|
"insetRight": 4,
|
||||||
|
"__comment_insetRight": "本行右边距(覆盖 metrics.edgeInset)",
|
||||||
|
"gap": 5,
|
||||||
|
"__comment_gap": "本行按键间距(覆盖 metrics.gap)",
|
||||||
|
"items": [
|
||||||
|
"mode_abc", "emoji", "space", "send"
|
||||||
|
],
|
||||||
|
"__comment_items": "本行按键列表;letter:x/digit:x/sym:x 或 keyDefs 中的 id"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
CustomKeyboard/Resource/normal_hei_them.zip
Normal file
BIN
CustomKeyboard/Resource/normal_them.zip
Normal file
@@ -11,10 +11,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
- (instancetype)initWithContainerView:(UIView *)containerView;
|
- (instancetype)initWithContainerView:(UIView *)containerView;
|
||||||
|
|
||||||
/// 配置删除按钮(包含长按删除;可选是否显示“立刻清空”提示)
|
/// 配置删除按钮(包含长按删除;可选是否显示“上滑清空”提示)
|
||||||
- (void)bindDeleteButton:(nullable UIView *)button showClearLabel:(BOOL)showClearLabel;
|
- (void)bindDeleteButton:(nullable UIView *)button showClearLabel:(BOOL)showClearLabel;
|
||||||
|
|
||||||
/// 触发“立刻清空”逻辑(可用于功能面板的清空按钮)
|
/// 触发“上滑清空”逻辑(可用于功能面板的清空按钮)
|
||||||
- (void)performClearAction;
|
- (void)performClearAction;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -7,24 +7,25 @@
|
|||||||
#import "KBResponderUtils.h"
|
#import "KBResponderUtils.h"
|
||||||
#import "KBSkinManager.h"
|
#import "KBSkinManager.h"
|
||||||
#import "KBBackspaceUndoManager.h"
|
#import "KBBackspaceUndoManager.h"
|
||||||
|
#import "KBInputBufferManager.h"
|
||||||
|
|
||||||
static const NSTimeInterval kKBBackspaceLongPressMinDuration = 0.35;
|
static const NSTimeInterval kKBBackspaceLongPressMinDuration = 0.35;
|
||||||
static const NSTimeInterval kKBBackspaceRepeatInterval = 0.06;
|
static const NSTimeInterval kKBBackspaceRepeatInterval = 0.06;
|
||||||
static const NSTimeInterval kKBBackspaceChunkStartDelay = 1.0;
|
static const NSTimeInterval kKBBackspaceChunkStartDelay = 0.6;
|
||||||
static const NSTimeInterval kKBBackspaceChunkRepeatInterval = 0.1;
|
static const NSTimeInterval kKBBackspaceChunkRepeatInterval = 0.1;
|
||||||
static const NSTimeInterval kKBBackspaceChunkFastDelay = 1.4;
|
static const NSTimeInterval kKBBackspaceChunkFastDelay = 1.2;
|
||||||
static const NSInteger kKBBackspaceChunkSize = 6;
|
static const NSInteger kKBBackspaceChunkSize = 8;
|
||||||
static const NSInteger kKBBackspaceChunkSizeFast = 12;
|
static const NSInteger kKBBackspaceChunkSizeFast = 16;
|
||||||
static const CGFloat kKBBackspaceClearLabelCornerRadius = 8.0;
|
static const CGFloat kKBBackspaceClearLabelCornerRadius = 8.0;
|
||||||
static const CGFloat kKBBackspaceClearLabelHeight = 34;
|
static const CGFloat kKBBackspaceClearLabelHeight = 34;
|
||||||
static const CGFloat kKBBackspaceClearLabelPaddingX = 10.0;
|
static const CGFloat kKBBackspaceClearLabelPaddingX = 10.0;
|
||||||
static const CGFloat kKBBackspaceClearLabelTopGap = 6.0;
|
static const CGFloat kKBBackspaceClearLabelTopGap = 6.0;
|
||||||
static const CGFloat kKBBackspaceClearLabelHorizontalInset = 6.0;
|
static const CGFloat kKBBackspaceClearLabelHorizontalInset = 6.0;
|
||||||
static const NSInteger kKBBackspaceClearBatchSize = 24;
|
static const NSTimeInterval kKBBackspaceClearBatchInterval = 0.02;
|
||||||
static const NSTimeInterval kKBBackspaceClearBatchInterval = 0.005;
|
|
||||||
static const NSInteger kKBBackspaceClearMaxDeletes = 10000;
|
static const NSInteger kKBBackspaceClearMaxDeletes = 10000;
|
||||||
static const NSInteger kKBBackspaceClearEmptyContextMaxRounds = 40;
|
static const NSInteger kKBBackspaceClearEmptyContextMaxRounds = 40;
|
||||||
static const NSInteger kKBBackspaceClearMaxStep = 80;
|
static const NSInteger kKBBackspaceClearMaxStep = 80;
|
||||||
|
static const NSInteger kKBBackspaceClearDeletesPerTick = 10;
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
||||||
KBBackspaceChunkClassUnknown = 0,
|
KBBackspaceChunkClassUnknown = 0,
|
||||||
@@ -34,6 +35,12 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
KBBackspaceChunkClassOther
|
KBBackspaceChunkClassOther
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, KBClearPhase) {
|
||||||
|
KBClearPhaseSkipWhitespace = 0,
|
||||||
|
KBClearPhaseSkipTrailingBoundary,
|
||||||
|
KBClearPhaseDeleteUntilBoundary
|
||||||
|
};
|
||||||
|
|
||||||
@interface KBBackspaceLongPressHandler ()
|
@interface KBBackspaceLongPressHandler ()
|
||||||
@property (nonatomic, weak) UIView *containerView;
|
@property (nonatomic, weak) UIView *containerView;
|
||||||
@property (nonatomic, weak) UIView *backspaceButton;
|
@property (nonatomic, weak) UIView *backspaceButton;
|
||||||
@@ -50,6 +57,7 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
@property (nonatomic, strong) UILabel *backspaceClearLabel;
|
@property (nonatomic, strong) UILabel *backspaceClearLabel;
|
||||||
@property (nonatomic, copy) NSString *pendingClearBefore;
|
@property (nonatomic, copy) NSString *pendingClearBefore;
|
||||||
@property (nonatomic, copy) NSString *pendingClearAfter;
|
@property (nonatomic, copy) NSString *pendingClearAfter;
|
||||||
|
@property (nonatomic, assign) KBClearPhase backspaceClearPhase;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation KBBackspaceLongPressHandler
|
@implementation KBBackspaceLongPressHandler
|
||||||
@@ -57,6 +65,7 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
- (instancetype)initWithContainerView:(UIView *)containerView {
|
- (instancetype)initWithContainerView:(UIView *)containerView {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
_containerView = containerView;
|
_containerView = containerView;
|
||||||
|
_backspaceClearPhase = KBClearPhaseSkipWhitespace;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -103,9 +112,17 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
}
|
}
|
||||||
switch (gr.state) {
|
switch (gr.state) {
|
||||||
case UIGestureRecognizerStateBegan: {
|
case UIGestureRecognizerStateBegan: {
|
||||||
[self kb_captureDeletionSnapshotIfNeeded];
|
UIResponder *start = (UIResponder *)([self kb_hostView] ?: self.backspaceButton);
|
||||||
|
UIInputViewController *ivc = KBFindInputViewController(start);
|
||||||
|
if (ivc) {
|
||||||
|
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
||||||
|
[[KBInputBufferManager shared] refreshFromProxyIfPossible:proxy];
|
||||||
|
[[KBInputBufferManager shared] prepareSnapshotForDeleteWithContextBefore:proxy.documentContextBeforeInput
|
||||||
|
after:proxy.documentContextAfterInput];
|
||||||
|
}
|
||||||
if (self.showClearLabelEnabled) {
|
if (self.showClearLabelEnabled) {
|
||||||
[self kb_capturePendingClearSnapshotIfNeeded];
|
[self kb_capturePendingClearSnapshotIfNeeded];
|
||||||
|
[[KBInputBufferManager shared] beginPendingClearSnapshot];
|
||||||
}
|
}
|
||||||
self.backspaceHoldToken += 1;
|
self.backspaceHoldToken += 1;
|
||||||
NSUInteger token = self.backspaceHoldToken;
|
NSUInteger token = self.backspaceHoldToken;
|
||||||
@@ -141,6 +158,7 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
if (!ivc) { self.backspaceHoldActive = NO; return; }
|
if (!ivc) { self.backspaceHoldActive = NO; return; }
|
||||||
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
||||||
NSString *before = proxy.documentContextBeforeInput ?: @"";
|
NSString *before = proxy.documentContextBeforeInput ?: @"";
|
||||||
|
if (before.length == 0) { before = [KBInputBufferManager shared].liveText ?: @""; }
|
||||||
NSTimeInterval elapsed = [NSDate date].timeIntervalSinceReferenceDate - self.backspaceHoldStartTime;
|
NSTimeInterval elapsed = [NSDate date].timeIntervalSinceReferenceDate - self.backspaceHoldStartTime;
|
||||||
NSInteger deleteCount = 1;
|
NSInteger deleteCount = 1;
|
||||||
if (before.length > 0) {
|
if (before.length > 0) {
|
||||||
@@ -152,9 +170,8 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
[self kb_showBackspaceClearLabelIfNeeded];
|
[self kb_showBackspaceClearLabelIfNeeded];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (NSInteger i = 0; i < deleteCount; i++) {
|
[[KBBackspaceUndoManager shared] captureAndDeleteBackwardFromProxy:proxy count:(NSUInteger)deleteCount];
|
||||||
[proxy deleteBackward];
|
[[KBInputBufferManager shared] applyHoldDeleteCount:(NSUInteger)deleteCount];
|
||||||
}
|
|
||||||
|
|
||||||
NSTimeInterval interval = [self kb_backspaceRepeatIntervalForElapsed:elapsed];
|
NSTimeInterval interval = [self kb_backspaceRepeatIntervalForElapsed:elapsed];
|
||||||
__weak typeof(self) weakSelf = self;
|
__weak typeof(self) weakSelf = self;
|
||||||
@@ -193,34 +210,77 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
whitespaceSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
whitespaceSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||||
asciiWordSet = [NSCharacterSet characterSetWithCharactersInString:
|
asciiWordSet = [NSCharacterSet characterSetWithCharactersInString:
|
||||||
@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"];
|
@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"];
|
||||||
punctuationSet = [NSCharacterSet punctuationCharacterSet];
|
NSMutableCharacterSet *punct = [[NSCharacterSet punctuationCharacterSet] mutableCopy];
|
||||||
|
// 补齐常见中文/全角标点(避免 chunk 总是只删 1 个符号)
|
||||||
|
[punct addCharactersInString:@",。!?;:、()【】《》“”‘’·…—"];
|
||||||
|
punctuationSet = [punct copy];
|
||||||
});
|
});
|
||||||
|
|
||||||
__block NSInteger deleteCount = 0;
|
__block NSInteger deleteCount = 0;
|
||||||
__block KBBackspaceChunkClass chunkClass = KBBackspaceChunkClassUnknown;
|
typedef NS_ENUM(NSInteger, KBBackspaceChunkPhase) {
|
||||||
|
KBBackspaceChunkPhaseWhitespace = 0,
|
||||||
|
KBBackspaceChunkPhasePunctuation,
|
||||||
|
KBBackspaceChunkPhaseCore
|
||||||
|
};
|
||||||
|
__block KBBackspaceChunkPhase phase = KBBackspaceChunkPhaseWhitespace;
|
||||||
|
__block KBBackspaceChunkClass coreClass = KBBackspaceChunkClassUnknown;
|
||||||
|
|
||||||
[context enumerateSubstringsInRange:NSMakeRange(0, context.length)
|
[context enumerateSubstringsInRange:NSMakeRange(0, context.length)
|
||||||
options:NSStringEnumerationByComposedCharacterSequences | NSStringEnumerationReverse
|
options:NSStringEnumerationByComposedCharacterSequences | NSStringEnumerationReverse
|
||||||
usingBlock:^(NSString *substring, __unused NSRange substringRange, __unused NSRange enclosingRange, BOOL *stop) {
|
usingBlock:^(NSString *substring, __unused NSRange substringRange, __unused NSRange enclosingRange, BOOL *stop) {
|
||||||
if (substring.length == 0) { return; }
|
if (substring.length == 0) { return; }
|
||||||
KBBackspaceChunkClass currentClass = KBBackspaceChunkClassOther;
|
if (deleteCount >= maxCount) {
|
||||||
if ([substring rangeOfCharacterFromSet:whitespaceSet].location != NSNotFound) {
|
|
||||||
currentClass = KBBackspaceChunkClassWhitespace;
|
|
||||||
} else if ([substring rangeOfCharacterFromSet:asciiWordSet].location != NSNotFound) {
|
|
||||||
currentClass = KBBackspaceChunkClassASCIIWord;
|
|
||||||
} else if ([substring rangeOfCharacterFromSet:punctuationSet].location != NSNotFound) {
|
|
||||||
currentClass = KBBackspaceChunkClassPunctuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chunkClass == KBBackspaceChunkClassUnknown) {
|
|
||||||
chunkClass = currentClass;
|
|
||||||
} else if (chunkClass != currentClass) {
|
|
||||||
*stop = YES;
|
*stop = YES;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KBBackspaceChunkClass currentClass = KBBackspaceChunkClassOther;
|
||||||
|
if ([substring rangeOfCharacterFromSet:whitespaceSet].location != NSNotFound) {
|
||||||
|
currentClass = KBBackspaceChunkClassWhitespace;
|
||||||
|
} else if ([substring rangeOfCharacterFromSet:punctuationSet].location != NSNotFound) {
|
||||||
|
currentClass = KBBackspaceChunkClassPunctuation;
|
||||||
|
} else if ([substring rangeOfCharacterFromSet:asciiWordSet].location != NSNotFound) {
|
||||||
|
currentClass = KBBackspaceChunkClassASCIIWord;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL consumed = NO;
|
||||||
|
while (!consumed) {
|
||||||
|
if (phase == KBBackspaceChunkPhaseWhitespace) {
|
||||||
|
if (currentClass == KBBackspaceChunkClassWhitespace) {
|
||||||
deleteCount += 1;
|
deleteCount += 1;
|
||||||
|
consumed = YES;
|
||||||
|
} else {
|
||||||
|
phase = KBBackspaceChunkPhasePunctuation;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phase == KBBackspaceChunkPhasePunctuation) {
|
||||||
|
if (currentClass == KBBackspaceChunkClassPunctuation) {
|
||||||
|
deleteCount += 1;
|
||||||
|
consumed = YES;
|
||||||
|
} else {
|
||||||
|
phase = KBBackspaceChunkPhaseCore;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// phase == Core:连续删同一类(ASCII 单词 / 其它),让效果更像微信“几个字一组”
|
||||||
|
if (coreClass == KBBackspaceChunkClassUnknown) {
|
||||||
|
coreClass = currentClass;
|
||||||
|
}
|
||||||
|
if (currentClass != coreClass) {
|
||||||
|
*stop = YES;
|
||||||
|
consumed = YES;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
deleteCount += 1;
|
||||||
|
consumed = YES;
|
||||||
|
}
|
||||||
|
|
||||||
if (deleteCount >= maxCount) {
|
if (deleteCount >= maxCount) {
|
||||||
*stop = YES;
|
*stop = YES;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@@ -229,13 +289,16 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
|
|
||||||
- (NSInteger)kb_clearDeleteCountForContext:(NSString *)context
|
- (NSInteger)kb_clearDeleteCountForContext:(NSString *)context
|
||||||
hitBoundary:(BOOL *)hitBoundary {
|
hitBoundary:(BOOL *)hitBoundary {
|
||||||
if (context.length == 0) { return kKBBackspaceClearBatchSize; }
|
if (context.length == 0) {
|
||||||
|
if (hitBoundary) { *hitBoundary = NO; }
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static NSCharacterSet *sentenceBoundarySet = nil;
|
static NSCharacterSet *sentenceBoundarySet = nil;
|
||||||
static NSCharacterSet *whitespaceSet = nil;
|
static NSCharacterSet *whitespaceSet = nil;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
sentenceBoundarySet = [NSCharacterSet characterSetWithCharactersInString:@".!?;。!?;…\n"];
|
sentenceBoundarySet = [NSCharacterSet characterSetWithCharactersInString:@".!?。!?"];
|
||||||
whitespaceSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
whitespaceSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -310,6 +373,12 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
shouldClear = [self kb_isPointInsideBackspaceClearLabel:point];
|
shouldClear = [self kb_isPointInsideBackspaceClearLabel:point];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if DEBUG
|
||||||
|
NSLog(@"[kb_handleBackspaceLongPressEnded] shouldClear=%@ highlighted=%@ labelHidden=%@",
|
||||||
|
shouldClear ? @"YES" : @"NO",
|
||||||
|
self.backspaceClearHighlighted ? @"YES" : @"NO",
|
||||||
|
self.backspaceClearLabel.hidden ? @"YES" : @"NO");
|
||||||
|
#endif
|
||||||
self.backspaceHoldActive = NO;
|
self.backspaceHoldActive = NO;
|
||||||
self.backspaceChunkModeActive = NO;
|
self.backspaceChunkModeActive = NO;
|
||||||
self.backspaceHoldToken += 1;
|
self.backspaceHoldToken += 1;
|
||||||
@@ -320,6 +389,8 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
} else {
|
} else {
|
||||||
self.pendingClearBefore = nil;
|
self.pendingClearBefore = nil;
|
||||||
self.pendingClearAfter = nil;
|
self.pendingClearAfter = nil;
|
||||||
|
[[KBInputBufferManager shared] clearPendingClearSnapshot];
|
||||||
|
[[KBInputBufferManager shared] commitLiveToManual];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,13 +502,14 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
UIResponder *start = (UIResponder *)([self kb_hostView] ?: self.backspaceButton);
|
UIResponder *start = (UIResponder *)([self kb_hostView] ?: self.backspaceButton);
|
||||||
UIInputViewController *ivc = KBFindInputViewController(start);
|
UIInputViewController *ivc = KBFindInputViewController(start);
|
||||||
if (ivc) {
|
if (ivc) {
|
||||||
NSString *before = self.pendingClearBefore ?: (ivc.textDocumentProxy.documentContextBeforeInput ?: @"");
|
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
||||||
NSString *after = self.pendingClearAfter ?: (ivc.textDocumentProxy.documentContextAfterInput ?: @"");
|
[[KBInputBufferManager shared] refreshFromProxyIfPossible:proxy];
|
||||||
[[KBBackspaceUndoManager shared] recordClearWithContextBefore:before after:after];
|
|
||||||
}
|
}
|
||||||
self.pendingClearBefore = nil;
|
self.pendingClearBefore = nil;
|
||||||
self.pendingClearAfter = nil;
|
self.pendingClearAfter = nil;
|
||||||
|
[[KBInputBufferManager shared] clearPendingClearSnapshot];
|
||||||
self.backspaceClearToken += 1;
|
self.backspaceClearToken += 1;
|
||||||
|
self.backspaceClearPhase = KBClearPhaseSkipWhitespace;
|
||||||
NSUInteger token = self.backspaceClearToken;
|
NSUInteger token = self.backspaceClearToken;
|
||||||
[self kb_clearAllInputStepForToken:token guard:0 emptyRounds:0];
|
[self kb_clearAllInputStepForToken:token guard:0 emptyRounds:0];
|
||||||
}
|
}
|
||||||
@@ -450,40 +522,101 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
UIInputViewController *ivc = KBFindInputViewController(start);
|
UIInputViewController *ivc = KBFindInputViewController(start);
|
||||||
if (!ivc) { return; }
|
if (!ivc) { return; }
|
||||||
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
||||||
NSString *before = proxy.documentContextBeforeInput ?: @"";
|
|
||||||
NSInteger count = before.length;
|
|
||||||
NSInteger batch = 0;
|
|
||||||
NSInteger nextEmptyRounds = emptyRounds;
|
NSInteger nextEmptyRounds = emptyRounds;
|
||||||
BOOL hitBoundary = NO;
|
static NSCharacterSet *stopBoundarySet = nil;
|
||||||
if (count > 0) {
|
static NSCharacterSet *trailingBoundarySet = nil;
|
||||||
batch = [self kb_clearDeleteCountForContext:before hitBoundary:&hitBoundary];
|
static NSCharacterSet *trailingWhitespaceSet = nil;
|
||||||
nextEmptyRounds = 0;
|
static dispatch_once_t onceToken;
|
||||||
} else {
|
dispatch_once(&onceToken, ^{
|
||||||
batch = kKBBackspaceClearBatchSize;
|
// stopBoundary: 遇到这些符号就停(不删除它)
|
||||||
nextEmptyRounds = emptyRounds + 1;
|
// - 句末符号:. ! ? 。!?
|
||||||
}
|
// - 省略号:…(中文里“……”常用作句/段落的停顿)
|
||||||
if (batch <= 0) { batch = 1; }
|
// - 换行:\n \r(段落边界,避免一次“清空”跨段把全文删完)
|
||||||
|
stopBoundarySet = [NSCharacterSet characterSetWithCharactersInString:@".!?。!?…\n\r\u2028\u2029"];
|
||||||
|
|
||||||
if (guard >= kKBBackspaceClearMaxDeletes ||
|
// trailingBoundary: 允许作为“尾部句末符号”先删掉,再继续删上一句(更接近微信体验)
|
||||||
nextEmptyRounds > kKBBackspaceClearEmptyContextMaxRounds) {
|
// 注意:不要把换行/省略号放进来,否则可能跨段/跨停顿继续删。
|
||||||
|
trailingBoundarySet = [NSCharacterSet characterSetWithCharactersInString:@".!?。!?"];
|
||||||
|
|
||||||
|
// trailingWhitespace: 只跳过空格/Tab(不包含换行,换行由 stopBoundarySet 处理)
|
||||||
|
trailingWhitespaceSet = [NSCharacterSet whitespaceCharacterSet];
|
||||||
|
});
|
||||||
|
KBClearPhase phase = self.backspaceClearPhase;
|
||||||
|
|
||||||
|
NSInteger deletedThisTick = 0;
|
||||||
|
BOOL shouldStop = NO;
|
||||||
|
NSString *lastBefore = nil;
|
||||||
|
for (NSInteger i = 0; i < kKBBackspaceClearDeletesPerTick; i++) {
|
||||||
|
NSString *before = proxy.documentContextBeforeInput ?: @"";
|
||||||
|
if (before.length == 0) {
|
||||||
|
nextEmptyRounds += 1;
|
||||||
|
// 宿主(微信/QQ 等)可能在长文本场景下返回空 context,即使还有很多内容。
|
||||||
|
// 为了避免一次“清空”误删全文:一旦拿不到 before,就立刻停止本次清空。
|
||||||
|
shouldStop = YES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
nextEmptyRounds = 0;
|
||||||
|
|
||||||
|
if (lastBefore && [before isEqualToString:lastBefore] && deletedThisTick > 0) {
|
||||||
|
// 宿主未及时刷新 context,留到下一 tick 再继续,避免越界/重复记录
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
lastBefore = before;
|
||||||
|
|
||||||
|
// 取最后一个组合字符
|
||||||
|
__block NSString *lastChar = @"";
|
||||||
|
[before enumerateSubstringsInRange:NSMakeRange(0, before.length)
|
||||||
|
options:NSStringEnumerationByComposedCharacterSequences | NSStringEnumerationReverse
|
||||||
|
usingBlock:^(NSString *substring, __unused NSRange substringRange, __unused NSRange enclosingRange, BOOL *stop) {
|
||||||
|
lastChar = substring ?: @"";
|
||||||
|
*stop = YES;
|
||||||
|
}];
|
||||||
|
if (lastChar.length == 0) { break; }
|
||||||
|
|
||||||
|
BOOL isWhitespace = ([lastChar rangeOfCharacterFromSet:trailingWhitespaceSet].location != NSNotFound);
|
||||||
|
BOOL isStopBoundary = ([lastChar rangeOfCharacterFromSet:stopBoundarySet].location != NSNotFound);
|
||||||
|
BOOL isTrailingBoundary = ([lastChar rangeOfCharacterFromSet:trailingBoundarySet].location != NSNotFound);
|
||||||
|
|
||||||
|
if (phase == KBClearPhaseSkipWhitespace) {
|
||||||
|
if (isWhitespace) {
|
||||||
|
[[KBBackspaceUndoManager shared] captureAndDeleteBackwardFromProxy:proxy count:1];
|
||||||
|
[[KBInputBufferManager shared] applyClearDeleteCount:1];
|
||||||
|
deletedThisTick += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
phase = KBClearPhaseSkipTrailingBoundary;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phase == KBClearPhaseSkipTrailingBoundary) {
|
||||||
|
if (isTrailingBoundary) {
|
||||||
|
[[KBBackspaceUndoManager shared] captureAndDeleteBackwardFromProxy:proxy count:1];
|
||||||
|
[[KBInputBufferManager shared] applyClearDeleteCount:1];
|
||||||
|
deletedThisTick += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
phase = KBClearPhaseDeleteUntilBoundary;
|
||||||
|
}
|
||||||
|
|
||||||
|
// phase == DeleteUntilBoundary
|
||||||
|
if (isStopBoundary) {
|
||||||
|
shouldStop = YES; // 保留该句末符号
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
[[KBBackspaceUndoManager shared] captureAndDeleteBackwardFromProxy:proxy count:1];
|
||||||
|
[[KBInputBufferManager shared] applyClearDeleteCount:1];
|
||||||
|
deletedThisTick += 1;
|
||||||
|
if (guard + deletedThisTick >= kKBBackspaceClearMaxDeletes) { break; }
|
||||||
|
if (deletedThisTick >= kKBBackspaceClearMaxStep) { break; }
|
||||||
|
}
|
||||||
|
|
||||||
|
self.backspaceClearPhase = phase;
|
||||||
|
NSInteger nextGuard = guard + deletedThisTick;
|
||||||
|
if (nextGuard >= kKBBackspaceClearMaxDeletes ||
|
||||||
|
nextEmptyRounds > kKBBackspaceClearEmptyContextMaxRounds ||
|
||||||
|
shouldStop) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NSInteger i = 0; i < batch; i++) {
|
|
||||||
[proxy deleteBackward];
|
|
||||||
}
|
|
||||||
|
|
||||||
NSInteger nextGuard = guard + batch;
|
|
||||||
BOOL shouldContinue = NO;
|
|
||||||
if (count > 0 && !hitBoundary) {
|
|
||||||
if (count > batch) {
|
|
||||||
shouldContinue = YES;
|
|
||||||
} else if ([proxy hasText]) {
|
|
||||||
shouldContinue = YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!shouldContinue) { return; }
|
|
||||||
__weak typeof(self) weakSelf = self;
|
__weak typeof(self) weakSelf = self;
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
|
||||||
(int64_t)(kKBBackspaceClearBatchInterval * NSEC_PER_SEC)),
|
(int64_t)(kKBBackspaceClearBatchInterval * NSEC_PER_SEC)),
|
||||||
@@ -513,7 +646,6 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)kb_capturePendingClearSnapshotIfNeeded {
|
- (void)kb_capturePendingClearSnapshotIfNeeded {
|
||||||
if ([KBBackspaceUndoManager shared].hasUndo) { return; }
|
|
||||||
if (self.pendingClearBefore.length > 0 || self.pendingClearAfter.length > 0) { return; }
|
if (self.pendingClearBefore.length > 0 || self.pendingClearAfter.length > 0) { return; }
|
||||||
UIResponder *start = (UIResponder *)([self kb_hostView] ?: self.backspaceButton);
|
UIResponder *start = (UIResponder *)([self kb_hostView] ?: self.backspaceButton);
|
||||||
UIInputViewController *ivc = KBFindInputViewController(start);
|
UIInputViewController *ivc = KBFindInputViewController(start);
|
||||||
@@ -521,6 +653,10 @@ typedef NS_ENUM(NSInteger, KBBackspaceChunkClass) {
|
|||||||
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
||||||
self.pendingClearBefore = proxy.documentContextBeforeInput ?: @"";
|
self.pendingClearBefore = proxy.documentContextBeforeInput ?: @"";
|
||||||
self.pendingClearAfter = proxy.documentContextAfterInput ?: @"";
|
self.pendingClearAfter = proxy.documentContextAfterInput ?: @"";
|
||||||
|
#if DEBUG
|
||||||
|
NSLog(@"[kb_capturePendingClearSnapshotIfNeeded/before] len=%lu text=%@", (unsigned long)self.pendingClearBefore.length, self.pendingClearBefore);
|
||||||
|
NSLog(@"[kb_capturePendingClearSnapshotIfNeeded/after] len=%lu text=%@", (unsigned long)self.pendingClearAfter.length, self.pendingClearAfter);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ extern NSNotificationName const KBBackspaceUndoStateDidChangeNotification;
|
|||||||
/// 记录一次“立刻清空”删除的内容(基于 documentContextBeforeInput/AfterInput)。
|
/// 记录一次“立刻清空”删除的内容(基于 documentContextBeforeInput/AfterInput)。
|
||||||
- (void)recordClearWithContextBefore:(NSString *)before after:(NSString *)after;
|
- (void)recordClearWithContextBefore:(NSString *)before after:(NSString *)after;
|
||||||
|
|
||||||
|
/// 记录本次将被 deleteBackward 的内容,并执行 deleteBackward(支持多次累计,撤销时一次性插回)。
|
||||||
|
- (void)captureAndDeleteBackwardFromProxy:(id<UITextDocumentProxy>)proxy count:(NSUInteger)count;
|
||||||
|
|
||||||
/// 在指定 responder 处执行撤销(向光标处插回删除的内容)
|
/// 在指定 responder 处执行撤销(向光标处插回删除的内容)
|
||||||
- (void)performUndoFromResponder:(UIResponder *)responder;
|
- (void)performUndoFromResponder:(UIResponder *)responder;
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,38 @@
|
|||||||
|
|
||||||
#import "KBBackspaceUndoManager.h"
|
#import "KBBackspaceUndoManager.h"
|
||||||
#import "KBResponderUtils.h"
|
#import "KBResponderUtils.h"
|
||||||
|
#import "KBInputBufferManager.h"
|
||||||
|
|
||||||
NSNotificationName const KBBackspaceUndoStateDidChangeNotification = @"KBBackspaceUndoStateDidChangeNotification";
|
NSNotificationName const KBBackspaceUndoStateDidChangeNotification = @"KBBackspaceUndoStateDidChangeNotification";
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
static NSString *KBLogString(NSString *tag, NSString *text) {
|
||||||
|
NSString *safeTag = tag ?: @"";
|
||||||
|
NSString *safeText = text ?: @"";
|
||||||
|
if (safeText.length <= 2000) {
|
||||||
|
return [NSString stringWithFormat:@"[%@] len=%lu text=%@", safeTag, (unsigned long)safeText.length, safeText];
|
||||||
|
}
|
||||||
|
NSString *head = [safeText substringToIndex:800];
|
||||||
|
NSString *tail = [safeText substringFromIndex:safeText.length - 800];
|
||||||
|
return [NSString stringWithFormat:@"[%@] len=%lu head=%@ ... tail=%@", safeTag, (unsigned long)safeText.length, head, tail];
|
||||||
|
}
|
||||||
|
#define KB_UNDO_LOG(tag, text) NSLog(@"%@", KBLogString((tag), (text)))
|
||||||
|
#else
|
||||||
|
#define KB_UNDO_LOG(tag, text) do {} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, KBUndoSnapshotSource) {
|
||||||
|
KBUndoSnapshotSourceNone = 0,
|
||||||
|
KBUndoSnapshotSourceDeletionSnapshot,
|
||||||
|
KBUndoSnapshotSourceClear
|
||||||
|
};
|
||||||
|
|
||||||
@interface KBBackspaceUndoManager ()
|
@interface KBBackspaceUndoManager ()
|
||||||
@property (nonatomic, copy) NSString *undoText;
|
@property (nonatomic, copy) NSString *undoText;
|
||||||
@property (nonatomic, assign) NSInteger undoAfterLength;
|
@property (nonatomic, assign) NSInteger undoAfterLength;
|
||||||
@property (nonatomic, assign) BOOL hasUndo;
|
@property (nonatomic, assign) BOOL hasUndo;
|
||||||
|
@property (nonatomic, assign) KBUndoSnapshotSource snapshotSource;
|
||||||
|
@property (nonatomic, strong) NSMutableArray<NSString *> *undoDeletedPieces;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation KBBackspaceUndoManager
|
@implementation KBBackspaceUndoManager
|
||||||
@@ -29,55 +54,189 @@ NSNotificationName const KBBackspaceUndoStateDidChangeNotification = @"KBBackspa
|
|||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
_undoText = @"";
|
_undoText = @"";
|
||||||
_undoAfterLength = 0;
|
_undoAfterLength = 0;
|
||||||
|
_snapshotSource = KBUndoSnapshotSourceNone;
|
||||||
|
_undoDeletedPieces = [NSMutableArray array];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)captureAndDeleteBackwardFromProxy:(id<UITextDocumentProxy>)proxy count:(NSUInteger)count {
|
||||||
|
if (!proxy || count == 0) { return; }
|
||||||
|
|
||||||
|
NSString *selected = proxy.selectedText ?: @"";
|
||||||
|
NSString *ctxBefore = proxy.documentContextBeforeInput ?: @"";
|
||||||
|
NSString *ctxAfter = proxy.documentContextAfterInput ?: @"";
|
||||||
|
NSUInteger ctxLen = ctxBefore.length + ctxAfter.length;
|
||||||
|
BOOL isSelectAllLike = (selected.length > 0 &&
|
||||||
|
(ctxLen == 0 || selected.length >= MAX((NSUInteger)40, ctxLen * 2)));
|
||||||
|
if (isSelectAllLike) {
|
||||||
|
// “全选删除”在微信/QQ中通常拿不到可靠的全文,因此禁用撤销,避免插回错误/不完整内容。
|
||||||
|
if (self.hasUndo) {
|
||||||
|
[self registerNonClearAction];
|
||||||
|
}
|
||||||
|
#if DEBUG
|
||||||
|
KB_UNDO_LOG(@"captureAndDelete/selectAllDisableUndo", selected);
|
||||||
|
#endif
|
||||||
|
[proxy deleteBackward];
|
||||||
|
[[KBInputBufferManager shared] resetWithText:@""];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!self.hasUndo) {
|
||||||
|
[self.undoDeletedPieces removeAllObjects];
|
||||||
|
self.undoText = @"";
|
||||||
|
self.undoAfterLength = 0;
|
||||||
|
self.snapshotSource = KBUndoSnapshotSourceDeletionSnapshot;
|
||||||
|
[self kb_updateHasUndo:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL didAppend = NO;
|
||||||
|
NSString *lastObservedBefore = nil;
|
||||||
|
for (NSUInteger i = 0; i < count; i++) {
|
||||||
|
NSString *before = proxy.documentContextBeforeInput ?: @"";
|
||||||
|
if (before.length > 0) {
|
||||||
|
// 若宿主在同一 runloop 内不更新 context,则跳过记录,避免把同一个字符重复记录成“多句”。
|
||||||
|
if (lastObservedBefore && [before isEqualToString:lastObservedBefore]) {
|
||||||
|
// still delete, but don't record
|
||||||
|
} else {
|
||||||
|
NSString *piece = [self kb_lastComposedCharacterFromString:before];
|
||||||
|
if (piece.length > 0) {
|
||||||
|
[self.undoDeletedPieces addObject:piece];
|
||||||
|
didAppend = YES;
|
||||||
|
}
|
||||||
|
lastObservedBefore = before;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[proxy deleteBackward];
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
if (didAppend) {
|
||||||
|
NSUInteger piecesCount = self.undoDeletedPieces.count;
|
||||||
|
if (piecesCount <= 20) {
|
||||||
|
KB_UNDO_LOG(@"captureAndDelete/undoInsertTextNow", [self kb_buildUndoInsertTextFromPieces]);
|
||||||
|
} else if (piecesCount % 50 == 0) {
|
||||||
|
NSString *lastPiece = self.undoDeletedPieces.lastObject ?: @"";
|
||||||
|
NSLog(@"[captureAndDelete/undoPieces] pieces=%lu lastPiece=%@",
|
||||||
|
(unsigned long)piecesCount,
|
||||||
|
lastPiece);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
- (void)recordDeletionSnapshotBefore:(NSString *)before after:(NSString *)after {
|
- (void)recordDeletionSnapshotBefore:(NSString *)before after:(NSString *)after {
|
||||||
if (self.undoText.length > 0) { return; }
|
if (self.hasUndo) { return; }
|
||||||
|
NSString *pending = [KBInputBufferManager shared].pendingClearSnapshot;
|
||||||
|
NSString *manual = [KBInputBufferManager shared].manualSnapshot;
|
||||||
|
NSString *fallbackText = (pending.length > 0) ? pending : ((manual.length > 0) ? manual : [KBInputBufferManager shared].liveText);
|
||||||
|
if (fallbackText.length > 0) {
|
||||||
|
self.undoText = fallbackText;
|
||||||
|
self.undoAfterLength = 0;
|
||||||
|
self.snapshotSource = KBUndoSnapshotSourceDeletionSnapshot;
|
||||||
|
KB_UNDO_LOG(@"recordDeletionSnapshot/fallback", self.undoText);
|
||||||
|
[self kb_updateHasUndo:YES];
|
||||||
|
return;
|
||||||
|
}
|
||||||
NSString *safeBefore = before ?: @"";
|
NSString *safeBefore = before ?: @"";
|
||||||
NSString *safeAfter = after ?: @"";
|
NSString *safeAfter = after ?: @"";
|
||||||
NSString *full = [safeBefore stringByAppendingString:safeAfter];
|
NSString *full = [safeBefore stringByAppendingString:safeAfter];
|
||||||
if (full.length == 0) { return; }
|
if (full.length == 0) { return; }
|
||||||
self.undoText = full;
|
self.undoText = full;
|
||||||
self.undoAfterLength = (NSInteger)safeAfter.length;
|
self.undoAfterLength = (NSInteger)safeAfter.length;
|
||||||
|
self.snapshotSource = KBUndoSnapshotSourceDeletionSnapshot;
|
||||||
|
KB_UNDO_LOG(@"recordDeletionSnapshot/context", self.undoText);
|
||||||
|
[self kb_updateHasUndo:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)recordClearWithContextBefore:(NSString *)before after:(NSString *)after {
|
- (void)recordClearWithContextBefore:(NSString *)before after:(NSString *)after {
|
||||||
if (self.undoText.length == 0) {
|
NSString *pending = [KBInputBufferManager shared].pendingClearSnapshot;
|
||||||
|
NSString *manual = [KBInputBufferManager shared].manualSnapshot;
|
||||||
|
NSString *fallbackText = (pending.length > 0) ? pending : ((manual.length > 0) ? manual : [KBInputBufferManager shared].liveText);
|
||||||
|
|
||||||
NSString *safeBefore = before ?: @"";
|
NSString *safeBefore = before ?: @"";
|
||||||
NSString *safeAfter = after ?: @"";
|
NSString *safeAfter = after ?: @"";
|
||||||
NSString *full = [safeBefore stringByAppendingString:safeAfter];
|
NSString *contextText = [[safeBefore stringByAppendingString:safeAfter] copy];
|
||||||
if (full.length > 0) {
|
|
||||||
self.undoText = full;
|
NSString *candidate = (fallbackText.length > 0) ? fallbackText : contextText;
|
||||||
self.undoAfterLength = (NSInteger)safeAfter.length;
|
NSInteger candidateAfterLen = (fallbackText.length > 0) ? 0 : (NSInteger)safeAfter.length;
|
||||||
|
|
||||||
|
if (candidate.length == 0) { return; }
|
||||||
|
|
||||||
|
KB_UNDO_LOG(@"recordClear/candidate", candidate);
|
||||||
|
|
||||||
|
if (self.undoText.length > 0) {
|
||||||
|
if (self.snapshotSource == KBUndoSnapshotSourceClear) {
|
||||||
|
KB_UNDO_LOG(@"recordClear/ignored(alreadyClear)", self.undoText);
|
||||||
|
[self kb_updateHasUndo:YES];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (self.snapshotSource == KBUndoSnapshotSourceDeletionSnapshot) {
|
||||||
|
if (candidate.length > self.undoText.length) {
|
||||||
|
self.undoText = candidate;
|
||||||
|
self.undoAfterLength = candidateAfterLen;
|
||||||
|
KB_UNDO_LOG(@"recordClear/upgradedFromDeletion", self.undoText);
|
||||||
|
} else {
|
||||||
|
KB_UNDO_LOG(@"recordClear/keepDeletionSnapshot", self.undoText);
|
||||||
|
}
|
||||||
|
self.snapshotSource = KBUndoSnapshotSourceClear;
|
||||||
|
[self kb_updateHasUndo:YES];
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self.undoText.length == 0) { return; }
|
|
||||||
|
self.undoText = candidate;
|
||||||
|
self.undoAfterLength = candidateAfterLen;
|
||||||
|
self.snapshotSource = KBUndoSnapshotSourceClear;
|
||||||
|
KB_UNDO_LOG(@"recordClear/set", self.undoText);
|
||||||
[self kb_updateHasUndo:YES];
|
[self kb_updateHasUndo:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)performUndoFromResponder:(UIResponder *)responder {
|
- (void)performUndoFromResponder:(UIResponder *)responder {
|
||||||
if (self.undoText.length == 0) { return; }
|
if (!self.hasUndo) { return; }
|
||||||
UIInputViewController *ivc = KBFindInputViewController(responder);
|
UIInputViewController *ivc = KBFindInputViewController(responder);
|
||||||
if (!ivc) { return; }
|
if (!ivc) { return; }
|
||||||
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
||||||
|
NSString *curBefore = proxy.documentContextBeforeInput ?: @"";
|
||||||
|
NSString *curAfter = proxy.documentContextAfterInput ?: @"";
|
||||||
|
KB_UNDO_LOG(@"performUndo/currentBefore", curBefore);
|
||||||
|
KB_UNDO_LOG(@"performUndo/currentAfter", curAfter);
|
||||||
|
NSString *insertText = [self kb_buildUndoInsertTextFromPieces];
|
||||||
|
if (insertText.length > 0) {
|
||||||
|
KB_UNDO_LOG(@"performUndo/insertDeletedText", insertText);
|
||||||
|
[proxy insertText:insertText];
|
||||||
|
[[KBInputBufferManager shared] appendText:insertText];
|
||||||
|
} else if (self.undoText.length > 0) {
|
||||||
|
KB_UNDO_LOG(@"performUndo/fallbackUndoText", self.undoText);
|
||||||
[self kb_clearAllTextForProxy:proxy];
|
[self kb_clearAllTextForProxy:proxy];
|
||||||
[proxy insertText:self.undoText];
|
[proxy insertText:self.undoText];
|
||||||
if (self.undoAfterLength > 0 &&
|
if (self.undoAfterLength > 0 &&
|
||||||
[proxy respondsToSelector:@selector(adjustTextPositionByCharacterOffset:)]) {
|
[proxy respondsToSelector:@selector(adjustTextPositionByCharacterOffset:)]) {
|
||||||
[proxy adjustTextPositionByCharacterOffset:-self.undoAfterLength];
|
[proxy adjustTextPositionByCharacterOffset:-self.undoAfterLength];
|
||||||
}
|
}
|
||||||
|
[[KBInputBufferManager shared] resetWithText:self.undoText];
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
self.undoText = @"";
|
self.undoText = @"";
|
||||||
self.undoAfterLength = 0;
|
self.undoAfterLength = 0;
|
||||||
|
self.snapshotSource = KBUndoSnapshotSourceNone;
|
||||||
|
[self.undoDeletedPieces removeAllObjects];
|
||||||
[self kb_updateHasUndo:NO];
|
[self kb_updateHasUndo:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)registerNonClearAction {
|
- (void)registerNonClearAction {
|
||||||
if (self.undoText.length == 0) { return; }
|
if (!self.hasUndo) { return; }
|
||||||
|
if (self.undoText.length > 0) {
|
||||||
|
KB_UNDO_LOG(@"registerNonClearAction/clearUndoText", self.undoText);
|
||||||
|
}
|
||||||
|
if (self.undoDeletedPieces.count > 0) {
|
||||||
|
KB_UNDO_LOG(@"registerNonClearAction/clearDeletedPieces", [self kb_buildUndoInsertTextFromPieces]);
|
||||||
|
}
|
||||||
self.undoText = @"";
|
self.undoText = @"";
|
||||||
self.undoAfterLength = 0;
|
self.undoAfterLength = 0;
|
||||||
|
self.snapshotSource = KBUndoSnapshotSourceNone;
|
||||||
|
[self.undoDeletedPieces removeAllObjects];
|
||||||
[self kb_updateHasUndo:NO];
|
[self kb_updateHasUndo:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,6 +248,29 @@ NSNotificationName const KBBackspaceUndoStateDidChangeNotification = @"KBBackspa
|
|||||||
[[NSNotificationCenter defaultCenter] postNotificationName:KBBackspaceUndoStateDidChangeNotification object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:KBBackspaceUndoStateDidChangeNotification object:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)kb_lastComposedCharacterFromString:(NSString *)text {
|
||||||
|
if (text.length == 0) { return @""; }
|
||||||
|
__block NSString *last = @"";
|
||||||
|
[text enumerateSubstringsInRange:NSMakeRange(0, text.length)
|
||||||
|
options:NSStringEnumerationByComposedCharacterSequences | NSStringEnumerationReverse
|
||||||
|
usingBlock:^(NSString *substring, __unused NSRange substringRange, __unused NSRange enclosingRange, BOOL *stop) {
|
||||||
|
last = substring ?: @"";
|
||||||
|
*stop = YES;
|
||||||
|
}];
|
||||||
|
return last ?: @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)kb_buildUndoInsertTextFromPieces {
|
||||||
|
if (self.undoDeletedPieces.count == 0) { return @""; }
|
||||||
|
NSMutableString *result = [NSMutableString string];
|
||||||
|
for (NSInteger i = (NSInteger)self.undoDeletedPieces.count - 1; i >= 0; i--) {
|
||||||
|
NSString *piece = self.undoDeletedPieces[(NSUInteger)i] ?: @"";
|
||||||
|
if (piece.length == 0) { continue; }
|
||||||
|
[result appendString:piece];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static const NSInteger kKBUndoClearMaxRounds = 200;
|
static const NSInteger kKBUndoClearMaxRounds = 200;
|
||||||
|
|
||||||
- (void)kb_clearAllTextForProxy:(id<UITextDocumentProxy>)proxy {
|
- (void)kb_clearAllTextForProxy:(id<UITextDocumentProxy>)proxy {
|
||||||
|
|||||||
34
CustomKeyboard/Utils/KBInputBufferManager.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@protocol UITextDocumentProxy;
|
||||||
|
|
||||||
|
@interface KBInputBufferManager : NSObject
|
||||||
|
|
||||||
|
+ (instancetype)shared;
|
||||||
|
|
||||||
|
@property (nonatomic, copy, readonly) NSString *liveText;
|
||||||
|
@property (nonatomic, copy, readonly) NSString *manualSnapshot;
|
||||||
|
@property (nonatomic, copy, readonly) NSString *pendingClearSnapshot;
|
||||||
|
|
||||||
|
- (void)seedIfEmptyWithContextBefore:(nullable NSString *)before after:(nullable NSString *)after;
|
||||||
|
- (void)updateFromExternalContextBefore:(nullable NSString *)before after:(nullable NSString *)after;
|
||||||
|
- (void)refreshFromProxyIfPossible:(nullable id<UITextDocumentProxy>)proxy;
|
||||||
|
- (void)prepareSnapshotForDeleteWithContextBefore:(nullable NSString *)before
|
||||||
|
after:(nullable NSString *)after;
|
||||||
|
- (void)beginPendingClearSnapshot;
|
||||||
|
- (void)clearPendingClearSnapshot;
|
||||||
|
- (void)resetWithText:(NSString *)text;
|
||||||
|
- (void)appendText:(NSString *)text;
|
||||||
|
- (void)deleteBackwardByCount:(NSUInteger)count;
|
||||||
|
- (void)replaceTailWithText:(NSString *)text deleteCount:(NSUInteger)count;
|
||||||
|
- (void)applyHoldDeleteCount:(NSUInteger)count;
|
||||||
|
- (void)applyClearDeleteCount:(NSUInteger)count;
|
||||||
|
- (void)clearAllLiveText;
|
||||||
|
- (void)commitLiveToManual;
|
||||||
|
- (void)restoreManualSnapshot;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
279
CustomKeyboard/Utils/KBInputBufferManager.m
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
#import "KBInputBufferManager.h"
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
static NSString *KBLogString2(NSString *tag, NSString *text) {
|
||||||
|
NSString *safeTag = tag ?: @"";
|
||||||
|
NSString *safeText = text ?: @"";
|
||||||
|
if (safeText.length <= 2000) {
|
||||||
|
return [NSString stringWithFormat:@"[%@] len=%lu text=%@", safeTag, (unsigned long)safeText.length, safeText];
|
||||||
|
}
|
||||||
|
NSString *head = [safeText substringToIndex:800];
|
||||||
|
NSString *tail = [safeText substringFromIndex:safeText.length - 800];
|
||||||
|
return [NSString stringWithFormat:@"[%@] len=%lu head=%@ ... tail=%@", safeTag, (unsigned long)safeText.length, head, tail];
|
||||||
|
}
|
||||||
|
#define KB_BUF_LOG(tag, text) NSLog(@"❤️=%@", KBLogString2((tag), (text)))
|
||||||
|
#else
|
||||||
|
#define KB_BUF_LOG(tag, text) do {} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@interface KBInputBufferManager ()
|
||||||
|
@property (nonatomic, copy, readwrite) NSString *liveText;
|
||||||
|
@property (nonatomic, copy, readwrite) NSString *manualSnapshot;
|
||||||
|
@property (nonatomic, copy, readwrite) NSString *pendingClearSnapshot;
|
||||||
|
@property (nonatomic, assign) BOOL manualSnapshotDirty;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation KBInputBufferManager
|
||||||
|
|
||||||
|
+ (instancetype)shared {
|
||||||
|
static KBInputBufferManager *mgr = nil;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
mgr = [[KBInputBufferManager alloc] init];
|
||||||
|
});
|
||||||
|
return mgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (instancetype)init {
|
||||||
|
if (self = [super init]) {
|
||||||
|
_liveText = @"";
|
||||||
|
_manualSnapshot = @"";
|
||||||
|
_pendingClearSnapshot = @"";
|
||||||
|
_manualSnapshotDirty = NO;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)seedIfEmptyWithContextBefore:(NSString *)before after:(NSString *)after {
|
||||||
|
if (self.liveText.length > 0 || self.manualSnapshot.length > 0) { return; }
|
||||||
|
NSString *safeBefore = before ?: @"";
|
||||||
|
NSString *safeAfter = after ?: @"";
|
||||||
|
NSString *full = [safeBefore stringByAppendingString:safeAfter];
|
||||||
|
if (full.length == 0) { return; }
|
||||||
|
self.liveText = full;
|
||||||
|
self.manualSnapshot = full;
|
||||||
|
self.manualSnapshotDirty = NO;
|
||||||
|
KB_BUF_LOG(@"seedIfEmpty", full);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)updateFromExternalContextBefore:(NSString *)before after:(NSString *)after {
|
||||||
|
NSString *safeBefore = before ?: @"";
|
||||||
|
NSString *safeAfter = after ?: @"";
|
||||||
|
NSString *context = [safeBefore stringByAppendingString:safeAfter];
|
||||||
|
if (context.length == 0) { return; }
|
||||||
|
|
||||||
|
// 微信/QQ 等宿主通常只提供光标附近“截断窗口”,不应当作为全文快照。
|
||||||
|
// 这里只更新 liveText,给删除/清空逻辑做参考;manualSnapshot 仅由键盘自身输入/撤销来维护。
|
||||||
|
self.liveText = context;
|
||||||
|
self.manualSnapshotDirty = YES;
|
||||||
|
#if DEBUG
|
||||||
|
static NSUInteger sExternalLogCounter = 0;
|
||||||
|
sExternalLogCounter += 1;
|
||||||
|
if (sExternalLogCounter % 12 == 0) {
|
||||||
|
KB_BUF_LOG(@"updateFromExternalContext/liveOnly", context);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)refreshFromProxyIfPossible:(id<UITextDocumentProxy>)proxy {
|
||||||
|
NSString *harvested = [self kb_harvestFullTextFromProxy:proxy];
|
||||||
|
if (harvested.length == 0) {
|
||||||
|
KB_BUF_LOG(@"refreshFromProxy/failedOrUnsupported", @"");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL manualEmpty = (self.manualSnapshot.length == 0);
|
||||||
|
BOOL longerThanManual = (harvested.length > self.manualSnapshot.length);
|
||||||
|
if (!(manualEmpty || longerThanManual)) {
|
||||||
|
KB_BUF_LOG(@"refreshFromProxy/ignoredShorter", harvested);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.liveText = harvested;
|
||||||
|
self.manualSnapshot = harvested;
|
||||||
|
self.manualSnapshotDirty = NO;
|
||||||
|
KB_BUF_LOG(@"refreshFromProxy/accepted", harvested);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)prepareSnapshotForDeleteWithContextBefore:(NSString *)before
|
||||||
|
after:(NSString *)after {
|
||||||
|
NSString *safeBefore = before ?: @"";
|
||||||
|
NSString *safeAfter = after ?: @"";
|
||||||
|
NSString *context = [safeBefore stringByAppendingString:safeAfter];
|
||||||
|
|
||||||
|
BOOL manualValid = (self.manualSnapshot.length > 0 &&
|
||||||
|
(context.length == 0 ||
|
||||||
|
(self.manualSnapshot.length >= context.length &&
|
||||||
|
[self.manualSnapshot rangeOfString:context].location != NSNotFound)));
|
||||||
|
if (manualValid) { return; }
|
||||||
|
|
||||||
|
if (self.liveText.length > 0) {
|
||||||
|
self.manualSnapshot = self.liveText;
|
||||||
|
self.manualSnapshotDirty = NO;
|
||||||
|
KB_BUF_LOG(@"prepareSnapshotForDelete/fromLiveText", self.manualSnapshot);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (context.length > 0) {
|
||||||
|
self.manualSnapshot = context;
|
||||||
|
self.manualSnapshotDirty = NO;
|
||||||
|
KB_BUF_LOG(@"prepareSnapshotForDelete/fromContext", self.manualSnapshot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)beginPendingClearSnapshot {
|
||||||
|
if (self.pendingClearSnapshot.length > 0) { return; }
|
||||||
|
if (self.manualSnapshot.length > 0) {
|
||||||
|
self.pendingClearSnapshot = self.manualSnapshot;
|
||||||
|
KB_BUF_LOG(@"beginPendingClearSnapshot/fromManual", self.pendingClearSnapshot);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (self.liveText.length > 0) {
|
||||||
|
self.pendingClearSnapshot = self.liveText;
|
||||||
|
KB_BUF_LOG(@"beginPendingClearSnapshot/fromLive", self.pendingClearSnapshot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)clearPendingClearSnapshot {
|
||||||
|
self.pendingClearSnapshot = @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)resetWithText:(NSString *)text {
|
||||||
|
NSString *safe = text ?: @"";
|
||||||
|
self.liveText = safe;
|
||||||
|
self.manualSnapshot = safe;
|
||||||
|
self.pendingClearSnapshot = @"";
|
||||||
|
self.manualSnapshotDirty = NO;
|
||||||
|
KB_BUF_LOG(@"resetWithText", safe);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)appendText:(NSString *)text {
|
||||||
|
if (text.length == 0) { return; }
|
||||||
|
[self kb_syncManualSnapshotIfNeeded];
|
||||||
|
self.liveText = [self.liveText stringByAppendingString:text];
|
||||||
|
self.manualSnapshot = [self.manualSnapshot stringByAppendingString:text];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)deleteBackwardByCount:(NSUInteger)count {
|
||||||
|
if (count == 0) { return; }
|
||||||
|
self.liveText = [self kb_stringByDeletingComposedCharacters:count from:self.liveText];
|
||||||
|
self.manualSnapshot = [self kb_stringByDeletingComposedCharacters:count from:self.manualSnapshot];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)replaceTailWithText:(NSString *)text deleteCount:(NSUInteger)count {
|
||||||
|
[self kb_syncManualSnapshotIfNeeded];
|
||||||
|
[self deleteBackwardByCount:count];
|
||||||
|
[self appendText:text];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applyHoldDeleteCount:(NSUInteger)count {
|
||||||
|
if (count == 0) { return; }
|
||||||
|
self.liveText = [self kb_stringByDeletingComposedCharacters:count from:self.liveText];
|
||||||
|
self.manualSnapshotDirty = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applyClearDeleteCount:(NSUInteger)count {
|
||||||
|
if (count == 0) { return; }
|
||||||
|
self.liveText = [self kb_stringByDeletingComposedCharacters:count from:self.liveText];
|
||||||
|
self.manualSnapshotDirty = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)clearAllLiveText {
|
||||||
|
self.liveText = @"";
|
||||||
|
self.pendingClearSnapshot = @"";
|
||||||
|
self.manualSnapshotDirty = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)commitLiveToManual {
|
||||||
|
self.manualSnapshot = self.liveText ?: @"";
|
||||||
|
self.manualSnapshotDirty = NO;
|
||||||
|
KB_BUF_LOG(@"commitLiveToManual", self.manualSnapshot);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)restoreManualSnapshot {
|
||||||
|
self.liveText = self.manualSnapshot ?: @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Helpers
|
||||||
|
|
||||||
|
- (void)kb_syncManualSnapshotIfNeeded {
|
||||||
|
if (!self.manualSnapshotDirty) { return; }
|
||||||
|
self.manualSnapshot = self.liveText ?: @"";
|
||||||
|
self.manualSnapshotDirty = NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)kb_stringByDeletingComposedCharacters:(NSUInteger)count
|
||||||
|
from:(NSString *)text {
|
||||||
|
if (count == 0) { return text ?: @""; }
|
||||||
|
NSString *source = text ?: @"";
|
||||||
|
if (source.length == 0) { return @""; }
|
||||||
|
|
||||||
|
__block NSUInteger removed = 0;
|
||||||
|
__block NSUInteger endIndex = source.length;
|
||||||
|
[source enumerateSubstringsInRange:NSMakeRange(0, source.length)
|
||||||
|
options:NSStringEnumerationByComposedCharacterSequences | NSStringEnumerationReverse
|
||||||
|
usingBlock:^(__unused NSString *substring, NSRange substringRange, __unused NSRange enclosingRange, BOOL *stop) {
|
||||||
|
removed += 1;
|
||||||
|
endIndex = substringRange.location;
|
||||||
|
if (removed >= count) {
|
||||||
|
*stop = YES;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
if (removed < count) { return @""; }
|
||||||
|
return [source substringToIndex:endIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)kb_harvestFullTextFromProxy:(id<UITextDocumentProxy>)proxy {
|
||||||
|
if (!proxy) { return @""; }
|
||||||
|
if (![proxy respondsToSelector:@selector(adjustTextPositionByCharacterOffset:)]) { return @""; }
|
||||||
|
|
||||||
|
static const NSInteger kKBHarvestMaxRounds = 160;
|
||||||
|
static const NSInteger kKBHarvestMaxChars = 50000;
|
||||||
|
|
||||||
|
NSInteger movedToEnd = 0;
|
||||||
|
NSInteger movedLeft = 0;
|
||||||
|
NSMutableArray<NSString *> *chunks = [NSMutableArray array];
|
||||||
|
NSInteger totalChars = 0;
|
||||||
|
|
||||||
|
@try {
|
||||||
|
NSInteger guard = 0;
|
||||||
|
NSString *after = proxy.documentContextAfterInput ?: @"";
|
||||||
|
while (after.length > 0 && guard < kKBHarvestMaxRounds) {
|
||||||
|
NSInteger step = (NSInteger)after.length;
|
||||||
|
[(id)proxy adjustTextPositionByCharacterOffset:step];
|
||||||
|
movedToEnd += step;
|
||||||
|
guard += 1;
|
||||||
|
after = proxy.documentContextAfterInput ?: @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
guard = 0;
|
||||||
|
NSString *before = proxy.documentContextBeforeInput ?: @"";
|
||||||
|
while (before.length > 0 && guard < kKBHarvestMaxRounds && totalChars < kKBHarvestMaxChars) {
|
||||||
|
[chunks addObject:before];
|
||||||
|
totalChars += (NSInteger)before.length;
|
||||||
|
NSInteger step = (NSInteger)before.length;
|
||||||
|
[(id)proxy adjustTextPositionByCharacterOffset:-step];
|
||||||
|
movedLeft += step;
|
||||||
|
guard += 1;
|
||||||
|
before = proxy.documentContextBeforeInput ?: @"";
|
||||||
|
}
|
||||||
|
} @finally {
|
||||||
|
if (movedLeft != 0) {
|
||||||
|
[(id)proxy adjustTextPositionByCharacterOffset:movedLeft];
|
||||||
|
}
|
||||||
|
if (movedToEnd != 0) {
|
||||||
|
[(id)proxy adjustTextPositionByCharacterOffset:-movedToEnd];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chunks.count == 0) { return @""; }
|
||||||
|
NSMutableString *result = [NSMutableString stringWithCapacity:(NSUInteger)totalChars];
|
||||||
|
for (NSInteger i = (NSInteger)chunks.count - 1; i >= 0; i--) {
|
||||||
|
NSString *part = chunks[(NSUInteger)i] ?: @"";
|
||||||
|
if (part.length == 0) { continue; }
|
||||||
|
[result appendString:part];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#import "KBFunctionTagListView.h"
|
#import "KBFunctionTagListView.h"
|
||||||
#import "KBFunctionTagCell.h"
|
#import "KBFunctionTagCell.h"
|
||||||
|
#import "KBMaiPointReporter.h"
|
||||||
|
|
||||||
static NSString * const kKBFunctionTagCellId2 = @"KBFunctionTagCellId2";
|
static NSString * const kKBFunctionTagCellId2 = @"KBFunctionTagCellId2";
|
||||||
static CGFloat const kKBItemSpace = 4;
|
static CGFloat const kKBItemSpace = 4;
|
||||||
@@ -66,8 +67,23 @@ static CGFloat const kKBItemSpace = 4;
|
|||||||
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { return kKBItemSpace; }
|
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { return kKBItemSpace; }
|
||||||
|
|
||||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
if ([self.delegate respondsToSelector:@selector(tagListView:didSelectIndex:title:)]) {
|
|
||||||
KBTagItemModel *model = (indexPath.item < self.items.count) ? self.items[indexPath.item] : [KBTagItemModel new];
|
KBTagItemModel *model = (indexPath.item < self.items.count) ? self.items[indexPath.item] : [KBTagItemModel new];
|
||||||
|
NSInteger personaId = 0;
|
||||||
|
if ([model isKindOfClass:KBTagItemModel.class]) {
|
||||||
|
personaId = model.characterId > 0 ? model.characterId : model.tagId;
|
||||||
|
}
|
||||||
|
NSMutableDictionary *extra = [NSMutableDictionary dictionary];
|
||||||
|
extra[@"index"] = @(indexPath.item);
|
||||||
|
extra[@"id"] = @(personaId);
|
||||||
|
if ([model.characterName isKindOfClass:NSString.class] && model.characterName.length > 0) {
|
||||||
|
extra[@"name"] = model.characterName;
|
||||||
|
}
|
||||||
|
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_keyboard_function_tag_item"
|
||||||
|
pageId:@"keyboard_function_panel"
|
||||||
|
elementId:@"renshe_item"
|
||||||
|
extra:extra.copy
|
||||||
|
completion:nil];
|
||||||
|
if ([self.delegate respondsToSelector:@selector(tagListView:didSelectIndex:title:)]) {
|
||||||
[self.delegate tagListView:self didSelectIndex:indexPath.item title:model.characterName];
|
[self.delegate tagListView:self didSelectIndex:indexPath.item title:model.characterName];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "KBFunctionTagCell.h"
|
#import "KBFunctionTagCell.h"
|
||||||
|
#import "KBFunctionView.h"
|
||||||
#import "Masonry.h"
|
#import "Masonry.h"
|
||||||
|
|
||||||
@interface KBFunctionTagCell ()
|
@interface KBFunctionTagCell ()
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
|
|
||||||
- (instancetype)initWithFrame:(CGRect)frame {
|
- (instancetype)initWithFrame:(CGRect)frame {
|
||||||
if (self = [super initWithFrame:frame]) {
|
if (self = [super initWithFrame:frame]) {
|
||||||
self.contentView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9];
|
self.contentView.backgroundColor = [KBFunctionView kb_cellBackgroundColor];
|
||||||
self.contentView.layer.cornerRadius = 12;
|
self.contentView.layer.cornerRadius = 12;
|
||||||
self.contentView.layer.masksToBounds = YES;
|
self.contentView.layer.masksToBounds = YES;
|
||||||
|
|
||||||
@@ -73,7 +74,6 @@
|
|||||||
_emojiLabel.textAlignment = NSTextAlignmentCenter;
|
_emojiLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
_emojiLabel.font = [KBFont medium:20];
|
_emojiLabel.font = [KBFont medium:20];
|
||||||
_emojiLabel.adjustsFontSizeToFitWidth = YES;
|
_emojiLabel.adjustsFontSizeToFitWidth = YES;
|
||||||
|
|
||||||
}
|
}
|
||||||
return _emojiLabel;
|
return _emojiLabel;
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
if (!_titleLabelInternal) {
|
if (!_titleLabelInternal) {
|
||||||
_titleLabelInternal = [[UILabel alloc] init];
|
_titleLabelInternal = [[UILabel alloc] init];
|
||||||
_titleLabelInternal.font = [KBFont medium:10];
|
_titleLabelInternal.font = [KBFont medium:10];
|
||||||
_titleLabelInternal.textColor = [UIColor colorWithHex:0x1B1F1A];
|
_titleLabelInternal.textColor = [KBFunctionView kb_cellTextColor];
|
||||||
// 最多两行,文本过长时末尾截断
|
// 最多两行,文本过长时末尾截断
|
||||||
_titleLabelInternal.numberOfLines = 2;
|
_titleLabelInternal.numberOfLines = 2;
|
||||||
_titleLabelInternal.lineBreakMode = NSLineBreakByTruncatingTail;
|
_titleLabelInternal.lineBreakMode = NSLineBreakByTruncatingTail;
|
||||||
@@ -91,14 +91,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
|
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
|
||||||
static UIActivityIndicatorViewStyle KBSpinnerStyle(void) { return UIActivityIndicatorViewStyleMedium; }
|
static UIActivityIndicatorViewStyle KBSpinnerStyle(void) {
|
||||||
|
return UIActivityIndicatorViewStyleMedium;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
static UIActivityIndicatorViewStyle KBSpinnerStyle(void) { return UIActivityIndicatorViewStyleGray; }
|
static UIActivityIndicatorViewStyle KBSpinnerStyle(void) {
|
||||||
|
return UIActivityIndicatorViewStyleGray;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
- (UIActivityIndicatorView *)loadingView {
|
- (UIActivityIndicatorView *)loadingView {
|
||||||
if (!_loadingView) {
|
if (!_loadingView) {
|
||||||
_loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:KBSpinnerStyle()];
|
_loadingView = [[UIActivityIndicatorView alloc]
|
||||||
|
initWithActivityIndicatorStyle:KBSpinnerStyle()];
|
||||||
_loadingView.hidesWhenStopped = YES;
|
_loadingView.hidesWhenStopped = YES;
|
||||||
_loadingView.color = [UIColor grayColor];
|
_loadingView.color = [UIColor grayColor];
|
||||||
_loadingView.hidden = YES;
|
_loadingView.hidden = YES;
|
||||||
@@ -108,7 +113,9 @@ static UIActivityIndicatorViewStyle KBSpinnerStyle(void) { return UIActivityIndi
|
|||||||
|
|
||||||
#pragma mark - Expose
|
#pragma mark - Expose
|
||||||
|
|
||||||
- (UILabel *)titleLabel { return self.titleLabelInternal; }
|
- (UILabel *)titleLabel {
|
||||||
|
return self.titleLabelInternal;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setLoading:(BOOL)loading {
|
- (void)setLoading:(BOOL)loading {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
|
|||||||
@@ -10,9 +10,12 @@
|
|||||||
|
|
||||||
@protocol KBFunctionViewDelegate <NSObject>
|
@protocol KBFunctionViewDelegate <NSObject>
|
||||||
@optional
|
@optional
|
||||||
- (void)functionView:(KBFunctionView *_Nullable)functionView didTapToolActionAtIndex:(NSInteger)index;
|
- (void)functionView:(KBFunctionView *_Nullable)functionView
|
||||||
- (void)functionView:(KBFunctionView *_Nullable)functionView didRightTapToolActionAtIndex:(NSInteger)index;
|
didTapToolActionAtIndex:(NSInteger)index;
|
||||||
- (void)functionViewDidRequestSubscription:(KBFunctionView *_Nullable)functionView;
|
- (void)functionView:(KBFunctionView *_Nullable)functionView
|
||||||
|
didRightTapToolActionAtIndex:(NSInteger)index;
|
||||||
|
- (void)functionViewDidRequestSubscription:
|
||||||
|
(KBFunctionView *_Nullable)functionView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -23,9 +26,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@property(nonatomic, weak) id<KBFunctionViewDelegate> delegate;
|
@property(nonatomic, weak) id<KBFunctionViewDelegate> delegate;
|
||||||
|
|
||||||
|
@property(nonatomic, strong, readonly)
|
||||||
@property (nonatomic, strong, readonly) UICollectionView *collectionView; // 话术分类/标签列表
|
UICollectionView *collectionView; // 话术分类/标签列表
|
||||||
@property (nonatomic, strong, readonly) NSArray<NSString *> *items; // 简单数据源(演示用)
|
@property(nonatomic, strong, readonly)
|
||||||
|
NSArray<NSString *> *items; // 简单数据源(演示用)
|
||||||
|
|
||||||
// 子视图暴露,便于外部接入事件
|
// 子视图暴露,便于外部接入事件
|
||||||
@property(nonatomic, strong, readonly) KBFunctionBarView *barView;
|
@property(nonatomic, strong, readonly) KBFunctionBarView *barView;
|
||||||
@@ -39,6 +43,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// 应用当前皮肤(更新背景/强调色)
|
/// 应用当前皮肤(更新背景/强调色)
|
||||||
- (void)kb_applyTheme;
|
- (void)kb_applyTheme;
|
||||||
|
|
||||||
|
#pragma mark - Theme Colors (用于 Cell 获取暗黑模式颜色)
|
||||||
|
|
||||||
|
/// Cell 背景色:暗黑 #707070,浅色 白色90%透明度
|
||||||
|
+ (UIColor *)kb_cellBackgroundColor;
|
||||||
|
|
||||||
|
/// Cell 文字颜色:暗黑 #FFFFFF,浅色 #1B1F1A
|
||||||
|
+ (UIColor *)kb_cellTextColor;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -6,29 +6,32 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "KBFunctionView.h"
|
#import "KBFunctionView.h"
|
||||||
#import "KBResponderUtils.h" // 统一查找 UIInputViewController 的工具
|
#import "KBAuthManager.h" // 登录态判断(共享钥匙串)
|
||||||
|
#import "KBBackspaceLongPressHandler.h"
|
||||||
|
#import "KBBackspaceUndoManager.h"
|
||||||
|
#import "KBBizCode.h"
|
||||||
|
#import "KBFullAccessGuideView.h"
|
||||||
|
#import "KBFullAccessManager.h"
|
||||||
#import "KBFunctionBarView.h"
|
#import "KBFunctionBarView.h"
|
||||||
#import "KBFunctionPasteView.h"
|
#import "KBFunctionPasteView.h"
|
||||||
#import "KBFunctionTagCell.h"
|
#import "KBFunctionTagCell.h"
|
||||||
#import "Masonry.h"
|
|
||||||
#import <MBProgressHUD.h>
|
|
||||||
#import "KBFullAccessGuideView.h"
|
|
||||||
#import "KBFullAccessManager.h"
|
|
||||||
#import "KBSkinManager.h"
|
|
||||||
#import "KBAuthManager.h" // 登录态判断(共享钥匙串)
|
|
||||||
#import "KBULBridgeNotification.h" // Darwin 通知常量(UL 已处理)
|
|
||||||
#import "KBHostAppLauncher.h"
|
|
||||||
#import "KBStreamTextView.h" // 流式文本视图
|
|
||||||
#import "KBStreamOverlayView.h" // 带关闭按钮的流式层
|
|
||||||
#import "KBFunctionTagListView.h"
|
#import "KBFunctionTagListView.h"
|
||||||
#import "WJXEventSource.h"
|
#import "KBHostAppLauncher.h"
|
||||||
|
#import "KBInputBufferManager.h"
|
||||||
|
#import "KBResponderUtils.h" // 统一查找 UIInputViewController 的工具
|
||||||
|
#import "KBSkinManager.h"
|
||||||
|
#import "KBStreamOverlayView.h" // 带关闭按钮的流式层
|
||||||
|
#import "KBStreamTextView.h" // 流式文本视图
|
||||||
#import "KBTagItemModel.h"
|
#import "KBTagItemModel.h"
|
||||||
|
#import "KBULBridgeNotification.h" // Darwin 通知常量(UL 已处理)
|
||||||
|
#import "Masonry.h"
|
||||||
|
#import "WJXEventSource.h"
|
||||||
|
#import <MBProgressHUD.h>
|
||||||
#import <MJExtension/MJExtension.h>
|
#import <MJExtension/MJExtension.h>
|
||||||
#import "KBBizCode.h"
|
|
||||||
#import "KBBackspaceLongPressHandler.h"
|
|
||||||
#import "KBBackspaceUndoManager.h"
|
|
||||||
|
|
||||||
@interface KBFunctionView () <KBFunctionBarViewDelegate, KBStreamOverlayViewDelegate, KBFunctionTagListViewDelegate>
|
@interface KBFunctionView () <KBFunctionBarViewDelegate,
|
||||||
|
KBStreamOverlayViewDelegate,
|
||||||
|
KBFunctionTagListViewDelegate>
|
||||||
// UI
|
// UI
|
||||||
@property(nonatomic, strong) KBFunctionBarView *barViewInternal;
|
@property(nonatomic, strong) KBFunctionBarView *barViewInternal;
|
||||||
@property(nonatomic, strong) KBFunctionPasteView *pasteViewInternal;
|
@property(nonatomic, strong) KBFunctionPasteView *pasteViewInternal;
|
||||||
@@ -44,8 +47,10 @@
|
|||||||
|
|
||||||
// 网络流式(封装)
|
// 网络流式(封装)
|
||||||
@property(nonatomic, strong, nullable) WJXEventSource *eventSource;
|
@property(nonatomic, strong, nullable) WJXEventSource *eventSource;
|
||||||
@property (nonatomic, assign) BOOL streamHasOutput; // 是否已输出过正文(首段去首个 \t 用)
|
@property(nonatomic, assign)
|
||||||
@property (nonatomic, strong, nullable) NSNumber *loadingTagIndex; // 当前显示loading的标签index
|
BOOL streamHasOutput; // 是否已输出过正文(首段去首个 \t 用)
|
||||||
|
@property(nonatomic, strong, nullable)
|
||||||
|
NSNumber *loadingTagIndex; // 当前显示loading的标签index
|
||||||
@property(nonatomic, copy, nullable) NSString *loadingTagTitle;
|
@property(nonatomic, copy, nullable) NSString *loadingTagTitle;
|
||||||
@property(nonatomic, assign) BOOL eventSourceDidReceiveDone;
|
@property(nonatomic, assign) BOOL eventSourceDidReceiveDone;
|
||||||
@property(nonatomic, copy, nullable) NSString *eventSourceSplitPrefix;
|
@property(nonatomic, copy, nullable) NSString *eventSourceSplitPrefix;
|
||||||
@@ -55,8 +60,10 @@
|
|||||||
@property(nonatomic, strong) NSMutableArray<KBTagItemModel *> *modelArray;
|
@property(nonatomic, strong) NSMutableArray<KBTagItemModel *> *modelArray;
|
||||||
|
|
||||||
// 剪贴板自动检测
|
// 剪贴板自动检测
|
||||||
@property (nonatomic, strong) NSTimer *pasteboardTimer; // 轮询定时器(轻量、主线程)
|
@property(nonatomic, strong)
|
||||||
@property (nonatomic, assign) NSInteger lastHandledPBCount; // 上次处理过的 changeCount,避免重复弹窗
|
NSTimer *pasteboardTimer; // 轮询定时器(轻量、主线程)
|
||||||
|
@property(nonatomic, assign)
|
||||||
|
NSInteger lastHandledPBCount; // 上次处理过的 changeCount,避免重复弹窗
|
||||||
|
|
||||||
// UL 双路兜底
|
// UL 双路兜底
|
||||||
@property(nonatomic, assign) NSUInteger kb_ulSeq; // 当前 UL 发起序号
|
@property(nonatomic, assign) NSUInteger kb_ulSeq; // 当前 UL 发起序号
|
||||||
@@ -70,25 +77,29 @@
|
|||||||
if (self = [super initWithFrame:frame]) {
|
if (self = [super initWithFrame:frame]) {
|
||||||
// 背景使用当前主题强调色
|
// 背景使用当前主题强调色
|
||||||
[self kb_applyTheme];
|
[self kb_applyTheme];
|
||||||
self.backspaceHandler = [[KBBackspaceLongPressHandler alloc] initWithContainerView:self];
|
self.backspaceHandler =
|
||||||
|
[[KBBackspaceLongPressHandler alloc] initWithContainerView:self];
|
||||||
|
|
||||||
[self setupUI];
|
[self setupUI];
|
||||||
// [self reloadDemoData];
|
// [self reloadDemoData];
|
||||||
[self kb_reloadTagsFromSharedDefaults];
|
[self kb_reloadTagsFromSharedDefaults];
|
||||||
|
|
||||||
|
|
||||||
// 初始化剪贴板监控状态
|
// 初始化剪贴板监控状态
|
||||||
_lastHandledPBCount = [UIPasteboard generalPasteboard].changeCount;
|
_lastHandledPBCount = [UIPasteboard generalPasteboard].changeCount;
|
||||||
|
|
||||||
// 监听“完全访问”状态变化,动态启停剪贴板监控,避免在未开完全访问时触发 TCC/XPC 错误日志
|
// 监听“完全访问”状态变化,动态启停剪贴板监控,避免在未开完全访问时触发
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(kb_fullAccessChanged) name:KBFullAccessChangedNotification object:nil];
|
// TCC/XPC 错误日志
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver:self
|
||||||
|
selector:@selector(kb_fullAccessChanged)
|
||||||
|
name:KBFullAccessChangedNotification
|
||||||
|
object:nil];
|
||||||
|
|
||||||
// 监听主 App 的 Darwin 确认(UL 已处理)
|
// 监听主 App 的 Darwin 确认(UL 已处理)
|
||||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
CFNotificationCenterAddObserver(
|
||||||
(__bridge const void *)(self),
|
CFNotificationCenterGetDarwinNotifyCenter(),
|
||||||
KBULDarwinCallback,
|
(__bridge const void *)(self), KBULDarwinCallback,
|
||||||
(__bridge CFStringRef)KBDarwinULHandled,
|
(__bridge CFStringRef)KBDarwinULHandled, NULL,
|
||||||
NULL,
|
|
||||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -98,11 +109,13 @@
|
|||||||
|
|
||||||
/// 从 App Group 的 NSUserDefaults 中读取真实 JSON,解析为 model + 标签文案
|
/// 从 App Group 的 NSUserDefaults 中读取真实 JSON,解析为 model + 标签文案
|
||||||
- (void)kb_reloadTagsFromSharedDefaults {
|
- (void)kb_reloadTagsFromSharedDefaults {
|
||||||
NSUserDefaults *sharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:AppGroup];
|
NSUserDefaults *sharedDefaults =
|
||||||
|
[[NSUserDefaults alloc] initWithSuiteName:AppGroup];
|
||||||
NSDictionary *jsonDict = [sharedDefaults objectForKey:AppGroup_MyKbJson];
|
NSDictionary *jsonDict = [sharedDefaults objectForKey:AppGroup_MyKbJson];
|
||||||
if (jsonDict != nil) {
|
if (jsonDict != nil) {
|
||||||
id dataObj = jsonDict[@"data"];
|
id dataObj = jsonDict[@"data"];
|
||||||
NSArray<KBTagItemModel *> *modelList = [KBTagItemModel mj_objectArrayWithKeyValuesArray:(NSArray *)dataObj];
|
NSArray<KBTagItemModel *> *modelList =
|
||||||
|
[KBTagItemModel mj_objectArrayWithKeyValuesArray:(NSArray *)dataObj];
|
||||||
if (modelList.count > 0) {
|
if (modelList.count > 0) {
|
||||||
self.modelArray = [NSMutableArray array];
|
self.modelArray = [NSMutableArray array];
|
||||||
[self.modelArray addObjectsFromArray:modelList];
|
[self.modelArray addObjectsFromArray:modelList];
|
||||||
@@ -114,21 +127,118 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Theme
|
#pragma mark - Theme
|
||||||
|
|
||||||
|
/// 判断当前是否为暗黑模式
|
||||||
|
- (BOOL)kb_isDarkMode {
|
||||||
|
if (@available(iOS 13.0, *)) {
|
||||||
|
return self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark;
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Theme Colors
|
||||||
|
|
||||||
|
/// 整体背景色:暗黑 #323232,浅色 #D0D3DA
|
||||||
|
+ (UIColor *)kb_backgroundColor {
|
||||||
|
if (@available(iOS 13.0, *)) {
|
||||||
|
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||||
|
UITraitCollection *_Nonnull traitCollection) {
|
||||||
|
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||||
|
return [UIColor colorWithHex:0x2B2B2B];
|
||||||
|
} else {
|
||||||
|
return [UIColor colorWithHex:0xD0D3DA];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
return [UIColor colorWithHex:0xD0D3DA];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Cell 背景色:暗黑 #707070,浅色 白色90%透明度
|
||||||
|
+ (UIColor *)kb_cellBackgroundColor {
|
||||||
|
if (@available(iOS 13.0, *)) {
|
||||||
|
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||||
|
UITraitCollection *_Nonnull traitCollection) {
|
||||||
|
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||||
|
return [UIColor colorWithHex:0x707070];
|
||||||
|
} else {
|
||||||
|
return [UIColor colorWithWhite:1 alpha:0.9];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
return [UIColor colorWithWhite:1 alpha:0.9];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Cell 文字颜色:暗黑 #FFFFFF,浅色 #1B1F1A
|
||||||
|
+ (UIColor *)kb_cellTextColor {
|
||||||
|
if (@available(iOS 13.0, *)) {
|
||||||
|
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||||
|
UITraitCollection *_Nonnull traitCollection) {
|
||||||
|
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||||
|
return [UIColor whiteColor];
|
||||||
|
} else {
|
||||||
|
return [UIColor colorWithHex:0x1B1F1A];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
return [UIColor colorWithHex:0x1B1F1A];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Clear 按钮文字颜色:暗黑白色,浅色黑色
|
||||||
|
+ (UIColor *)kb_clearButtonTextColor {
|
||||||
|
if (@available(iOS 13.0, *)) {
|
||||||
|
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||||
|
UITraitCollection *_Nonnull traitCollection) {
|
||||||
|
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||||
|
return [UIColor whiteColor];
|
||||||
|
} else {
|
||||||
|
return [UIColor blackColor];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
return [UIColor blackColor];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 删除按钮背景色:暗黑 #707070,浅色 #B9BDC8
|
||||||
|
+ (UIColor *)kb_deleteButtonBackgroundColor {
|
||||||
|
if (@available(iOS 13.0, *)) {
|
||||||
|
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||||
|
UITraitCollection *_Nonnull traitCollection) {
|
||||||
|
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||||
|
return [UIColor colorWithHex:0x707070];
|
||||||
|
} else {
|
||||||
|
return [UIColor colorWithHex:0xB9BDC8];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
return [UIColor colorWithHex:0xB9BDC8];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)kb_applyTheme {
|
- (void)kb_applyTheme {
|
||||||
// KBSkinManager *mgr = [KBSkinManager shared];
|
// 使用动态颜色设置背景
|
||||||
// UIColor *accent = mgr.current.accentColor ?: [UIColor colorWithRed:0.77 green:0.93 blue:0.82 alpha:1.0];
|
self.backgroundColor = [KBFunctionView kb_backgroundColor];
|
||||||
// BOOL hasImg = ([mgr currentBackgroundImage] != nil);
|
|
||||||
self.backgroundColor = [UIColor colorWithHex:0xD0D3DA];
|
// 更新按钮颜色
|
||||||
|
self.clearButtonInternal.backgroundColor =
|
||||||
|
[KBFunctionView kb_deleteButtonBackgroundColor];
|
||||||
|
[self.clearButtonInternal
|
||||||
|
setTitleColor:[KBFunctionView kb_clearButtonTextColor]
|
||||||
|
forState:UIControlStateNormal];
|
||||||
|
self.deleteButtonInternal.backgroundColor =
|
||||||
|
[KBFunctionView kb_deleteButtonBackgroundColor];
|
||||||
|
|
||||||
|
// 刷新 TagListView 以更新 cell 颜色
|
||||||
|
[self.tagListView.collectionView reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[self stopPasteboardMonitor];
|
[self stopPasteboardMonitor];
|
||||||
[self kb_stopNetworkStreaming];
|
[self kb_stopNetworkStreaming];
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge const void *)(self), (__bridge CFStringRef)KBDarwinULHandled, NULL);
|
CFNotificationCenterRemoveObserver(
|
||||||
|
CFNotificationCenterGetDarwinNotifyCenter(),
|
||||||
|
(__bridge const void *)(self), (__bridge CFStringRef)KBDarwinULHandled,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - UI
|
#pragma mark - UI
|
||||||
@@ -195,7 +305,9 @@
|
|||||||
make.height.mas_equalTo(smallH);
|
make.height.mas_equalTo(smallH);
|
||||||
}];
|
}];
|
||||||
// 点击整个粘贴卡片按钮,行为与右侧「Paste」按钮保持一致
|
// 点击整个粘贴卡片按钮,行为与右侧「Paste」按钮保持一致
|
||||||
[self.pasteViewInternal.pasBtn addTarget:self action:@selector(onTapPaste) forControlEvents:UIControlEventTouchUpInside];
|
[self.pasteViewInternal.pasBtn addTarget:self
|
||||||
|
action:@selector(onTapPaste)
|
||||||
|
forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
// 3. Tag List View
|
// 3. Tag List View
|
||||||
[self addSubview:self.tagListView];
|
[self addSubview:self.tagListView];
|
||||||
@@ -228,7 +340,9 @@
|
|||||||
|
|
||||||
- (void)kb_showStreamTextViewIfNeededWithTitle:(NSString *)title {
|
- (void)kb_showStreamTextViewIfNeededWithTitle:(NSString *)title {
|
||||||
// 已有则不重复创建
|
// 已有则不重复创建
|
||||||
if (self.streamOverlay.superview) { return; }
|
if (self.streamOverlay.superview) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 隐藏标签列表,使用同一区域展示流式文本
|
// 隐藏标签列表,使用同一区域展示流式文本
|
||||||
self.tagListView.hidden = YES;
|
self.tagListView.hidden = YES;
|
||||||
@@ -276,16 +390,20 @@
|
|||||||
[self kb_onTapStreamDelete];
|
[self kb_onTapStreamDelete];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Network Streaming (WJXEventSource)
|
#pragma mark - Network Streaming (WJXEventSource)
|
||||||
|
|
||||||
- (void)kb_startNetworkStreamingWithSeed:(NSString *)seedTitle {
|
- (void)kb_startNetworkStreamingWithSeed:(NSString *)seedTitle {
|
||||||
[self kb_stopNetworkStreaming];
|
[self kb_stopNetworkStreaming];
|
||||||
if (![[KBFullAccessManager shared] hasFullAccess]) { return; }
|
if (![[KBFullAccessManager shared] hasFullAccess]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NSString *apiUrl = [NSString stringWithFormat:@"%@%@", KB_BASE_URL, API_AI_TALK];
|
NSString *apiUrl =
|
||||||
|
[NSString stringWithFormat:@"%@%@", KB_BASE_URL, API_AI_TALK];
|
||||||
NSURL *url = [NSURL URLWithString:apiUrl];
|
NSURL *url = [NSURL URLWithString:apiUrl];
|
||||||
if (!url) { return; }
|
if (!url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NSInteger characterId = 0;
|
NSInteger characterId = 0;
|
||||||
if (self.loadingTagIndex != nil) {
|
if (self.loadingTagIndex != nil) {
|
||||||
@@ -296,21 +414,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NSInteger resolvedCharacterId = (characterId > 0) ? characterId : 75;
|
NSInteger resolvedCharacterId = (characterId > 0) ? characterId : 75;
|
||||||
NSString *message = seedTitle.length > 0 ? seedTitle : @"aliqua non cupidatat";
|
NSString *message =
|
||||||
// message = [NSString stringWithFormat:@"%@%d",message,arc4random() % 10000];
|
seedTitle.length > 0 ? seedTitle : @"aliqua non cupidatat";
|
||||||
NSDictionary *payload = @{
|
// message = [NSString stringWithFormat:@"%@%d",message,arc4random() %
|
||||||
@"characterId": @(resolvedCharacterId),
|
// 10000];
|
||||||
@"message": message
|
NSDictionary *payload =
|
||||||
};
|
@{@"characterId" : @(resolvedCharacterId), @"message" : message};
|
||||||
NSLog(@"[KBFunction] request payload: %@", payload);
|
NSLog(@"[KBFunction] request payload: %@", payload);
|
||||||
NSError *bodyError = nil;
|
NSError *bodyError = nil;
|
||||||
NSData *bodyData = [NSJSONSerialization dataWithJSONObject:payload options:0 error:&bodyError];
|
NSData *bodyData = [NSJSONSerialization dataWithJSONObject:payload
|
||||||
|
options:0
|
||||||
|
error:&bodyError];
|
||||||
if (bodyError || bodyData.length == 0) {
|
if (bodyError || bodyData.length == 0) {
|
||||||
NSLog(@"[KBFunction] build body failed: %@", bodyError);
|
NSLog(@"[KBFunction] build body failed: %@", bodyError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60];
|
NSMutableURLRequest *request =
|
||||||
|
[NSMutableURLRequest requestWithURL:url
|
||||||
|
cachePolicy:NSURLRequestReloadIgnoringCacheData
|
||||||
|
timeoutInterval:60];
|
||||||
request.HTTPMethod = @"POST";
|
request.HTTPMethod = @"POST";
|
||||||
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
||||||
NSString *token = KBAuthManager.shared.current.accessToken ?: @"";
|
NSString *token = KBAuthManager.shared.current.accessToken ?: @"";
|
||||||
@@ -326,14 +449,24 @@
|
|||||||
__weak typeof(self) weakSelf = self;
|
__weak typeof(self) weakSelf = self;
|
||||||
WJXEventSource *source = [[WJXEventSource alloc] initWithRquest:request];
|
WJXEventSource *source = [[WJXEventSource alloc] initWithRquest:request];
|
||||||
source.ignoreRetryAction = YES;
|
source.ignoreRetryAction = YES;
|
||||||
[source addListener:^(WJXEvent * _Nonnull event) {
|
[source
|
||||||
__strong typeof(weakSelf) self = weakSelf; if (!self) return;
|
addListener:^(WJXEvent *_Nonnull event) {
|
||||||
|
__strong typeof(weakSelf) self = weakSelf;
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
[self kb_handleEventSourceMessage:event];
|
[self kb_handleEventSourceMessage:event];
|
||||||
} forEvent:WJXEventNameMessage queue:NSOperationQueue.mainQueue];
|
}
|
||||||
[source addListener:^(WJXEvent * _Nonnull event) {
|
forEvent:WJXEventNameMessage
|
||||||
__strong typeof(weakSelf) self = weakSelf; if (!self) return;
|
queue:NSOperationQueue.mainQueue];
|
||||||
|
[source
|
||||||
|
addListener:^(WJXEvent *_Nonnull event) {
|
||||||
|
__strong typeof(weakSelf) self = weakSelf;
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
[self kb_handleEventSourceError:event.error];
|
[self kb_handleEventSourceError:event.error];
|
||||||
} forEvent:WJXEventNameError queue:NSOperationQueue.mainQueue];
|
}
|
||||||
|
forEvent:WJXEventNameError
|
||||||
|
queue:NSOperationQueue.mainQueue];
|
||||||
self.eventSource = source;
|
self.eventSource = source;
|
||||||
[self.eventSource open];
|
[self.eventSource open];
|
||||||
}
|
}
|
||||||
@@ -347,16 +480,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)kb_handleEventSourceMessage:(WJXEvent *)event {
|
- (void)kb_handleEventSourceMessage:(WJXEvent *)event {
|
||||||
if (event.data.length == 0) { return; }
|
if (event.data.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
NSLog(@"[KBStream] SSE raw payload: %@", event.data);
|
NSLog(@"[KBStream] SSE raw payload: %@", event.data);
|
||||||
NSData *jsonData = [event.data dataUsingEncoding:NSUTF8StringEncoding];
|
NSData *jsonData = [event.data dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
if (!jsonData) { return; }
|
if (!jsonData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
NSDictionary *payload = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
|
NSDictionary *payload = [NSJSONSerialization JSONObjectWithData:jsonData
|
||||||
if (error || ![payload isKindOfClass:[NSDictionary class]]) { return; }
|
options:0
|
||||||
if ([self kb_handleBizErrorIfNeeded:payload]) { return; }
|
error:&error];
|
||||||
|
if (error || ![payload isKindOfClass:[NSDictionary class]]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ([self kb_handleBizErrorIfNeeded:payload]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
NSString *type = payload[@"type"];
|
NSString *type = payload[@"type"];
|
||||||
if (![type isKindOfClass:[NSString class]]) { return; }
|
if (![type isKindOfClass:[NSString class]]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ([type isEqualToString:@"llm_chunk"]) {
|
if ([type isEqualToString:@"llm_chunk"]) {
|
||||||
NSString *chunk = [self kb_normalizedLLMChunkString:payload[@"data"]];
|
NSString *chunk = [self kb_normalizedLLMChunkString:payload[@"data"]];
|
||||||
@@ -380,7 +525,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)kb_handleEventSourceError:(NSError *_Nullable)error {
|
- (void)kb_handleEventSourceError:(NSError *_Nullable)error {
|
||||||
if (self.eventSourceDidReceiveDone) { return; }
|
if (self.eventSourceDidReceiveDone) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
[self kb_finishEventSourceWithError:error];
|
[self kb_finishEventSourceWithError:error];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +560,8 @@
|
|||||||
if (msg.length == 0) {
|
if (msg.length == 0) {
|
||||||
msg = KBLocalized(@"拉取失败");
|
msg = KBLocalized(@"拉取失败");
|
||||||
}
|
}
|
||||||
NSError *bizError = [NSError errorWithDomain:@"KBStreamBizError"
|
NSError *bizError =
|
||||||
|
[NSError errorWithDomain:@"KBStreamBizError"
|
||||||
code:code
|
code:code
|
||||||
userInfo:@{NSLocalizedDescriptionKey : msg}];
|
userInfo:@{NSLocalizedDescriptionKey : msg}];
|
||||||
[self kb_finishEventSourceWithError:bizError];
|
[self kb_finishEventSourceWithError:bizError];
|
||||||
@@ -424,7 +572,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)kb_requestSubscriptionGuide {
|
- (void)kb_requestSubscriptionGuide {
|
||||||
if ([self.delegate respondsToSelector:@selector(functionViewDidRequestSubscription:)]) {
|
if ([self.delegate
|
||||||
|
respondsToSelector:@selector(functionViewDidRequestSubscription:)]) {
|
||||||
[self.delegate functionViewDidRequestSubscription:self];
|
[self.delegate functionViewDidRequestSubscription:self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -432,7 +581,9 @@
|
|||||||
#pragma mark - Event Parsing
|
#pragma mark - Event Parsing
|
||||||
|
|
||||||
- (NSString *)kb_normalizedLLMChunkString:(id)dataValue {
|
- (NSString *)kb_normalizedLLMChunkString:(id)dataValue {
|
||||||
if (![dataValue isKindOfClass:[NSString class]]) { return @""; }
|
if (![dataValue isKindOfClass:[NSString class]]) {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
NSString *text = (NSString *)dataValue;
|
NSString *text = (NSString *)dataValue;
|
||||||
|
|
||||||
// 1. 处理上一个包遗留的 <SPLIT> 前缀(比如 "<SP" + "LIT>")
|
// 1. 处理上一个包遗留的 <SPLIT> 前缀(比如 "<SP" + "LIT>")
|
||||||
@@ -440,7 +591,9 @@
|
|||||||
text = [self.eventSourceSplitPrefix stringByAppendingString:text ?: @""];
|
text = [self.eventSourceSplitPrefix stringByAppendingString:text ?: @""];
|
||||||
self.eventSourceSplitPrefix = nil;
|
self.eventSourceSplitPrefix = nil;
|
||||||
}
|
}
|
||||||
if (text.length == 0) { return @""; }
|
if (text.length == 0) {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
|
||||||
// 2. 去掉开头多余换行(避免一开始就空一大块)
|
// 2. 去掉开头多余换行(避免一开始就空一大块)
|
||||||
while (text.length > 0) {
|
while (text.length > 0) {
|
||||||
@@ -451,7 +604,9 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (text.length == 0) { return @""; }
|
if (text.length == 0) {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
|
||||||
// 3. 处理结尾可能是不完整的 "<SPLIT" 之类,先截掉,放到下一个包里拼
|
// 3. 处理结尾可能是不完整的 "<SPLIT" 之类,先截掉,放到下一个包里拼
|
||||||
NSString *suffix = [self kb_pendingSplitSuffixForString:text];
|
NSString *suffix = [self kb_pendingSplitSuffixForString:text];
|
||||||
@@ -459,24 +614,29 @@
|
|||||||
self.eventSourceSplitPrefix = suffix;
|
self.eventSourceSplitPrefix = suffix;
|
||||||
text = [text substringToIndex:text.length - suffix.length];
|
text = [text substringToIndex:text.length - suffix.length];
|
||||||
}
|
}
|
||||||
if (text.length == 0) { return @""; }
|
if (text.length == 0) {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
|
||||||
// 4. 处理完整的 <SPLIT>,变成段落分隔符 \t
|
// 4. 处理完整的 <SPLIT>,变成段落分隔符 \t
|
||||||
text = [text stringByReplacingOccurrencesOfString:@"<SPLIT>" withString:@"\t"];
|
text = [text stringByReplacingOccurrencesOfString:@"<SPLIT>"
|
||||||
|
withString:@"\t"];
|
||||||
|
|
||||||
// 不再做其它替换,不合并 /t、不改行,只把真正内容原样丢给 UI
|
// 不再做其它替换,不合并 /t、不改行,只把真正内容原样丢给 UI
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (NSString *)kb_formattedSearchResultString:(id)dataValue {
|
- (NSString *)kb_formattedSearchResultString:(id)dataValue {
|
||||||
// data 不是数组就直接返回空串
|
// data 不是数组就直接返回空串
|
||||||
if (![dataValue isKindOfClass:[NSArray class]]) { return @""; }
|
if (![dataValue isKindOfClass:[NSArray class]]) {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
NSArray *list = (NSArray *)dataValue;
|
NSArray *list = (NSArray *)dataValue;
|
||||||
|
|
||||||
NSMutableArray<NSString *> *segments = [NSMutableArray array];
|
NSMutableArray<NSString *> *segments = [NSMutableArray array];
|
||||||
|
|
||||||
[list enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
[list enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx,
|
||||||
|
BOOL *_Nonnull stop) {
|
||||||
NSString *payload = nil;
|
NSString *payload = nil;
|
||||||
|
|
||||||
if ([obj isKindOfClass:[NSDictionary class]]) {
|
if ([obj isKindOfClass:[NSDictionary class]]) {
|
||||||
@@ -489,19 +649,24 @@
|
|||||||
payload = (NSString *)obj;
|
payload = (NSString *)obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
payload = [payload stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
payload = [payload
|
||||||
|
stringByTrimmingCharactersInSet:[NSCharacterSet
|
||||||
|
whitespaceAndNewlineCharacterSet]];
|
||||||
if (payload.length > 0) {
|
if (payload.length > 0) {
|
||||||
// 每一个 payload 就是一段
|
// 每一个 payload 就是一段
|
||||||
[segments addObject:payload];
|
[segments addObject:payload];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if (segments.count == 0) { return @""; }
|
if (segments.count == 0) {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
|
||||||
// 用 \t 拼起来,KBStreamTextView 会按 \t 拆成多个 label
|
// 用 \t 拼起来,KBStreamTextView 会按 \t 拆成多个 label
|
||||||
NSMutableString *result = [NSMutableString string];
|
NSMutableString *result = [NSMutableString string];
|
||||||
|
|
||||||
[segments enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
[segments enumerateObjectsUsingBlock:^(NSString *_Nonnull obj, NSUInteger idx,
|
||||||
|
BOOL *_Nonnull stop) {
|
||||||
// 每段前面加一个 \t,保证是新的一段
|
// 每段前面加一个 \t,保证是新的一段
|
||||||
[result appendFormat:@"\t%@", obj];
|
[result appendFormat:@"\t%@", obj];
|
||||||
}];
|
}];
|
||||||
@@ -509,12 +674,15 @@
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (NSString *)kb_pendingSplitSuffixForString:(NSString *)text {
|
- (NSString *)kb_pendingSplitSuffixForString:(NSString *)text {
|
||||||
static NSString *const token = @"<SPLIT>";
|
static NSString *const token = @"<SPLIT>";
|
||||||
if (text.length == 0) { return @""; }
|
if (text.length == 0) {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
NSUInteger tokenLen = token.length;
|
NSUInteger tokenLen = token.length;
|
||||||
if (tokenLen <= 1) { return @""; }
|
if (tokenLen <= 1) {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
NSUInteger maxLen = MIN(tokenLen - 1, text.length);
|
NSUInteger maxLen = MIN(tokenLen - 1, text.length);
|
||||||
for (NSUInteger len = maxLen; len > 0; len--) {
|
for (NSUInteger len = maxLen; len > 0; len--) {
|
||||||
NSString *suffix = [text substringFromIndex:text.length - len];
|
NSString *suffix = [text substringFromIndex:text.length - len];
|
||||||
@@ -532,16 +700,20 @@
|
|||||||
/// - 已将 `<SPLIT>` 转换为 `\t` 并去掉多余换行
|
/// - 已将 `<SPLIT>` 转换为 `\t` 并去掉多余换行
|
||||||
/// - 这里仅负责附加到视图与标记首段状态,避免 UI 抖动
|
/// - 这里仅负责附加到视图与标记首段状态,避免 UI 抖动
|
||||||
- (void)kb_appendChunkToStreamView:(NSString *)chunk {
|
- (void)kb_appendChunkToStreamView:(NSString *)chunk {
|
||||||
if (chunk.length == 0) return;
|
if (chunk.length == 0)
|
||||||
|
return;
|
||||||
// 第一次有数据才创建 overlay,并取消 cell 上的小菊花
|
// 第一次有数据才创建 overlay,并取消 cell 上的小菊花
|
||||||
if (!self.streamOverlay) {
|
if (!self.streamOverlay) {
|
||||||
[self kb_showStreamTextViewIfNeededWithTitle:self.loadingTagTitle ?: @""];
|
[self kb_showStreamTextViewIfNeededWithTitle:self.loadingTagTitle ?: @""];
|
||||||
if (self.loadingTagIndex) {
|
if (self.loadingTagIndex) {
|
||||||
[self.tagListView setLoading:NO atIndex:self.loadingTagIndex.integerValue];
|
[self.tagListView setLoading:NO
|
||||||
self.loadingTagIndex = nil; self.loadingTagTitle = nil;
|
atIndex:self.loadingTagIndex.integerValue];
|
||||||
|
self.loadingTagIndex = nil;
|
||||||
|
self.loadingTagTitle = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!self.streamOverlay) return;
|
if (!self.streamOverlay)
|
||||||
|
return;
|
||||||
[self.streamOverlay appendChunk:chunk];
|
[self.streamOverlay appendChunk:chunk];
|
||||||
self.streamHasOutput = YES;
|
self.streamHasOutput = YES;
|
||||||
}
|
}
|
||||||
@@ -553,20 +725,24 @@
|
|||||||
if (text.length > 0) {
|
if (text.length > 0) {
|
||||||
NSString *displayText = text;
|
NSString *displayText = text;
|
||||||
if (displayText.length > 30) {
|
if (displayText.length > 30) {
|
||||||
displayText = [[displayText substringToIndex:30] stringByAppendingString:@"…"];
|
displayText =
|
||||||
|
[[displayText substringToIndex:30] stringByAppendingString:@"…"];
|
||||||
}
|
}
|
||||||
[self.pasteView.pasBtn setImage:nil forState:UIControlStateNormal];
|
[self.pasteView.pasBtn setImage:nil forState:UIControlStateNormal];
|
||||||
[self.pasteView.pasBtn setTitle:displayText forState:UIControlStateNormal];
|
[self.pasteView.pasBtn setTitle:displayText forState:UIControlStateNormal];
|
||||||
} else {
|
} else {
|
||||||
UIImage *img = [UIImage imageNamed:@"kb_zt_icon"];
|
UIImage *img = [UIImage imageNamed:@"kb_zt_icon"];
|
||||||
[self.pasteView.pasBtn setImage:img forState:UIControlStateNormal];
|
[self.pasteView.pasBtn setImage:img forState:UIControlStateNormal];
|
||||||
[self.pasteView.pasBtn setTitle:KBLocalized(@" Paste Ta's Words") forState:UIControlStateNormal];
|
[self.pasteView.pasBtn setTitle:KBLocalized(@" Paste Ta's Words")
|
||||||
|
forState:UIControlStateNormal];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - KBFunctionTagListViewDelegate
|
#pragma mark - KBFunctionTagListViewDelegate
|
||||||
|
|
||||||
- (void)tagListView:(KBFunctionTagListView *)view didSelectIndex:(NSInteger)index title:(NSString *)title {
|
- (void)tagListView:(KBFunctionTagListView *)view
|
||||||
|
didSelectIndex:(NSInteger)index
|
||||||
|
title:(NSString *)title {
|
||||||
// 1) 先判断权限:未开启“完全访问”则走引导逻辑
|
// 1) 先判断权限:未开启“完全访问”则走引导逻辑
|
||||||
if (![[KBFullAccessManager shared] hasFullAccess]) {
|
if (![[KBFullAccessManager shared] hasFullAccess]) {
|
||||||
// 未开启完全访问:保持原有引导路径
|
// 未开启完全访问:保持原有引导路径
|
||||||
@@ -575,38 +751,46 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2) 权限没问题,再判断是否登录:未登录 -> 直接拉起主 App,由主 App 负责完成登录
|
// 2) 权限没问题,再判断是否登录:未登录 -> 直接拉起主 App,由主 App
|
||||||
|
// 负责完成登录
|
||||||
if (!KBAuthManager.shared.isLoggedIn) {
|
if (!KBAuthManager.shared.isLoggedIn) {
|
||||||
|
|
||||||
|
|
||||||
UIInputViewController *ivc = KBFindInputViewController(self);
|
UIInputViewController *ivc = KBFindInputViewController(self);
|
||||||
|
|
||||||
NSString *schemeStr = [NSString stringWithFormat:@"%@://login?src=keyboard", KB_APP_SCHEME];
|
NSString *schemeStr =
|
||||||
|
[NSString stringWithFormat:@"%@://login?src=keyboard", KB_APP_SCHEME];
|
||||||
NSURL *scheme = [NSURL URLWithString:schemeStr];
|
NSURL *scheme = [NSURL URLWithString:schemeStr];
|
||||||
// 从当前视图作为起点,通过响应链找到 UIApplication 再调起主 App
|
// 从当前视图作为起点,通过响应链找到 UIApplication 再调起主 App
|
||||||
BOOL ok = [KBHostAppLauncher openHostAppURL:scheme fromResponder:ivc.view];
|
BOOL ok = [KBHostAppLauncher openHostAppURL:scheme fromResponder:ivc.view];
|
||||||
return;
|
return;
|
||||||
// if (!ivc) return;
|
// if (!ivc) return;
|
||||||
// NSString *encodedTitle = [title stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]] ?: @"";
|
// NSString *encodedTitle = [title
|
||||||
// NSURL *ul = [NSURL URLWithString:[NSString stringWithFormat:@"%@?src=functionView&index=%ld&title=%@", KB_UL_LOGIN, (long)index, encodedTitle]];
|
// stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet
|
||||||
// if (!ul) return;
|
// URLQueryAllowedCharacterSet]] ?: @""; NSURL *ul = [NSURL
|
||||||
|
// URLWithString:[NSString
|
||||||
|
// stringWithFormat:@"%@?src=functionView&index=%ld&title=%@",
|
||||||
|
// KB_UL_LOGIN, (long)index, encodedTitle]]; if (!ul) return;
|
||||||
// // 发起 UL,不依赖 ok 结果
|
// // 发起 UL,不依赖 ok 结果
|
||||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 *
|
||||||
// [ivc.extensionContext openURL:ul completionHandler:^(__unused BOOL ok) {}];
|
// NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
// [ivc.extensionContext openURL:ul completionHandler:^(__unused
|
||||||
|
// BOOL ok) {}];
|
||||||
// });
|
// });
|
||||||
// // 双路兜底:500ms 内未收到主 App 确认,则回退到自定义 Scheme(通过宿主 UIApplication 打开)
|
// // 双路兜底:500ms 内未收到主 App 确认,则回退到自定义
|
||||||
// self.kb_ulHandledFlag = NO;
|
// Scheme(通过宿主 UIApplication 打开) self.kb_ulHandledFlag = NO;
|
||||||
// NSUInteger token = ++self.kb_ulSeq;
|
// NSUInteger token = ++self.kb_ulSeq;
|
||||||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 *
|
||||||
|
// NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
// if (token != self.kb_ulSeq) return; // 已有新请求覆盖
|
// if (token != self.kb_ulSeq) return; // 已有新请求覆盖
|
||||||
// if (self.kb_ulHandledFlag) return; // 主 App 已确认处理
|
// if (self.kb_ulHandledFlag) return; // 主 App 已确认处理
|
||||||
// NSURL *scheme = [NSURL URLWithString:[NSString stringWithFormat:@"%@://login?src=functionView&index=%ld&title=%@", KB_APP_SCHEME, (long)index, encodedTitle]];
|
// NSURL *scheme = [NSURL URLWithString:[NSString
|
||||||
// if (!scheme) return;
|
// stringWithFormat:@"%@://login?src=functionView&index=%ld&title=%@",
|
||||||
// UIResponder *start = ivc.view ?: (UIResponder *)self;
|
// KB_APP_SCHEME, (long)index, encodedTitle]]; if (!scheme)
|
||||||
|
// return; UIResponder *start = ivc.view ?: (UIResponder *)self;
|
||||||
// // 让键盘失去焦点
|
// // 让键盘失去焦点
|
||||||
// [ivc dismissKeyboard];
|
// [ivc dismissKeyboard];
|
||||||
// BOOL ok = [KBHostAppLauncher openHostAppURL:scheme fromResponder:start];
|
// BOOL ok = [KBHostAppLauncher openHostAppURL:scheme
|
||||||
// if (!ok) {
|
// fromResponder:start]; if (!ok) {
|
||||||
// [KBHUD showInfo:KBLocalized(@"请切换到主App完成登录")];
|
// [KBHUD showInfo:KBLocalized(@"请切换到主App完成登录")];
|
||||||
// }else{
|
// }else{
|
||||||
//
|
//
|
||||||
@@ -614,7 +798,8 @@
|
|||||||
// });
|
// });
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
BOOL hasPasteText = ![self.pasteView.pasBtn.currentTitle isEqualToString:KBLocalized(@" Paste Ta's Words")];
|
BOOL hasPasteText = ![self.pasteView.pasBtn.currentTitle
|
||||||
|
isEqualToString:KBLocalized(@" Paste Ta's Words")];
|
||||||
// BOOL hasPasteText = (self.pasteView.pasBtn.imageView.image == nil);
|
// BOOL hasPasteText = (self.pasteView.pasBtn.imageView.image == nil);
|
||||||
if (!hasPasteText) {
|
if (!hasPasteText) {
|
||||||
[KBHUD showInfo:KBLocalized(@"Please copy the text first")];
|
[KBHUD showInfo:KBLocalized(@"Please copy the text first")];
|
||||||
@@ -630,15 +815,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Darwin 回调:主 App 已处理 UL
|
// Darwin 回调:主 App 已处理 UL
|
||||||
static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
|
static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer,
|
||||||
|
CFStringRef name, const void *object,
|
||||||
|
CFDictionaryRef userInfo) {
|
||||||
KBFunctionView *self_ = (__bridge KBFunctionView *)observer;
|
KBFunctionView *self_ = (__bridge KBFunctionView *)observer;
|
||||||
if (!self_) return;
|
if (!self_)
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{ self_.kb_ulHandledFlag = YES; });
|
return;
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
self_.kb_ulHandledFlag = YES;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户点击功能标签:优先 UL 拉起主App,失败再 Scheme;两次都失败则提示开启完全访问。
|
// 用户点击功能标签:优先 UL 拉起主App,失败再
|
||||||
// 若已开启“完全访问”,则直接在键盘侧创建 KBStreamTextView,并在其右上角提供删除按钮关闭。
|
// Scheme;两次都失败则提示开启完全访问。 若已开启“完全访问”,则直接在键盘侧创建
|
||||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
// KBStreamTextView,并在其右上角提供删除按钮关闭。
|
||||||
|
- (void)collectionView:(UICollectionView *)collectionView
|
||||||
|
didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
// 点击上报已下沉到 KBFunctionTagListView(保证能拿到人设 id/name)
|
||||||
// 权限全部打开(键盘已启用 + 完全访问)。在扩展进程中仅需判断“完全访问”。
|
// 权限全部打开(键盘已启用 + 完全访问)。在扩展进程中仅需判断“完全访问”。
|
||||||
if ([[KBFullAccessManager shared] hasFullAccess]) {
|
if ([[KBFullAccessManager shared] hasFullAccess]) {
|
||||||
KBTagItemModel *selModel = self.modelArray[indexPath.item];
|
KBTagItemModel *selModel = self.modelArray[indexPath.item];
|
||||||
@@ -649,43 +842,71 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
|
|||||||
[KBHUD showInfo:KBLocalized(@"处理中…")];
|
[KBHUD showInfo:KBLocalized(@"处理中…")];
|
||||||
|
|
||||||
UIInputViewController *ivc = KBFindInputViewController(self);
|
UIInputViewController *ivc = KBFindInputViewController(self);
|
||||||
if (!ivc) return;
|
if (!ivc)
|
||||||
|
return;
|
||||||
|
|
||||||
NSString *title = self.modelArray[indexPath.item].characterName;
|
NSString *title = self.modelArray[indexPath.item].characterName;
|
||||||
NSString *encodedTitle = [title stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]] ?: @"";
|
NSString *encodedTitle =
|
||||||
|
[title stringByAddingPercentEncodingWithAllowedCharacters:
|
||||||
|
[NSCharacterSet URLQueryAllowedCharacterSet]]
|
||||||
|
?: @"";
|
||||||
|
|
||||||
NSURL *ul = [NSURL URLWithString:[NSString stringWithFormat:@"%@?src=functionView&index=%ld&title=%@", KB_UL_LOGIN, (long)indexPath.item, encodedTitle]];
|
NSURL *ul = [NSURL
|
||||||
if (!ul) return;
|
URLWithString:
|
||||||
|
[NSString stringWithFormat:@"%@?src=functionView&index=%ld&title=%@",
|
||||||
|
KB_UL_LOGIN, (long)indexPath.item,
|
||||||
|
encodedTitle]];
|
||||||
|
if (!ul)
|
||||||
|
return;
|
||||||
|
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
dispatch_after(
|
||||||
|
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)),
|
||||||
|
dispatch_get_main_queue(), ^{
|
||||||
// 先尝试通过 extensionContext 打开 UL
|
// 先尝试通过 extensionContext 打开 UL
|
||||||
[ivc.extensionContext openURL:ul completionHandler:^(BOOL ok) {
|
[ivc.extensionContext
|
||||||
|
openURL:ul
|
||||||
|
completionHandler:^(BOOL ok) {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// UL 失败时,再通过宿主 UIApplication + 自定义 Scheme 兜底
|
// UL 失败时,再通过宿主 UIApplication + 自定义 Scheme 兜底
|
||||||
NSURL *scheme = [NSURL URLWithString:[NSString stringWithFormat:@"%@@//login?src=functionView&index=%ld&title=%@", KB_APP_SCHEME, (long)indexPath.item, encodedTitle]];
|
NSURL *scheme = [NSURL
|
||||||
|
URLWithString:
|
||||||
|
[NSString
|
||||||
|
stringWithFormat:
|
||||||
|
@"%@@//login?src=functionView&index=%ld&title=%@",
|
||||||
|
KB_APP_SCHEME, (long)indexPath.item,
|
||||||
|
encodedTitle]];
|
||||||
UIResponder *start = ivc.view ?: (UIResponder *)self;
|
UIResponder *start = ivc.view ?: (UIResponder *)self;
|
||||||
BOOL ok2 = [KBHostAppLauncher openHostAppURL:scheme fromResponder:start];
|
BOOL ok2 = [KBHostAppLauncher openHostAppURL:scheme
|
||||||
|
fromResponder:start];
|
||||||
if (!ok2) {
|
if (!ok2) {
|
||||||
// 两条路都失败:大概率未开完全访问或宿主拦截。统一交由 Manager 引导。
|
// 两条路都失败:大概率未开完全访问或宿主拦截。统一交由 Manager
|
||||||
|
// 引导。
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[[KBFullAccessManager shared] ensureFullAccessOrGuideInView:self];
|
[[KBFullAccessManager shared]
|
||||||
|
ensureFullAccessOrGuideInView:self];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Button Actions
|
#pragma mark - Button Actions
|
||||||
|
|
||||||
- (void)onTapPaste {
|
- (void)onTapPaste {
|
||||||
|
// [[KBMaiPointReporter sharedReporter]
|
||||||
|
// reportClickWithEventName:@"click_keyboard_function_paste_btn"
|
||||||
|
// pageId:@"keyboard_function_panel"
|
||||||
|
// elementId:@"paste_btn"
|
||||||
|
// extra:nil
|
||||||
|
// completion:nil];
|
||||||
// 用户点击“粘贴”时才读取剪贴板:
|
// 用户点击“粘贴”时才读取剪贴板:
|
||||||
// - iOS16+ 会在跨 App 首次读取时自动弹出系统权限弹窗;
|
// - iOS16+ 会在跨 App 首次读取时自动弹出系统权限弹窗;
|
||||||
// - iOS15 及以下不会弹窗,直接返回内容;
|
// - iOS15 及以下不会弹窗,直接返回内容;
|
||||||
// 注意:不要在非用户触发的时机主动读取(如 viewDidLoad),否则会造成“立刻弹窗”的体验。
|
// 注意:不要在非用户触发的时机主动读取(如
|
||||||
// 权限全部打开(键盘已启用 + 完全访问)。在扩展进程中仅需判断“完全访问”。
|
// viewDidLoad),否则会造成“立刻弹窗”的体验。 权限全部打开(键盘已启用 +
|
||||||
|
// 完全访问)。在扩展进程中仅需判断“完全访问”。
|
||||||
if (![[KBFullAccessManager shared] hasFullAccess]) {
|
if (![[KBFullAccessManager shared] hasFullAccess]) {
|
||||||
// 未开启完全访问:保持原有引导路径
|
// 未开启完全访问:保持原有引导路径
|
||||||
[[KBFullAccessManager shared] ensureFullAccessOrGuideInView:self];
|
[[KBFullAccessManager shared] ensureFullAccessOrGuideInView:self];
|
||||||
@@ -721,21 +942,34 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
|
|||||||
// - 无论允许/拒绝,都把本次 changeCount 记为已处理,避免一直重复询问。
|
// - 无论允许/拒绝,都把本次 changeCount 记为已处理,避免一直重复询问。
|
||||||
|
|
||||||
- (void)startPasteboardMonitor {
|
- (void)startPasteboardMonitor {
|
||||||
|
// 禁用自动读取剪贴板,避免触发系统“允许粘贴”弹窗
|
||||||
|
return;
|
||||||
// 未开启“完全访问”时不做自动读取,避免宿主/系统拒绝并刷错误日志
|
// 未开启“完全访问”时不做自动读取,避免宿主/系统拒绝并刷错误日志
|
||||||
if (![[KBFullAccessManager shared] hasFullAccess]) return;
|
if (![[KBFullAccessManager shared] hasFullAccess])
|
||||||
if (self.pasteboardTimer) return;
|
return;
|
||||||
KBWeakSelf
|
if (self.pasteboardTimer)
|
||||||
self.pasteboardTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 repeats:YES block:^(NSTimer * _Nonnull timer) {
|
return;
|
||||||
__strong typeof(weakSelf) self = weakSelf; if (!self) return;
|
KBWeakSelf self.pasteboardTimer = [NSTimer
|
||||||
UIPasteboard *pb = [UIPasteboard generalPasteboard];
|
scheduledTimerWithTimeInterval:0.5
|
||||||
|
repeats:YES
|
||||||
|
block:^(NSTimer *_Nonnull timer) {
|
||||||
|
__strong typeof(weakSelf) self = weakSelf;
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
|
UIPasteboard *pb =
|
||||||
|
[UIPasteboard generalPasteboard];
|
||||||
NSInteger cc = pb.changeCount;
|
NSInteger cc = pb.changeCount;
|
||||||
if (cc <= self.lastHandledPBCount) return; // 没有新复制
|
if (cc <= self.lastHandledPBCount)
|
||||||
self.lastHandledPBCount = cc; // 标记已处理,避免重复
|
return; // 没有新复制
|
||||||
|
self.lastHandledPBCount =
|
||||||
|
cc; // 标记已处理,避免重复
|
||||||
|
|
||||||
// 实际读取触发系统弹窗(iOS16+)
|
// 实际读取触发系统弹窗(iOS16+)
|
||||||
NSString *text = pb.string;
|
NSString *text = pb.string;
|
||||||
// 有文字 -> 仅展示文字;无文字/非文本 -> 恢复图标 + 原占位文案
|
// 有文字 -> 仅展示文字;无文字/非文本 ->
|
||||||
[self kb_updatePasteButtonWithDisplayText:text];
|
// 恢复图标 + 原占位文案
|
||||||
|
[self
|
||||||
|
kb_updatePasteButtonWithDisplayText:text];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -768,29 +1002,55 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)kb_fullAccessChanged {
|
- (void)kb_fullAccessChanged {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{ [self kb_refreshPasteboardMonitor]; });
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[self kb_refreshPasteboardMonitor];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)onTapDelete {
|
- (void)onTapDelete {
|
||||||
NSLog(@"点击:删除");
|
NSLog(@"点击:删除");
|
||||||
|
// [[KBMaiPointReporter sharedReporter]
|
||||||
|
// reportClickWithEventName:@"click_keyboard_function_delete_btn"
|
||||||
|
// pageId:@"keyboard_function_panel"
|
||||||
|
// elementId:@"delete_btn"
|
||||||
|
// extra:nil
|
||||||
|
// completion:nil];
|
||||||
UIInputViewController *ivc = KBFindInputViewController(self);
|
UIInputViewController *ivc = KBFindInputViewController(self);
|
||||||
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
||||||
[[KBBackspaceUndoManager shared] recordDeletionSnapshotBefore:proxy.documentContextBeforeInput
|
[[KBInputBufferManager shared] refreshFromProxyIfPossible:proxy];
|
||||||
after:proxy.documentContextAfterInput];
|
[[KBInputBufferManager shared]
|
||||||
[proxy deleteBackward];
|
prepareSnapshotForDeleteWithContextBefore:proxy.documentContextBeforeInput
|
||||||
|
after:proxy
|
||||||
|
.documentContextAfterInput];
|
||||||
|
[[KBBackspaceUndoManager shared] captureAndDeleteBackwardFromProxy:proxy
|
||||||
|
count:1];
|
||||||
|
[[KBInputBufferManager shared] applyHoldDeleteCount:1];
|
||||||
}
|
}
|
||||||
- (void)onTapClear {
|
- (void)onTapClear {
|
||||||
NSLog(@"点击:清空");
|
NSLog(@"点击:清空");
|
||||||
|
// [[KBMaiPointReporter sharedReporter]
|
||||||
|
// reportClickWithEventName:@"click_keyboard_function_clear_btn"
|
||||||
|
// pageId:@"keyboard_function_panel"
|
||||||
|
// elementId:@"clear_btn"
|
||||||
|
// extra:nil
|
||||||
|
// completion:nil];
|
||||||
[self.backspaceHandler performClearAction];
|
[self.backspaceHandler performClearAction];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)onTapSend {
|
- (void)onTapSend {
|
||||||
NSLog(@"点击:发送");
|
NSLog(@"点击:发送");
|
||||||
|
// [[KBMaiPointReporter sharedReporter]
|
||||||
|
// reportClickWithEventName:@"click_keyboard_function_send_btn"
|
||||||
|
// pageId:@"keyboard_function_panel"
|
||||||
|
// elementId:@"send_btn"
|
||||||
|
// extra:nil
|
||||||
|
// completion:nil];
|
||||||
[[KBBackspaceUndoManager shared] registerNonClearAction];
|
[[KBBackspaceUndoManager shared] registerNonClearAction];
|
||||||
// 发送:插入换行。大多数聊天类 App 会把回车视为“发送”
|
// 发送:插入换行。大多数聊天类 App 会把回车视为“发送”
|
||||||
UIInputViewController *ivc = KBFindInputViewController(self);
|
UIInputViewController *ivc = KBFindInputViewController(self);
|
||||||
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
id<UITextDocumentProxy> proxy = ivc.textDocumentProxy;
|
||||||
[proxy insertText:@"\n"];
|
[proxy insertText:@"\n"];
|
||||||
|
[[KBInputBufferManager shared] appendText:@"\n"];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Lazy
|
#pragma mark - Lazy
|
||||||
@@ -805,16 +1065,20 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
|
|||||||
|
|
||||||
#pragma mark - KBFunctionBarViewDelegate
|
#pragma mark - KBFunctionBarViewDelegate
|
||||||
|
|
||||||
- (void)functionBarView:(KBFunctionBarView *)bar didTapLeftAtIndex:(NSInteger)index {
|
- (void)functionBarView:(KBFunctionBarView *)bar
|
||||||
|
didTapLeftAtIndex:(NSInteger)index {
|
||||||
// 将事件继续透传给上层(如键盘控制器),用于切换界面或其它业务
|
// 将事件继续透传给上层(如键盘控制器),用于切换界面或其它业务
|
||||||
if ([self.delegate respondsToSelector:@selector(functionView:didTapToolActionAtIndex:)]) {
|
if ([self.delegate respondsToSelector:@selector(functionView:
|
||||||
|
didTapToolActionAtIndex:)]) {
|
||||||
[self.delegate functionView:self didTapToolActionAtIndex:index];
|
[self.delegate functionView:self didTapToolActionAtIndex:index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)functionBarView:(KBFunctionBarView *)bar didTapRightAtIndex:(NSInteger)index {
|
- (void)functionBarView:(KBFunctionBarView *)bar
|
||||||
|
didTapRightAtIndex:(NSInteger)index {
|
||||||
// 右侧按钮点击,如收藏/宫格等,按需继续向外抛出(这里暂不定义单独协议方法,可在此内部处理或扩展)
|
// 右侧按钮点击,如收藏/宫格等,按需继续向外抛出(这里暂不定义单独协议方法,可在此内部处理或扩展)
|
||||||
if ([self.delegate respondsToSelector:@selector(functionView:didRightTapToolActionAtIndex:)]) {
|
if ([self.delegate respondsToSelector:@selector(functionView:
|
||||||
|
didRightTapToolActionAtIndex:)]) {
|
||||||
[self.delegate functionView:self didRightTapToolActionAtIndex:index];
|
[self.delegate functionView:self didRightTapToolActionAtIndex:index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -842,7 +1106,8 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
|
|||||||
return _rightButtonContainer;
|
return _rightButtonContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIButton *)buildRightButtonWithTitle:(NSString *)title color:(UIColor *)color {
|
- (UIButton *)buildRightButtonWithTitle:(NSString *)title
|
||||||
|
color:(UIColor *)color {
|
||||||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
btn.backgroundColor = color;
|
btn.backgroundColor = color;
|
||||||
btn.layer.cornerRadius = 8.0;
|
btn.layer.cornerRadius = 8.0;
|
||||||
@@ -855,8 +1120,15 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
|
|||||||
|
|
||||||
- (UIButton *)pasteButtonInternal {
|
- (UIButton *)pasteButtonInternal {
|
||||||
if (!_pasteButtonInternal) {
|
if (!_pasteButtonInternal) {
|
||||||
_pasteButtonInternal = [self buildRightButtonWithTitle:KBLocalized(@"Paste") color:[UIColor colorWithRed:0.13 green:0.73 blue:0.60 alpha:1.0]];
|
_pasteButtonInternal =
|
||||||
[_pasteButtonInternal addTarget:self action:@selector(onTapPaste) forControlEvents:UIControlEventTouchUpInside];
|
[self buildRightButtonWithTitle:KBLocalized(@"Paste")
|
||||||
|
color:[UIColor colorWithRed:0.13
|
||||||
|
green:0.73
|
||||||
|
blue:0.60
|
||||||
|
alpha:1.0]];
|
||||||
|
[_pasteButtonInternal addTarget:self
|
||||||
|
action:@selector(onTapPaste)
|
||||||
|
forControlEvents:UIControlEventTouchUpInside];
|
||||||
}
|
}
|
||||||
return _pasteButtonInternal;
|
return _pasteButtonInternal;
|
||||||
}
|
}
|
||||||
@@ -867,10 +1139,14 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
|
|||||||
_deleteButtonInternal.backgroundColor = [UIColor colorWithHex:0xB9BDC8];
|
_deleteButtonInternal.backgroundColor = [UIColor colorWithHex:0xB9BDC8];
|
||||||
_deleteButtonInternal.layer.cornerRadius = 8.0;
|
_deleteButtonInternal.layer.cornerRadius = 8.0;
|
||||||
_deleteButtonInternal.layer.masksToBounds = YES;
|
_deleteButtonInternal.layer.masksToBounds = YES;
|
||||||
[_deleteButtonInternal setImage:[UIImage imageNamed:@"kb_del_icon"] forState:UIControlStateNormal];
|
[_deleteButtonInternal setImage:[UIImage imageNamed:@"kb_del_icon"]
|
||||||
|
forState:UIControlStateNormal];
|
||||||
|
|
||||||
[_deleteButtonInternal addTarget:self action:@selector(onTapDelete) forControlEvents:UIControlEventTouchUpInside];
|
[_deleteButtonInternal addTarget:self
|
||||||
[self.backspaceHandler bindDeleteButton:_deleteButtonInternal showClearLabel:NO];
|
action:@selector(onTapDelete)
|
||||||
|
forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
[self.backspaceHandler bindDeleteButton:_deleteButtonInternal
|
||||||
|
showClearLabel:NO];
|
||||||
}
|
}
|
||||||
return _deleteButtonInternal;
|
return _deleteButtonInternal;
|
||||||
}
|
}
|
||||||
@@ -882,32 +1158,53 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer, C
|
|||||||
_clearButtonInternal.layer.cornerRadius = 8.0;
|
_clearButtonInternal.layer.cornerRadius = 8.0;
|
||||||
_clearButtonInternal.layer.masksToBounds = YES;
|
_clearButtonInternal.layer.masksToBounds = YES;
|
||||||
_clearButtonInternal.titleLabel.font = [KBFont medium:13];
|
_clearButtonInternal.titleLabel.font = [KBFont medium:13];
|
||||||
[_clearButtonInternal setTitle:KBLocalized(@"Clear") forState:UIControlStateNormal];
|
[_clearButtonInternal setTitle:KBLocalized(@"Clear")
|
||||||
[_clearButtonInternal setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
|
forState:UIControlStateNormal];
|
||||||
[_clearButtonInternal addTarget:self action:@selector(onTapClear) forControlEvents:UIControlEventTouchUpInside];
|
[_clearButtonInternal setTitleColor:[UIColor blackColor]
|
||||||
|
forState:UIControlStateNormal];
|
||||||
|
[_clearButtonInternal addTarget:self
|
||||||
|
action:@selector(onTapClear)
|
||||||
|
forControlEvents:UIControlEventTouchUpInside];
|
||||||
}
|
}
|
||||||
return _clearButtonInternal;
|
return _clearButtonInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIButton *)sendButtonInternal {
|
- (UIButton *)sendButtonInternal {
|
||||||
if (!_sendButtonInternal) {
|
if (!_sendButtonInternal) {
|
||||||
_sendButtonInternal = [self buildRightButtonWithTitle:KBLocalized(@"Send") color:[UIColor colorWithHex:0x02BEAC]];
|
_sendButtonInternal =
|
||||||
[_sendButtonInternal addTarget:self action:@selector(onTapSend) forControlEvents:UIControlEventTouchUpInside];
|
[self buildRightButtonWithTitle:KBLocalized(@"Send")
|
||||||
|
color:[UIColor colorWithHex:0x02BEAC]];
|
||||||
|
[_sendButtonInternal addTarget:self
|
||||||
|
action:@selector(onTapSend)
|
||||||
|
forControlEvents:UIControlEventTouchUpInside];
|
||||||
}
|
}
|
||||||
return _sendButtonInternal;
|
return _sendButtonInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Expose
|
#pragma mark - Expose
|
||||||
|
|
||||||
- (UICollectionView *)collectionView { return self.tagListView.collectionView; }
|
- (UICollectionView *)collectionView {
|
||||||
|
return self.tagListView.collectionView;
|
||||||
|
}
|
||||||
//- (NSArray<NSString *> *)items { return self.itemsInternal; }
|
//- (NSArray<NSString *> *)items { return self.itemsInternal; }
|
||||||
- (KBFunctionBarView *)barView { return self.barViewInternal; }
|
- (KBFunctionBarView *)barView {
|
||||||
- (KBFunctionPasteView *)pasteView { return self.pasteViewInternal; }
|
return self.barViewInternal;
|
||||||
- (UIButton *)pasteButton { return self.pasteButtonInternal; }
|
}
|
||||||
- (UIButton *)deleteButton { return self.deleteButtonInternal; }
|
- (KBFunctionPasteView *)pasteView {
|
||||||
- (UIButton *)clearButton { return self.clearButtonInternal; }
|
return self.pasteViewInternal;
|
||||||
- (UIButton *)sendButton { return self.sendButtonInternal; }
|
}
|
||||||
|
- (UIButton *)pasteButton {
|
||||||
|
return self.pasteButtonInternal;
|
||||||
|
}
|
||||||
|
- (UIButton *)deleteButton {
|
||||||
|
return self.deleteButtonInternal;
|
||||||
|
}
|
||||||
|
- (UIButton *)clearButton {
|
||||||
|
return self.clearButtonInternal;
|
||||||
|
}
|
||||||
|
- (UIButton *)sendButton {
|
||||||
|
return self.sendButtonInternal;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Find Owner Controller
|
#pragma mark - Find Owner Controller
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#import "Masonry.h"
|
#import "Masonry.h"
|
||||||
#import "KBSkinManager.h"
|
#import "KBSkinManager.h"
|
||||||
#import "KBBackspaceUndoManager.h"
|
#import "KBBackspaceUndoManager.h"
|
||||||
|
#import "KBKeyboardLayoutConfig.h"
|
||||||
|
|
||||||
@interface KBKeyBoardMainView ()<KBToolBarDelegate, KBKeyboardViewDelegate, KBEmojiPanelViewDelegate, KBSuggestionBarViewDelegate>
|
@interface KBKeyBoardMainView ()<KBToolBarDelegate, KBKeyboardViewDelegate, KBEmojiPanelViewDelegate, KBSuggestionBarViewDelegate>
|
||||||
@property (nonatomic, strong) KBToolBar *topBar;
|
@property (nonatomic, strong) KBToolBar *topBar;
|
||||||
@@ -45,6 +46,13 @@
|
|||||||
|
|
||||||
// 键盘区域(高度按照设计值做等比缩放,避免不同机型上按键被压缩/拉伸)
|
// 键盘区域(高度按照设计值做等比缩放,避免不同机型上按键被压缩/拉伸)
|
||||||
CGFloat keyboardAreaHeight = KBFit(200.0f);
|
CGFloat keyboardAreaHeight = KBFit(200.0f);
|
||||||
|
KBKeyboardLayoutConfig *layoutConfig = [KBKeyboardLayoutConfig sharedConfig];
|
||||||
|
if (layoutConfig) {
|
||||||
|
CGFloat configHeight = [layoutConfig keyboardAreaScaledHeight];
|
||||||
|
if (configHeight > 0.0) {
|
||||||
|
keyboardAreaHeight = configHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
CGFloat bottomInset = KBFit(4.0f);
|
CGFloat bottomInset = KBFit(4.0f);
|
||||||
// CGFloat topBarHeight = KBFit(40.0f);
|
// CGFloat topBarHeight = KBFit(40.0f);
|
||||||
CGFloat barSpacing = KBFit(6.0f);
|
CGFloat barSpacing = KBFit(6.0f);
|
||||||
@@ -247,11 +255,8 @@
|
|||||||
|
|
||||||
- (void)kb_applyTheme {
|
- (void)kb_applyTheme {
|
||||||
KBSkinManager *mgr = [KBSkinManager shared];
|
KBSkinManager *mgr = [KBSkinManager shared];
|
||||||
BOOL hasImg = ([mgr currentBackgroundImage] != nil);
|
self.backgroundColor = [UIColor clearColor];
|
||||||
// UIColor *bg = mgr.current.keyboardBackground;
|
self.keyboardView.backgroundColor = [UIColor clearColor];
|
||||||
UIColor *bg = [UIColor colorWithHex:0xD1D3DB];
|
|
||||||
self.backgroundColor = hasImg ? [UIColor clearColor] : bg;
|
|
||||||
self.keyboardView.backgroundColor = hasImg ? [UIColor clearColor] : bg;
|
|
||||||
if ([self.topBar respondsToSelector:@selector(kb_applyTheme)]) {
|
if ([self.topBar respondsToSelector:@selector(kb_applyTheme)]) {
|
||||||
[self.topBar kb_applyTheme];
|
[self.topBar kb_applyTheme];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
@property (nonatomic, strong) KBKey *key;
|
@property (nonatomic, strong) KBKey *key;
|
||||||
@property (nonatomic, strong) UIImageView *iconView;
|
@property (nonatomic, strong) UIImageView *iconView;
|
||||||
|
@property (nonatomic, strong, nullable) UIColor *customBackgroundColor;
|
||||||
|
|
||||||
/// 配置基础样式(背景、圆角等)。创建按钮时调用。
|
/// 配置基础样式(背景、圆角等)。创建按钮时调用。
|
||||||
- (void)applyDefaultStyle;
|
- (void)applyDefaultStyle;
|
||||||
|
|||||||
@@ -6,12 +6,14 @@
|
|||||||
#import "KBKeyButton.h"
|
#import "KBKeyButton.h"
|
||||||
#import "KBKey.h"
|
#import "KBKey.h"
|
||||||
#import "KBSkinManager.h"
|
#import "KBSkinManager.h"
|
||||||
|
#import <QuartzCore/QuartzCore.h>
|
||||||
|
|
||||||
@interface KBKeyButton ()
|
@interface KBKeyButton ()
|
||||||
// 内部缓存:便于从按钮查找到所属的 KBKeyboardView
|
// 内部缓存:便于从按钮查找到所属的 KBKeyboardView
|
||||||
@property (nonatomic, weak, readonly) UIView *kb_keyboardContainer;
|
@property (nonatomic, weak, readonly) UIView *kb_keyboardContainer;
|
||||||
@property (nonatomic, strong) UIImageView *normalImageView; /// 没有皮肤的时候展示
|
@property (nonatomic, strong) UIImageView *normalImageView; /// 没有皮肤的时候展示
|
||||||
@property (nonatomic, strong) UIColor *baseBackgroundColor; /// 无按下状态下,由皮肤/主题决定的底色(由 normalImageView 展示)
|
@property (nonatomic, strong) UIColor *baseBackgroundColor; /// 无按下状态下,由皮肤/主题决定的底色(由 normalImageView 展示)
|
||||||
|
@property (nonatomic, strong) CAGradientLayer *bottomShadowLayer;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -24,8 +26,8 @@
|
|||||||
[NSLayoutConstraint activateConstraints:@[
|
[NSLayoutConstraint activateConstraints:@[
|
||||||
[self.normalImageView.topAnchor constraintEqualToAnchor:self.topAnchor],
|
[self.normalImageView.topAnchor constraintEqualToAnchor:self.topAnchor],
|
||||||
[self.normalImageView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
|
[self.normalImageView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
|
||||||
[self.normalImageView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:2],
|
[self.normalImageView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
|
||||||
[self.normalImageView.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-2],
|
[self.normalImageView.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
|
||||||
]];
|
]];
|
||||||
[self applyDefaultStyle];
|
[self applyDefaultStyle];
|
||||||
}
|
}
|
||||||
@@ -48,6 +50,7 @@
|
|||||||
|
|
||||||
// 初始状态下根据主题设置底色(给没有皮肤图的按键使用)
|
// 初始状态下根据主题设置底色(给没有皮肤图的按键使用)
|
||||||
[self refreshStateAppearance];
|
[self refreshStateAppearance];
|
||||||
|
[self kb_setupBottomShadowIfNeeded];
|
||||||
|
|
||||||
// 懒创建图标视图,用于后续皮肤按键小图标展示
|
// 懒创建图标视图,用于后续皮肤按键小图标展示
|
||||||
if (!self.iconView) {
|
if (!self.iconView) {
|
||||||
@@ -61,8 +64,8 @@
|
|||||||
[NSLayoutConstraint activateConstraints:@[
|
[NSLayoutConstraint activateConstraints:@[
|
||||||
[iv.topAnchor constraintEqualToAnchor:self.topAnchor],
|
[iv.topAnchor constraintEqualToAnchor:self.topAnchor],
|
||||||
[iv.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
|
[iv.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
|
||||||
[iv.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:2],
|
[iv.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
|
||||||
[iv.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-2],
|
[iv.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
|
||||||
]];
|
]];
|
||||||
self.iconView = iv;
|
self.iconView = iv;
|
||||||
|
|
||||||
@@ -72,6 +75,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)layoutSubviews {
|
||||||
|
[super layoutSubviews];
|
||||||
|
if (!self.bottomShadowLayer) { return; }
|
||||||
|
CGRect bounds = self.normalImageView.bounds;
|
||||||
|
CGFloat shadowHeight = 2;
|
||||||
|
if (CGRectGetHeight(bounds) <= 0 || CGRectGetWidth(bounds) <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 有皮肤图时,强制隐藏文字,避免图标与文本叠加
|
||||||
|
if (self.iconView.image != nil) {
|
||||||
|
self.titleLabel.hidden = YES;
|
||||||
|
}
|
||||||
|
self.bottomShadowLayer.frame = CGRectMake(0,
|
||||||
|
CGRectGetHeight(bounds) - shadowHeight,
|
||||||
|
CGRectGetWidth(bounds),
|
||||||
|
shadowHeight);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setKey:(KBKey *)key {
|
- (void)setKey:(KBKey *)key {
|
||||||
_key = key;
|
_key = key;
|
||||||
}
|
}
|
||||||
@@ -121,14 +142,25 @@
|
|||||||
[self refreshStateAppearance];
|
[self refreshStateAppearance];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setCustomBackgroundColor:(UIColor *)customBackgroundColor {
|
||||||
|
_customBackgroundColor = customBackgroundColor;
|
||||||
|
[self refreshStateAppearance];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)refreshStateAppearance {
|
- (void)refreshStateAppearance {
|
||||||
// 选中态用于 Shift/CapsLock 等特殊按键的高亮显示
|
// 选中态用于 Shift/CapsLock 等特殊按键的高亮显示
|
||||||
KBSkinTheme *t = [KBSkinManager shared].current;
|
KBSkinTheme *t = [KBSkinManager shared].current;
|
||||||
UIColor *base = nil;
|
UIColor *base = nil;
|
||||||
if (self.isSelected) {
|
if (self.isSelected) {
|
||||||
base = t.keyHighlightBackground ?: t.keyBackground;
|
base = t.keyHighlightBackground ?: t.keyBackground;
|
||||||
|
if (self.customBackgroundColor) {
|
||||||
|
base = t.keyHighlightBackground ?: self.customBackgroundColor;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
base = t.keyBackground;
|
base = self.customBackgroundColor ?: t.keyBackground;
|
||||||
|
}
|
||||||
|
if (self.customBackgroundColor && self.key.type == KBKeyTypeShift) {
|
||||||
|
base = self.customBackgroundColor;
|
||||||
}
|
}
|
||||||
if (!base) {
|
if (!base) {
|
||||||
base = [UIColor whiteColor];
|
base = [UIColor whiteColor];
|
||||||
@@ -138,6 +170,13 @@
|
|||||||
// 按键背景统一由 normalImageView 控制,按钮本身透明
|
// 按键背景统一由 normalImageView 控制,按钮本身透明
|
||||||
self.backgroundColor = [UIColor clearColor];
|
self.backgroundColor = [UIColor clearColor];
|
||||||
|
|
||||||
|
if (self.key.type == KBKeyTypeShift) {
|
||||||
|
UIColor *textColor = self.isSelected ? [UIColor blackColor] : (t.keyTextColor ?: [UIColor blackColor]);
|
||||||
|
[self setTitleColor:textColor forState:UIControlStateNormal];
|
||||||
|
[self setTitleColor:textColor forState:UIControlStateHighlighted];
|
||||||
|
[self setTitleColor:textColor forState:UIControlStateSelected];
|
||||||
|
}
|
||||||
|
|
||||||
// 有皮肤图时仅展示 icon,不再显示普通背景色
|
// 有皮肤图时仅展示 icon,不再显示普通背景色
|
||||||
if (self.iconView.image != nil || self.normalImageView.hidden) {
|
if (self.iconView.image != nil || self.normalImageView.hidden) {
|
||||||
return;
|
return;
|
||||||
@@ -169,6 +208,7 @@
|
|||||||
|
|
||||||
BOOL hasIcon = (iconImg != nil);
|
BOOL hasIcon = (iconImg != nil);
|
||||||
self.normalImageView.hidden = hasIcon;
|
self.normalImageView.hidden = hasIcon;
|
||||||
|
self.bottomShadowLayer.hidden = hasIcon;
|
||||||
if (hasIcon) {
|
if (hasIcon) {
|
||||||
// 有图标:仅显示图片,完全隐藏文字
|
// 有图标:仅显示图片,完全隐藏文字
|
||||||
[self setTitle:@"" forState:UIControlStateNormal];
|
[self setTitle:@"" forState:UIControlStateNormal];
|
||||||
@@ -184,6 +224,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)kb_setupBottomShadowIfNeeded {
|
||||||
|
if (self.bottomShadowLayer) { return; }
|
||||||
|
CAGradientLayer *layer = [CAGradientLayer layer];
|
||||||
|
layer.startPoint = CGPointMake(0.5, 0.0);
|
||||||
|
layer.endPoint = CGPointMake(0.5, 1.0);
|
||||||
|
layer.colors = @[
|
||||||
|
(id)[UIColor colorWithWhite:0 alpha:0.5].CGColor,
|
||||||
|
(id)[UIColor colorWithWhite:0 alpha:0.7].CGColor
|
||||||
|
];
|
||||||
|
[self.normalImageView.layer addSublayer:layer];
|
||||||
|
// self.bottomShadowLayer = layer;
|
||||||
|
}
|
||||||
|
|
||||||
- (UIImageView *)normalImageView{
|
- (UIImageView *)normalImageView{
|
||||||
if (!_normalImageView) {
|
if (!_normalImageView) {
|
||||||
_normalImageView = [[UIImageView alloc] init];
|
_normalImageView = [[UIImageView alloc] init];
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#import "KBSkinManager.h"
|
#import "KBSkinManager.h"
|
||||||
#import "KBKeyPreviewView.h"
|
#import "KBKeyPreviewView.h"
|
||||||
#import "KBBackspaceLongPressHandler.h"
|
#import "KBBackspaceLongPressHandler.h"
|
||||||
|
#import "KBKeyboardLayoutConfig.h"
|
||||||
|
|
||||||
// UI 常量统一管理,方便后续调试样式(以 375 宽设计稿为基准,通过 KBFit 做等比缩放)
|
// UI 常量统一管理,方便后续调试样式(以 375 宽设计稿为基准,通过 KBFit 做等比缩放)
|
||||||
#define kKBRowVerticalSpacing KBFit(8.0f)
|
#define kKBRowVerticalSpacing KBFit(8.0f)
|
||||||
@@ -33,17 +34,19 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
|
|||||||
@property (nonatomic, strong) NSArray<NSArray<KBKey *> *> *keysForRows;
|
@property (nonatomic, strong) NSArray<NSArray<KBKey *> *> *keysForRows;
|
||||||
@property (nonatomic, strong) KBBackspaceLongPressHandler *backspaceHandler;
|
@property (nonatomic, strong) KBBackspaceLongPressHandler *backspaceHandler;
|
||||||
@property (nonatomic, strong) KBKeyPreviewView *previewView;
|
@property (nonatomic, strong) KBKeyPreviewView *previewView;
|
||||||
|
@property (nonatomic, strong) KBKeyboardLayoutConfig *layoutConfig;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation KBKeyboardView
|
@implementation KBKeyboardView
|
||||||
|
|
||||||
- (instancetype)initWithFrame:(CGRect)frame {
|
- (instancetype)initWithFrame:(CGRect)frame {
|
||||||
if (self = [super initWithFrame:frame]) {
|
if (self = [super initWithFrame:frame]) {
|
||||||
self.backgroundColor = [KBSkinManager shared].current.keyboardBackground;
|
self.backgroundColor = [UIColor clearColor];
|
||||||
_layoutStyle = KBKeyboardLayoutStyleLetters;
|
_layoutStyle = KBKeyboardLayoutStyleLetters;
|
||||||
// 默认小写:与需求一致,初始不开启 Shift
|
// 默认小写:与需求一致,初始不开启 Shift
|
||||||
_shiftOn = NO;
|
_shiftOn = NO;
|
||||||
_symbolsMoreOn = NO; // 数字面板默认第一页(123)
|
_symbolsMoreOn = NO; // 数字面板默认第一页(123)
|
||||||
|
self.layoutConfig = [KBKeyboardLayoutConfig sharedConfig];
|
||||||
self.backspaceHandler = [[KBBackspaceLongPressHandler alloc] initWithContainerView:self];
|
self.backspaceHandler = [[KBBackspaceLongPressHandler alloc] initWithContainerView:self];
|
||||||
[self buildBase];
|
[self buildBase];
|
||||||
[self reloadKeys];
|
[self reloadKeys];
|
||||||
@@ -67,26 +70,39 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
|
|||||||
[self addSubview:self.row3];
|
[self addSubview:self.row3];
|
||||||
[self addSubview:self.row4];
|
[self addSubview:self.row4];
|
||||||
|
|
||||||
|
KBKeyboardLayoutConfig *config = [self kb_layoutConfig];
|
||||||
|
KBKeyboardLayout *layout = [self kb_layoutForName:@"letters"];
|
||||||
|
NSArray<KBKeyboardRowConfig *> *rows = layout.rows ?: @[];
|
||||||
|
|
||||||
|
CGFloat rowSpacing = [self kb_metricValue:config.metrics.rowSpacing fallback:nil defaultValue:8.0];
|
||||||
|
CGFloat topInset = [self kb_metricValue:config.metrics.topInset fallback:nil defaultValue:8.0];
|
||||||
|
CGFloat bottomInset = [self kb_metricValue:config.metrics.bottomInset fallback:nil defaultValue:6.0];
|
||||||
|
|
||||||
|
CGFloat row1Height = [self kb_rowHeightForRow:(rows.count > 0 ? rows[0] : nil)];
|
||||||
|
CGFloat row2Height = [self kb_rowHeightForRow:(rows.count > 1 ? rows[1] : nil)];
|
||||||
|
CGFloat row3Height = [self kb_rowHeightForRow:(rows.count > 2 ? rows[2] : nil)];
|
||||||
|
CGFloat row4Height = [self kb_rowHeightForRow:(rows.count > 3 ? rows[3] : nil)];
|
||||||
|
|
||||||
[self.row1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.row1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.equalTo(self.mas_top).offset(kKBRowVerticalSpacing);
|
make.top.equalTo(self.mas_top).offset(topInset);
|
||||||
make.left.right.equalTo(self);
|
make.left.right.equalTo(self);
|
||||||
make.height.mas_equalTo(kKBRowHeight);
|
make.height.mas_equalTo(row1Height);
|
||||||
}];
|
}];
|
||||||
[self.row2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.row2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.equalTo(self.row1.mas_bottom).offset(kKBRowVerticalSpacing);
|
make.top.equalTo(self.row1.mas_bottom).offset(rowSpacing);
|
||||||
make.left.right.equalTo(self);
|
make.left.right.equalTo(self);
|
||||||
make.height.equalTo(self.row1);
|
make.height.mas_equalTo(row2Height);
|
||||||
}];
|
}];
|
||||||
[self.row3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.row3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.equalTo(self.row2.mas_bottom).offset(kKBRowVerticalSpacing);
|
make.top.equalTo(self.row2.mas_bottom).offset(rowSpacing);
|
||||||
make.left.right.equalTo(self);
|
make.left.right.equalTo(self);
|
||||||
make.height.equalTo(self.row1);
|
make.height.mas_equalTo(row3Height);
|
||||||
}];
|
}];
|
||||||
[self.row4 mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.row4 mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.equalTo(self.row3.mas_bottom).offset(kKBRowVerticalSpacing);
|
make.top.equalTo(self.row3.mas_bottom).offset(rowSpacing);
|
||||||
make.left.right.equalTo(self);
|
make.left.right.equalTo(self);
|
||||||
make.height.equalTo(self.row1);
|
make.height.mas_equalTo(row4Height);
|
||||||
make.bottom.equalTo(self.mas_bottom).offset(-6);
|
make.bottom.equalTo(self.mas_bottom).offset(-bottomInset);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,18 +115,92 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
|
|||||||
[row.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
|
[row.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.keysForRows = [self buildKeysForCurrentLayout];
|
KBKeyboardLayout *layout = [self kb_currentLayout];
|
||||||
if (self.keysForRows.count < 4) return;
|
NSArray<KBKeyboardRowConfig *> *rows = layout.rows ?: @[];
|
||||||
|
if (rows.count < 4) {
|
||||||
|
[self kb_buildLegacyLayout];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
[self buildRow:self.row1 withKeys:self.keysForRows[0]];
|
[self buildRow:self.row1 withRowConfig:rows[0]];
|
||||||
|
[self buildRow:self.row2 withRowConfig:rows[1]];
|
||||||
|
[self buildRow:self.row3 withRowConfig:rows[2]];
|
||||||
|
[self buildRow:self.row4 withRowConfig:rows[3]];
|
||||||
|
}
|
||||||
|
|
||||||
// 第二行:字母布局时通过左右等宽占位让整行居中
|
#pragma mark - Hit Test
|
||||||
CGFloat row2Spacer = (self.layoutStyle == KBKeyboardLayoutStyleLetters)
|
|
||||||
? kKBLettersRow2EdgeSpacerMultiplier : 0.0;
|
|
||||||
[self buildRow:self.row2 withKeys:self.keysForRows[1] edgeSpacerMultiplier:row2Spacer];
|
|
||||||
|
|
||||||
[self buildRow:self.row3 withKeys:self.keysForRows[2]];
|
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
||||||
[self buildRow:self.row4 withKeys:self.keysForRows[3]];
|
UIView *hit = [super hitTest:point withEvent:event];
|
||||||
|
if ([hit isKindOfClass:[KBKeyButton class]]) {
|
||||||
|
return hit;
|
||||||
|
}
|
||||||
|
if ([self kb_isHitInsideKeyRows:hit]) {
|
||||||
|
KBKeyButton *btn = [self kb_nearestKeyButtonForPoint:point];
|
||||||
|
if (btn) { return btn; }
|
||||||
|
}
|
||||||
|
return hit;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)kb_isHitInsideKeyRows:(UIView *)hitView {
|
||||||
|
if (!hitView) { return NO; }
|
||||||
|
if (hitView == self) { return YES; }
|
||||||
|
if ([hitView isDescendantOfView:self.row1]) { return YES; }
|
||||||
|
if ([hitView isDescendantOfView:self.row2]) { return YES; }
|
||||||
|
if ([hitView isDescendantOfView:self.row3]) { return YES; }
|
||||||
|
if ([hitView isDescendantOfView:self.row4]) { return YES; }
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KBKeyButton *)kb_nearestKeyButtonForPoint:(CGPoint)point {
|
||||||
|
KBKeyButton *best = nil;
|
||||||
|
CGFloat bestDistance = CGFLOAT_MAX;
|
||||||
|
NSArray<UIView *> *rows = @[self.row1, self.row2, self.row3, self.row4];
|
||||||
|
|
||||||
|
UIView *targetRow = nil;
|
||||||
|
for (UIView *row in rows) {
|
||||||
|
CGRect rowFrame = [self convertRect:row.bounds fromView:row];
|
||||||
|
if (CGRectContainsPoint(rowFrame, point)) {
|
||||||
|
targetRow = row;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NSArray<UIView *> *candidateRows = targetRow ? @[targetRow] : rows;
|
||||||
|
for (UIView *row in candidateRows) {
|
||||||
|
NSArray<KBKeyButton *> *buttons = [self kb_collectKeyButtonsInView:row];
|
||||||
|
for (KBKeyButton *btn in buttons) {
|
||||||
|
CGRect frame = [self convertRect:btn.frame fromView:btn.superview];
|
||||||
|
CGFloat dx = point.x - CGRectGetMidX(frame);
|
||||||
|
CGFloat dy = point.y - CGRectGetMidY(frame);
|
||||||
|
CGFloat dist = (dx * dx) + (dy * dy);
|
||||||
|
if (dist < bestDistance) {
|
||||||
|
bestDistance = dist;
|
||||||
|
best = btn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return best;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray<KBKeyButton *> *)kb_collectKeyButtonsInView:(UIView *)view {
|
||||||
|
if (!view) { return @[]; }
|
||||||
|
NSMutableArray<KBKeyButton *> *buttons = [NSMutableArray array];
|
||||||
|
[self kb_collectKeyButtonsInView:view into:buttons];
|
||||||
|
return buttons.copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)kb_collectKeyButtonsInView:(UIView *)view
|
||||||
|
into:(NSMutableArray<KBKeyButton *> *)buttons {
|
||||||
|
for (UIView *sub in view.subviews) {
|
||||||
|
if ([sub isKindOfClass:[KBKeyButton class]]) {
|
||||||
|
[buttons addObject:(KBKeyButton *)sub];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (sub.subviews.count > 0) {
|
||||||
|
[self kb_collectKeyButtonsInView:sub into:buttons];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Key Model Construction
|
#pragma mark - Key Model Construction
|
||||||
@@ -315,6 +405,152 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
|
|||||||
|
|
||||||
#pragma mark - Row Building
|
#pragma mark - Row Building
|
||||||
|
|
||||||
|
- (void)buildRow:(UIView *)row withRowConfig:(KBKeyboardRowConfig *)rowConfig {
|
||||||
|
if (!row || !rowConfig) { return; }
|
||||||
|
CGFloat gap = [self kb_gapForRow:rowConfig];
|
||||||
|
CGFloat insetLeft = [self kb_insetLeftForRow:rowConfig];
|
||||||
|
CGFloat insetRight = [self kb_insetRightForRow:rowConfig];
|
||||||
|
|
||||||
|
if (rowConfig.segments) {
|
||||||
|
KBKeyboardRowSegments *segments = rowConfig.segments;
|
||||||
|
NSArray<KBKeyboardRowItem *> *leftItems = [segments leftItems];
|
||||||
|
NSArray<KBKeyboardRowItem *> *centerItems = [segments centerItems];
|
||||||
|
NSArray<KBKeyboardRowItem *> *rightItems = [segments rightItems];
|
||||||
|
UIView *leftContainer = [UIView new];
|
||||||
|
UIView *centerContainer = [UIView new];
|
||||||
|
UIView *rightContainer = [UIView new];
|
||||||
|
[row addSubview:leftContainer];
|
||||||
|
[row addSubview:centerContainer];
|
||||||
|
[row addSubview:rightContainer];
|
||||||
|
|
||||||
|
[leftContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.equalTo(row.mas_left).offset(insetLeft);
|
||||||
|
make.top.bottom.equalTo(row);
|
||||||
|
}];
|
||||||
|
[rightContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.right.equalTo(row.mas_right).offset(-insetRight);
|
||||||
|
make.top.bottom.equalTo(row);
|
||||||
|
}];
|
||||||
|
[centerContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.centerX.equalTo(row);
|
||||||
|
make.top.bottom.equalTo(row);
|
||||||
|
make.left.greaterThanOrEqualTo(leftContainer.mas_right).offset(gap);
|
||||||
|
make.right.lessThanOrEqualTo(rightContainer.mas_left).offset(-gap);
|
||||||
|
}];
|
||||||
|
|
||||||
|
if (leftItems.count == 0) {
|
||||||
|
[leftContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.mas_equalTo(0);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
if (centerItems.count == 0) {
|
||||||
|
[centerContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.mas_equalTo(0);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
if (rightItems.count == 0) {
|
||||||
|
[rightContainer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.mas_equalTo(0);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
[self kb_buildButtonsInContainer:leftContainer
|
||||||
|
items:leftItems
|
||||||
|
gap:gap
|
||||||
|
insetLeft:0
|
||||||
|
insetRight:0
|
||||||
|
alignCenter:NO];
|
||||||
|
[self kb_buildButtonsInContainer:centerContainer
|
||||||
|
items:centerItems
|
||||||
|
gap:gap
|
||||||
|
insetLeft:0
|
||||||
|
insetRight:0
|
||||||
|
alignCenter:NO];
|
||||||
|
[self kb_buildButtonsInContainer:rightContainer
|
||||||
|
items:rightItems
|
||||||
|
gap:gap
|
||||||
|
insetLeft:0
|
||||||
|
insetRight:0
|
||||||
|
alignCenter:NO];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL alignCenter = [rowConfig.align.lowercaseString isEqualToString:@"center"];
|
||||||
|
[self kb_buildButtonsInContainer:row
|
||||||
|
items:[rowConfig resolvedItems]
|
||||||
|
gap:gap
|
||||||
|
insetLeft:insetLeft
|
||||||
|
insetRight:insetRight
|
||||||
|
alignCenter:alignCenter];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)kb_buildButtonsInContainer:(UIView *)container
|
||||||
|
items:(NSArray<KBKeyboardRowItem *> *)items
|
||||||
|
gap:(CGFloat)gap
|
||||||
|
insetLeft:(CGFloat)insetLeft
|
||||||
|
insetRight:(CGFloat)insetRight
|
||||||
|
alignCenter:(BOOL)alignCenter {
|
||||||
|
if (items.count == 0) { return; }
|
||||||
|
|
||||||
|
UIView *leftSpacer = nil;
|
||||||
|
UIView *rightSpacer = nil;
|
||||||
|
if (alignCenter) {
|
||||||
|
leftSpacer = [UIView new];
|
||||||
|
rightSpacer = [UIView new];
|
||||||
|
[container addSubview:leftSpacer];
|
||||||
|
[container addSubview:rightSpacer];
|
||||||
|
[leftSpacer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.equalTo(container.mas_left).offset(insetLeft);
|
||||||
|
make.top.bottom.equalTo(container);
|
||||||
|
}];
|
||||||
|
[rightSpacer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.right.equalTo(container.mas_right).offset(-insetRight);
|
||||||
|
make.top.bottom.equalTo(container);
|
||||||
|
}];
|
||||||
|
[leftSpacer mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.equalTo(rightSpacer);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
KBKeyButton *previous = nil;
|
||||||
|
for (KBKeyboardRowItem *item in items) {
|
||||||
|
KBKeyButton *btn = [self kb_buttonForItem:item];
|
||||||
|
if (!btn) { continue; }
|
||||||
|
[container addSubview:btn];
|
||||||
|
|
||||||
|
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.top.bottom.equalTo(container);
|
||||||
|
if (previous) {
|
||||||
|
make.left.equalTo(previous.mas_right).offset(gap);
|
||||||
|
} else {
|
||||||
|
if (leftSpacer) {
|
||||||
|
make.left.equalTo(leftSpacer.mas_right).offset(gap);
|
||||||
|
} else {
|
||||||
|
make.left.equalTo(container.mas_left).offset(insetLeft);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
|
CGFloat width = [self kb_widthForItem:item key:btn.key];
|
||||||
|
if (width > 0.0) {
|
||||||
|
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.width.mas_equalTo(width);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
previous = btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!previous) { return; }
|
||||||
|
[previous mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
if (rightSpacer) {
|
||||||
|
make.right.equalTo(rightSpacer.mas_left).offset(-gap);
|
||||||
|
} else {
|
||||||
|
make.right.equalTo(container.mas_right).offset(-insetRight);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)buildRow:(UIView *)row withKeys:(NSArray<KBKey *> *)keys {
|
- (void)buildRow:(UIView *)row withKeys:(NSArray<KBKey *> *)keys {
|
||||||
[self buildRow:row withKeys:keys edgeSpacerMultiplier:0.0];
|
[self buildRow:row withKeys:keys edgeSpacerMultiplier:0.0];
|
||||||
}
|
}
|
||||||
@@ -581,6 +817,386 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
|
|||||||
// Space 不设置宽度;通过此前已建立的左右约束自动占满剩余宽度。
|
// Space 不设置宽度;通过此前已建立的左右约束自动占满剩余宽度。
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Config Helpers
|
||||||
|
|
||||||
|
- (KBKeyboardLayoutConfig *)kb_layoutConfig {
|
||||||
|
if (!self.layoutConfig) {
|
||||||
|
self.layoutConfig = [KBKeyboardLayoutConfig sharedConfig];
|
||||||
|
}
|
||||||
|
return self.layoutConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KBKeyboardLayout *)kb_layoutForName:(NSString *)name {
|
||||||
|
return [[self kb_layoutConfig] layoutForName:name];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KBKeyboardLayout *)kb_currentLayout {
|
||||||
|
if (self.layoutStyle == KBKeyboardLayoutStyleNumbers) {
|
||||||
|
return [self kb_layoutForName:(self.symbolsMoreOn ? @"symbolsMore" : @"numbers")];
|
||||||
|
}
|
||||||
|
return [self kb_layoutForName:@"letters"];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)kb_buildLegacyLayout {
|
||||||
|
self.keysForRows = [self buildKeysForCurrentLayout];
|
||||||
|
if (self.keysForRows.count < 4) { return; }
|
||||||
|
|
||||||
|
[self buildRow:self.row1 withKeys:self.keysForRows[0]];
|
||||||
|
|
||||||
|
CGFloat row2Spacer = (self.layoutStyle == KBKeyboardLayoutStyleLetters)
|
||||||
|
? kKBLettersRow2EdgeSpacerMultiplier : 0.0;
|
||||||
|
[self buildRow:self.row2 withKeys:self.keysForRows[1] edgeSpacerMultiplier:row2Spacer];
|
||||||
|
|
||||||
|
[self buildRow:self.row3 withKeys:self.keysForRows[2]];
|
||||||
|
[self buildRow:self.row4 withKeys:self.keysForRows[3]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_scaledValue:(CGFloat)designValue {
|
||||||
|
KBKeyboardLayoutConfig *config = [self kb_layoutConfig];
|
||||||
|
if (config) {
|
||||||
|
return [config scaledValue:designValue];
|
||||||
|
}
|
||||||
|
return KBFit(designValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_numberValue:(NSNumber *)value defaultValue:(CGFloat)defaultValue {
|
||||||
|
if ([value isKindOfClass:[NSNumber class]]) {
|
||||||
|
return value.doubleValue;
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_metricValue:(NSNumber *)value fallback:(NSNumber *)fallback defaultValue:(CGFloat)defaultValue {
|
||||||
|
CGFloat v = [self kb_numberValue:value defaultValue:-1.0];
|
||||||
|
if (v < 0.0) {
|
||||||
|
v = [self kb_numberValue:fallback defaultValue:defaultValue];
|
||||||
|
}
|
||||||
|
if (v < 0.0) {
|
||||||
|
v = defaultValue;
|
||||||
|
}
|
||||||
|
return [self kb_scaledValue:v];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_rowHeightForRow:(KBKeyboardRowConfig *)row {
|
||||||
|
KBKeyboardLayoutConfig *config = [self kb_layoutConfig];
|
||||||
|
NSNumber *height = row.height ?: config.metrics.keyHeight;
|
||||||
|
CGFloat value = [self kb_numberValue:height defaultValue:40.0];
|
||||||
|
return [self kb_scaledValue:value];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_gapForRow:(KBKeyboardRowConfig *)row {
|
||||||
|
KBKeyboardLayoutConfig *config = [self kb_layoutConfig];
|
||||||
|
return [self kb_metricValue:row.gap fallback:config.metrics.gap defaultValue:5.0];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_insetLeftForRow:(KBKeyboardRowConfig *)row {
|
||||||
|
KBKeyboardLayoutConfig *config = [self kb_layoutConfig];
|
||||||
|
return [self kb_metricValue:row.insetLeft fallback:config.metrics.edgeInset defaultValue:0.0];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_insetRightForRow:(KBKeyboardRowConfig *)row {
|
||||||
|
KBKeyboardLayoutConfig *config = [self kb_layoutConfig];
|
||||||
|
return [self kb_metricValue:row.insetRight fallback:config.metrics.edgeInset defaultValue:0.0];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KBKeyButton *)kb_buttonForItem:(KBKeyboardRowItem *)item {
|
||||||
|
if (item.itemId.length == 0) { return nil; }
|
||||||
|
KBKeyboardKeyDef *def = [[self kb_layoutConfig] keyDefForIdentifier:item.itemId];
|
||||||
|
KBKey *key = [self kb_keyForItemId:item.itemId];
|
||||||
|
if (!key) { return nil; }
|
||||||
|
|
||||||
|
KBKeyButton *btn = [[KBKeyButton alloc] init];
|
||||||
|
btn.key = key;
|
||||||
|
[btn setTitle:key.title forState:UIControlStateNormal];
|
||||||
|
|
||||||
|
UIColor *bgColor = [self kb_backgroundColorForItem:item keyDef:def];
|
||||||
|
if (bgColor) {
|
||||||
|
btn.customBackgroundColor = bgColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGFloat fontSize = [self kb_fontSizeForItem:item key:key];
|
||||||
|
if (fontSize > 0.0) {
|
||||||
|
btn.titleLabel.font = [UIFont systemFontOfSize:fontSize weight:UIFontWeightSemibold];
|
||||||
|
}
|
||||||
|
|
||||||
|
[btn applyThemeForCurrentKey];
|
||||||
|
[btn addTarget:self action:@selector(onKeyTapped:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
|
if (key.type == KBKeyTypeBackspace) {
|
||||||
|
[self.backspaceHandler bindDeleteButton:btn showClearLabel:YES];
|
||||||
|
}
|
||||||
|
if (key.type == KBKeyTypeShift) {
|
||||||
|
btn.selected = self.shiftOn;
|
||||||
|
}
|
||||||
|
[self kb_applySymbolIfNeededForButton:btn keyDef:def fontSize:fontSize];
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)kb_applySymbolIfNeededForButton:(KBKeyButton *)button
|
||||||
|
keyDef:(KBKeyboardKeyDef *)def
|
||||||
|
fontSize:(CGFloat)fontSize {
|
||||||
|
if (!button || !def) { return; }
|
||||||
|
if (button.iconView.image != nil) { return; }
|
||||||
|
NSString *symbolName = button.isSelected ? def.selectedSymbolName : def.symbolName;
|
||||||
|
if (symbolName.length == 0) { return; }
|
||||||
|
|
||||||
|
UIImage *image = [UIImage systemImageNamed:symbolName];
|
||||||
|
if (!image) { return; }
|
||||||
|
|
||||||
|
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:fontSize weight:UIFontWeightSemibold];
|
||||||
|
image = [image imageWithConfiguration:config];
|
||||||
|
|
||||||
|
button.iconView.image = image;
|
||||||
|
button.iconView.hidden = NO;
|
||||||
|
button.iconView.contentMode = UIViewContentModeCenter;
|
||||||
|
button.titleLabel.hidden = YES;
|
||||||
|
|
||||||
|
UIColor *textColor = [KBSkinManager shared].current.keyTextColor ?: [UIColor blackColor];
|
||||||
|
button.iconView.tintColor = button.isSelected ? [UIColor blackColor] : textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIColor *)kb_backgroundColorForItem:(KBKeyboardRowItem *)item keyDef:(KBKeyboardKeyDef *)def {
|
||||||
|
NSString *hex = def.backgroundColor;
|
||||||
|
if (hex.length == 0) {
|
||||||
|
hex = [self kb_layoutConfig].defaultKeyBackground;
|
||||||
|
}
|
||||||
|
if (hex.length == 0) { return nil; }
|
||||||
|
return [KBSkinManager colorFromHexString:hex defaultColor:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_metricWidthForKey:(NSString *)key {
|
||||||
|
KBKeyboardLayoutMetrics *m = [self kb_layoutConfig].metrics;
|
||||||
|
if ([key isEqualToString:@"letterWidth"]) { return m.letterWidth.doubleValue; }
|
||||||
|
if ([key isEqualToString:@"controlWidth"]) { return m.controlWidth.doubleValue; }
|
||||||
|
if ([key isEqualToString:@"sendWidth"]) { return m.sendWidth.doubleValue; }
|
||||||
|
if ([key isEqualToString:@"symbolsWideWidth"]) { return m.symbolsWideWidth.doubleValue; }
|
||||||
|
if ([key isEqualToString:@"symbolsSideWidth"]) { return m.symbolsSideWidth.doubleValue; }
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_widthForItem:(KBKeyboardRowItem *)item key:(KBKey *)key {
|
||||||
|
CGFloat width = 0.0;
|
||||||
|
if (item.widthValue.doubleValue > 0.0) {
|
||||||
|
width = item.widthValue.doubleValue;
|
||||||
|
} else if (item.width.length > 0) {
|
||||||
|
if ([item.width.lowercaseString isEqualToString:@"flex"]) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
width = [self kb_metricWidthForKey:item.width];
|
||||||
|
if (width <= 0.0) {
|
||||||
|
width = item.width.doubleValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width <= 0.0) {
|
||||||
|
KBKeyboardLayoutMetrics *m = [self kb_layoutConfig].metrics;
|
||||||
|
if ([item.itemId hasPrefix:@"letter:"] ||
|
||||||
|
[item.itemId hasPrefix:@"digit:"] ||
|
||||||
|
[item.itemId hasPrefix:@"sym:"]) {
|
||||||
|
width = m.letterWidth.doubleValue;
|
||||||
|
} else if (key.type == KBKeyTypeReturn) {
|
||||||
|
width = m.sendWidth.doubleValue;
|
||||||
|
} else if (key.type == KBKeyTypeSpace) {
|
||||||
|
return 0.0;
|
||||||
|
} else {
|
||||||
|
width = m.controlWidth.doubleValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width <= 0.0) {
|
||||||
|
if ([item.itemId hasPrefix:@"letter:"] ||
|
||||||
|
[item.itemId hasPrefix:@"digit:"] ||
|
||||||
|
[item.itemId hasPrefix:@"sym:"]) {
|
||||||
|
width = 32.0;
|
||||||
|
} else if (key.type == KBKeyTypeReturn) {
|
||||||
|
width = 88.0;
|
||||||
|
} else if (key.type == KBKeyTypeSpace) {
|
||||||
|
return 0.0;
|
||||||
|
} else {
|
||||||
|
width = 41.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return width > 0.0 ? [self kb_scaledValue:width] : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_fontSizeForItem:(KBKeyboardRowItem *)item key:(KBKey *)key {
|
||||||
|
NSString *fontKey = nil;
|
||||||
|
if ([item.itemId hasPrefix:@"letter:"]) {
|
||||||
|
fontKey = @"letter";
|
||||||
|
} else if ([item.itemId hasPrefix:@"digit:"]) {
|
||||||
|
fontKey = @"digit";
|
||||||
|
} else if ([item.itemId hasPrefix:@"sym:"]) {
|
||||||
|
fontKey = @"symbol";
|
||||||
|
} else {
|
||||||
|
KBKeyboardKeyDef *def = [[self kb_layoutConfig] keyDefForIdentifier:item.itemId];
|
||||||
|
fontKey = def.font;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fontKey.length == 0) {
|
||||||
|
switch (key.type) {
|
||||||
|
case KBKeyTypeModeChange:
|
||||||
|
case KBKeyTypeSymbolsToggle:
|
||||||
|
fontKey = @"mode";
|
||||||
|
break;
|
||||||
|
case KBKeyTypeSpace:
|
||||||
|
fontKey = @"space";
|
||||||
|
break;
|
||||||
|
case KBKeyTypeReturn:
|
||||||
|
fontKey = @"send";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fontKey = @"symbol";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [self kb_fontSizeForFontKey:fontKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)kb_fontSizeForFontKey:(NSString *)fontKey {
|
||||||
|
KBKeyboardLayoutFonts *fonts = [self kb_layoutConfig].fonts;
|
||||||
|
CGFloat size = 0.0;
|
||||||
|
if ([fontKey isEqualToString:@"letter"]) { size = fonts.letter.doubleValue; }
|
||||||
|
else if ([fontKey isEqualToString:@"digit"]) { size = fonts.digit.doubleValue; }
|
||||||
|
else if ([fontKey isEqualToString:@"symbol"]) { size = fonts.symbol.doubleValue; }
|
||||||
|
else if ([fontKey isEqualToString:@"mode"]) { size = fonts.mode.doubleValue; }
|
||||||
|
else if ([fontKey isEqualToString:@"space"]) { size = fonts.space.doubleValue; }
|
||||||
|
else if ([fontKey isEqualToString:@"send"]) { size = fonts.send.doubleValue; }
|
||||||
|
if (size <= 0.0) { size = 18.0; }
|
||||||
|
return [self kb_scaledValue:size];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KBKey *)kb_keyForItemId:(NSString *)itemId {
|
||||||
|
if (itemId.length == 0) { return nil; }
|
||||||
|
KBKeyboardKeyDef *def = [[self kb_layoutConfig] keyDefForIdentifier:itemId];
|
||||||
|
if (def) {
|
||||||
|
return [self kb_keyFromDef:def identifier:itemId];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSRange range = [itemId rangeOfString:@":"];
|
||||||
|
if (range.location != NSNotFound) {
|
||||||
|
NSString *prefix = [itemId substringToIndex:range.location];
|
||||||
|
NSString *value = [itemId substringFromIndex:range.location + 1];
|
||||||
|
if ([prefix isEqualToString:@"letter"]) {
|
||||||
|
if (value.length == 1) {
|
||||||
|
return [self kb_letterKeyWithChar:value];
|
||||||
|
}
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
if ([prefix isEqualToString:@"digit"]) {
|
||||||
|
NSString *identifier = [NSString stringWithFormat:@"digit_%@", value];
|
||||||
|
KBKey *k = [KBKey keyWithIdentifier:identifier title:value output:value type:KBKeyTypeCharacter];
|
||||||
|
k.caseVariant = KBKeyCaseVariantNone;
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
if ([prefix isEqualToString:@"sym"]) {
|
||||||
|
NSString *identifier = [self kb_identifierForSymbol:value];
|
||||||
|
KBKey *k = [KBKey keyWithIdentifier:identifier title:value output:value type:KBKeyTypeCharacter];
|
||||||
|
k.caseVariant = KBKeyCaseVariantNone;
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KBKey *)kb_keyFromDef:(KBKeyboardKeyDef *)def identifier:(NSString *)identifier {
|
||||||
|
KBKeyType type = [self kb_keyTypeForDef:def];
|
||||||
|
NSString *title = def.title ?: @"";
|
||||||
|
if (type == KBKeyTypeShift && self.shiftOn && def.selectedTitle.length > 0) {
|
||||||
|
title = def.selectedTitle;
|
||||||
|
}
|
||||||
|
NSString *output = @"";
|
||||||
|
switch (type) {
|
||||||
|
case KBKeyTypeSpace:
|
||||||
|
output = @" ";
|
||||||
|
break;
|
||||||
|
case KBKeyTypeReturn:
|
||||||
|
output = @"\n";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
output = @"";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *finalId = identifier;
|
||||||
|
if ([identifier isEqualToString:@"emoji"]) {
|
||||||
|
finalId = KBKeyIdentifierEmojiPanel;
|
||||||
|
} else if ([identifier isEqualToString:@"send"]) {
|
||||||
|
finalId = @"return";
|
||||||
|
}
|
||||||
|
|
||||||
|
KBKey *k = [KBKey keyWithIdentifier:finalId title:title output:output type:type];
|
||||||
|
if (type == KBKeyTypeShift) {
|
||||||
|
k.caseVariant = self.shiftOn ? KBKeyCaseVariantUpper : KBKeyCaseVariantLower;
|
||||||
|
} else {
|
||||||
|
k.caseVariant = KBKeyCaseVariantNone;
|
||||||
|
}
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KBKeyType)kb_keyTypeForDef:(KBKeyboardKeyDef *)def {
|
||||||
|
NSString *type = def.type.lowercaseString;
|
||||||
|
if ([type isEqualToString:@"shift"]) return KBKeyTypeShift;
|
||||||
|
if ([type isEqualToString:@"backspace"]) return KBKeyTypeBackspace;
|
||||||
|
if ([type isEqualToString:@"mode"]) return KBKeyTypeModeChange;
|
||||||
|
if ([type isEqualToString:@"symbolstoggle"]) return KBKeyTypeSymbolsToggle;
|
||||||
|
if ([type isEqualToString:@"space"]) return KBKeyTypeSpace;
|
||||||
|
if ([type isEqualToString:@"return"]) return KBKeyTypeReturn;
|
||||||
|
if ([type isEqualToString:@"globe"]) return KBKeyTypeGlobe;
|
||||||
|
return KBKeyTypeCustom;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)kb_identifierForSymbol:(NSString *)symbol {
|
||||||
|
if (symbol.length == 0) { return nil; }
|
||||||
|
static NSDictionary<NSString *, NSString *> *map = nil;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
map = @{
|
||||||
|
@"-": @"sym_minus",
|
||||||
|
@"/": @"sym_slash",
|
||||||
|
@":": @"sym_colon",
|
||||||
|
@";": @"sym_semicolon",
|
||||||
|
@"(": @"sym_paren_l",
|
||||||
|
@")": @"sym_paren_r",
|
||||||
|
@"¥": @"sym_money",
|
||||||
|
@"¥": @"sym_money",
|
||||||
|
@"&": @"sym_amp",
|
||||||
|
@"@": @"sym_at",
|
||||||
|
@"\"": @"sym_quote_double",
|
||||||
|
@"“": @"sym_quote_double",
|
||||||
|
@"”": @"sym_quote_double",
|
||||||
|
@".": @"sym_dot",
|
||||||
|
@",": @"sym_comma",
|
||||||
|
@"?": @"sym_question",
|
||||||
|
@"!": @"sym_exclam",
|
||||||
|
@"'": @"sym_quote_single",
|
||||||
|
@"‘": @"sym_quote_single",
|
||||||
|
@"’": @"sym_quote_single",
|
||||||
|
@"[": @"sym_bracket_l",
|
||||||
|
@"]": @"sym_bracket_r",
|
||||||
|
@"{": @"sym_brace_l",
|
||||||
|
@"}": @"sym_brace_r",
|
||||||
|
@"#": @"sym_hash",
|
||||||
|
@"%": @"sym_percent",
|
||||||
|
@"^": @"sym_caret",
|
||||||
|
@"*": @"sym_asterisk",
|
||||||
|
@"+": @"sym_plus",
|
||||||
|
@"=": @"sym_equal",
|
||||||
|
@"_": @"sym_underscore",
|
||||||
|
@"\\": @"sym_backslash",
|
||||||
|
@"|": @"sym_pipe",
|
||||||
|
@"~": @"sym_tilde",
|
||||||
|
@"<": @"sym_lt",
|
||||||
|
@">": @"sym_gt",
|
||||||
|
@"€": @"sym_euro",
|
||||||
|
@"$": @"sym_dollar",
|
||||||
|
@"·": @"sym_bullet"
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return map[symbol];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Actions
|
#pragma mark - Actions
|
||||||
|
|
||||||
- (void)onKeyTapped:(KBKeyButton *)sender {
|
- (void)onKeyTapped:(KBKeyButton *)sender {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#import "KBStreamTextView.h"
|
#import "KBStreamTextView.h"
|
||||||
#import "KBResponderUtils.h" // 通过响应链找到 UIInputViewController,并将文本输出到宿主
|
#import "KBResponderUtils.h" // 通过响应链找到 UIInputViewController,并将文本输出到宿主
|
||||||
|
#import "KBInputBufferManager.h"
|
||||||
|
|
||||||
@interface KBStreamTextView ()
|
@interface KBStreamTextView ()
|
||||||
|
|
||||||
@@ -371,6 +372,7 @@ static inline NSString *KBTrimRight(NSString *s) {
|
|||||||
if (rawText.length > 0) {
|
if (rawText.length > 0) {
|
||||||
[proxy insertText:rawText];
|
[proxy insertText:rawText];
|
||||||
}
|
}
|
||||||
|
[[KBInputBufferManager shared] resetWithText:rawText ?: @""];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
148
KBMaiPointEventTable.md
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
# KBMaiPoint 埋点事件表(统一口径:iOS / Android / 后端)
|
||||||
|
|
||||||
|
## 统一约定(全端一致)
|
||||||
|
|
||||||
|
### 1)事件类型(event_type)
|
||||||
|
- 页面曝光:`page_exposure`
|
||||||
|
- 点击事件:`click`
|
||||||
|
|
||||||
|
> iOS 侧可映射为:`KBMaiPointGenericReportTypePage / KBMaiPointGenericReportTypeClick`
|
||||||
|
|
||||||
|
### 2)事件名称(event_name)
|
||||||
|
- 统一使用 `lower_snake_case`,不绑定任何端的类名/资源名
|
||||||
|
- 页面曝光统一前缀:`enter_`
|
||||||
|
- 点击事件统一前缀:`click_`
|
||||||
|
|
||||||
|
### 3)事件参数(value / params)
|
||||||
|
- **所有事件都固定带**:`token`(`NSString`,有就传真实值;没有就传空字符串 `""`)
|
||||||
|
- 建议额外固定带:`page_id`(页面/区域统一ID)
|
||||||
|
- 点击类事件建议固定带:`element_id`(控件/入口统一ID)
|
||||||
|
- 列表/集合类点击建议带:`index`(`NSInteger`)与业务 `id`(如 `theme_id` / `product_id`)
|
||||||
|
|
||||||
|
参数示例(最小):
|
||||||
|
```json
|
||||||
|
{ "token": "", "page_id": "shop", "element_id": "search_btn" }
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## A. 主工程(keyBoard)
|
||||||
|
|
||||||
|
### A1)页面曝光(触发:VC 的 `viewDidAppear`)
|
||||||
|
|
||||||
|
| 注释 | 事件类型 | 事件名称 | page_id | iOS 对应页面 | Android 对应页面 | 触发时机 | 事件参数(示例) |
|
||||||
|
|---|---|---|---|---|---|---|---|
|
||||||
|
| 进入首页 | page_exposure | enter_home_main | home_main | HomeMainVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"home_main" }` |
|
||||||
|
| 进入首页Tab容器 | page_exposure | enter_home | home | HomeVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"home" }` |
|
||||||
|
| 进入热门页 | page_exposure | enter_home_hot | home_hot | HomeHotVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"home_hot" }` |
|
||||||
|
| 进入排行榜页 | page_exposure | enter_home_rank | home_rank | HomeRankVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"home_rank" }` |
|
||||||
|
| 进入排行榜内容页 | page_exposure | enter_home_rank_content | home_rank_content | HomeRankContentVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"home_rank_content" }` |
|
||||||
|
| 进入首页底部弹层 | page_exposure | enter_home_sheet | home_sheet | HomeSheetVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"home_sheet" }` |
|
||||||
|
| 进入社区页 | page_exposure | enter_community | community | KBCommunityVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"community" }` |
|
||||||
|
| 进入搜索页 | page_exposure | enter_search | search | KBSearchVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"search" }` |
|
||||||
|
| 进入搜索结果页 | page_exposure | enter_search_result | search_result | KBSearchResultVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"search_result" }` |
|
||||||
|
| 进入商店页 | page_exposure | enter_shop | shop | KBShopVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"shop" }` |
|
||||||
|
| 进入商店分类列表页 | page_exposure | enter_shop_item_list | shop_item_list | KBShopItemVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"shop_item_list" }` |
|
||||||
|
| 进入皮肤详情页 | page_exposure | enter_skin_detail | skin_detail | KBSkinDetailVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"skin_detail", "theme_id":"" }` |
|
||||||
|
| 进入我的页 | page_exposure | enter_my | my | MyVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"my" }` |
|
||||||
|
| 进入我的皮肤页 | page_exposure | enter_my_skin | my_skin | MySkinVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"my_skin" }` |
|
||||||
|
| 进入我的键盘配置页 | page_exposure | enter_my_keyboard | my_keyboard | KBMyKeyBoardVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"my_keyboard" }` |
|
||||||
|
| 进入个人信息页 | page_exposure | enter_person_info | person_info | KBPersonInfoVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"person_info" }` |
|
||||||
|
| 进入反馈页 | page_exposure | enter_feedback | feedback | KBFeedBackVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"feedback" }` |
|
||||||
|
| 进入公告页 | page_exposure | enter_notice | notice | KBNoticeVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"notice" }` |
|
||||||
|
| 进入消费记录页 | page_exposure | enter_consumption_record | consumption_record | KBConsumptionRecordVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"consumption_record" }` |
|
||||||
|
| 进入VIP购买页 | page_exposure | enter_vip_pay | vip_pay | KBVipPay | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"vip_pay" }` |
|
||||||
|
| 进入积分充值页 | page_exposure | enter_points_recharge | points_recharge | KBJfPay | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"points_recharge" }` |
|
||||||
|
| 进入登录页 | page_exposure | enter_login | login | KBLoginVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"login" }` |
|
||||||
|
| 进入邮箱登录页 | page_exposure | enter_login_email | login_email | KBEmailLoginVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"login_email" }` |
|
||||||
|
| 进入邮箱注册页 | page_exposure | enter_register_email | register_email | KBEmailRegistVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"register_email" }` |
|
||||||
|
| 进入注册验证码页 | page_exposure | enter_register_verify_email | register_verify_email | KBRegistVerEmailVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"register_verify_email" }` |
|
||||||
|
| 进入忘记密码页 | page_exposure | enter_forgot_password_email | forgot_password_email | KBForgetPwdVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"forgot_password_email" }` |
|
||||||
|
| 进入忘记密码验证码页 | page_exposure | enter_forgot_password_verify | forgot_password_verify | KBForgetVerPwdVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"forgot_password_verify" }` |
|
||||||
|
| 进入忘记密码新密码页 | page_exposure | enter_forgot_password_newpwd | forgot_password_newpwd | KBForgetPwdNewPwdVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"forgot_password_newpwd" }` |
|
||||||
|
| 进入键盘权限引导页(App内) | page_exposure | enter_keyboard_permission_guide | keyboard_permission_guide | KBPermissionViewController | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"keyboard_permission_guide" }` |
|
||||||
|
| 进入首次引导页 | page_exposure | enter_guide | guide | KBGuideVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"guide" }` |
|
||||||
|
| 进入性别选择页 | page_exposure | enter_sex_select | sex_select | KBSexSelVC | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"sex_select" }` |
|
||||||
|
| 进入WebView页 | page_exposure | enter_webview | webview | KBWebViewViewController | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"webview", "url":"" }` |
|
||||||
|
|
||||||
|
> 测试/工具页(建议仅 DEBUG 或按需接入):`KBTestVC / KBLangTestVC / KBSkinCenterVC / ViewController / LoginViewController / KBLoginSheetViewController`。
|
||||||
|
|
||||||
|
### A2)点击事件(按钮/列表/入口)
|
||||||
|
|
||||||
|
| 注释 | 事件类型 | 事件名称 | page_id | element_id | iOS 对应控件/方法 | Android 对应控件 | 触发时机 | 事件参数(示例) |
|
||||||
|
|---|---|---|---|---|---|---|---|---|
|
||||||
|
| 首页点击“购买会员” | click | click_home_buy_vip_btn | home_main | buy_vip_btn | HomeHeadView `onTapBuyAction` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"home_main", "element_id":"buy_vip_btn" }` |
|
||||||
|
| 首页点击“权限悬浮按钮” | click | click_home_permission_float_btn | home_main | permission_float_btn | HomeMainVC `keyPermissButton.clickDragViewBlock` | Android 自定义 | 点击悬浮按钮 | `{ "token":"", "page_id":"home_main", "element_id":"permission_float_btn" }` |
|
||||||
|
| 权限引导页点击“去设置” | click | click_permission_open_settings_btn | keyboard_permission_guide | open_settings_btn | KBPermissionViewController `openSettings` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"keyboard_permission_guide", "element_id":"open_settings_btn" }` |
|
||||||
|
| 权限引导页点击“关闭” | click | click_permission_close_btn | keyboard_permission_guide | close_btn | KBPermissionViewController `closeButtonAction` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"keyboard_permission_guide", "element_id":"close_btn" }` |
|
||||||
|
| 商店页点击“搜索” | click | click_shop_search_btn | shop | search_btn | KBShopVC `searchBtnAction` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"shop", "element_id":"search_btn" }` |
|
||||||
|
| 商店页点击“我的皮肤” | click | click_shop_my_skin_btn | shop | my_skin_btn | KBShopVC `skinBtnAction` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"shop", "element_id":"my_skin_btn" }` |
|
||||||
|
| 商店列表点击皮肤卡片 | click | click_shop_theme_card | shop_item_list | theme_card | KBShopItemVC `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"shop_item_list", "element_id":"theme_card", "theme_id":"", "index":0 }` |
|
||||||
|
| 皮肤详情点击“下载/购买” | click | click_skin_download_btn | skin_detail | download_btn | KBSkinDetailVC `handleDownloadAction` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"skin_detail", "element_id":"download_btn", "theme_id":"", "purchased":0 }` |
|
||||||
|
| 皮肤详情点击“推荐皮肤” | click | click_skin_recommend_card | skin_detail | recommend_card | KBSkinDetailVC `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"skin_detail", "element_id":"recommend_card", "from_theme_id":"", "to_theme_id":"", "index":0 }` |
|
||||||
|
| 搜索栏点击搜索 | click | click_search_submit | search | search_submit | KBSearchBarView `onSearch` | Android 自定义 | 点击搜索 | `{ "token":"", "page_id":"search", "element_id":"search_submit", "keyword_len":0 }` |
|
||||||
|
| 搜索页点击历史词条 | click | click_search_history_item | search | history_item | KBSearchVC `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"search", "element_id":"history_item", "index":0 }` |
|
||||||
|
| 搜索页点击“展开更多历史” | click | click_search_history_more | search | history_more | KBSearchVC `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"search", "element_id":"history_more" }` |
|
||||||
|
| 搜索页点击“清空历史” | click | click_search_clear_history | search | clear_history | KBSearchVC `clearHistory`(header trash) | Android 自定义 | 点击垃圾桶 | `{ "token":"", "page_id":"search", "element_id":"clear_history" }` |
|
||||||
|
| 搜索页点击推荐皮肤 | click | click_search_recommend_theme | search | recommend_theme_card | KBSearchVC `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"search", "element_id":"recommend_theme_card", "theme_id":"", "index":0 }` |
|
||||||
|
| 搜索结果页点击皮肤 | click | click_search_result_theme | search_result | result_theme_card | KBSearchResultVC `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"search_result", "element_id":"result_theme_card", "theme_id":"", "index":0 }` |
|
||||||
|
| 我的页点击菜单项 | click | click_my_menu_item | my | menu_item | MyVC `didSelectRowAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"my", "element_id":"menu_item", "item_id":"", "item_title":"" }` |
|
||||||
|
| 我的页点击“邀请”成功复制 | click | click_my_invite_copy | my | invite_copy | MyVC(邀请分支) | Android 自定义 | 复制时机 | `{ "token":"", "page_id":"my", "element_id":"invite_copy" }` |
|
||||||
|
| 反馈页点击提交 | click | click_feedback_commit_btn | feedback | commit_btn | KBFeedBackVC `onTapCommit` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"feedback", "element_id":"commit_btn", "content_len":0 }` |
|
||||||
|
| 个人信息点击更换头像 | click | click_person_avatar_edit | person_info | avatar_edit | KBPersonInfoVC `onTapAvatarEdit` | Android 自定义 | tapGesture | `{ "token":"", "page_id":"person_info", "element_id":"avatar_edit" }` |
|
||||||
|
| 个人信息点击退出登录 | click | click_person_logout_btn | person_info | logout_btn | KBPersonInfoVC `onTapLogout` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"person_info", "element_id":"logout_btn" }` |
|
||||||
|
| 我的键盘页点击保存 | click | click_my_keyboard_save_btn | my_keyboard | save_btn | KBMyKeyBoardVC `onSave` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"my_keyboard", "element_id":"save_btn" }` |
|
||||||
|
| 我的皮肤页点击编辑/取消 | click | click_my_skin_toggle_edit | my_skin | toggle_edit | MySkinVC `onToggleEdit` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"my_skin", "element_id":"toggle_edit", "editing":0 }` |
|
||||||
|
| 我的皮肤页点击删除 | click | click_my_skin_delete_btn | my_skin | delete_btn | MySkinVC `onDelete` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"my_skin", "element_id":"delete_btn", "selected_count":0 }` |
|
||||||
|
| 我的皮肤页点击皮肤(进入详情) | click | click_my_skin_theme_card | my_skin | theme_card | MySkinVC `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"my_skin", "element_id":"theme_card", "theme_id":"", "index":0 }` |
|
||||||
|
| 登录页点击 Apple 登录 | click | click_login_apple_btn | login | apple_btn | KBLoginVC `onTapAppleLogin` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"login", "element_id":"apple_btn" }` |
|
||||||
|
| 登录页点击邮箱登录 | click | click_login_email_btn | login | email_btn | KBLoginVC `onTapEmailLogin` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"login", "element_id":"email_btn" }` |
|
||||||
|
| 登录页点击注册 | click | click_login_signup_btn | login | signup_btn | KBLoginVC `onTapSignUp` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"login", "element_id":"signup_btn" }` |
|
||||||
|
| 登录页点击忘记密码 | click | click_login_forgot_btn | login | forgot_btn | KBLoginVC `onTapForgotPassword` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"login", "element_id":"forgot_btn" }` |
|
||||||
|
| 邮箱登录页点击提交 | click | click_login_email_submit_btn | login_email | submit_btn | KBEmailLoginVC `onTapSubmit` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"login_email", "element_id":"submit_btn" }` |
|
||||||
|
| 邮箱注册页点击提交 | click | click_register_email_submit_btn | register_email | submit_btn | KBEmailRegistVC `onTapSubmit` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"register_email", "element_id":"submit_btn" }` |
|
||||||
|
| 注册验证码页点击确认 | click | click_register_verify_confirm_btn | register_verify_email | confirm_btn | KBRegistVerEmailVC `onTapConfirm` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"register_verify_email", "element_id":"confirm_btn" }` |
|
||||||
|
| 忘记密码(邮箱)点击下一步 | click | click_forgot_email_next_btn | forgot_password_email | next_btn | KBForgetPwdVC `onTapNext` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"forgot_password_email", "element_id":"next_btn" }` |
|
||||||
|
| 忘记密码(验证码)点击下一步 | click | click_forgot_verify_next_btn | forgot_password_verify | next_btn | KBForgetVerPwdVC `onTapNext` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"forgot_password_verify", "element_id":"next_btn" }` |
|
||||||
|
| 忘记密码(新密码)点击下一步 | click | click_forgot_newpwd_next_btn | forgot_password_newpwd | next_btn | KBForgetPwdNewPwdVC `onTapNext` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"forgot_password_newpwd", "element_id":"next_btn" }` |
|
||||||
|
| VIP页选择套餐 | click | click_vip_select_plan | vip_pay | plan_item | KBVipPay `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"vip_pay", "element_id":"plan_item", "product_id":"", "index":0 }` |
|
||||||
|
| VIP页点击支付 | click | click_vip_pay_btn | vip_pay | pay_btn | KBVipPay `onTapPayButton` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"vip_pay", "element_id":"pay_btn", "product_id":"" }` |
|
||||||
|
| VIP页点击恢复购买 | click | click_vip_restore_btn | vip_pay | restore_btn | KBVipPay `onTapRestoreButton` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"vip_pay", "element_id":"restore_btn" }` |
|
||||||
|
| VIP页点击关闭 | click | click_vip_close_btn | vip_pay | close_btn | KBVipPay `onTapClose` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"vip_pay", "element_id":"close_btn" }` |
|
||||||
|
| 积分充值页选择商品 | click | click_points_select_product | points_recharge | product_item | KBJfPay `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"points_recharge", "element_id":"product_item", "product_id":"", "index":0 }` |
|
||||||
|
| 积分充值页点击充值 | click | click_points_pay_btn | points_recharge | pay_btn | KBJfPay `onTapPayButton` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"points_recharge", "element_id":"pay_btn", "product_id":"" }` |
|
||||||
|
| 引导页点击复制示例1 | click | click_guide_copy_example_1 | guide | copy_example_1 | KBGuideTopCell `kb_onTapQ1` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"guide", "element_id":"copy_example_1" }` |
|
||||||
|
| 引导页点击复制示例2 | click | click_guide_copy_example_2 | guide | copy_example_2 | KBGuideTopCell `kb_onTapQ2` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"guide", "element_id":"copy_example_2" }` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## B. 键盘扩展(CustomKeyboard)
|
||||||
|
|
||||||
|
### B1)页面曝光(触发:显示/切换时机)
|
||||||
|
|
||||||
|
| 注释 | 事件类型 | 事件名称 | page_id | iOS 对应页面/视图 | Android 对应页面 | 触发时机 | 事件参数(示例) |
|
||||||
|
|---|---|---|---|---|---|---|---|
|
||||||
|
| 键盘首次显示 | page_exposure | enter_keyboard | keyboard | KeyboardViewController | Android 自定义 | viewDidAppear | `{ "token":"", "page_id":"keyboard" }` |
|
||||||
|
| 打开功能面板 | page_exposure | enter_keyboard_function_panel | keyboard_function_panel | KBFunctionView | Android 自定义 | showFunctionPanel:YES | `{ "token":"", "page_id":"keyboard_function_panel" }` |
|
||||||
|
| 关闭功能面板(回到主键盘) | page_exposure | enter_keyboard_main_panel | keyboard_main_panel | KBKeyBoardMainView | Android 自定义 | showFunctionPanel:NO | `{ "token":"", "page_id":"keyboard_main_panel" }` |
|
||||||
|
| 打开设置页 | page_exposure | enter_keyboard_settings | keyboard_settings | KBSettingView | Android 自定义 | showSettingView:YES | `{ "token":"", "page_id":"keyboard_settings" }` |
|
||||||
|
| 打开订阅/充值面板 | page_exposure | enter_keyboard_subscription_panel | keyboard_subscription_panel | KBKeyboardSubscriptionView | Android 自定义 | showSubscriptionPanel | `{ "token":"", "page_id":"keyboard_subscription_panel" }` |
|
||||||
|
|
||||||
|
### B2)点击事件(键盘工具栏 / 功能面板 / 订阅面板)
|
||||||
|
|
||||||
|
| 注释 | 事件类型 | 事件名称 | page_id | element_id | iOS 对应控件/方法 | Android 对应控件 | 触发时机 | 事件参数(示例) |
|
||||||
|
|---|---|---|---|---|---|---|---|---|
|
||||||
|
| 点击键盘顶部工具栏(index=0 打开功能面板) | click | click_keyboard_toolbar_action | keyboard_main_panel | toolbar_action | KBKeyBoardMainViewDelegate `didTapToolActionAtIndex:` | Android 自定义 | 点击工具栏 | `{ "token":"", "page_id":"keyboard_main_panel", "element_id":"toolbar_action", "index":0 }` |
|
||||||
|
| 点击键盘设置按钮 | click | click_keyboard_settings_btn | keyboard_main_panel | settings_btn | `keyBoardMainViewDidTapSettings:` | Android 自定义 | 点击设置 | `{ "token":"", "page_id":"keyboard_main_panel", "element_id":"settings_btn" }` |
|
||||||
|
| 点击设置页返回 | click | click_keyboard_settings_back_btn | keyboard_settings | back_btn | KeyboardViewController `onTapSettingsBack` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"keyboard_settings", "element_id":"back_btn" }` |
|
||||||
|
| 点击撤销删除 | click | click_keyboard_undo_btn | keyboard_main_panel | undo_btn | `keyBoardMainViewDidTapUndo:` | Android 自定义 | 点击撤销 | `{ "token":"", "page_id":"keyboard_main_panel", "element_id":"undo_btn" }` |
|
||||||
|
| 点击表情面板搜索 | click | click_keyboard_emoji_search_btn | keyboard_main_panel | emoji_search_btn | `keyBoardMainViewDidTapEmojiSearch:` | Android 自定义 | 点击搜索 | `{ "token":"", "page_id":"keyboard_main_panel", "element_id":"emoji_search_btn" }` |
|
||||||
|
| 点击联想词条 | click | click_keyboard_suggestion_item | keyboard_main_panel | suggestion_item | `didSelectSuggestion:` | Android 自定义 | 点击候选 | `{ "token":"", "page_id":"keyboard_main_panel", "element_id":"suggestion_item", "index":0 }` |
|
||||||
|
| 功能面板点击“粘贴” | click | click_keyboard_function_paste_btn | keyboard_function_panel | paste_btn | KBFunctionView `onTapPaste` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"keyboard_function_panel", "element_id":"paste_btn" }` |
|
||||||
|
| 功能面板点击“删除” | click | click_keyboard_function_delete_btn | keyboard_function_panel | delete_btn | KBFunctionView `onTapDelete` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"keyboard_function_panel", "element_id":"delete_btn" }` |
|
||||||
|
| 功能面板点击“清空” | click | click_keyboard_function_clear_btn | keyboard_function_panel | clear_btn | KBFunctionView `onTapClear` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"keyboard_function_panel", "element_id":"clear_btn" }` |
|
||||||
|
| 功能面板点击“发送” | click | click_keyboard_function_send_btn | keyboard_function_panel | send_btn | KBFunctionView `onTapSend` | Android 自定义 | touchUpInside | `{ "token":"", "page_id":"keyboard_function_panel", "element_id":"send_btn" }` |
|
||||||
|
| 功能面板点击“人设/标签”条目 | click | click_keyboard_function_tag_item | keyboard_function_panel | renshe_item | KBFunctionTagListView `didSelectItemAtIndexPath` | Android 自定义 | didSelect | `{ "token":"", "page_id":"keyboard_function_panel", "element_id":"renshe_item", "index":0, "id":456, "name":"" }` |
|
||||||
|
| 功能面板右侧点击“登录/充值”入口(未登录走登录) | click | click_keyboard_function_right_action | keyboard_function_panel | right_action | KeyboardViewController `didRightTapToolActionAtIndex:` | Android 自定义 | 点击右侧入口 | `{ "token":"", "page_id":"keyboard_function_panel", "element_id":"right_action", "action":"login_or_recharge" }` |
|
||||||
|
| 订阅面板点击关闭 | click | click_keyboard_subscription_close_btn | keyboard_subscription_panel | close_btn | `subscriptionViewDidTapClose:` | Android 自定义 | 点击关闭 | `{ "token":"", "page_id":"keyboard_subscription_panel", "element_id":"close_btn" }` |
|
||||||
|
| 订阅面板点击购买某商品 | click | click_keyboard_subscription_product_btn | keyboard_subscription_panel | product_btn | `didTapPurchaseForProduct:` | Android 自定义 | 点击购买 | `{ "token":"", "page_id":"keyboard_subscription_panel", "element_id":"product_btn", "product_id":"", "index":0 }` |
|
||||||
BIN
KBMaiPointEventTable.xlsx
Normal file
@@ -96,6 +96,6 @@ SPEC CHECKSUMS:
|
|||||||
SDWebImage: f29024626962457f3470184232766516dee8dfea
|
SDWebImage: f29024626962457f3470184232766516dee8dfea
|
||||||
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
|
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
|
||||||
|
|
||||||
PODFILE CHECKSUM: acf7541bd40dd969fa4950d6c000005b2889c85b
|
PODFILE CHECKSUM: 3b9d37a9d2c323afb33b6389f3c70184f53ea313
|
||||||
|
|
||||||
COCOAPODS: 1.16.2
|
COCOAPODS: 1.16.2
|
||||||
|
|||||||
2
Pods/Manifest.lock
generated
@@ -96,6 +96,6 @@ SPEC CHECKSUMS:
|
|||||||
SDWebImage: f29024626962457f3470184232766516dee8dfea
|
SDWebImage: f29024626962457f3470184232766516dee8dfea
|
||||||
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
|
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
|
||||||
|
|
||||||
PODFILE CHECKSUM: acf7541bd40dd969fa4950d6c000005b2889c85b
|
PODFILE CHECKSUM: 3b9d37a9d2c323afb33b6389f3c70184f53ea313
|
||||||
|
|
||||||
COCOAPODS: 1.16.2
|
COCOAPODS: 1.16.2
|
||||||
|
|||||||
1738
Pods/Pods.xcodeproj/project.pbxproj
generated
@@ -68,7 +68,7 @@
|
|||||||
#define API_SUBSCRIPTION_PRODUCT_LIST @"/products/subscription/list" // 查询订阅商品列表
|
#define API_SUBSCRIPTION_PRODUCT_LIST @"/products/subscription/list" // 查询订阅商品列表
|
||||||
|
|
||||||
/// AI
|
/// AI
|
||||||
#define API_AI_TALK @"/chat/talk" // 排行榜标签列表
|
#define API_AI_TALK @"/chat/talk"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,8 @@
|
|||||||
|
|
||||||
#if __OBJC__
|
#if __OBJC__
|
||||||
static inline CGFloat KBScreenWidth(void) {
|
static inline CGFloat KBScreenWidth(void) {
|
||||||
return [UIScreen mainScreen].bounds.size.width;
|
CGSize size = [UIScreen mainScreen].bounds.size;
|
||||||
|
return MIN(size.width, size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline CGFloat KBScaleFactor(void) {
|
static inline CGFloat KBScaleFactor(void) {
|
||||||
|
|||||||
20
Shared/KBLog.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// KBLog.h
|
||||||
|
// Shared debug logging macro (App + Extension)
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#ifndef KBLOG
|
||||||
|
// 调试专用日志(DEBUG 打印,RELEASE 不打印)。尽量显眼,包含函数与行号。
|
||||||
|
#if DEBUG
|
||||||
|
#define KBLOG(fmt, ...) do { \
|
||||||
|
NSString *kb_msg__ = [NSString stringWithFormat:(fmt), ##__VA_ARGS__]; \
|
||||||
|
NSString *kb_full_msg__ = [NSString stringWithFormat:@"\n==============================[KB DEBUG]==============================\n[Function] %s\n[Line] %d\n%@\n=====================================================================\n", __PRETTY_FUNCTION__, __LINE__, kb_msg__]; \
|
||||||
|
fprintf(stderr, "%s", kb_full_msg__.UTF8String); \
|
||||||
|
} while(0)
|
||||||
|
#else
|
||||||
|
#define KBLOG(...)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -6,27 +6,75 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#ifndef KB_MAI_POINT_BASE_URL
|
#ifndef KB_MAI_POINT_BASE_URL
|
||||||
#define KB_MAI_POINT_BASE_URL @"http://192.168.1.188:35310/api"
|
#define KB_MAI_POINT_BASE_URL @"http://192.168.2.21:35310/api"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef KB_MAI_POINT_PATH_NEW_ACCOUNT
|
#ifndef KB_MAI_POINT_PATH_NEW_ACCOUNT
|
||||||
#define KB_MAI_POINT_PATH_NEW_ACCOUNT @"/newAccount"
|
#define KB_MAI_POINT_PATH_NEW_ACCOUNT @"/newAccount"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef KB_MAI_POINT_PATH_GENERIC_DATA
|
||||||
|
#define KB_MAI_POINT_PATH_GENERIC_DATA @"/genericData"
|
||||||
|
#endif
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
extern NSString * const KBMaiPointErrorDomain;
|
extern NSString * const KBMaiPointErrorDomain;
|
||||||
|
extern NSString * const KBMaiPointEventTypePageExposure;
|
||||||
|
extern NSString * const KBMaiPointEventTypeClick;
|
||||||
|
|
||||||
typedef void (^KBMaiPointReportCompletion)(BOOL success, NSError * _Nullable error);
|
typedef void (^KBMaiPointReportCompletion)(BOOL success, NSError * _Nullable error);
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, KBMaiPointGenericReportType) {
|
||||||
|
/// 未知/默认类型(按需扩展,具体含义以服务端约定为准)
|
||||||
|
KBMaiPointGenericReportTypeUnknown = 0,
|
||||||
|
/// 点击
|
||||||
|
KBMaiPointGenericReportTypeClick = 1,
|
||||||
|
/// 曝光
|
||||||
|
KBMaiPointGenericReportTypeExposure = 2,
|
||||||
|
/// 页面/进入
|
||||||
|
KBMaiPointGenericReportTypePage = 3,
|
||||||
|
};
|
||||||
|
|
||||||
/// Lightweight reporter for Mai point tracking. Safe for app + extension.
|
/// Lightweight reporter for Mai point tracking. Safe for app + extension.
|
||||||
@interface KBMaiPointReporter : NSObject
|
@interface KBMaiPointReporter : NSObject
|
||||||
|
|
||||||
+ (instancetype)sharedReporter;
|
+ (instancetype)sharedReporter;
|
||||||
|
|
||||||
|
/// 统一埋点:POST /genericData
|
||||||
|
/// - eventType: 建议取值 `page_exposure` / `click`
|
||||||
|
/// - eventName: 统一事件名(如 enter_xxx / click_xxx)
|
||||||
|
/// - value: 事件参数字典(内部会自动注入 token;无 token 时为 @"")
|
||||||
|
- (void)reportEventType:(NSString *)eventType
|
||||||
|
eventName:(NSString *)eventName
|
||||||
|
value:(nullable NSDictionary *)value
|
||||||
|
completion:(KBMaiPointReportCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
/// 页面曝光快捷方法:内部会补齐 page_id
|
||||||
|
- (void)reportPageExposureWithEventName:(NSString *)eventName
|
||||||
|
pageId:(NSString *)pageId
|
||||||
|
extra:(nullable NSDictionary *)extra
|
||||||
|
completion:(KBMaiPointReportCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
/// 点击快捷方法:内部会补齐 page_id / element_id
|
||||||
|
- (void)reportClickWithEventName:(NSString *)eventName
|
||||||
|
pageId:(NSString *)pageId
|
||||||
|
elementId:(NSString *)elementId
|
||||||
|
extra:(nullable NSDictionary *)extra
|
||||||
|
completion:(KBMaiPointReportCompletion _Nullable)completion;
|
||||||
|
|
||||||
/// POST /newAccount with type + account.
|
/// POST /newAccount with type + account.
|
||||||
- (void)reportNewAccountWithType:(NSString *)type
|
- (void)reportNewAccountWithType:(NSString *)type
|
||||||
account:(NSString *)account
|
account:(nullable NSString *)account
|
||||||
|
completion:(KBMaiPointReportCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
//- (void)reportGenericDataWithEvent:(NSString *)event
|
||||||
|
// account:(nullable NSString *)account
|
||||||
|
// completion:(KBMaiPointReportCompletion _Nullable)completion;
|
||||||
|
|
||||||
|
/// POST /genericData with type + event + account.
|
||||||
|
- (void)reportGenericDataWithEventType:(KBMaiPointGenericReportType)type
|
||||||
|
account:(nullable NSString *)account
|
||||||
completion:(KBMaiPointReportCompletion _Nullable)completion;
|
completion:(KBMaiPointReportCompletion _Nullable)completion;
|
||||||
|
|
||||||
/// Generic POST for future endpoints.
|
/// Generic POST for future endpoints.
|
||||||
|
|||||||
@@ -4,8 +4,39 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "KBMaiPointReporter.h"
|
#import "KBMaiPointReporter.h"
|
||||||
|
#import "KBLog.h"
|
||||||
|
#import "KBAuthManager.h"
|
||||||
|
#if __has_include(<UIKit/UIKit.h>)
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
#import <objc/runtime.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
NSString * const KBMaiPointErrorDomain = @"KBMaiPointErrorDomain";
|
NSString * const KBMaiPointErrorDomain = @"KBMaiPointErrorDomain";
|
||||||
|
NSString * const KBMaiPointEventTypePageExposure = @"page_exposure";
|
||||||
|
NSString * const KBMaiPointEventTypeClick = @"click";
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
static void KBMaiPoint_DebugLogURL(NSURLRequest *request) {
|
||||||
|
NSString *url = request.URL.absoluteString ?: @"";
|
||||||
|
KBLOG(@"🍃[KBMaiPointReporter] url=%@", url);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KBMaiPoint_DebugLogError(NSURLResponse *response, NSError *error) {
|
||||||
|
if (error) {
|
||||||
|
NSString *msg = error.localizedDescription ?: @"(no description)";
|
||||||
|
KBLOG(@"🍃[KBMaiPointReporter] error=%@ domain=%@ code=%ld", msg, error.domain ?: @"", (long)error.code);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ([response isKindOfClass:NSHTTPURLResponse.class]) {
|
||||||
|
NSInteger statusCode = ((NSHTTPURLResponse *)response).statusCode;
|
||||||
|
if (statusCode >= 200 && statusCode < 300) {
|
||||||
|
KBLOG(@"🍃[KBMaiPointReporter] status=HTTP_%ld", (long)statusCode);
|
||||||
|
} else {
|
||||||
|
KBLOG(@"🍃[KBMaiPointReporter] error=HTTP_%ld", (long)statusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
@implementation KBMaiPointReporter
|
@implementation KBMaiPointReporter
|
||||||
|
|
||||||
@@ -18,12 +49,96 @@ NSString * const KBMaiPointErrorDomain = @"KBMaiPointErrorDomain";
|
|||||||
return reporter;
|
return reporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)kb_trimmedStringOrEmpty:(NSString * _Nullable)string {
|
||||||
|
NSString *value = [string isKindOfClass:[NSString class]] ? string : @"";
|
||||||
|
return [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] ?: @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)kb_currentTokenOrEmpty {
|
||||||
|
NSString *t = [KBAuthManager shared].current.accessToken;
|
||||||
|
return [self kb_trimmedStringOrEmpty:t];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)reportEventType:(NSString *)eventType
|
||||||
|
eventName:(NSString *)eventName
|
||||||
|
value:(NSDictionary * _Nullable)value
|
||||||
|
completion:(KBMaiPointReportCompletion _Nullable)completion {
|
||||||
|
NSString *trimmedType = [self kb_trimmedStringOrEmpty:eventType];
|
||||||
|
NSString *trimmedName = [self kb_trimmedStringOrEmpty:eventName];
|
||||||
|
if (trimmedType.length == 0 || trimmedName.length == 0) {
|
||||||
|
NSError *error = [NSError errorWithDomain:KBMaiPointErrorDomain
|
||||||
|
code:-1
|
||||||
|
userInfo:@{NSLocalizedDescriptionKey: @"Invalid parameter"}];
|
||||||
|
if (completion) {
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
completion(NO, error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSMutableDictionary *val = [NSMutableDictionary dictionary];
|
||||||
|
if ([value isKindOfClass:[NSDictionary class]] && value.count > 0) {
|
||||||
|
[val addEntriesFromDictionary:value];
|
||||||
|
}
|
||||||
|
if (![val[@"token"] isKindOfClass:NSString.class]) {
|
||||||
|
val[@"token"] = [self kb_currentTokenOrEmpty];
|
||||||
|
} else {
|
||||||
|
// 若外部传了 token,也做一次兜底(nil -> @"" / trim)
|
||||||
|
val[@"token"] = [self kb_trimmedStringOrEmpty:val[@"token"]];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSDictionary *params = @{
|
||||||
|
// 字段兼容:后端若用 eventId 统计,也能直接用 eventName
|
||||||
|
@"eventType": trimmedType,
|
||||||
|
@"eventName": trimmedName,
|
||||||
|
@"eventId": trimmedName,
|
||||||
|
@"value": val.copy
|
||||||
|
};
|
||||||
|
[self postPath:KB_MAI_POINT_PATH_GENERIC_DATA parameters:params completion:completion];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)reportPageExposureWithEventName:(NSString *)eventName
|
||||||
|
pageId:(NSString *)pageId
|
||||||
|
extra:(NSDictionary * _Nullable)extra
|
||||||
|
completion:(KBMaiPointReportCompletion _Nullable)completion {
|
||||||
|
NSString *pid = [self kb_trimmedStringOrEmpty:pageId];
|
||||||
|
NSMutableDictionary *val = [NSMutableDictionary dictionary];
|
||||||
|
if (pid.length > 0) {
|
||||||
|
val[@"page_id"] = pid;
|
||||||
|
}
|
||||||
|
if ([extra isKindOfClass:[NSDictionary class]] && extra.count > 0) {
|
||||||
|
[val addEntriesFromDictionary:extra];
|
||||||
|
}
|
||||||
|
[self reportEventType:KBMaiPointEventTypePageExposure eventName:eventName value:val completion:completion];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)reportClickWithEventName:(NSString *)eventName
|
||||||
|
pageId:(NSString *)pageId
|
||||||
|
elementId:(NSString *)elementId
|
||||||
|
extra:(NSDictionary * _Nullable)extra
|
||||||
|
completion:(KBMaiPointReportCompletion _Nullable)completion {
|
||||||
|
NSString *pid = [self kb_trimmedStringOrEmpty:pageId];
|
||||||
|
NSString *eid = [self kb_trimmedStringOrEmpty:elementId];
|
||||||
|
NSMutableDictionary *val = [NSMutableDictionary dictionary];
|
||||||
|
if (pid.length > 0) {
|
||||||
|
val[@"page_id"] = pid;
|
||||||
|
}
|
||||||
|
if (eid.length > 0) {
|
||||||
|
val[@"element_id"] = eid;
|
||||||
|
}
|
||||||
|
if ([extra isKindOfClass:[NSDictionary class]] && extra.count > 0) {
|
||||||
|
[val addEntriesFromDictionary:extra];
|
||||||
|
}
|
||||||
|
[self reportEventType:KBMaiPointEventTypeClick eventName:eventName value:val completion:completion];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)reportNewAccountWithType:(NSString *)type
|
- (void)reportNewAccountWithType:(NSString *)type
|
||||||
account:(NSString *)account
|
account:(NSString * _Nullable)account
|
||||||
completion:(KBMaiPointReportCompletion)completion {
|
completion:(KBMaiPointReportCompletion _Nullable)completion {
|
||||||
NSString *trimmedType = [type stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
NSString *trimmedType = [self kb_trimmedStringOrEmpty:type];
|
||||||
NSString *trimmedAccount = [account stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
NSString *trimmedAccount = [self kb_trimmedStringOrEmpty:account];
|
||||||
if (trimmedType.length == 0 || trimmedAccount.length == 0) {
|
if (trimmedType.length == 0) {
|
||||||
NSError *error = [NSError errorWithDomain:KBMaiPointErrorDomain
|
NSError *error = [NSError errorWithDomain:KBMaiPointErrorDomain
|
||||||
code:-1
|
code:-1
|
||||||
userInfo:@{NSLocalizedDescriptionKey: @"Invalid parameter"}];
|
userInfo:@{NSLocalizedDescriptionKey: @"Invalid parameter"}];
|
||||||
@@ -37,14 +152,43 @@ NSString * const KBMaiPointErrorDomain = @"KBMaiPointErrorDomain";
|
|||||||
|
|
||||||
NSDictionary *params = @{
|
NSDictionary *params = @{
|
||||||
@"type": trimmedType,
|
@"type": trimmedType,
|
||||||
@"account": trimmedAccount
|
@"account": trimmedAccount ?: @"",
|
||||||
|
@"token": [self kb_currentTokenOrEmpty]
|
||||||
};
|
};
|
||||||
[self postPath:KB_MAI_POINT_PATH_NEW_ACCOUNT parameters:params completion:completion];
|
[self postPath:KB_MAI_POINT_PATH_NEW_ACCOUNT parameters:params completion:completion];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- (void)reportGenericDataWithEvent:(NSString *)event
|
||||||
|
// account:(NSString * _Nullable)account
|
||||||
|
// completion:(KBMaiPointReportCompletion _Nullable)completion {
|
||||||
|
// [self reportGenericDataWithType:KBMaiPointGenericReportTypeUnknown
|
||||||
|
// event:event
|
||||||
|
// account:account
|
||||||
|
// completion:completion];
|
||||||
|
//}
|
||||||
|
|
||||||
|
- (void)reportGenericDataWithEventType:(KBMaiPointGenericReportType)eventType
|
||||||
|
account:(nullable NSString *)account
|
||||||
|
completion:(KBMaiPointReportCompletion _Nullable)completion{
|
||||||
|
// 兼容旧接口:没有 eventName 时给一个默认值,避免调用方崩溃
|
||||||
|
NSString *typeStr = @"unknown";
|
||||||
|
switch (eventType) {
|
||||||
|
case KBMaiPointGenericReportTypeClick: typeStr = KBMaiPointEventTypeClick; break;
|
||||||
|
case KBMaiPointGenericReportTypeExposure: typeStr = @"exposure"; break;
|
||||||
|
case KBMaiPointGenericReportTypePage: typeStr = KBMaiPointEventTypePageExposure; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
NSMutableDictionary *val = [NSMutableDictionary dictionary];
|
||||||
|
NSString *trimmedAccount = [self kb_trimmedStringOrEmpty:account];
|
||||||
|
if (trimmedAccount.length > 0) {
|
||||||
|
val[@"account"] = trimmedAccount;
|
||||||
|
}
|
||||||
|
[self reportEventType:typeStr eventName:@"generic_event" value:val completion:completion];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)postPath:(NSString *)path
|
- (void)postPath:(NSString *)path
|
||||||
parameters:(NSDictionary *)parameters
|
parameters:(NSDictionary *)parameters
|
||||||
completion:(KBMaiPointReportCompletion)completion {
|
completion:(KBMaiPointReportCompletion _Nullable)completion {
|
||||||
if (path.length == 0 || ![parameters isKindOfClass:[NSDictionary class]]) {
|
if (path.length == 0 || ![parameters isKindOfClass:[NSDictionary class]]) {
|
||||||
NSError *error = [NSError errorWithDomain:KBMaiPointErrorDomain
|
NSError *error = [NSError errorWithDomain:KBMaiPointErrorDomain
|
||||||
code:-1
|
code:-1
|
||||||
@@ -89,6 +233,10 @@ NSString * const KBMaiPointErrorDomain = @"KBMaiPointErrorDomain";
|
|||||||
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
||||||
request.HTTPBody = body;
|
request.HTTPBody = body;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
KBMaiPoint_DebugLogURL(request);
|
||||||
|
#endif
|
||||||
|
|
||||||
NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration];
|
NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration];
|
||||||
config.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
|
config.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
|
||||||
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
|
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
|
||||||
@@ -115,6 +263,10 @@ NSString * const KBMaiPointErrorDomain = @"KBMaiPointErrorDomain";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
KBMaiPoint_DebugLogError(response, finalError);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (completion) {
|
if (completion) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
completion(success, finalError);
|
completion(success, finalError);
|
||||||
@@ -125,3 +277,123 @@ NSString * const KBMaiPointErrorDomain = @"KBMaiPointErrorDomain";
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#if __has_include(<UIKit/UIKit.h>)
|
||||||
|
|
||||||
|
// ============================
|
||||||
|
// 自动页面曝光(viewDidAppear)
|
||||||
|
// 说明:仅对“在表里登记过的 VC”生效;其它 VC 不处理。
|
||||||
|
// ============================
|
||||||
|
|
||||||
|
static NSDictionary<NSString *, NSDictionary *> *KBMaiPoint_PageExposureMap(void) {
|
||||||
|
static NSDictionary<NSString *, NSDictionary *> *m;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
m = @{
|
||||||
|
// 主工程
|
||||||
|
@"HomeMainVC": @{@"event_name": @"enter_home_main", @"page_id": @"home_main"},
|
||||||
|
@"HomeVC": @{@"event_name": @"enter_home", @"page_id": @"home"},
|
||||||
|
@"HomeHotVC": @{@"event_name": @"enter_home_hot", @"page_id": @"home_hot"},
|
||||||
|
@"HomeRankVC": @{@"event_name": @"enter_home_rank", @"page_id": @"home_rank"},
|
||||||
|
@"HomeRankContentVC": @{@"event_name": @"enter_home_rank_content", @"page_id": @"home_rank_content"},
|
||||||
|
@"HomeSheetVC": @{@"event_name": @"enter_home_sheet", @"page_id": @"home_sheet"},
|
||||||
|
@"KBCommunityVC": @{@"event_name": @"enter_community", @"page_id": @"community"},
|
||||||
|
@"KBSearchVC": @{@"event_name": @"enter_search", @"page_id": @"search"},
|
||||||
|
@"KBSearchResultVC": @{@"event_name": @"enter_search_result", @"page_id": @"search_result"},
|
||||||
|
@"KBShopVC": @{@"event_name": @"enter_shop", @"page_id": @"shop"},
|
||||||
|
@"KBShopItemVC": @{@"event_name": @"enter_shop_item_list", @"page_id": @"shop_item_list"},
|
||||||
|
@"KBSkinDetailVC": @{@"event_name": @"enter_skin_detail", @"page_id": @"skin_detail"},
|
||||||
|
@"MyVC": @{@"event_name": @"enter_my", @"page_id": @"my"},
|
||||||
|
@"MySkinVC": @{@"event_name": @"enter_my_skin", @"page_id": @"my_skin"},
|
||||||
|
@"KBMyKeyBoardVC": @{@"event_name": @"enter_my_keyboard", @"page_id": @"my_keyboard"},
|
||||||
|
@"KBPersonInfoVC": @{@"event_name": @"enter_person_info", @"page_id": @"person_info"},
|
||||||
|
@"KBFeedBackVC": @{@"event_name": @"enter_feedback", @"page_id": @"feedback"},
|
||||||
|
@"KBNoticeVC": @{@"event_name": @"enter_notice", @"page_id": @"notice"},
|
||||||
|
@"KBConsumptionRecordVC": @{@"event_name": @"enter_consumption_record", @"page_id": @"consumption_record"},
|
||||||
|
@"KBVipPay": @{@"event_name": @"enter_vip_pay", @"page_id": @"vip_pay"},
|
||||||
|
@"KBJfPay": @{@"event_name": @"enter_points_recharge", @"page_id": @"points_recharge"},
|
||||||
|
@"KBLoginVC": @{@"event_name": @"enter_login", @"page_id": @"login"},
|
||||||
|
@"KBEmailLoginVC": @{@"event_name": @"enter_login_email", @"page_id": @"login_email"},
|
||||||
|
@"KBEmailRegistVC": @{@"event_name": @"enter_register_email", @"page_id": @"register_email"},
|
||||||
|
@"KBRegistVerEmailVC": @{@"event_name": @"enter_register_verify_email", @"page_id": @"register_verify_email"},
|
||||||
|
@"KBForgetPwdVC": @{@"event_name": @"enter_forgot_password_email", @"page_id": @"forgot_password_email"},
|
||||||
|
@"KBForgetVerPwdVC": @{@"event_name": @"enter_forgot_password_verify", @"page_id": @"forgot_password_verify"},
|
||||||
|
@"KBForgetPwdNewPwdVC": @{@"event_name": @"enter_forgot_password_newpwd", @"page_id": @"forgot_password_newpwd"},
|
||||||
|
@"KBPermissionViewController": @{@"event_name": @"enter_keyboard_permission_guide", @"page_id": @"keyboard_permission_guide"},
|
||||||
|
@"KBGuideVC": @{@"event_name": @"enter_guide", @"page_id": @"guide"},
|
||||||
|
@"KBSexSelVC": @{@"event_name": @"enter_sex_select", @"page_id": @"sex_select"},
|
||||||
|
@"KBWebViewViewController": @{@"event_name": @"enter_webview", @"page_id": @"webview"},
|
||||||
|
|
||||||
|
// 键盘扩展
|
||||||
|
@"KeyboardViewController": @{@"event_name": @"enter_keyboard", @"page_id": @"keyboard"},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void KBMaiPoint_SwizzleInstanceMethod(Class cls, SEL originalSel, SEL swizzledSel) {
|
||||||
|
Method original = class_getInstanceMethod(cls, originalSel);
|
||||||
|
Method swizzled = class_getInstanceMethod(cls, swizzledSel);
|
||||||
|
if (!original || !swizzled) return;
|
||||||
|
BOOL added = class_addMethod(cls,
|
||||||
|
originalSel,
|
||||||
|
method_getImplementation(swizzled),
|
||||||
|
method_getTypeEncoding(swizzled));
|
||||||
|
if (added) {
|
||||||
|
class_replaceMethod(cls,
|
||||||
|
swizzledSel,
|
||||||
|
method_getImplementation(original),
|
||||||
|
method_getTypeEncoding(original));
|
||||||
|
} else {
|
||||||
|
method_exchangeImplementations(original, swizzled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@interface UIViewController (KBMaiPointAutoReport)
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation UIViewController (KBMaiPointAutoReport)
|
||||||
|
|
||||||
|
+ (void)load {
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
KBMaiPoint_SwizzleInstanceMethod(self, @selector(viewDidAppear:), @selector(kb_maipoint_viewDidAppear:));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)kb_maipoint_viewDidAppear:(BOOL)animated {
|
||||||
|
[self kb_maipoint_viewDidAppear:animated];
|
||||||
|
|
||||||
|
NSString *clsName = NSStringFromClass(self.class);
|
||||||
|
NSDictionary *cfg = KBMaiPoint_PageExposureMap()[clsName];
|
||||||
|
if (![cfg isKindOfClass:NSDictionary.class]) { return; }
|
||||||
|
|
||||||
|
NSString *eventName = cfg[@"event_name"];
|
||||||
|
NSString *pageId = cfg[@"page_id"];
|
||||||
|
if (![eventName isKindOfClass:NSString.class] || ![pageId isKindOfClass:NSString.class]) { return; }
|
||||||
|
|
||||||
|
// 少数页面带额外参数(尽量不取敏感信息)
|
||||||
|
NSMutableDictionary *extra = [NSMutableDictionary dictionary];
|
||||||
|
if ([clsName isEqualToString:@"KBSkinDetailVC"]) {
|
||||||
|
id themeId = nil;
|
||||||
|
@try { themeId = [self valueForKey:@"themeId"]; } @catch (__unused NSException *e) { themeId = nil; }
|
||||||
|
if ([themeId isKindOfClass:NSString.class] && ((NSString *)themeId).length > 0) {
|
||||||
|
extra[@"theme_id"] = themeId;
|
||||||
|
}
|
||||||
|
} else if ([clsName isEqualToString:@"KBWebViewViewController"]) {
|
||||||
|
id url = nil;
|
||||||
|
@try { url = [self valueForKey:@"url"]; } @catch (__unused NSException *e) { url = nil; }
|
||||||
|
if ([url isKindOfClass:NSString.class] && ((NSString *)url).length > 0) {
|
||||||
|
extra[@"url"] = url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[[KBMaiPointReporter sharedReporter] reportPageExposureWithEventName:eventName
|
||||||
|
pageId:pageId
|
||||||
|
extra:(extra.count > 0 ? extra.copy : nil)
|
||||||
|
completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -226,6 +226,12 @@ static NSString * const kKBSkinMetadataThemeKey = @"theme_json";
|
|||||||
if ([forceValue respondsToSelector:@selector(boolValue)]) {
|
if ([forceValue respondsToSelector:@selector(boolValue)]) {
|
||||||
forceDownload = [forceValue boolValue];
|
forceDownload = [forceValue boolValue];
|
||||||
}
|
}
|
||||||
|
id serverIcons = skinJSON[@"key_icons"];
|
||||||
|
NSUInteger serverIconCount = [serverIcons isKindOfClass:NSDictionary.class] ? ((NSDictionary *)serverIcons).count : 0;
|
||||||
|
NSLog(@"[SkinBridge] request id=%@ zip=%@ force=%d key_icons_class=%@ count=%tu",
|
||||||
|
skinId, zipURL, forceDownload,
|
||||||
|
serverIcons ? NSStringFromClass([serverIcons class]) : @"nil",
|
||||||
|
serverIconCount);
|
||||||
|
|
||||||
// key_icons 可选:
|
// key_icons 可选:
|
||||||
// - 若后端提供 key_icons,则优先使用服务端映射;
|
// - 若后端提供 key_icons,则优先使用服务端映射;
|
||||||
@@ -236,6 +242,9 @@ static NSString * const kKBSkinMetadataThemeKey = @"theme_json";
|
|||||||
} else {
|
} else {
|
||||||
iconShortNames = [self defaultIconShortNames];
|
iconShortNames = [self defaultIconShortNames];
|
||||||
}
|
}
|
||||||
|
NSLog(@"[SkinBridge] iconShortNames source=%@ count=%tu",
|
||||||
|
[skinJSON[@"key_icons"] isKindOfClass:NSDictionary.class] ? @"server" : @"default",
|
||||||
|
iconShortNames.count);
|
||||||
|
|
||||||
NSFileManager *fm = [NSFileManager defaultManager];
|
NSFileManager *fm = [NSFileManager defaultManager];
|
||||||
NSURL *containerURL = [fm containerURLForSecurityApplicationGroupIdentifier:AppGroup];
|
NSURL *containerURL = [fm containerURLForSecurityApplicationGroupIdentifier:AppGroup];
|
||||||
@@ -262,6 +271,7 @@ static NSString * const kKBSkinMetadataThemeKey = @"theme_json";
|
|||||||
NSArray *contents = hasIconsDir ? [fm contentsOfDirectoryAtPath:iconsDir error:NULL] : nil;
|
NSArray *contents = hasIconsDir ? [fm contentsOfDirectoryAtPath:iconsDir error:NULL] : nil;
|
||||||
// 标记在本次请求发起前是否已经有缓存资源(用于“有缓存但本次下载失败”时仍允许切换皮肤)。
|
// 标记在本次请求发起前是否已经有缓存资源(用于“有缓存但本次下载失败”时仍允许切换皮肤)。
|
||||||
BOOL hasCachedAssets = (contents.count > 0);
|
BOOL hasCachedAssets = (contents.count > 0);
|
||||||
|
NSLog(@"[SkinBridge] assets cache id=%@ cached=%d iconsDir=%@", skinId, hasCachedAssets, iconsDir);
|
||||||
|
|
||||||
NSString *bgPath = [skinRoot stringByAppendingPathComponent:@"background.png"];
|
NSString *bgPath = [skinRoot stringByAppendingPathComponent:@"background.png"];
|
||||||
BOOL useTempRoot = forceDownload;
|
BOOL useTempRoot = forceDownload;
|
||||||
@@ -482,6 +492,8 @@ static NSString * const kKBSkinMetadataThemeKey = @"theme_json";
|
|||||||
// 若既没有预先存在的缓存资源,也没有在本次流程中成功解压出资源,
|
// 若既没有预先存在的缓存资源,也没有在本次流程中成功解压出资源,
|
||||||
// 说明当前皮肤 B 的资源完全不可用,此时不应覆盖现有皮肤主题。
|
// 说明当前皮肤 B 的资源完全不可用,此时不应覆盖现有皮肤主题。
|
||||||
BOOL hasAssets = (didUnzip || (!forceDownload && hasCachedAssets));
|
BOOL hasAssets = (didUnzip || (!forceDownload && hasCachedAssets));
|
||||||
|
NSLog(@"[SkinBridge] apply check id=%@ hasAssets=%d didUnzip=%d cached=%d",
|
||||||
|
skinId, hasAssets, didUnzip, hasCachedAssets);
|
||||||
if (!hasAssets) {
|
if (!hasAssets) {
|
||||||
NSError *finalError = innerError ?: [NSError errorWithDomain:KBSkinBridgeErrorDomain
|
NSError *finalError = innerError ?: [NSError errorWithDomain:KBSkinBridgeErrorDomain
|
||||||
code:KBSkinBridgeErrorZipMissing
|
code:KBSkinBridgeErrorZipMissing
|
||||||
@@ -491,7 +503,9 @@ static NSString * const kKBSkinMetadataThemeKey = @"theme_json";
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构造 key_icons -> App Group 相对路径 映射
|
// 构造 key_icons -> App Group 相对路径 映射(仅保留实际存在的图标)
|
||||||
|
NSString *iconsDirFinal = [skinRoot stringByAppendingPathComponent:@"icons"];
|
||||||
|
__block NSUInteger missingCount = 0;
|
||||||
NSMutableDictionary<NSString *, NSString *> *iconPathMap = [NSMutableDictionary dictionary];
|
NSMutableDictionary<NSString *, NSString *> *iconPathMap = [NSMutableDictionary dictionary];
|
||||||
[iconShortNames enumerateKeysAndObjectsUsingBlock:^(NSString *identifier, NSString *shortName, BOOL *stop) {
|
[iconShortNames enumerateKeysAndObjectsUsingBlock:^(NSString *identifier, NSString *shortName, BOOL *stop) {
|
||||||
if (![shortName isKindOfClass:NSString.class] || shortName.length == 0) return;
|
if (![shortName isKindOfClass:NSString.class] || shortName.length == 0) return;
|
||||||
@@ -500,9 +514,27 @@ static NSString * const kKBSkinMetadataThemeKey = @"theme_json";
|
|||||||
if (fileName.pathExtension.length == 0) {
|
if (fileName.pathExtension.length == 0) {
|
||||||
fileName = [fileName stringByAppendingPathExtension:@"png"];
|
fileName = [fileName stringByAppendingPathExtension:@"png"];
|
||||||
}
|
}
|
||||||
|
NSString *fullPath = [iconsDirFinal stringByAppendingPathComponent:fileName];
|
||||||
|
if (![fm fileExistsAtPath:fullPath]) {
|
||||||
|
missingCount += 1;
|
||||||
|
if (missingCount <= 5) {
|
||||||
|
NSLog(@"[SkinBridge] icon missing id=%@ short=%@", identifier, fileName);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
NSString *relative = [NSString stringWithFormat:@"Skins/%@/icons/%@", skinId, fileName];
|
NSString *relative = [NSString stringWithFormat:@"Skins/%@/icons/%@", skinId, fileName];
|
||||||
iconPathMap[identifier] = relative;
|
iconPathMap[identifier] = relative;
|
||||||
}];
|
}];
|
||||||
|
if (missingCount > 0) {
|
||||||
|
NSLog(@"[SkinBridge] icon missing count=%tu total=%tu", missingCount, iconShortNames.count);
|
||||||
|
}
|
||||||
|
NSLog(@"[SkinBridge] iconPathMap count=%tu shift=%@ shift_upper=%@ backspace=%@ mode_123=%@ return=%@",
|
||||||
|
iconPathMap.count,
|
||||||
|
iconPathMap[@"shift"],
|
||||||
|
iconPathMap[@"shift_upper"],
|
||||||
|
iconPathMap[@"backspace"],
|
||||||
|
iconPathMap[@"mode_123"],
|
||||||
|
iconPathMap[@"return"]);
|
||||||
|
|
||||||
NSMutableDictionary *themeJSON = [skinJSON mutableCopy];
|
NSMutableDictionary *themeJSON = [skinJSON mutableCopy];
|
||||||
themeJSON[@"id"] = skinId;
|
themeJSON[@"id"] = skinId;
|
||||||
@@ -515,6 +547,8 @@ static NSString * const kKBSkinMetadataThemeKey = @"theme_json";
|
|||||||
// 背景图优先从 Zip 解压出的 background.png 读取
|
// 背景图优先从 Zip 解压出的 background.png 读取
|
||||||
NSData *bgData = [NSData dataWithContentsOfFile:bgPath];
|
NSData *bgData = [NSData dataWithContentsOfFile:bgPath];
|
||||||
BOOL ok = themeOK;
|
BOOL ok = themeOK;
|
||||||
|
NSLog(@"[SkinBridge] theme apply id=%@ themeOK=%d bg=%d",
|
||||||
|
skinId, themeOK, (bgData.length > 0));
|
||||||
if (bgData.length > 0) {
|
if (bgData.length > 0) {
|
||||||
ok = [[KBSkinManager shared] applyImageSkinWithData:bgData skinId:skinId name:name];
|
ok = [[KBSkinManager shared] applyImageSkinWithData:bgData skinId:skinId name:name];
|
||||||
}
|
}
|
||||||
@@ -748,6 +782,8 @@ static NSString * const kKBSkinMetadataThemeKey = @"theme_json";
|
|||||||
shortNames = [self defaultIconShortNames];
|
shortNames = [self defaultIconShortNames];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSString *iconsDirFinal = iconsDir;
|
||||||
|
__block NSUInteger missingCount = 0;
|
||||||
NSMutableDictionary<NSString *, NSString *> *iconPathMap = [NSMutableDictionary dictionary];
|
NSMutableDictionary<NSString *, NSString *> *iconPathMap = [NSMutableDictionary dictionary];
|
||||||
[shortNames enumerateKeysAndObjectsUsingBlock:^(NSString *identifier, NSString *shortName, BOOL *stop) {
|
[shortNames enumerateKeysAndObjectsUsingBlock:^(NSString *identifier, NSString *shortName, BOOL *stop) {
|
||||||
if (identifier.length == 0 || ![shortName isKindOfClass:NSString.class] || shortName.length == 0) return;
|
if (identifier.length == 0 || ![shortName isKindOfClass:NSString.class] || shortName.length == 0) return;
|
||||||
@@ -755,9 +791,20 @@ static NSString * const kKBSkinMetadataThemeKey = @"theme_json";
|
|||||||
if (fileName.pathExtension.length == 0) {
|
if (fileName.pathExtension.length == 0) {
|
||||||
fileName = [fileName stringByAppendingPathExtension:@"png"];
|
fileName = [fileName stringByAppendingPathExtension:@"png"];
|
||||||
}
|
}
|
||||||
|
NSString *fullPath = [iconsDirFinal stringByAppendingPathComponent:fileName];
|
||||||
|
if (![fm fileExistsAtPath:fullPath]) {
|
||||||
|
missingCount += 1;
|
||||||
|
if (missingCount <= 5) {
|
||||||
|
NSLog(@"[SkinBridge] icon missing(bundle) id=%@ short=%@", identifier, fileName);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
NSString *relative = [NSString stringWithFormat:@"Skins/%@/icons/%@", skinId, fileName];
|
NSString *relative = [NSString stringWithFormat:@"Skins/%@/icons/%@", skinId, fileName];
|
||||||
iconPathMap[identifier] = relative;
|
iconPathMap[identifier] = relative;
|
||||||
}];
|
}];
|
||||||
|
if (missingCount > 0) {
|
||||||
|
NSLog(@"[SkinBridge] icon missing(bundle) count=%tu total=%tu", missingCount, shortNames.count);
|
||||||
|
}
|
||||||
|
|
||||||
NSMutableDictionary *themeJSON = [NSMutableDictionary dictionary];
|
NSMutableDictionary *themeJSON = [NSMutableDictionary dictionary];
|
||||||
themeJSON[@"id"] = skinId;
|
themeJSON[@"id"] = skinId;
|
||||||
|
|||||||
@@ -152,6 +152,18 @@ static void KBSkinDarwinCallback(CFNotificationCenterRef center, void *observer,
|
|||||||
if ([icons isKindOfClass:NSDictionary.class]) {
|
if ([icons isKindOfClass:NSDictionary.class]) {
|
||||||
t.keyIconMap = icons;
|
t.keyIconMap = icons;
|
||||||
}
|
}
|
||||||
|
NSUInteger iconCount = [t.keyIconMap isKindOfClass:NSDictionary.class] ? t.keyIconMap.count : 0;
|
||||||
|
NSUInteger hiddenCount = t.hiddenKeyTextIdentifiers.count;
|
||||||
|
NSLog(@"[SkinManager] applyThemeFromJSON id=%@ name=%@ iconMap=%tu hiddenKeys=%tu",
|
||||||
|
t.skinId, t.name, iconCount, hiddenCount);
|
||||||
|
if (iconCount > 0) {
|
||||||
|
NSLog(@"[SkinManager] iconMap sample shift=%@ shift_upper=%@ backspace=%@ mode_123=%@ return=%@",
|
||||||
|
t.keyIconMap[@"shift"],
|
||||||
|
t.keyIconMap[@"shift_upper"],
|
||||||
|
t.keyIconMap[@"backspace"],
|
||||||
|
t.keyIconMap[@"mode_123"],
|
||||||
|
t.keyIconMap[@"return"]);
|
||||||
|
}
|
||||||
return [self applyTheme:t];
|
return [self applyTheme:t];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +261,19 @@ static void KBSkinDarwinCallback(CFNotificationCenterRef center, void *observer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (UIImage *)iconImageForKeyIdentifier:(NSString *)identifier caseVariant:(NSInteger)caseVariant {
|
- (UIImage *)iconImageForKeyIdentifier:(NSString *)identifier caseVariant:(NSInteger)caseVariant {
|
||||||
|
#if DEBUG
|
||||||
|
static NSSet<NSString *> *kb_debugIconIds;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
kb_debugIconIds = [NSSet setWithObjects:
|
||||||
|
@"shift", @"backspace", @"mode_123", @"mode_abc",
|
||||||
|
@"symbols_toggle_more", @"symbols_toggle_123",
|
||||||
|
@"return", @"space", @"emoji_panel", @"letter_q",
|
||||||
|
nil];
|
||||||
|
});
|
||||||
|
BOOL shouldLog = [kb_debugIconIds containsObject:identifier];
|
||||||
|
#endif
|
||||||
|
|
||||||
NSDictionary<NSString *, NSString *> *map = self.current.keyIconMap;
|
NSDictionary<NSString *, NSString *> *map = self.current.keyIconMap;
|
||||||
NSString *value = nil;
|
NSString *value = nil;
|
||||||
|
|
||||||
@@ -292,10 +317,23 @@ static void KBSkinDarwinCallback(CFNotificationCenterRef center, void *observer,
|
|||||||
UIImage *img = [UIImage imageWithContentsOfFile:fullPath];
|
UIImage *img = [UIImage imageWithContentsOfFile:fullPath];
|
||||||
if (img) return img;
|
if (img) return img;
|
||||||
}
|
}
|
||||||
|
#if DEBUG
|
||||||
|
if (shouldLog) {
|
||||||
|
NSLog(@"[SkinManager] icon file missing id=%@ value=%@ skin=%@",
|
||||||
|
identifier, value, self.current.skinId ?: @"");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
// 否则按本地 Assets 名称加载(兼容旧实现)
|
// 否则按本地 Assets 名称加载(兼容旧实现)
|
||||||
return [UIImage imageNamed:value];
|
UIImage *img = [UIImage imageNamed:value];
|
||||||
|
#if DEBUG
|
||||||
|
if (!img && shouldLog) {
|
||||||
|
NSLog(@"[SkinManager] icon asset missing id=%@ value=%@ skin=%@",
|
||||||
|
identifier, value, self.current.skinId ?: @"");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 兜底:若 keyIconMap 中没有该键,则按照约定的命名规则直接从 App Group 读取:
|
// 兜底:若 keyIconMap 中没有该键,则按照约定的命名规则直接从 App Group 读取:
|
||||||
@@ -329,6 +367,12 @@ static void KBSkinDarwinCallback(CFNotificationCenterRef center, void *observer,
|
|||||||
if (img) return img;
|
if (img) return img;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if DEBUG
|
||||||
|
if (shouldLog) {
|
||||||
|
NSLog(@"[SkinManager] icon fallback missing id=%@ variant=%ld skin=%@",
|
||||||
|
identifier, (long)caseVariant, self.current.skinId ?: @"");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
_DerivedData/Logs/Build/LogStoreManifest.plist
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>logFormatVersion</key>
|
||||||
|
<integer>11</integer>
|
||||||
|
<key>logs</key>
|
||||||
|
<dict/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
10
_DerivedData/Logs/Launch/LogStoreManifest.plist
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>logFormatVersion</key>
|
||||||
|
<integer>11</integer>
|
||||||
|
<key>logs</key>
|
||||||
|
<dict/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
10
_DerivedData/Logs/Localization/LogStoreManifest.plist
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>logFormatVersion</key>
|
||||||
|
<integer>11</integer>
|
||||||
|
<key>logs</key>
|
||||||
|
<dict/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
47
_DerivedData/Logs/Package/LogStoreManifest.plist
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>logFormatVersion</key>
|
||||||
|
<integer>11</integer>
|
||||||
|
<key>logs</key>
|
||||||
|
<dict>
|
||||||
|
<key>800731DD-5595-43EC-B207-003BAB7870CE</key>
|
||||||
|
<dict>
|
||||||
|
<key>className</key>
|
||||||
|
<string>IDECommandLineBuildLog</string>
|
||||||
|
<key>documentTypeString</key>
|
||||||
|
<string><nil></string>
|
||||||
|
<key>domainType</key>
|
||||||
|
<string>Xcode.IDEActivityLogDomainType.BuildLog</string>
|
||||||
|
<key>fileName</key>
|
||||||
|
<string>800731DD-5595-43EC-B207-003BAB7870CE.xcactivitylog</string>
|
||||||
|
<key>hasPrimaryLog</key>
|
||||||
|
<true/>
|
||||||
|
<key>primaryObservable</key>
|
||||||
|
<dict>
|
||||||
|
<key>highLevelStatus</key>
|
||||||
|
<string>E</string>
|
||||||
|
<key>totalNumberOfAnalyzerIssues</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>totalNumberOfErrors</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>totalNumberOfTestFailures</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>totalNumberOfWarnings</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
</dict>
|
||||||
|
<key>signature</key>
|
||||||
|
<string>Resolve Packages</string>
|
||||||
|
<key>timeStartedRecording</key>
|
||||||
|
<real>788359220.39837599</real>
|
||||||
|
<key>timeStoppedRecording</key>
|
||||||
|
<real>788359220.51885402</real>
|
||||||
|
<key>title</key>
|
||||||
|
<string>Resolve Packages</string>
|
||||||
|
<key>uniqueIdentifier</key>
|
||||||
|
<string>800731DD-5595-43EC-B207-003BAB7870CE</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
10
_DerivedData/Logs/Test/LogStoreManifest.plist
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>logFormatVersion</key>
|
||||||
|
<integer>11</integer>
|
||||||
|
<key>logs</key>
|
||||||
|
<dict/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
29
_xcodebuild.xcresult/Info.plist
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>dateCreated</key>
|
||||||
|
<date>2025-12-25T12:40:20Z</date>
|
||||||
|
<key>externalLocations</key>
|
||||||
|
<array/>
|
||||||
|
<key>rootId</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<string>0~z4eUyi7LNyiJgMc9YvhirRPEbAqQY1U8Utz3Zonm5K5gXqlevHrHNamc2oelL32RyN2c9x-M59B2wBAeP3TOAg==</string>
|
||||||
|
</dict>
|
||||||
|
<key>storage</key>
|
||||||
|
<dict>
|
||||||
|
<key>backend</key>
|
||||||
|
<string>fileBacked2</string>
|
||||||
|
<key>compression</key>
|
||||||
|
<string>standard</string>
|
||||||
|
</dict>
|
||||||
|
<key>version</key>
|
||||||
|
<dict>
|
||||||
|
<key>major</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>minor</key>
|
||||||
|
<integer>53</integer>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
04050ECB2F10FB8F008051EB /* UIImage+KBColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 047C655D2EBCD5B20035E841 /* UIImage+KBColor.m */; };
|
||||||
041007D22ECE012000D203BB /* KBSkinIconMap.strings in Resources */ = {isa = PBXBuildFile; fileRef = 041007D12ECE012000D203BB /* KBSkinIconMap.strings */; };
|
041007D22ECE012000D203BB /* KBSkinIconMap.strings in Resources */ = {isa = PBXBuildFile; fileRef = 041007D12ECE012000D203BB /* KBSkinIconMap.strings */; };
|
||||||
041007D42ECE012500D203BB /* 002.zip in Resources */ = {isa = PBXBuildFile; fileRef = 041007D32ECE012500D203BB /* 002.zip */; };
|
041007D42ECE012500D203BB /* 002.zip in Resources */ = {isa = PBXBuildFile; fileRef = 041007D32ECE012500D203BB /* 002.zip */; };
|
||||||
04122F5D2EC5E5A900EF7AB3 /* KBLoginVM.m in Sources */ = {isa = PBXBuildFile; fileRef = 04122F5B2EC5E5A900EF7AB3 /* KBLoginVM.m */; };
|
04122F5D2EC5E5A900EF7AB3 /* KBLoginVM.m in Sources */ = {isa = PBXBuildFile; fileRef = 04122F5B2EC5E5A900EF7AB3 /* KBLoginVM.m */; };
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
04286A062ECC81B200CE730C /* KBSkinService.m in Sources */ = {isa = PBXBuildFile; fileRef = 04286A052ECC81B200CE730C /* KBSkinService.m */; };
|
04286A062ECC81B200CE730C /* KBSkinService.m in Sources */ = {isa = PBXBuildFile; fileRef = 04286A052ECC81B200CE730C /* KBSkinService.m */; };
|
||||||
04286A0B2ECD88B400CE730C /* KeyboardAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04286A0A2ECD88B400CE730C /* KeyboardAssets.xcassets */; };
|
04286A0B2ECD88B400CE730C /* KeyboardAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04286A0A2ECD88B400CE730C /* KeyboardAssets.xcassets */; };
|
||||||
04286A0F2ECDA71B00CE730C /* 001.zip in Resources */ = {isa = PBXBuildFile; fileRef = 04286A0E2ECDA71B00CE730C /* 001.zip */; };
|
04286A0F2ECDA71B00CE730C /* 001.zip in Resources */ = {isa = PBXBuildFile; fileRef = 04286A0E2ECDA71B00CE730C /* 001.zip */; };
|
||||||
04286A132ECDEBF900CE730C /* KBSkinIconMap.strings in Resources */ = {isa = PBXBuildFile; fileRef = 04286A122ECDEBF900CE730C /* KBSkinIconMap.strings */; };
|
04286A132ECDEBF900CE730C /* KBSkinIconMap.strings in Resources */ = {isa = PBXBuildFile; fileRef = 041007D12ECE012000D203BB /* KBSkinIconMap.strings */; };
|
||||||
043FBCD22EAF97630036AFE1 /* KBPermissionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAE12EAF940F0089C901 /* KBPermissionViewController.m */; };
|
043FBCD22EAF97630036AFE1 /* KBPermissionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAE12EAF940F0089C901 /* KBPermissionViewController.m */; };
|
||||||
0450AA742EF013D000B6AF06 /* KBEmojiCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */; };
|
0450AA742EF013D000B6AF06 /* KBEmojiCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */; };
|
||||||
0450AAE22EF03D5100B6AF06 /* KBPerson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0450AAE12EF03D5100B6AF06 /* KBPerson.swift */; };
|
0450AAE22EF03D5100B6AF06 /* KBPerson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0450AAE12EF03D5100B6AF06 /* KBPerson.swift */; };
|
||||||
@@ -67,7 +68,6 @@
|
|||||||
04791F982ED49CE7004E8522 /* KBFont.m in Sources */ = {isa = PBXBuildFile; fileRef = 04791F972ED49CE7004E8522 /* KBFont.m */; };
|
04791F982ED49CE7004E8522 /* KBFont.m in Sources */ = {isa = PBXBuildFile; fileRef = 04791F972ED49CE7004E8522 /* KBFont.m */; };
|
||||||
04791F992ED49CE7004E8522 /* KBFont.m in Sources */ = {isa = PBXBuildFile; fileRef = 04791F972ED49CE7004E8522 /* KBFont.m */; };
|
04791F992ED49CE7004E8522 /* KBFont.m in Sources */ = {isa = PBXBuildFile; fileRef = 04791F972ED49CE7004E8522 /* KBFont.m */; };
|
||||||
04791FF72ED5B985004E8522 /* Christmas.zip in Resources */ = {isa = PBXBuildFile; fileRef = 04791FF62ED5B985004E8522 /* Christmas.zip */; };
|
04791FF72ED5B985004E8522 /* Christmas.zip in Resources */ = {isa = PBXBuildFile; fileRef = 04791FF62ED5B985004E8522 /* Christmas.zip */; };
|
||||||
04791FFB2ED5EAB8004E8522 /* fense.zip in Resources */ = {isa = PBXBuildFile; fileRef = 04791FFA2ED5EAB8004E8522 /* fense.zip */; };
|
|
||||||
04791FFC2ED71D17004E8522 /* UIColor+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95E42EB220B5007BD342 /* UIColor+Extension.m */; };
|
04791FFC2ED71D17004E8522 /* UIColor+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95E42EB220B5007BD342 /* UIColor+Extension.m */; };
|
||||||
04791FFF2ED830FA004E8522 /* KBKeyboardMaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04791FFE2ED830FA004E8522 /* KBKeyboardMaskView.m */; };
|
04791FFF2ED830FA004E8522 /* KBKeyboardMaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04791FFE2ED830FA004E8522 /* KBKeyboardMaskView.m */; };
|
||||||
047920072ED86ABC004E8522 /* kb_guide_keyboard.gif in Resources */ = {isa = PBXBuildFile; fileRef = 047920062ED86ABC004E8522 /* kb_guide_keyboard.gif */; };
|
047920072ED86ABC004E8522 /* kb_guide_keyboard.gif in Resources */ = {isa = PBXBuildFile; fileRef = 047920062ED86ABC004E8522 /* kb_guide_keyboard.gif */; };
|
||||||
@@ -129,10 +129,6 @@
|
|||||||
0498BD8C2EE69E15006CC1D5 /* KBTagItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BD8A2EE69E15006CC1D5 /* KBTagItemModel.m */; };
|
0498BD8C2EE69E15006CC1D5 /* KBTagItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BD8A2EE69E15006CC1D5 /* KBTagItemModel.m */; };
|
||||||
0498BD8F2EE6A3BD006CC1D5 /* KBMyMainModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BD8E2EE6A3BD006CC1D5 /* KBMyMainModel.m */; };
|
0498BD8F2EE6A3BD006CC1D5 /* KBMyMainModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BD8E2EE6A3BD006CC1D5 /* KBMyMainModel.m */; };
|
||||||
0498BD902EE6A3BD006CC1D5 /* KBMyMainModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BD8E2EE6A3BD006CC1D5 /* KBMyMainModel.m */; };
|
0498BD902EE6A3BD006CC1D5 /* KBMyMainModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BD8E2EE6A3BD006CC1D5 /* KBMyMainModel.m */; };
|
||||||
A1F0C1D22FACAD0012345678 /* KBMaiPointReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1D12FACAD0012345678 /* KBMaiPointReporter.m */; };
|
|
||||||
A1F0C1D32FACAD0012345678 /* KBMaiPointReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1D12FACAD0012345678 /* KBMaiPointReporter.m */; };
|
|
||||||
A1F0C1C22FABCDEF12345678 /* KBInviteCodeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1C12FABCDEF12345678 /* KBInviteCodeModel.m */; };
|
|
||||||
A1F0C1C32FABCDEF12345678 /* KBInviteCodeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1C12FABCDEF12345678 /* KBInviteCodeModel.m */; };
|
|
||||||
0498BDDA2EE7ECEA006CC1D5 /* WJXEventSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BDD82EE7ECEA006CC1D5 /* WJXEventSource.m */; };
|
0498BDDA2EE7ECEA006CC1D5 /* WJXEventSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BDD82EE7ECEA006CC1D5 /* WJXEventSource.m */; };
|
||||||
0498BDDE2EE81508006CC1D5 /* KBShopVM.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BDDD2EE81508006CC1D5 /* KBShopVM.m */; };
|
0498BDDE2EE81508006CC1D5 /* KBShopVM.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BDDD2EE81508006CC1D5 /* KBShopVM.m */; };
|
||||||
0498BDE12EEA87C9006CC1D5 /* KBShopStyleModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BDE02EEA87C8006CC1D5 /* KBShopStyleModel.m */; };
|
0498BDE12EEA87C9006CC1D5 /* KBShopStyleModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498BDE02EEA87C8006CC1D5 /* KBShopStyleModel.m */; };
|
||||||
@@ -149,8 +145,6 @@
|
|||||||
049FB2292EC31BB000FAB05D /* KBChangeNicknamePopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB2282EC31BB000FAB05D /* KBChangeNicknamePopView.m */; };
|
049FB2292EC31BB000FAB05D /* KBChangeNicknamePopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB2282EC31BB000FAB05D /* KBChangeNicknamePopView.m */; };
|
||||||
049FB22C2EC31F8800FAB05D /* KBGenderPickerPopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB22B2EC31F8800FAB05D /* KBGenderPickerPopView.m */; };
|
049FB22C2EC31F8800FAB05D /* KBGenderPickerPopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB22B2EC31F8800FAB05D /* KBGenderPickerPopView.m */; };
|
||||||
049FB22F2EC34EB900FAB05D /* KBStreamTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB22E2EC34EB900FAB05D /* KBStreamTextView.m */; };
|
049FB22F2EC34EB900FAB05D /* KBStreamTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB22E2EC34EB900FAB05D /* KBStreamTextView.m */; };
|
||||||
049FB2322EC45A0000FAB05D /* KBStreamFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB2312EC45A0000FAB05D /* KBStreamFetcher.m */; };
|
|
||||||
049FB2352EC45C6A00FAB05D /* NetworkStreamHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB2342EC45C6A00FAB05D /* NetworkStreamHandler.m */; };
|
|
||||||
049FB23B2EC4766700FAB05D /* KBFunctionTagListView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB2372EC4766700FAB05D /* KBFunctionTagListView.m */; };
|
049FB23B2EC4766700FAB05D /* KBFunctionTagListView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB2372EC4766700FAB05D /* KBFunctionTagListView.m */; };
|
||||||
049FB23C2EC4766700FAB05D /* KBStreamOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB2392EC4766700FAB05D /* KBStreamOverlayView.m */; };
|
049FB23C2EC4766700FAB05D /* KBStreamOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB2392EC4766700FAB05D /* KBStreamOverlayView.m */; };
|
||||||
049FB23F2EC4B6EF00FAB05D /* KBULBridgeNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB23E2EC4B6EF00FAB05D /* KBULBridgeNotification.m */; };
|
049FB23F2EC4B6EF00FAB05D /* KBULBridgeNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 049FB23E2EC4B6EF00FAB05D /* KBULBridgeNotification.m */; };
|
||||||
@@ -176,6 +170,8 @@
|
|||||||
04C6EADD2EAF8CEB0089C901 /* KBToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EADC2EAF8CEB0089C901 /* KBToolBar.m */; };
|
04C6EADD2EAF8CEB0089C901 /* KBToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EADC2EAF8CEB0089C901 /* KBToolBar.m */; };
|
||||||
04D1F6B22EDFF10A00B12345 /* KBSkinInstallBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D1F6B12EDFF10A00B12345 /* KBSkinInstallBridge.m */; };
|
04D1F6B22EDFF10A00B12345 /* KBSkinInstallBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D1F6B12EDFF10A00B12345 /* KBSkinInstallBridge.m */; };
|
||||||
04D1F6B32EDFF10A00B12345 /* KBSkinInstallBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D1F6B12EDFF10A00B12345 /* KBSkinInstallBridge.m */; };
|
04D1F6B32EDFF10A00B12345 /* KBSkinInstallBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 04D1F6B12EDFF10A00B12345 /* KBSkinInstallBridge.m */; };
|
||||||
|
04E161832F10E6470022C23B /* normal_hei_them.zip in Resources */ = {isa = PBXBuildFile; fileRef = 04E161812F10E6470022C23B /* normal_hei_them.zip */; };
|
||||||
|
04E161842F10E6470022C23B /* normal_them.zip in Resources */ = {isa = PBXBuildFile; fileRef = 04E161822F10E6470022C23B /* normal_them.zip */; };
|
||||||
04FC95672EB0546C007BD342 /* KBKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95652EB0546C007BD342 /* KBKey.m */; };
|
04FC95672EB0546C007BD342 /* KBKey.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95652EB0546C007BD342 /* KBKey.m */; };
|
||||||
04FC956A2EB05497007BD342 /* KBKeyButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95692EB05497007BD342 /* KBKeyButton.m */; };
|
04FC956A2EB05497007BD342 /* KBKeyButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC95692EB05497007BD342 /* KBKeyButton.m */; };
|
||||||
04FC956D2EB054B7007BD342 /* KBKeyboardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC956C2EB054B7007BD342 /* KBKeyboardView.m */; };
|
04FC956D2EB054B7007BD342 /* KBKeyboardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC956C2EB054B7007BD342 /* KBKeyboardView.m */; };
|
||||||
@@ -205,6 +201,7 @@
|
|||||||
04FEDB032EFE000000123456 /* KBEmojiBottomBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDB022EFE000000123456 /* KBEmojiBottomBarView.m */; };
|
04FEDB032EFE000000123456 /* KBEmojiBottomBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDB022EFE000000123456 /* KBEmojiBottomBarView.m */; };
|
||||||
04FEDC122F00010000999999 /* KBKeyboardSubscriptionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDC112F00010000999999 /* KBKeyboardSubscriptionView.m */; };
|
04FEDC122F00010000999999 /* KBKeyboardSubscriptionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDC112F00010000999999 /* KBKeyboardSubscriptionView.m */; };
|
||||||
04FEDC222F00020000999999 /* KBKeyboardSubscriptionProduct.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDC212F00020000999999 /* KBKeyboardSubscriptionProduct.m */; };
|
04FEDC222F00020000999999 /* KBKeyboardSubscriptionProduct.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDC212F00020000999999 /* KBKeyboardSubscriptionProduct.m */; };
|
||||||
|
04FEDC252F10000100000001 /* KBKeyboardLayoutConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDC242F10000100000001 /* KBKeyboardLayoutConfig.m */; };
|
||||||
04FEDC322F00030000999999 /* KBKeyboardSubscriptionFeatureItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDC312F00030000999999 /* KBKeyboardSubscriptionFeatureItemView.m */; };
|
04FEDC322F00030000999999 /* KBKeyboardSubscriptionFeatureItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDC312F00030000999999 /* KBKeyboardSubscriptionFeatureItemView.m */; };
|
||||||
04FEDC422F00040000999999 /* KBKeyboardSubscriptionFeatureMarqueeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDC412F00040000999999 /* KBKeyboardSubscriptionFeatureMarqueeView.m */; };
|
04FEDC422F00040000999999 /* KBKeyboardSubscriptionFeatureMarqueeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDC412F00040000999999 /* KBKeyboardSubscriptionFeatureMarqueeView.m */; };
|
||||||
05A1B2D12F5B1A2B3C4D5E60 /* KBSearchVM.m in Sources */ = {isa = PBXBuildFile; fileRef = 05A1B2C52F5B1A2B3C4D5E60 /* KBSearchVM.m */; };
|
05A1B2D12F5B1A2B3C4D5E60 /* KBSearchVM.m in Sources */ = {isa = PBXBuildFile; fileRef = 05A1B2C52F5B1A2B3C4D5E60 /* KBSearchVM.m */; };
|
||||||
@@ -218,6 +215,7 @@
|
|||||||
A1B2C3EA2F20000000000001 /* KBSuggestionEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3E72F20000000000001 /* KBSuggestionEngine.m */; };
|
A1B2C3EA2F20000000000001 /* KBSuggestionEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3E72F20000000000001 /* KBSuggestionEngine.m */; };
|
||||||
A1B2C3EB2F20000000000001 /* KBSuggestionBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3E92F20000000000001 /* KBSuggestionBarView.m */; };
|
A1B2C3EB2F20000000000001 /* KBSuggestionBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3E92F20000000000001 /* KBSuggestionBarView.m */; };
|
||||||
A1B2C3ED2F20000000000001 /* kb_words.txt in Resources */ = {isa = PBXBuildFile; fileRef = A1B2C3EC2F20000000000001 /* kb_words.txt */; };
|
A1B2C3ED2F20000000000001 /* kb_words.txt in Resources */ = {isa = PBXBuildFile; fileRef = A1B2C3EC2F20000000000001 /* kb_words.txt */; };
|
||||||
|
A1B2C3F12F20000000000002 /* kb_keyboard_layout_config.json in Resources */ = {isa = PBXBuildFile; fileRef = A1B2C3F02F20000000000002 /* kb_keyboard_layout_config.json */; };
|
||||||
A1B2C3F42EB35A9900000001 /* KBFullAccessGuideView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3F22EB35A9900000001 /* KBFullAccessGuideView.m */; };
|
A1B2C3F42EB35A9900000001 /* KBFullAccessGuideView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3F22EB35A9900000001 /* KBFullAccessGuideView.m */; };
|
||||||
A1B2C4002EB4A0A100000003 /* KBAuthManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C4002EB4A0A100000002 /* KBAuthManager.m */; };
|
A1B2C4002EB4A0A100000003 /* KBAuthManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C4002EB4A0A100000002 /* KBAuthManager.m */; };
|
||||||
A1B2C4002EB4A0A100000004 /* KBAuthManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C4002EB4A0A100000002 /* KBAuthManager.m */; };
|
A1B2C4002EB4A0A100000004 /* KBAuthManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C4002EB4A0A100000002 /* KBAuthManager.m */; };
|
||||||
@@ -225,12 +223,17 @@
|
|||||||
A1B2C4212EB4B7A100000001 /* KBKeyboardPermissionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C4222EB4B7A100000001 /* KBKeyboardPermissionManager.m */; };
|
A1B2C4212EB4B7A100000001 /* KBKeyboardPermissionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C4222EB4B7A100000001 /* KBKeyboardPermissionManager.m */; };
|
||||||
A1B2C9032FBD000100000001 /* KBBackspaceLongPressHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C9022FBD000100000001 /* KBBackspaceLongPressHandler.m */; };
|
A1B2C9032FBD000100000001 /* KBBackspaceLongPressHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C9022FBD000100000001 /* KBBackspaceLongPressHandler.m */; };
|
||||||
A1B2C9052FBD000200000001 /* KBBackspaceUndoManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C9042FBD000200000001 /* KBBackspaceUndoManager.m */; };
|
A1B2C9052FBD000200000001 /* KBBackspaceUndoManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C9042FBD000200000001 /* KBBackspaceUndoManager.m */; };
|
||||||
|
A1B2C9092FBD000200000005 /* KBInputBufferManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C9082FBD000200000004 /* KBInputBufferManager.m */; };
|
||||||
A1B2D7022EB8C00100000001 /* KBLangTestVC.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2D7012EB8C00100000001 /* KBLangTestVC.m */; };
|
A1B2D7022EB8C00100000001 /* KBLangTestVC.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2D7012EB8C00100000001 /* KBLangTestVC.m */; };
|
||||||
A1B2E1012EBC7AAA00000001 /* KBTopThreeView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2E0022EBC7AAA00000001 /* KBTopThreeView.m */; };
|
A1B2E1012EBC7AAA00000001 /* KBTopThreeView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2E0022EBC7AAA00000001 /* KBTopThreeView.m */; };
|
||||||
A1B2E1022EBC7AAA00000001 /* HomeHotCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2E0042EBC7AAA00000001 /* HomeHotCell.m */; };
|
A1B2E1022EBC7AAA00000001 /* HomeHotCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2E0042EBC7AAA00000001 /* HomeHotCell.m */; };
|
||||||
A1F0C1B12F1234567890ABCD /* KBConsumptionRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1A12F1234567890ABCD /* KBConsumptionRecord.m */; };
|
A1F0C1B12F1234567890ABCD /* KBConsumptionRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1A12F1234567890ABCD /* KBConsumptionRecord.m */; };
|
||||||
A1F0C1B22F1234567890ABCD /* KBConsumptionRecordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1A32F1234567890ABCD /* KBConsumptionRecordCell.m */; };
|
A1F0C1B22F1234567890ABCD /* KBConsumptionRecordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1A32F1234567890ABCD /* KBConsumptionRecordCell.m */; };
|
||||||
A1F0C1B32F1234567890ABCD /* KBConsumptionRecordVC.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1A52F1234567890ABCD /* KBConsumptionRecordVC.m */; };
|
A1F0C1B32F1234567890ABCD /* KBConsumptionRecordVC.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1A52F1234567890ABCD /* KBConsumptionRecordVC.m */; };
|
||||||
|
A1F0C1C22FABCDEF12345678 /* KBInviteCodeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1C12FABCDEF12345678 /* KBInviteCodeModel.m */; };
|
||||||
|
A1F0C1C32FABCDEF12345678 /* KBInviteCodeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1C12FABCDEF12345678 /* KBInviteCodeModel.m */; };
|
||||||
|
A1F0C1D22FACAD0012345678 /* KBMaiPointReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1D12FACAD0012345678 /* KBMaiPointReporter.m */; };
|
||||||
|
A1F0C1D32FACAD0012345678 /* KBMaiPointReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F0C1D12FACAD0012345678 /* KBMaiPointReporter.m */; };
|
||||||
EB72B60040437E3C0A4890FC /* KBShopThemeDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B9F60894E529C3EDAF6BAC3D /* KBShopThemeDetailModel.m */; };
|
EB72B60040437E3C0A4890FC /* KBShopThemeDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B9F60894E529C3EDAF6BAC3D /* KBShopThemeDetailModel.m */; };
|
||||||
ECC9EE02174D86E8D792472F /* Pods_keyBoard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 967065BB5230E43F293B3AF9 /* Pods_keyBoard.framework */; };
|
ECC9EE02174D86E8D792472F /* Pods_keyBoard.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 967065BB5230E43F293B3AF9 /* Pods_keyBoard.framework */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
@@ -295,7 +298,6 @@
|
|||||||
04286A052ECC81B200CE730C /* KBSkinService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinService.m; sourceTree = "<group>"; };
|
04286A052ECC81B200CE730C /* KBSkinService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinService.m; sourceTree = "<group>"; };
|
||||||
04286A0A2ECD88B400CE730C /* KeyboardAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = KeyboardAssets.xcassets; sourceTree = "<group>"; };
|
04286A0A2ECD88B400CE730C /* KeyboardAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = KeyboardAssets.xcassets; sourceTree = "<group>"; };
|
||||||
04286A0E2ECDA71B00CE730C /* 001.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = 001.zip; sourceTree = "<group>"; };
|
04286A0E2ECDA71B00CE730C /* 001.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = 001.zip; sourceTree = "<group>"; };
|
||||||
04286A122ECDEBF900CE730C /* KBSkinIconMap.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = KBSkinIconMap.strings; sourceTree = "<group>"; };
|
|
||||||
0450AA722EF013D000B6AF06 /* KBEmojiCollectionCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiCollectionCell.h; sourceTree = "<group>"; };
|
0450AA722EF013D000B6AF06 /* KBEmojiCollectionCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiCollectionCell.h; sourceTree = "<group>"; };
|
||||||
0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiCollectionCell.m; sourceTree = "<group>"; };
|
0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiCollectionCell.m; sourceTree = "<group>"; };
|
||||||
0450AAE02EF03D5100B6AF06 /* keyBoard-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "keyBoard-Bridging-Header.h"; sourceTree = "<group>"; };
|
0450AAE02EF03D5100B6AF06 /* keyBoard-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "keyBoard-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
@@ -348,7 +350,6 @@
|
|||||||
04791F962ED49CE7004E8522 /* KBFont.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBFont.h; sourceTree = "<group>"; };
|
04791F962ED49CE7004E8522 /* KBFont.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBFont.h; sourceTree = "<group>"; };
|
||||||
04791F972ED49CE7004E8522 /* KBFont.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBFont.m; sourceTree = "<group>"; };
|
04791F972ED49CE7004E8522 /* KBFont.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBFont.m; sourceTree = "<group>"; };
|
||||||
04791FF62ED5B985004E8522 /* Christmas.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Christmas.zip; sourceTree = "<group>"; };
|
04791FF62ED5B985004E8522 /* Christmas.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Christmas.zip; sourceTree = "<group>"; };
|
||||||
04791FFA2ED5EAB8004E8522 /* fense.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = fense.zip; sourceTree = "<group>"; };
|
|
||||||
04791FFD2ED830FA004E8522 /* KBKeyboardMaskView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyboardMaskView.h; sourceTree = "<group>"; };
|
04791FFD2ED830FA004E8522 /* KBKeyboardMaskView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyboardMaskView.h; sourceTree = "<group>"; };
|
||||||
04791FFE2ED830FA004E8522 /* KBKeyboardMaskView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyboardMaskView.m; sourceTree = "<group>"; };
|
04791FFE2ED830FA004E8522 /* KBKeyboardMaskView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyboardMaskView.m; sourceTree = "<group>"; };
|
||||||
047920062ED86ABC004E8522 /* kb_guide_keyboard.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = kb_guide_keyboard.gif; sourceTree = "<group>"; };
|
047920062ED86ABC004E8522 /* kb_guide_keyboard.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = kb_guide_keyboard.gif; sourceTree = "<group>"; };
|
||||||
@@ -459,10 +460,6 @@
|
|||||||
0498BD8A2EE69E15006CC1D5 /* KBTagItemModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBTagItemModel.m; sourceTree = "<group>"; };
|
0498BD8A2EE69E15006CC1D5 /* KBTagItemModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBTagItemModel.m; sourceTree = "<group>"; };
|
||||||
0498BD8D2EE6A3BD006CC1D5 /* KBMyMainModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBMyMainModel.h; sourceTree = "<group>"; };
|
0498BD8D2EE6A3BD006CC1D5 /* KBMyMainModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBMyMainModel.h; sourceTree = "<group>"; };
|
||||||
0498BD8E2EE6A3BD006CC1D5 /* KBMyMainModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBMyMainModel.m; sourceTree = "<group>"; };
|
0498BD8E2EE6A3BD006CC1D5 /* KBMyMainModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBMyMainModel.m; sourceTree = "<group>"; };
|
||||||
A1F0C1C02FABCDEF12345678 /* KBInviteCodeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBInviteCodeModel.h; sourceTree = "<group>"; };
|
|
||||||
A1F0C1C12FABCDEF12345678 /* KBInviteCodeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBInviteCodeModel.m; sourceTree = "<group>"; };
|
|
||||||
A1F0C1D02FACAD0012345678 /* KBMaiPointReporter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBMaiPointReporter.h; sourceTree = "<group>"; };
|
|
||||||
A1F0C1D12FACAD0012345678 /* KBMaiPointReporter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBMaiPointReporter.m; sourceTree = "<group>"; };
|
|
||||||
0498BDD72EE7ECEA006CC1D5 /* WJXEventSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WJXEventSource.h; sourceTree = "<group>"; };
|
0498BDD72EE7ECEA006CC1D5 /* WJXEventSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WJXEventSource.h; sourceTree = "<group>"; };
|
||||||
0498BDD82EE7ECEA006CC1D5 /* WJXEventSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WJXEventSource.m; sourceTree = "<group>"; };
|
0498BDD82EE7ECEA006CC1D5 /* WJXEventSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WJXEventSource.m; sourceTree = "<group>"; };
|
||||||
0498BDDC2EE81508006CC1D5 /* KBShopVM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBShopVM.h; sourceTree = "<group>"; };
|
0498BDDC2EE81508006CC1D5 /* KBShopVM.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBShopVM.h; sourceTree = "<group>"; };
|
||||||
@@ -496,10 +493,6 @@
|
|||||||
049FB22B2EC31F8800FAB05D /* KBGenderPickerPopView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBGenderPickerPopView.m; sourceTree = "<group>"; };
|
049FB22B2EC31F8800FAB05D /* KBGenderPickerPopView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBGenderPickerPopView.m; sourceTree = "<group>"; };
|
||||||
049FB22D2EC34EB900FAB05D /* KBStreamTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBStreamTextView.h; sourceTree = "<group>"; };
|
049FB22D2EC34EB900FAB05D /* KBStreamTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBStreamTextView.h; sourceTree = "<group>"; };
|
||||||
049FB22E2EC34EB900FAB05D /* KBStreamTextView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBStreamTextView.m; sourceTree = "<group>"; };
|
049FB22E2EC34EB900FAB05D /* KBStreamTextView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBStreamTextView.m; sourceTree = "<group>"; };
|
||||||
049FB2302EC45A0000FAB05D /* KBStreamFetcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBStreamFetcher.h; sourceTree = "<group>"; };
|
|
||||||
049FB2312EC45A0000FAB05D /* KBStreamFetcher.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBStreamFetcher.m; sourceTree = "<group>"; };
|
|
||||||
049FB2332EC45C6A00FAB05D /* NetworkStreamHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NetworkStreamHandler.h; sourceTree = "<group>"; };
|
|
||||||
049FB2342EC45C6A00FAB05D /* NetworkStreamHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NetworkStreamHandler.m; sourceTree = "<group>"; };
|
|
||||||
049FB2362EC4766700FAB05D /* KBFunctionTagListView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBFunctionTagListView.h; sourceTree = "<group>"; };
|
049FB2362EC4766700FAB05D /* KBFunctionTagListView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBFunctionTagListView.h; sourceTree = "<group>"; };
|
||||||
049FB2372EC4766700FAB05D /* KBFunctionTagListView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBFunctionTagListView.m; sourceTree = "<group>"; };
|
049FB2372EC4766700FAB05D /* KBFunctionTagListView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBFunctionTagListView.m; sourceTree = "<group>"; };
|
||||||
049FB2382EC4766700FAB05D /* KBStreamOverlayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBStreamOverlayView.h; sourceTree = "<group>"; };
|
049FB2382EC4766700FAB05D /* KBStreamOverlayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBStreamOverlayView.h; sourceTree = "<group>"; };
|
||||||
@@ -541,6 +534,8 @@
|
|||||||
04C6EAE12EAF940F0089C901 /* KBPermissionViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBPermissionViewController.m; sourceTree = "<group>"; };
|
04C6EAE12EAF940F0089C901 /* KBPermissionViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBPermissionViewController.m; sourceTree = "<group>"; };
|
||||||
04D1F6B02EDFF10A00B12345 /* KBSkinInstallBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinInstallBridge.h; sourceTree = "<group>"; };
|
04D1F6B02EDFF10A00B12345 /* KBSkinInstallBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinInstallBridge.h; sourceTree = "<group>"; };
|
||||||
04D1F6B12EDFF10A00B12345 /* KBSkinInstallBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinInstallBridge.m; sourceTree = "<group>"; };
|
04D1F6B12EDFF10A00B12345 /* KBSkinInstallBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinInstallBridge.m; sourceTree = "<group>"; };
|
||||||
|
04E161812F10E6470022C23B /* normal_hei_them.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = normal_hei_them.zip; sourceTree = "<group>"; };
|
||||||
|
04E161822F10E6470022C23B /* normal_them.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = normal_them.zip; sourceTree = "<group>"; };
|
||||||
04FC953A2EAFAE56007BD342 /* KeyBoardPrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyBoardPrefixHeader.pch; sourceTree = "<group>"; };
|
04FC953A2EAFAE56007BD342 /* KeyBoardPrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyBoardPrefixHeader.pch; sourceTree = "<group>"; };
|
||||||
04FC95642EB0546C007BD342 /* KBKey.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKey.h; sourceTree = "<group>"; };
|
04FC95642EB0546C007BD342 /* KBKey.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKey.h; sourceTree = "<group>"; };
|
||||||
04FC95652EB0546C007BD342 /* KBKey.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKey.m; sourceTree = "<group>"; };
|
04FC95652EB0546C007BD342 /* KBKey.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKey.m; sourceTree = "<group>"; };
|
||||||
@@ -602,6 +597,8 @@
|
|||||||
04FEDC112F00010000999999 /* KBKeyboardSubscriptionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyboardSubscriptionView.m; sourceTree = "<group>"; };
|
04FEDC112F00010000999999 /* KBKeyboardSubscriptionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyboardSubscriptionView.m; sourceTree = "<group>"; };
|
||||||
04FEDC202F00020000999999 /* KBKeyboardSubscriptionProduct.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyboardSubscriptionProduct.h; sourceTree = "<group>"; };
|
04FEDC202F00020000999999 /* KBKeyboardSubscriptionProduct.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyboardSubscriptionProduct.h; sourceTree = "<group>"; };
|
||||||
04FEDC212F00020000999999 /* KBKeyboardSubscriptionProduct.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyboardSubscriptionProduct.m; sourceTree = "<group>"; };
|
04FEDC212F00020000999999 /* KBKeyboardSubscriptionProduct.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyboardSubscriptionProduct.m; sourceTree = "<group>"; };
|
||||||
|
04FEDC232F10000100000001 /* KBKeyboardLayoutConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyboardLayoutConfig.h; sourceTree = "<group>"; };
|
||||||
|
04FEDC242F10000100000001 /* KBKeyboardLayoutConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyboardLayoutConfig.m; sourceTree = "<group>"; };
|
||||||
04FEDC302F00030000999999 /* KBKeyboardSubscriptionFeatureItemView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyboardSubscriptionFeatureItemView.h; sourceTree = "<group>"; };
|
04FEDC302F00030000999999 /* KBKeyboardSubscriptionFeatureItemView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyboardSubscriptionFeatureItemView.h; sourceTree = "<group>"; };
|
||||||
04FEDC312F00030000999999 /* KBKeyboardSubscriptionFeatureItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyboardSubscriptionFeatureItemView.m; sourceTree = "<group>"; };
|
04FEDC312F00030000999999 /* KBKeyboardSubscriptionFeatureItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBKeyboardSubscriptionFeatureItemView.m; sourceTree = "<group>"; };
|
||||||
04FEDC402F00040000999999 /* KBKeyboardSubscriptionFeatureMarqueeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyboardSubscriptionFeatureMarqueeView.h; sourceTree = "<group>"; };
|
04FEDC402F00040000999999 /* KBKeyboardSubscriptionFeatureMarqueeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBKeyboardSubscriptionFeatureMarqueeView.h; sourceTree = "<group>"; };
|
||||||
@@ -629,6 +626,7 @@
|
|||||||
A1B2C3E82F20000000000001 /* KBSuggestionBarView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSuggestionBarView.h; sourceTree = "<group>"; };
|
A1B2C3E82F20000000000001 /* KBSuggestionBarView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSuggestionBarView.h; sourceTree = "<group>"; };
|
||||||
A1B2C3E92F20000000000001 /* KBSuggestionBarView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSuggestionBarView.m; sourceTree = "<group>"; };
|
A1B2C3E92F20000000000001 /* KBSuggestionBarView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSuggestionBarView.m; sourceTree = "<group>"; };
|
||||||
A1B2C3EC2F20000000000001 /* kb_words.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = kb_words.txt; sourceTree = "<group>"; };
|
A1B2C3EC2F20000000000001 /* kb_words.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = kb_words.txt; sourceTree = "<group>"; };
|
||||||
|
A1B2C3F02F20000000000002 /* kb_keyboard_layout_config.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = kb_keyboard_layout_config.json; sourceTree = "<group>"; };
|
||||||
A1B2C3F12EB35A9900000001 /* KBFullAccessGuideView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBFullAccessGuideView.h; sourceTree = "<group>"; };
|
A1B2C3F12EB35A9900000001 /* KBFullAccessGuideView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBFullAccessGuideView.h; sourceTree = "<group>"; };
|
||||||
A1B2C3F22EB35A9900000001 /* KBFullAccessGuideView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBFullAccessGuideView.m; sourceTree = "<group>"; };
|
A1B2C3F22EB35A9900000001 /* KBFullAccessGuideView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBFullAccessGuideView.m; sourceTree = "<group>"; };
|
||||||
A1B2C4002EB4A0A100000001 /* KBAuthManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBAuthManager.h; sourceTree = "<group>"; };
|
A1B2C4002EB4A0A100000001 /* KBAuthManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBAuthManager.h; sourceTree = "<group>"; };
|
||||||
@@ -639,6 +637,8 @@
|
|||||||
A1B2C9022FBD000100000001 /* KBBackspaceLongPressHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBBackspaceLongPressHandler.m; sourceTree = "<group>"; };
|
A1B2C9022FBD000100000001 /* KBBackspaceLongPressHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBBackspaceLongPressHandler.m; sourceTree = "<group>"; };
|
||||||
A1B2C9032FBD000200000001 /* KBBackspaceUndoManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBBackspaceUndoManager.h; sourceTree = "<group>"; };
|
A1B2C9032FBD000200000001 /* KBBackspaceUndoManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBBackspaceUndoManager.h; sourceTree = "<group>"; };
|
||||||
A1B2C9042FBD000200000001 /* KBBackspaceUndoManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBBackspaceUndoManager.m; sourceTree = "<group>"; };
|
A1B2C9042FBD000200000001 /* KBBackspaceUndoManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBBackspaceUndoManager.m; sourceTree = "<group>"; };
|
||||||
|
A1B2C9072FBD000200000003 /* KBInputBufferManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBInputBufferManager.h; sourceTree = "<group>"; };
|
||||||
|
A1B2C9082FBD000200000004 /* KBInputBufferManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBInputBufferManager.m; sourceTree = "<group>"; };
|
||||||
A1B2D7002EB8C00100000001 /* KBLangTestVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBLangTestVC.h; sourceTree = "<group>"; };
|
A1B2D7002EB8C00100000001 /* KBLangTestVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBLangTestVC.h; sourceTree = "<group>"; };
|
||||||
A1B2D7012EB8C00100000001 /* KBLangTestVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBLangTestVC.m; sourceTree = "<group>"; };
|
A1B2D7012EB8C00100000001 /* KBLangTestVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBLangTestVC.m; sourceTree = "<group>"; };
|
||||||
A1B2E0012EBC7AAA00000001 /* KBTopThreeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBTopThreeView.h; sourceTree = "<group>"; };
|
A1B2E0012EBC7AAA00000001 /* KBTopThreeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBTopThreeView.h; sourceTree = "<group>"; };
|
||||||
@@ -651,6 +651,10 @@
|
|||||||
A1F0C1A32F1234567890ABCD /* KBConsumptionRecordCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBConsumptionRecordCell.m; sourceTree = "<group>"; };
|
A1F0C1A32F1234567890ABCD /* KBConsumptionRecordCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBConsumptionRecordCell.m; sourceTree = "<group>"; };
|
||||||
A1F0C1A42F1234567890ABCD /* KBConsumptionRecordVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBConsumptionRecordVC.h; sourceTree = "<group>"; };
|
A1F0C1A42F1234567890ABCD /* KBConsumptionRecordVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBConsumptionRecordVC.h; sourceTree = "<group>"; };
|
||||||
A1F0C1A52F1234567890ABCD /* KBConsumptionRecordVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBConsumptionRecordVC.m; sourceTree = "<group>"; };
|
A1F0C1A52F1234567890ABCD /* KBConsumptionRecordVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBConsumptionRecordVC.m; sourceTree = "<group>"; };
|
||||||
|
A1F0C1C02FABCDEF12345678 /* KBInviteCodeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBInviteCodeModel.h; sourceTree = "<group>"; };
|
||||||
|
A1F0C1C12FABCDEF12345678 /* KBInviteCodeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBInviteCodeModel.m; sourceTree = "<group>"; };
|
||||||
|
A1F0C1D02FACAD0012345678 /* KBMaiPointReporter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBMaiPointReporter.h; sourceTree = "<group>"; };
|
||||||
|
A1F0C1D12FACAD0012345678 /* KBMaiPointReporter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBMaiPointReporter.m; sourceTree = "<group>"; };
|
||||||
B12EC429812407B9F0E67565 /* Pods-CustomKeyboard.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CustomKeyboard.release.xcconfig"; path = "Target Support Files/Pods-CustomKeyboard/Pods-CustomKeyboard.release.xcconfig"; sourceTree = "<group>"; };
|
B12EC429812407B9F0E67565 /* Pods-CustomKeyboard.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CustomKeyboard.release.xcconfig"; path = "Target Support Files/Pods-CustomKeyboard/Pods-CustomKeyboard.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
B8CA018AB878499327504AAD /* Pods-CustomKeyboard.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CustomKeyboard.debug.xcconfig"; path = "Target Support Files/Pods-CustomKeyboard/Pods-CustomKeyboard.debug.xcconfig"; sourceTree = "<group>"; };
|
B8CA018AB878499327504AAD /* Pods-CustomKeyboard.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CustomKeyboard.debug.xcconfig"; path = "Target Support Files/Pods-CustomKeyboard/Pods-CustomKeyboard.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
B9F60894E529C3EDAF6BAC3D /* KBShopThemeDetailModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBShopThemeDetailModel.m; sourceTree = "<group>"; };
|
B9F60894E529C3EDAF6BAC3D /* KBShopThemeDetailModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBShopThemeDetailModel.m; sourceTree = "<group>"; };
|
||||||
@@ -682,11 +686,13 @@
|
|||||||
041007D02ECE010100D203BB /* Resource */ = {
|
041007D02ECE010100D203BB /* Resource */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
04E161812F10E6470022C23B /* normal_hei_them.zip */,
|
||||||
|
04E161822F10E6470022C23B /* normal_them.zip */,
|
||||||
A1B2C3EC2F20000000000001 /* kb_words.txt */,
|
A1B2C3EC2F20000000000001 /* kb_words.txt */,
|
||||||
|
A1B2C3F02F20000000000002 /* kb_keyboard_layout_config.json */,
|
||||||
0498BDF42EEC50EE006CC1D5 /* emoji_categories.json */,
|
0498BDF42EEC50EE006CC1D5 /* emoji_categories.json */,
|
||||||
041007D12ECE012000D203BB /* KBSkinIconMap.strings */,
|
041007D12ECE012000D203BB /* KBSkinIconMap.strings */,
|
||||||
041007D32ECE012500D203BB /* 002.zip */,
|
041007D32ECE012500D203BB /* 002.zip */,
|
||||||
04791FFA2ED5EAB8004E8522 /* fense.zip */,
|
|
||||||
04791FF62ED5B985004E8522 /* Christmas.zip */,
|
04791FF62ED5B985004E8522 /* Christmas.zip */,
|
||||||
);
|
);
|
||||||
path = Resource;
|
path = Resource;
|
||||||
@@ -841,6 +847,8 @@
|
|||||||
A1B2C9022FBD000100000001 /* KBBackspaceLongPressHandler.m */,
|
A1B2C9022FBD000100000001 /* KBBackspaceLongPressHandler.m */,
|
||||||
A1B2C9032FBD000200000001 /* KBBackspaceUndoManager.h */,
|
A1B2C9032FBD000200000001 /* KBBackspaceUndoManager.h */,
|
||||||
A1B2C9042FBD000200000001 /* KBBackspaceUndoManager.m */,
|
A1B2C9042FBD000200000001 /* KBBackspaceUndoManager.m */,
|
||||||
|
A1B2C9072FBD000200000003 /* KBInputBufferManager.h */,
|
||||||
|
A1B2C9082FBD000200000004 /* KBInputBufferManager.m */,
|
||||||
);
|
);
|
||||||
path = Utils;
|
path = Utils;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -885,7 +893,6 @@
|
|||||||
0479200A2ED87CEE004E8522 /* permiss_video.mp4 */,
|
0479200A2ED87CEE004E8522 /* permiss_video.mp4 */,
|
||||||
047920102ED98E7D004E8522 /* permiss_video_2.mp4 */,
|
047920102ED98E7D004E8522 /* permiss_video_2.mp4 */,
|
||||||
047920062ED86ABC004E8522 /* kb_guide_keyboard.gif */,
|
047920062ED86ABC004E8522 /* kb_guide_keyboard.gif */,
|
||||||
04286A122ECDEBF900CE730C /* KBSkinIconMap.strings */,
|
|
||||||
04286A0E2ECDA71B00CE730C /* 001.zip */,
|
04286A0E2ECDA71B00CE730C /* 001.zip */,
|
||||||
);
|
);
|
||||||
path = Resource;
|
path = Resource;
|
||||||
@@ -1243,6 +1250,8 @@
|
|||||||
04FC95652EB0546C007BD342 /* KBKey.m */,
|
04FC95652EB0546C007BD342 /* KBKey.m */,
|
||||||
04FEDC202F00020000999999 /* KBKeyboardSubscriptionProduct.h */,
|
04FEDC202F00020000999999 /* KBKeyboardSubscriptionProduct.h */,
|
||||||
04FEDC212F00020000999999 /* KBKeyboardSubscriptionProduct.m */,
|
04FEDC212F00020000999999 /* KBKeyboardSubscriptionProduct.m */,
|
||||||
|
04FEDC232F10000100000001 /* KBKeyboardLayoutConfig.h */,
|
||||||
|
04FEDC242F10000100000001 /* KBKeyboardLayoutConfig.m */,
|
||||||
);
|
);
|
||||||
path = Model;
|
path = Model;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -1712,10 +1721,6 @@
|
|||||||
0498BDD92EE7ECEA006CC1D5 /* WJXEventSource */,
|
0498BDD92EE7ECEA006CC1D5 /* WJXEventSource */,
|
||||||
A1B2C3E02EB0C0A100000001 /* KBNetworkManager.h */,
|
A1B2C3E02EB0C0A100000001 /* KBNetworkManager.h */,
|
||||||
A1B2C3E12EB0C0A100000001 /* KBNetworkManager.m */,
|
A1B2C3E12EB0C0A100000001 /* KBNetworkManager.m */,
|
||||||
049FB2302EC45A0000FAB05D /* KBStreamFetcher.h */,
|
|
||||||
049FB2312EC45A0000FAB05D /* KBStreamFetcher.m */,
|
|
||||||
049FB2332EC45C6A00FAB05D /* NetworkStreamHandler.h */,
|
|
||||||
049FB2342EC45C6A00FAB05D /* NetworkStreamHandler.m */,
|
|
||||||
);
|
);
|
||||||
path = Network;
|
path = Network;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -1810,11 +1815,13 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
04E161832F10E6470022C23B /* normal_hei_them.zip in Resources */,
|
||||||
|
04E161842F10E6470022C23B /* normal_them.zip in Resources */,
|
||||||
04A9FE202EB893F10020DB6D /* Localizable.strings in Resources */,
|
04A9FE202EB893F10020DB6D /* Localizable.strings in Resources */,
|
||||||
041007D42ECE012500D203BB /* 002.zip in Resources */,
|
041007D42ECE012500D203BB /* 002.zip in Resources */,
|
||||||
041007D22ECE012000D203BB /* KBSkinIconMap.strings in Resources */,
|
041007D22ECE012000D203BB /* KBSkinIconMap.strings in Resources */,
|
||||||
A1B2C3ED2F20000000000001 /* kb_words.txt in Resources */,
|
A1B2C3ED2F20000000000001 /* kb_words.txt in Resources */,
|
||||||
04791FFB2ED5EAB8004E8522 /* fense.zip in Resources */,
|
A1B2C3F12F20000000000002 /* kb_keyboard_layout_config.json in Resources */,
|
||||||
0498BDF52EEC50EE006CC1D5 /* emoji_categories.json in Resources */,
|
0498BDF52EEC50EE006CC1D5 /* emoji_categories.json in Resources */,
|
||||||
04791FF72ED5B985004E8522 /* Christmas.zip in Resources */,
|
04791FF72ED5B985004E8522 /* Christmas.zip in Resources */,
|
||||||
04286A0B2ECD88B400CE730C /* KeyboardAssets.xcassets in Resources */,
|
04286A0B2ECD88B400CE730C /* KeyboardAssets.xcassets in Resources */,
|
||||||
@@ -1914,13 +1921,13 @@
|
|||||||
files = (
|
files = (
|
||||||
0498BD862EE1BEC9006CC1D5 /* KBSignUtils.m in Sources */,
|
0498BD862EE1BEC9006CC1D5 /* KBSignUtils.m in Sources */,
|
||||||
04791FFC2ED71D17004E8522 /* UIColor+Extension.m in Sources */,
|
04791FFC2ED71D17004E8522 /* UIColor+Extension.m in Sources */,
|
||||||
049FB2322EC45A0000FAB05D /* KBStreamFetcher.m in Sources */,
|
|
||||||
0450AC4A2EF2C3ED00B6AF06 /* KBKeyboardSubscriptionOptionCell.m in Sources */,
|
0450AC4A2EF2C3ED00B6AF06 /* KBKeyboardSubscriptionOptionCell.m in Sources */,
|
||||||
04A9FE0F2EB481100020DB6D /* KBHUD.m in Sources */,
|
04A9FE0F2EB481100020DB6D /* KBHUD.m in Sources */,
|
||||||
04C6EADD2EAF8CEB0089C901 /* KBToolBar.m in Sources */,
|
04C6EADD2EAF8CEB0089C901 /* KBToolBar.m in Sources */,
|
||||||
A1B2C3EB2F20000000000001 /* KBSuggestionBarView.m in Sources */,
|
A1B2C3EB2F20000000000001 /* KBSuggestionBarView.m in Sources */,
|
||||||
04FC95792EB09BC8007BD342 /* KBKeyBoardMainView.m in Sources */,
|
04FC95792EB09BC8007BD342 /* KBKeyBoardMainView.m in Sources */,
|
||||||
04FEDAB32EEDB05000123456 /* KBEmojiPanelView.m in Sources */,
|
04FEDAB32EEDB05000123456 /* KBEmojiPanelView.m in Sources */,
|
||||||
|
04050ECB2F10FB8F008051EB /* UIImage+KBColor.m in Sources */,
|
||||||
04FEDB032EFE000000123456 /* KBEmojiBottomBarView.m in Sources */,
|
04FEDB032EFE000000123456 /* KBEmojiBottomBarView.m in Sources */,
|
||||||
0498BD8C2EE69E15006CC1D5 /* KBTagItemModel.m in Sources */,
|
0498BD8C2EE69E15006CC1D5 /* KBTagItemModel.m in Sources */,
|
||||||
046131142ECF454500A6FADF /* KBKeyPreviewView.m in Sources */,
|
046131142ECF454500A6FADF /* KBKeyPreviewView.m in Sources */,
|
||||||
@@ -1933,7 +1940,6 @@
|
|||||||
04A9FE1A2EB892460020DB6D /* KBLocalizationManager.m in Sources */,
|
04A9FE1A2EB892460020DB6D /* KBLocalizationManager.m in Sources */,
|
||||||
A1B2C3EA2F20000000000001 /* KBSuggestionEngine.m in Sources */,
|
A1B2C3EA2F20000000000001 /* KBSuggestionEngine.m in Sources */,
|
||||||
A1B2C3E22EB0C0A100000001 /* KBNetworkManager.m in Sources */,
|
A1B2C3E22EB0C0A100000001 /* KBNetworkManager.m in Sources */,
|
||||||
049FB2352EC45C6A00FAB05D /* NetworkStreamHandler.m in Sources */,
|
|
||||||
04FC956A2EB05497007BD342 /* KBKeyButton.m in Sources */,
|
04FC956A2EB05497007BD342 /* KBKeyButton.m in Sources */,
|
||||||
04FEDAA12EEDB00100123456 /* KBEmojiDataProvider.m in Sources */,
|
04FEDAA12EEDB00100123456 /* KBEmojiDataProvider.m in Sources */,
|
||||||
04FC95B22EB0B2CC007BD342 /* KBSettingView.m in Sources */,
|
04FC95B22EB0B2CC007BD342 /* KBSettingView.m in Sources */,
|
||||||
@@ -1947,6 +1953,7 @@
|
|||||||
04FC95702EB09516007BD342 /* KBFunctionView.m in Sources */,
|
04FC95702EB09516007BD342 /* KBFunctionView.m in Sources */,
|
||||||
A1B2C9032FBD000100000001 /* KBBackspaceLongPressHandler.m in Sources */,
|
A1B2C9032FBD000100000001 /* KBBackspaceLongPressHandler.m in Sources */,
|
||||||
A1B2C9052FBD000200000001 /* KBBackspaceUndoManager.m in Sources */,
|
A1B2C9052FBD000200000001 /* KBBackspaceUndoManager.m in Sources */,
|
||||||
|
A1B2C9092FBD000200000005 /* KBInputBufferManager.m in Sources */,
|
||||||
049FB23F2EC4B6EF00FAB05D /* KBULBridgeNotification.m in Sources */,
|
049FB23F2EC4B6EF00FAB05D /* KBULBridgeNotification.m in Sources */,
|
||||||
04791F992ED49CE7004E8522 /* KBFont.m in Sources */,
|
04791F992ED49CE7004E8522 /* KBFont.m in Sources */,
|
||||||
04FC956D2EB054B7007BD342 /* KBKeyboardView.m in Sources */,
|
04FC956D2EB054B7007BD342 /* KBKeyboardView.m in Sources */,
|
||||||
@@ -1956,6 +1963,7 @@
|
|||||||
A1F0C1C22FABCDEF12345678 /* KBInviteCodeModel.m in Sources */,
|
A1F0C1C22FABCDEF12345678 /* KBInviteCodeModel.m in Sources */,
|
||||||
A1F0C1D22FACAD0012345678 /* KBMaiPointReporter.m in Sources */,
|
A1F0C1D22FACAD0012345678 /* KBMaiPointReporter.m in Sources */,
|
||||||
04FEDC222F00020000999999 /* KBKeyboardSubscriptionProduct.m in Sources */,
|
04FEDC222F00020000999999 /* KBKeyboardSubscriptionProduct.m in Sources */,
|
||||||
|
04FEDC252F10000100000001 /* KBKeyboardLayoutConfig.m in Sources */,
|
||||||
0450AA742EF013D000B6AF06 /* KBEmojiCollectionCell.m in Sources */,
|
0450AA742EF013D000B6AF06 /* KBEmojiCollectionCell.m in Sources */,
|
||||||
550CB2630FA4A7B4B9782EFA /* KBMyTheme.m in Sources */,
|
550CB2630FA4A7B4B9782EFA /* KBMyTheme.m in Sources */,
|
||||||
0498BDDA2EE7ECEA006CC1D5 /* WJXEventSource.m in Sources */,
|
0498BDDA2EE7ECEA006CC1D5 /* WJXEventSource.m in Sources */,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
<EnvironmentVariable
|
<EnvironmentVariable
|
||||||
key = "OS_ACTIVITY_MODE"
|
key = "OS_ACTIVITY_MODE"
|
||||||
value = "disable"
|
value = "disable"
|
||||||
isEnabled = "YES">
|
isEnabled = "NO">
|
||||||
</EnvironmentVariable>
|
</EnvironmentVariable>
|
||||||
</EnvironmentVariables>
|
</EnvironmentVariables>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
|
|||||||
BIN
keyBoard/Assets.xcassets/Test/jinling_icon.imageset/ChatGPT Image 2026年1月12日 14_07_17.png
vendored
Normal file
|
After Width: | Height: | Size: 144 KiB |
@@ -1,16 +1,15 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
|
"filename" : "ChatGPT Image 2026年1月12日 14_07_17.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "key_a@2x.png",
|
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "key_a@3x.png",
|
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_123@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_123@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 29 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_ai@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_ai@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 49 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_b@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_b@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 26 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_c@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_c@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 24 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_d@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_d@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 22 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_del@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_del@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 45 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_e@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_e@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 26 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_f@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_f@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 27 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_g@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_g@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 32 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_h@2x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "key_h@3x.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 11 KiB |