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"
}
+
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
self.tabBar.backgroundColor = .white
view.backgroundColor = .color(.bgColor)
- self.selectedIndex = 4
+// self.selectedIndex = 4
}
}
var recordFilePath : String?
var startIndex = 0//记录开始录音的次数,用于区分返回的数据
+ deinit {
+ PcmSound.sharedInstance().stopAudioUnit()
+ PcmSound.sharedInstance().cleanup()
+ }
+
override func setupViews() {
navBar.title = "中英互译".l10n
navBar.rightView.isHidden = false
// v.show(animate: true)
App.shared.goToPage(BleScanVC())
-
+// BleManager.shared.checkSettingsConnected()
}
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("链接不可用")
+ }
+ }
}
}
}
extension BleManager : JoyGemAIManagerDelegate {
func joyGemAuthFailedCallback() {
+ Logger.debug("鉴权失败")
YLprogressHUD.showAutoHiden("鉴权失败")
}
//
//
// }
+
+ func checkSettingsConnected()->[CBPeripheral]{
+ let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: kJoyGemAIServiceUUID)])
+ Logger.debug("已连接设备",list)
+ return list
+ }
}
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)")
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)
}
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