|
|
@@ -126,4 +126,30 @@ class FlutterMethodChannelManager: NSObject {
|
|
|
|
|
|
return currentKeyboardName == appDisplayName
|
|
|
}
|
|
|
+
|
|
|
+ // 是否添加键盘
|
|
|
+ func isKeyboardEnabled() -> Bool {
|
|
|
+
|
|
|
+ // 获取系统中已安装的键盘列表
|
|
|
+ let keyboards = UserDefaults.standard.dictionaryRepresentation()
|
|
|
+ .filter { $0.key.contains("Keyboard") }
|
|
|
+ if let keyboardList = keyboards["AppleKeyboards"] as? [String] {
|
|
|
+
|
|
|
+ let keyboardBundleId = "com.qihuan.zhuiaijianpan.AiKeyboard"
|
|
|
+ let isAdded = keyboardList.contains(keyboardBundleId)
|
|
|
+ return isAdded
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ // 是否为默认键盘
|
|
|
+ func isCustomKeybroad() -> Bool {
|
|
|
+
|
|
|
+ let currentKeyboardName = (((UITextInputMode.activeInputModes as NSArray).filtered(using: NSPredicate(format: "isDisplayed = YES"))).last as? NSObject)?.value(forKey: "extendedDisplayName") as? String
|
|
|
+
|
|
|
+ let infoDictionary = Bundle.main.infoDictionary!
|
|
|
+ let appDisplayName = infoDictionary["CFBundleDisplayName"] as? String
|
|
|
+
|
|
|
+ return currentKeyboardName == appDisplayName
|
|
|
+ }
|
|
|
}
|