|
@@ -241,6 +241,23 @@ class KeyboardViewController: UIInputViewController {
|
|
|
return view
|
|
return view
|
|
|
}()
|
|
}()
|
|
|
|
|
|
|
|
|
|
+ lazy var tipPopView: KeyboardTipsPopView = {
|
|
|
|
|
+
|
|
|
|
|
+ let view = KeyboardTipsPopView()
|
|
|
|
|
+ view.isHidden = true
|
|
|
|
|
+ view.settingBtnClosure = {
|
|
|
|
|
+
|
|
|
|
|
+ if let url = URL(string: "com.qihuan.zhuiaijianpan:///open/setting") {
|
|
|
|
|
+ self.openURL(url)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ view.backBtnClosure = {
|
|
|
|
|
+
|
|
|
|
|
+ self.tipPopView.isHidden = true
|
|
|
|
|
+ }
|
|
|
|
|
+ return view
|
|
|
|
|
+ }()
|
|
|
|
|
+
|
|
|
var nowShowView: UIView?
|
|
var nowShowView: UIView?
|
|
|
|
|
|
|
|
// 命令检查定时器
|
|
// 命令检查定时器
|
|
@@ -265,6 +282,8 @@ class KeyboardViewController: UIInputViewController {
|
|
|
if isFullAccess {
|
|
if isFullAccess {
|
|
|
requestKeyboardList()
|
|
requestKeyboardList()
|
|
|
requestPrologueList()
|
|
requestPrologueList()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ getLocalSystemKeyboard()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if let defaultType = UserDefaults.standard.value(forKey: "KeyboardChooseType") as? Int, let type = KeyboardType(rawValue: defaultType) {
|
|
if let defaultType = UserDefaults.standard.value(forKey: "KeyboardChooseType") as? Int, let type = KeyboardType(rawValue: defaultType) {
|
|
@@ -362,6 +381,24 @@ class KeyboardViewController: UIInputViewController {
|
|
|
// MARK: - 网络请求
|
|
// MARK: - 网络请求
|
|
|
extension KeyboardViewController {
|
|
extension KeyboardViewController {
|
|
|
|
|
|
|
|
|
|
+ func getLocalSystemKeyboard() {
|
|
|
|
|
+
|
|
|
|
|
+ if let systemKeyboardJson = KeyboardSharedDataManager.shared.getSystemkeyboard() {
|
|
|
|
|
+ if let jsonData = systemKeyboardJson.data(using: .utf8) {
|
|
|
|
|
+ let decoder = JSONDecoder()
|
|
|
|
|
+ do {
|
|
|
|
|
+ let characterList = try decoder.decode([CharacterModel].self, from: jsonData)
|
|
|
|
|
+ self.characterList = characterList
|
|
|
|
|
+ self.updateCharacterUI()
|
|
|
|
|
+ // 成功解码,可以使用 keyboardModel
|
|
|
|
|
+ print("CharacterList: \(characterList)")
|
|
|
|
|
+ } catch {
|
|
|
|
|
+ print("解码 KeyboardModel 失败: \(error)")
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 获取键盘列表
|
|
// 获取键盘列表
|
|
|
func requestKeyboardList() {
|
|
func requestKeyboardList() {
|
|
|
|
|
|
|
@@ -541,6 +578,12 @@ extension KeyboardViewController: KeyboardMenuViewDelegate, KeyboardExchangeView
|
|
|
// 功能按钮选择点击
|
|
// 功能按钮选择点击
|
|
|
@objc func functionBtnClickAction() {
|
|
@objc func functionBtnClickAction() {
|
|
|
|
|
|
|
|
|
|
+ let isFullAccess = self.hasFullAccess
|
|
|
|
|
+ if !isFullAccess {
|
|
|
|
|
+ self.popTipsView()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
KeyboardFunctionPopView.show(view: self.view, selectType: self.chooseType) { type in
|
|
KeyboardFunctionPopView.show(view: self.view, selectType: self.chooseType) { type in
|
|
|
self.chooseType = type
|
|
self.chooseType = type
|
|
|
}
|
|
}
|
|
@@ -640,6 +683,12 @@ extension KeyboardViewController: KeyboardMenuViewDelegate, KeyboardExchangeView
|
|
|
// 选择键盘按钮点击
|
|
// 选择键盘按钮点击
|
|
|
@objc func changeBtnClickAction() {
|
|
@objc func changeBtnClickAction() {
|
|
|
|
|
|
|
|
|
|
+ let isFullAccess = self.hasFullAccess
|
|
|
|
|
+ if !isFullAccess {
|
|
|
|
|
+ self.popTipsView()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
clearPopView()
|
|
clearPopView()
|
|
|
self.exchangeView.keyboardList = self.keyboardList
|
|
self.exchangeView.keyboardList = self.keyboardList
|
|
|
self.exchangeView.isHidden = false
|
|
self.exchangeView.isHidden = false
|
|
@@ -699,6 +748,13 @@ extension KeyboardViewController: KeyboardHelpViewDelegate, KeyboardTeachViewDel
|
|
|
// 帮聊点击cell
|
|
// 帮聊点击cell
|
|
|
func helpCollectionViewDidSelectItem(characterId: String, content: String, complete: @escaping ((Bool) -> ())) {
|
|
func helpCollectionViewDidSelectItem(characterId: String, content: String, complete: @escaping ((Bool) -> ())) {
|
|
|
|
|
|
|
|
|
|
+ let isFullAccess = self.hasFullAccess
|
|
|
|
|
+ if !isFullAccess {
|
|
|
|
|
+ self.popTipsView()
|
|
|
|
|
+ complete(false)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 判断是否登录
|
|
// 判断是否登录
|
|
|
let isLogin = KeyboardSharedDataManager.shared.isLoggedIn()
|
|
let isLogin = KeyboardSharedDataManager.shared.isLoggedIn()
|
|
|
if !isLogin {
|
|
if !isLogin {
|
|
@@ -716,6 +772,13 @@ extension KeyboardViewController: KeyboardHelpViewDelegate, KeyboardTeachViewDel
|
|
|
// 教你说点击cell
|
|
// 教你说点击cell
|
|
|
func teachCollectionViewDidSelectItem(characterId: String, content: String, complete: @escaping (([String], Bool, Bool) -> ())) {
|
|
func teachCollectionViewDidSelectItem(characterId: String, content: String, complete: @escaping (([String], Bool, Bool) -> ())) {
|
|
|
|
|
|
|
|
|
|
+ let isFullAccess = self.hasFullAccess
|
|
|
|
|
+ if !isFullAccess {
|
|
|
|
|
+ self.popTipsView()
|
|
|
|
|
+ complete([String](), false, false)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 判断是否登录
|
|
// 判断是否登录
|
|
|
let isLogin = KeyboardSharedDataManager.shared.isLoggedIn()
|
|
let isLogin = KeyboardSharedDataManager.shared.isLoggedIn()
|
|
|
if !isLogin {
|
|
if !isLogin {
|
|
@@ -1036,21 +1099,16 @@ extension KeyboardViewController {
|
|
|
|
|
|
|
|
if !isFullAccess {
|
|
if !isFullAccess {
|
|
|
|
|
|
|
|
- let tipView = KeyboardTipsPopView()
|
|
|
|
|
- tipView.settingBtnClosure = {
|
|
|
|
|
-
|
|
|
|
|
- if let url = URL(string: UIApplication.openSettingsURLString) {
|
|
|
|
|
- self.openURL(url)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- self.view.addSubview(tipView)
|
|
|
|
|
- tipView.snp.makeConstraints { make in
|
|
|
|
|
- make.left.right.bottom.equalTo(0)
|
|
|
|
|
- make.top.equalTo(56)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ popTipsView()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 弹出完全访问设置页
|
|
|
|
|
+ func popTipsView() {
|
|
|
|
|
+
|
|
|
|
|
+ self.tipPopView.isHidden = false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 跳转登录页
|
|
// 跳转登录页
|
|
|
func popLoginView() {
|
|
func popLoginView() {
|
|
|
|
|
|
|
@@ -1222,6 +1280,12 @@ extension KeyboardViewController {
|
|
|
make.top.left.right.bottom.equalTo(0)
|
|
make.top.left.right.bottom.equalTo(0)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ self.view.addSubview(tipPopView)
|
|
|
|
|
+ tipPopView.snp.makeConstraints { make in
|
|
|
|
|
+ make.left.right.bottom.equalTo(0)
|
|
|
|
|
+ make.top.equalTo(56)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
chooseView.addSubview(functionView)
|
|
chooseView.addSubview(functionView)
|
|
|
functionView.snp.makeConstraints { make in
|
|
functionView.snp.makeConstraints { make in
|
|
|
make.top.left.equalTo(1)
|
|
make.top.left.equalTo(1)
|