修改配置
authorliangzhenying <867174124@qq.com>
Tue, 11 Nov 2025 08:55:26 +0000 (16:55 +0800)
committerliangzhenying <867174124@qq.com>
Tue, 11 Nov 2025 08:55:26 +0000 (16:55 +0800)
ShenYin/ShenYin/Api/Config.swift
ShenYin/ShenYin/UI/Base/BaseTC.swift
ShenYin/ShenYin/UI/Home/Chinese2English/Chinese2EnglishVC.swift
ShenYin/ShenYin/UI/Home/Device/HomeDeviceVC.swift
ShenYin/ShenYin/UI/Home/Scan/DeviceVM.swift
ShenYin/ShenYin/UI/Launch/BleManager.swift
ShenYin/ShenYin/UI/Mine/Login/ViewModel/IASignWithWeChat.swift
ShenYin/ShenYin/UI/Mine/Update/AppUpdateVM.swift

index ef5d632..cf85a14 100644 (file)
@@ -7,17 +7,16 @@
 
 class DCConfig{
     static var appLanguage = AppSupportLanguage.english
-}
-
-class DCGlobal {    
+    
     /// 微信开发平台 App ID
     static let wxAppID = "wxf19317f23b00d8ab"
     static let wxUniversalLink = "https://www.thisiot.com/flychat"
     static let wxSecret = "SECRET"
     
-//    static let appStoreLink = "https://itunes.apple.com/cn/app/6738022284?mt=8"
+    //    static let appStoreLink = "https://itunes.apple.com/cn/app/6738022284?mt=8"
     static let appStoreLink = "https://itunes.apple.com/cn/app/6752551504?mt=8"
     
     /// 版本检测
     static let appStoreVersionURL = "https://itunes.apple.com/cn/lookup?id=6752551504"
 }
+
index e0c99ab..bf09675 100644 (file)
@@ -23,8 +23,7 @@ class BaseTC:UITabBarController{
     
 
     func setupUI(){
-       
-        let item0 = UITabBarItem(title: "AI" + "智能".l10n, image: UIImage(named: "tab_0_normal")?.withRenderingMode(.alwaysOriginal), selectedImage: UIImage(named: "tab_0_selected")?.withRenderingMode(.alwaysOriginal))
+        let item0 = UITabBarItem(title: "AI" + " " + "智能".l10n, image: UIImage(named: "tab_0_normal")?.withRenderingMode(.alwaysOriginal), selectedImage: UIImage(named: "tab_0_selected")?.withRenderingMode(.alwaysOriginal))
         let nc0 = BaseNC(rootViewController: homeVC)
         nc0.tabBarItem = item0
         
@@ -55,6 +54,6 @@ class BaseTC:UITabBarController{
         self.tabBar.backgroundColor = .white
         view.backgroundColor = .color(.bgColor)
 
-        self.selectedIndex = 4
+//        self.selectedIndex = 4
     }
 }
index fbb3713..d76fb7c 100644 (file)
@@ -17,6 +17,11 @@ class Chinese2EnglishVC:BaseVC{
     var recordFilePath : String?
     var startIndex = 0//记录开始录音的次数,用于区分返回的数据
 
+    deinit {
+        PcmSound.sharedInstance().stopAudioUnit()
+        PcmSound.sharedInstance().cleanup()
+    }
+    
     override func setupViews() {
         navBar.title = "中英互译".l10n
         navBar.rightView.isHidden = false
index a6ed801..37e6f7e 100644 (file)
@@ -71,7 +71,7 @@ class HomeDeviceVC:BaseVC{
         //        v.show(animate: true)
         
         App.shared.goToPage(BleScanVC())
-
+//        BleManager.shared.checkSettingsConnected()
     }
     
 
index f33849d..6ea1f70 100644 (file)
@@ -186,6 +186,32 @@ extension DeviceVM{
                 let api = CommomApi.otaUpdateVersion(param:params )
                 HttpClient.request(api) { (model:ResponseBaseModel,res) in
                 }
+                settingsConnected()
+            }
+        }
+    }
+    
+    static func settingsConnected(){
+        let list = BleManager.shared.checkSettingsConnected()
+        if list.count == 0{
+            CustomAlert.showWith(title: "提示", messgage: "请前往系统设置连接蓝牙") {
+                
+            } okCallback: {
+                if let url = URL(string: "prefs:root=Bluetooth") {
+                    // 检查URL是否可用,然后跳转
+                    if UIApplication.shared.canOpenURL(url) {
+                        UIApplication.shared.open(url) { (success) in
+                            // 提示用户是否成功打开了设置
+                            if success {
+                                print("成功跳转到蓝牙设置")
+                            } else {
+                                print("跳转失败")
+                            }
+                        }
+                    } else {
+                        print("链接不可用")
+                    }
+                }
             }
         }
     }
index 72b9d71..e80f359 100644 (file)
@@ -240,6 +240,7 @@ extension BleManager{
 
 extension BleManager : JoyGemAIManagerDelegate {
     func joyGemAuthFailedCallback() {
+        Logger.debug("鉴权失败")
         YLprogressHUD.showAutoHiden("鉴权失败")
     }
     
@@ -355,4 +356,10 @@ extension BleManager{
 //        
 //        
 //    }
+    
+    func checkSettingsConnected()->[CBPeripheral]{
+        let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: kJoyGemAIServiceUUID)])
+        Logger.debug("已连接设备",list)
+        return list
+    }
 }
index 5a68c68..8d65cfd 100644 (file)
@@ -18,7 +18,7 @@ class IASignWithWeChat:NSObject {
         WXApi.startLog(by: .detail) { log in
             Logger.debug(log)
         }
-        WXApi.registerApp(DCGlobal.wxAppID, universalLink: DCGlobal.wxUniversalLink)
+        WXApi.registerApp(DCConfig.wxAppID, universalLink: DCConfig.wxUniversalLink)
 //        WXApi.checkUniversalLinkReady { step, result in
 //            Logger.debug("step = ",step)
 //            Logger.debug("result success = \(result.success),errorInfo = \(result.errorInfo),suggestion = \(result.suggestion)")
index 4965f5c..87c5d9e 100644 (file)
@@ -40,7 +40,7 @@ class AppUpdateVM:BaseVM{
         CustomAlert.showWith(title: nil, messgage: "检测到新版本,是否前往更新".l10n) {
             
         } okCallback: {
-            guard let url = "https://www.baidu.com".yc.asUrl else{
+            guard let url = DCConfig.appStoreLink.yc.asUrl else{
                 return
             }
             UIApplication.shared.open(url)
@@ -49,7 +49,7 @@ class AppUpdateVM:BaseVM{
     }
     func forceUpdate(){
         CustomAlert.showWith(title: nil, messgage: "检测到新版本".l10n, ok: "前往更新".l10n,cancelCallback: nil) {
-            guard let url = "https://www.baidu.com".yc.asUrl else{
+            guard let url = DCConfig.appStoreLink.yc.asUrl else{
                 return
             }
             UIApplication.shared.open(url, options: [:], completionHandler: {_ in