fixUI
This commit is contained in:
37
Shared/KBKeyboardPermissionManager.h
Normal file
37
Shared/KBKeyboardPermissionManager.h
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// KBKeyboardPermissionManager.h
|
||||
// 主 App/键盘扩展 共用的“键盘启用 + 完全访问”权限管理
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, KBFARecord) {
|
||||
KBFARecordUnknown = 0,
|
||||
KBFARecordDenied = 1,
|
||||
KBFARecordGranted = 2,
|
||||
};
|
||||
|
||||
/// 统一权限管理(App 与扩展均可使用)
|
||||
@interface KBKeyboardPermissionManager : NSObject
|
||||
|
||||
+ (instancetype)shared;
|
||||
|
||||
/// App 侧:是否已添加并启用了自定义键盘(通过遍历 activeInputModes 粗略判断)
|
||||
- (BOOL)isKeyboardEnabled;
|
||||
|
||||
/// 最后一次由扩展上报的“完全访问”状态(来源:扩展运行后写入共享钥匙串)
|
||||
- (KBFARecord)lastKnownFullAccess;
|
||||
|
||||
/// 扩展侧:上报“完全访问”状态(写入共享钥匙串,以便 App 读取)
|
||||
- (void)reportFullAccessFromExtension:(BOOL)granted;
|
||||
|
||||
/// App 侧:若未满足“已启用键盘 + 完全访问(或未知)”则展示引导页(KBPermissionViewController)
|
||||
- (void)presentPermissionIfNeededFrom:(UIViewController *)presenting;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
Reference in New Issue
Block a user