40 lines
1.4 KiB
C
40 lines
1.4 KiB
C
|
|
//
|
||
|
|
// KBSkinInstallBridge.h
|
||
|
|
// 主 App 与键盘扩展共享的皮肤安装桥接工具。
|
||
|
|
//
|
||
|
|
|
||
|
|
#import <Foundation/Foundation.h>
|
||
|
|
|
||
|
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
|
||
|
|
/// 跨进程通知:主 App 请求键盘扩展安装皮肤。
|
||
|
|
extern NSString * const KBDarwinSkinInstallRequestNotification;
|
||
|
|
|
||
|
|
typedef void (^KBSkinInstallConsumeCompletion)(BOOL success, NSError * _Nullable error);
|
||
|
|
|
||
|
|
@interface KBSkinInstallBridge : NSObject
|
||
|
|
|
||
|
|
/// 默认图标短文件名映射(从 KBSkinIconMap.strings 读取)。
|
||
|
|
+ (NSDictionary<NSString *, NSString *> *)defaultIconShortNames;
|
||
|
|
|
||
|
|
/// 主 App 侧:记录一个“从 bundle 解压皮肤”的请求,写入 App Group 并广播 Darwin 通知。
|
||
|
|
+ (void)publishBundleSkinRequestWithId:(NSString *)skinId
|
||
|
|
name:(NSString *)name
|
||
|
|
zipName:(NSString *)zipName
|
||
|
|
iconShortNames:(nullable NSDictionary<NSString *, NSString *> *)iconShortNames;
|
||
|
|
|
||
|
|
/// 读取当前 App Group 中待处理的请求。
|
||
|
|
+ (nullable NSDictionary *)pendingRequestPayload;
|
||
|
|
|
||
|
|
/// 清理 App Group 中的请求记录。
|
||
|
|
+ (void)clearPendingRequest;
|
||
|
|
|
||
|
|
/// 键盘扩展侧:如有请求则解压/应用皮肤。completion 中 success==YES 表示已处理并应用。
|
||
|
|
+ (void)consumePendingRequestFromBundle:(NSBundle *)bundle
|
||
|
|
completion:(nullable KBSkinInstallConsumeCompletion)completion;
|
||
|
|
|
||
|
|
@end
|
||
|
|
|
||
|
|
NS_ASSUME_NONNULL_END
|
||
|
|
|