Files
keyboard/keyBoard/Class/Manager/KBSkinService.h
2025-11-19 20:16:19 +08:00

44 lines
1.5 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// KBSkinService.h
// keyBoard
//
// 统一的键盘皮肤下载/应用服务。
// - App 端调用,一处封装本地图标导出 / 网络图标下载 / 背景图下载逻辑
// - 内部会检查键盘是否开启完全访问,并在不足时给出提示或引导
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void(^KBSkinApplyCompletion)(BOOL success);
/// 皮肤资源来源
typedef NS_ENUM(NSUInteger, KBSkinSourceMode) {
/// 远程 Zip通过网络下载 zip_url 并解压到 App Group
KBSkinSourceModeRemoteZip = 0,
/// 本地 bundle Zip从主 App bundle 中读取 zip_url 指定的 zip 文件并解压到 App Group
KBSkinSourceModeLocalBundleZip = 1,
};
/// 皮肤下载与应用服务(仅主 App 使用)
@interface KBSkinService : NSObject
+ (instancetype)shared;
/// 根据后端返回的皮肤 JSON 下载并应用皮肤。
///
/// @param skinJSON 与后端约定的皮肤结构(包含 id/name/background_image/hidden_keys/key_icons 等)
/// @param presenting 用于弹出“键盘权限引导页”的控制器,可为 nil
/// @param mode 资源来源模式:远程 / 本地 bundle
/// @param completion 应用完成回调(下载/写入全部结束后调用success 表示是否成功)
- (void)applySkinWithJSON:(NSDictionary *)skinJSON
fromViewController:(nullable UIViewController *)presenting
mode:(KBSkinSourceMode)mode
completion:(nullable KBSkinApplyCompletion)completion;
@end
NS_ASSUME_NONNULL_END