From: liangzhenying <867174124@qq.com> Date: Mon, 30 Mar 2026 08:36:07 +0000 (+0800) Subject: 加了固件升级入口 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=10a2a0e0af4bd56921a4b3d604714444eb88dde4;p=mirrors%2FShenYin.git 加了固件升级入口 --- diff --git a/ShenYin/ShenYin.xcodeproj/project.pbxproj b/ShenYin/ShenYin.xcodeproj/project.pbxproj index e4a92ca..2ede7bb 100644 --- a/ShenYin/ShenYin.xcodeproj/project.pbxproj +++ b/ShenYin/ShenYin.xcodeproj/project.pbxproj @@ -1131,7 +1131,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.5; PRODUCT_BUNDLE_IDENTIFIER = com.deepchords.app; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1188,7 +1188,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.5; PRODUCT_BUNDLE_IDENTIFIER = com.deepchords.app; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1368,7 +1368,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 0.02; + MARKETING_VERSION = 0.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.ios.playboy; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1426,7 +1426,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - MARKETING_VERSION = 0.02; + MARKETING_VERSION = 0.0.2; PRODUCT_BUNDLE_IDENTIFIER = com.ios.playboy; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/ShenYin/ShenYin/Channel/DeepChords/Channel/Config/CCConfig.swift b/ShenYin/ShenYin/Channel/DeepChords/Channel/Config/CCConfig.swift index 77bfc08..f3c5663 100644 --- a/ShenYin/ShenYin/Channel/DeepChords/Channel/Config/CCConfig.swift +++ b/ShenYin/ShenYin/Channel/DeepChords/Channel/Config/CCConfig.swift @@ -45,7 +45,7 @@ class CCConfig{ static let findText = "查找耳机".l10n static let deviceType = "耳机".l10n static let serviceLogo = "logo_2" - static let userInfoList:[UserInfoCellType] = [.avatar,.nickName,.gender,.birthday,.height,.weight,.hobbies,.area] + static let userInfoList:[UserInfoCellType] = [.avatar,.nickName,.gender,.birthday,.height,.weight,.hobbies,.uid,.area] static let preferredStatusBarStyle: UIStatusBarStyle = .darkContent } extension YLColor: ColorRGBProviderProtocol { diff --git a/ShenYin/ShenYin/Channel/DeepChords/Channel/UI/JoyAiFunctionVC.swift b/ShenYin/ShenYin/Channel/DeepChords/Channel/UI/JoyAiFunctionVC.swift index 76e579c..99b4115 100644 --- a/ShenYin/ShenYin/Channel/DeepChords/Channel/UI/JoyAiFunctionVC.swift +++ b/ShenYin/ShenYin/Channel/DeepChords/Channel/UI/JoyAiFunctionVC.swift @@ -26,13 +26,16 @@ class JoyAiFunctionVC:BaseVC{ } override func setupViews() { - navBar.title = device.productName - navBar.backgroundColor = .white + navBar.do { v in + v.title = device.productName + v.backgroundColor = .white + v.rightView.isHidden = false + v.rightView.setImage(UIImage(named: "update_icon_normal"), for: .normal) + } + view.backgroundColor = .white view.addSubview(bgView) - - bgView.addSubviews([headerView,functionView,bottomView]) headerView.do { v in @@ -64,6 +67,18 @@ class JoyAiFunctionVC:BaseVC{ make.bottom.equalToSuperview().inset(10) } } + override func setupData() { + BleUpdateVM.shared.hasNewVerVersion(mac: device.mac) {[weak self] newVersion in + guard let self = self else {return} + let img = newVersion ? "update_icon_tips":"update_icon_normal" + navBar.rightView.setImage(UIImage(named: img), for: .normal) + } + } + override func navRightViewTapped() { + if CCBleManager.shared.isConected(mac: device.mac){ + App.shared.goToPage(BleUpdateVC(checked: true)) + } + } @objc func deviceChange(_ noti:Notification){ updateUI() } @@ -71,10 +86,12 @@ class JoyAiFunctionVC:BaseVC{ if CCBleManager.shared.isConected(mac: device.mac){ self.headerView.alpha = 1 self.functionView.alpha = 1 + self.navBar.rightView.alpha = self.headerView.alpha } else{ self.headerView.alpha = 0.5 self.functionView.alpha = 0.5 + self.navBar.rightView.alpha = self.headerView.alpha } functionView.enable = CCBleManager.shared.isConected(mac: device.mac) } @@ -87,7 +104,6 @@ class JoyAiFunctionVC:BaseVC{ if CCBleManager.shared.isConected(mac: device.mac){ CCPage.gotoSubTitle() } - } } diff --git a/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_normal.imageset/Contents.json b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_normal.imageset/Contents.json new file mode 100644 index 0000000..5c4d3b1 --- /dev/null +++ b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_normal.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_normal.imageset/Frame@2x.png b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_normal.imageset/Frame@2x.png new file mode 100644 index 0000000..6c6568b Binary files /dev/null and b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_normal.imageset/Frame@2x.png differ diff --git a/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_normal.imageset/Frame@3x.png b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_normal.imageset/Frame@3x.png new file mode 100644 index 0000000..a449d16 Binary files /dev/null and b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_normal.imageset/Frame@3x.png differ diff --git a/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_tips.imageset/Contents.json b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_tips.imageset/Contents.json new file mode 100644 index 0000000..5c4d3b1 --- /dev/null +++ b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_tips.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_tips.imageset/Frame@2x.png b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_tips.imageset/Frame@2x.png new file mode 100644 index 0000000..2a57909 Binary files /dev/null and b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_tips.imageset/Frame@2x.png differ diff --git a/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_tips.imageset/Frame@3x.png b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_tips.imageset/Frame@3x.png new file mode 100644 index 0000000..ec13064 Binary files /dev/null and b/ShenYin/ShenYin/Channel/DeepChords/DeepChords.xcassets/home/update_icon_tips.imageset/Frame@3x.png differ diff --git a/ShenYin/ShenYin/UI/Home/Scan/DeviceVM.swift b/ShenYin/ShenYin/Channel/DeviceVM.swift similarity index 100% rename from ShenYin/ShenYin/UI/Home/Scan/DeviceVM.swift rename to ShenYin/ShenYin/Channel/DeviceVM.swift diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/Channel/Config/CCConfig.swift b/ShenYin/ShenYin/Channel/PLAYBOY/Channel/Config/CCConfig.swift index e0321eb..317ac5c 100644 --- a/ShenYin/ShenYin/Channel/PLAYBOY/Channel/Config/CCConfig.swift +++ b/ShenYin/ShenYin/Channel/PLAYBOY/Channel/Config/CCConfig.swift @@ -25,7 +25,7 @@ class CCConfig{ /// 服务器地址 static let baseURL = "https://app-api.playboykq.com" /// 服务器地址 -// static let baseURL = "https://app-api.deepchords.com"" +// static let baseURL = "https://app-api.deepchords.com" /// 用户隐私协议地址 static let yonghuBaseURL = "https://pub-cdn.playboykq.com" @@ -37,7 +37,7 @@ class CCConfig{ static let findText = "查找眼镜".l10n static let deviceType = "眼镜".l10n static let serviceLogo = "logo_4" - static let userInfoList:[UserInfoCellType] = [.avatar,.nickName,.gender,.area] + static let userInfoList:[UserInfoCellType] = [.avatar,.nickName,.gender,.uid,.area] static let preferredStatusBarStyle: UIStatusBarStyle = .lightContent } diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/Channel/UI/PbAiFunctionVC.swift b/ShenYin/ShenYin/Channel/PLAYBOY/Channel/UI/PbAiFunctionVC.swift index 7dc174f..994e77b 100644 --- a/ShenYin/ShenYin/Channel/PLAYBOY/Channel/UI/PbAiFunctionVC.swift +++ b/ShenYin/ShenYin/Channel/PLAYBOY/Channel/UI/PbAiFunctionVC.swift @@ -25,10 +25,13 @@ class PbAiFunctionVC:BaseVC{ } override func setupViews() { - navBar.title = device.productName - navBar.backgroundColor = .color(.bgColor) -// navBar.rightView.isHidden = false - navBar.rightView.setTitle("字幕翻译", for: .normal) + navBar.do { v in + v.title = device.productName + v.backgroundColor = .color(.bgColor) + v.rightView.isHidden = false + v.rightView.setImage(UIImage(named: "update_icon_normal"), for: .normal) + } + view.backgroundColor = .color(.bgColor) // navBar.rightView.setImage(UIImage(named: "add_icon"), for: .normal) view.addSubview(bgView) @@ -59,8 +62,17 @@ class PbAiFunctionVC:BaseVC{ make.width.equalTo(kScreenWid) } } + override func setupData() { + BleUpdateVM.shared.hasNewVerVersion(mac: device.mac) {[weak self] newVersion in + guard let self = self else {return} + let img = newVersion ? "update_icon_tips":"update_icon_normal" + navBar.rightView.setImage(UIImage(named: img), for: .normal) + } + } override func navRightViewTapped() { - CCPage.gotoSubTitle() + if CCBleManager.shared.isConected(mac: device.mac){ + App.shared.goToPage(BleUpdateVC(checked: true)) + } } func updateUI(){ if CCBleManager.shared.isConected(mac: device.mac){ diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_normal.imageset/Contents.json b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_normal.imageset/Contents.json new file mode 100644 index 0000000..5c4d3b1 --- /dev/null +++ b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_normal.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_normal.imageset/Frame@2x.png b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_normal.imageset/Frame@2x.png new file mode 100644 index 0000000..cb311db Binary files /dev/null and b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_normal.imageset/Frame@2x.png differ diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_normal.imageset/Frame@3x.png b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_normal.imageset/Frame@3x.png new file mode 100644 index 0000000..cb7476f Binary files /dev/null and b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_normal.imageset/Frame@3x.png differ diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_tips.imageset/Contents.json b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_tips.imageset/Contents.json new file mode 100644 index 0000000..5c4d3b1 --- /dev/null +++ b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_tips.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_tips.imageset/Frame@2x.png b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_tips.imageset/Frame@2x.png new file mode 100644 index 0000000..4adee8c Binary files /dev/null and b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_tips.imageset/Frame@2x.png differ diff --git a/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_tips.imageset/Frame@3x.png b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_tips.imageset/Frame@3x.png new file mode 100644 index 0000000..f8e1857 Binary files /dev/null and b/ShenYin/ShenYin/Channel/PLAYBOY/PLAYBOY.xcassets/home/update_icon_tips.imageset/Frame@3x.png differ diff --git a/ShenYin/ShenYin/Channel/PaXa/Config/CCConfig.swift b/ShenYin/ShenYin/Channel/PaXa/Config/CCConfig.swift index 035c473..7a6a99e 100644 --- a/ShenYin/ShenYin/Channel/PaXa/Config/CCConfig.swift +++ b/ShenYin/ShenYin/Channel/PaXa/Config/CCConfig.swift @@ -39,7 +39,7 @@ class CCConfig{ static let findText = "查找耳机".l10n static let deviceType = "耳机".l10n static let serviceLogo = "logo_2" - static let userInfoList:[UserInfoCellType] = [.avatar,.nickName,.gender,.birthday,.height,.weight,.hobbies,.area] + static let userInfoList:[UserInfoCellType] = [.avatar,.nickName,.gender,.birthday,.height,.weight,.hobbies,.uid,.area] static let preferredStatusBarStyle: UIStatusBarStyle = .darkContent } extension YLColor: ColorRGBProviderProtocol { diff --git a/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_normal.imageset/Contents.json b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_normal.imageset/Contents.json new file mode 100644 index 0000000..5c4d3b1 --- /dev/null +++ b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_normal.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_normal.imageset/Frame@2x.png b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_normal.imageset/Frame@2x.png new file mode 100644 index 0000000..6c6568b Binary files /dev/null and b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_normal.imageset/Frame@2x.png differ diff --git a/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_normal.imageset/Frame@3x.png b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_normal.imageset/Frame@3x.png new file mode 100644 index 0000000..a449d16 Binary files /dev/null and b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_normal.imageset/Frame@3x.png differ diff --git a/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_tips.imageset/Contents.json b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_tips.imageset/Contents.json new file mode 100644 index 0000000..5c4d3b1 --- /dev/null +++ b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_tips.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_tips.imageset/Frame@2x.png b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_tips.imageset/Frame@2x.png new file mode 100644 index 0000000..2a57909 Binary files /dev/null and b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_tips.imageset/Frame@2x.png differ diff --git a/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_tips.imageset/Frame@3x.png b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_tips.imageset/Frame@3x.png new file mode 100644 index 0000000..ec13064 Binary files /dev/null and b/ShenYin/ShenYin/Channel/PaXa/PaXa.xcassets/home/update_icon_tips.imageset/Frame@3x.png differ diff --git a/ShenYin/ShenYin/UI/Mine/AboutVC.swift b/ShenYin/ShenYin/UI/Mine/AboutVC.swift index 66e1081..967a620 100644 --- a/ShenYin/ShenYin/UI/Mine/AboutVC.swift +++ b/ShenYin/ShenYin/UI/Mine/AboutVC.swift @@ -35,7 +35,12 @@ class AboutVC: BaseVC{ make.top.equalTo(kNavBtm) } } - + override func setupData() { + AppUpdateVM.shared.checkedUpdate {[weak self] model in + guard let self = self else {return} + tableView.reloadData() + } + } } extension AboutVC:UITableViewDelegate,UITableViewDataSource { @@ -92,7 +97,7 @@ extension AboutVC:UITableViewDelegate,UITableViewDataSource { App.shared.goToPage(FileDownloadVC(type: .xitongquanxianqingdan)) } else if data == .update{ - AppUpdateVM.shared.checkedUpdate() + AppUpdateVM.shared.manualCheckedUpdate() } else if data == .revoke{ App.shared.goToPage(RevokeVC()) diff --git a/ShenYin/ShenYin/UI/Mine/Root/MineVC.swift b/ShenYin/ShenYin/UI/Mine/Root/MineVC.swift index 8e73916..1b03b2b 100644 --- a/ShenYin/ShenYin/UI/Mine/Root/MineVC.swift +++ b/ShenYin/ShenYin/UI/Mine/Root/MineVC.swift @@ -88,7 +88,7 @@ extension MineVC:UITableViewDelegate,UITableViewDataSource { case .instructions: App.shared.goToPage(InstructionsVC()) case .update: - App.shared.goToPage(UpdateVC()) + App.shared.goToPage(BleUpdateVC(checked: false)) case .language: App.shared.goToPage(LanguageVC()) case .more: diff --git a/ShenYin/ShenYin/UI/Mine/Update/AppUpdateModel.swift b/ShenYin/ShenYin/UI/Mine/Update/AppUpdateModel.swift index a88eff1..4a6a47f 100644 --- a/ShenYin/ShenYin/UI/Mine/Update/AppUpdateModel.swift +++ b/ShenYin/ShenYin/UI/Mine/Update/AppUpdateModel.swift @@ -22,6 +22,9 @@ class AppUpdateModel:HandyJSON { var newVersioon:Bool{ return targetVersion.uppercased() > sourceVersion.uppercased() } + var optionUpdate:Bool{ + return updateType == "0" + } } class AppUpdateFileModel:HandyJSON { var url = "" diff --git a/ShenYin/ShenYin/UI/Mine/Update/AppUpdateVM.swift b/ShenYin/ShenYin/UI/Mine/Update/AppUpdateVM.swift index 62b1869..c89f1b4 100644 --- a/ShenYin/ShenYin/UI/Mine/Update/AppUpdateVM.swift +++ b/ShenYin/ShenYin/UI/Mine/Update/AppUpdateVM.swift @@ -8,64 +8,58 @@ class AppUpdateVM:BaseVM{ static let shared = AppUpdateVM() var updateModel:AppUpdateModel? - - func checkedUpdate(){ + + func checkedUpdate(finished:@escaping (_ model:AppUpdateModel?)->Void){ var params:[String:Any] = [:] params["sourceVersion"] = Bundle.main.appVersion ?? "1.0.0" params["platform"] = "iOS" - YLprogressHUD.showLoading() HttpClient.request(.otaTaskApp(param: params)) {[weak self](model:AppUpdateModelRoot,res) in YLprogressHUD.hidden() guard let self = self else {return} if model.isSuccess{ - self.updateModel = model.data - if model.data.newVersioon{ - if model.data.updateType == "0"{ - //可选升级 - optionUpdate(model: model.data) - } - else{ - //强制升级 - forceUpdate(model: model.data) - } - } - else{ - YLprogressHUD.showAutoHiden("已经是最新版本".l10n) - } + updateModel = model.data + finished(updateModel) } else{ - YLprogressHUD.showAutoHiden("请求失败".l10n) + finished(nil) } } } - func autoCheckedUpdate(){ - var params:[String:Any] = [:] - params["sourceVersion"] = Bundle.main.appVersion ?? "1.0.0" - params["platform"] = "iOS" + func manualCheckedUpdate(){ YLprogressHUD.showLoading() - HttpClient.request(.otaTaskApp(param: params)) {[weak self](model:AppUpdateModelRoot,res) in + checkedUpdate {[weak self] model in YLprogressHUD.hidden() - guard let self = self else {return} - if model.isSuccess{ - self.updateModel = model.data - if model.data.newVersioon{ - if model.data.updateType == "0"{ - autoOptionUpdate(model: model.data) - } - else{ - forceUpdate(model: model.data) - } + guard let self = self else{return} + guard let model = model else{ + YLprogressHUD.showAutoHiden("请求失败".l10n) + return + } + if model.newVersioon{ + if model.optionUpdate{ + optionUpdate(model: model) } else{ - YLprogressHUD.showAutoHiden("已经是最新版本".l10n) + forceUpdate(model: model) } } else{ - YLprogressHUD.showAutoHiden("请求失败".l10n) + YLprogressHUD.showAutoHiden("已经是最新版本".l10n) + } + } + } + func autoCheckedUpdate(){ + checkedUpdate {[weak self] model in + guard let self = self,let model = model else{return} + if model.newVersioon{ + if model.optionUpdate{ + autoOptionUpdate(model: model) + } + else{ + forceUpdate(model: model) + } } } } - private func autoOptionUpdate(model:AppUpdateModel){ if !UpdateCache.isSkip(version: model.targetVersion) { diff --git a/ShenYin/ShenYin/UI/Mine/Update/UpdateVC.swift b/ShenYin/ShenYin/UI/Mine/Update/BleUpdateVC.swift similarity index 51% rename from ShenYin/ShenYin/UI/Mine/Update/UpdateVC.swift rename to ShenYin/ShenYin/UI/Mine/Update/BleUpdateVC.swift index e2bffba..836f86c 100644 --- a/ShenYin/ShenYin/UI/Mine/Update/UpdateVC.swift +++ b/ShenYin/ShenYin/UI/Mine/Update/BleUpdateVC.swift @@ -7,14 +7,17 @@ import UIKit -class UpdateVC:BaseVC{ +class BleUpdateVC:BaseVC{ let icon = UIImageView(image: UIImage(named: "update_icon")) let versionLabel = UILabel() let btn = UIButton(type: .custom) + let autoChecked:Bool + init(checked:Bool) { + self.autoChecked = checked + super.init() + } override func viewDidLoad() { super.viewDidLoad() - - } override func setupViews() { view.addSubviews([icon,versionLabel,btn]) @@ -57,20 +60,39 @@ class UpdateVC:BaseVC{ } } override func setupData() { - CCDevice.getVersion {[weak self] version in - guard let self = self else{return} - let version = version ?? " --" - let allText = "当前版本".l10n + "\nV\(version)" - let attributedString = NSMutableAttributedString(string: allText) - let paragraphStyle = NSMutableParagraphStyle() - paragraphStyle.lineSpacing = 7 - attributedString.addAttribute(.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) -// attributedString.addAttribute(.font, value: UIFont.bold(16), range: NSRange(location: 0, length: attributedString.length)) -// attributedString.addAttribute(.font, value: UIFont.bold(14), range: NSRange(location: 4, length: version.count + 2)) - versionLabel.attributedText = attributedString - versionLabel.textAlignment = .center + if autoChecked { + CCDevice.getVersion {[weak self] version in + guard let self = self else{return} + let version = version ?? " --" + let allText = "当前版本".l10n + "\nV\(version)" + let attributedString = NSMutableAttributedString(string: allText) + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.lineSpacing = 7 + attributedString.addAttribute(.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) + // attributedString.addAttribute(.font, value: UIFont.bold(16), range: NSRange(location: 0, length: attributedString.length)) + // attributedString.addAttribute(.font, value: UIFont.bold(14), range: NSRange(location: 4, length: version.count + 2)) + versionLabel.attributedText = attributedString + versionLabel.textAlignment = .center + tapAction() + } + } + else{ + CCDevice.getVersion {[weak self] version in + guard let self = self else{return} + let version = version ?? " --" + let allText = "当前版本".l10n + "\nV\(version)" + let attributedString = NSMutableAttributedString(string: allText) + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.lineSpacing = 7 + attributedString.addAttribute(.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) + // attributedString.addAttribute(.font, value: UIFont.bold(16), range: NSRange(location: 0, length: attributedString.length)) + // attributedString.addAttribute(.font, value: UIFont.bold(14), range: NSRange(location: 4, length: version.count + 2)) + versionLabel.attributedText = attributedString + versionLabel.textAlignment = .center + } } } + @objc func tapAction(){ if !CCBleManager.shared.isConneted{ YLprogressHUD.showAutoHiden("请先连接设备".l10n) diff --git a/ShenYin/ShenYin/UI/Mine/Update/BleUpdateVM.swift b/ShenYin/ShenYin/UI/Mine/Update/BleUpdateVM.swift index 3492798..3ee8f22 100644 --- a/ShenYin/ShenYin/UI/Mine/Update/BleUpdateVM.swift +++ b/ShenYin/ShenYin/UI/Mine/Update/BleUpdateVM.swift @@ -7,6 +7,38 @@ class BleUpdateVM:BaseVM{ static let shared = BleUpdateVM() + + func hasNewVerVersion(mac:String,finished:@escaping ((Bool) -> Void)){ + if !CCBleManager.shared.isConected(mac: mac){ + finished(false) + return + } + + CCDevice.getDN { dn in + guard let deviceName = dn else{ + return + } + CCDevice.getVersion { version in + guard let version = version else{ + return + } + + var params:[String:Any] = [:] + params["sourceVersion"] = version + params["deviceId"] = deviceName + HttpClient.request(.otaTask(param: params)) {(model:AppUpdateModelRoot,res) in + if model.isSuccess,model.data.newVersioon{ + finished(true) + } + else{ + finished(false) + } + } + } + } + } + + func checkedUpdate(){ CCDevice.getDN {[weak self] dn in guard let self = self else{return} @@ -22,7 +54,7 @@ class BleUpdateVM:BaseVM{ } } } - func startCheck(deviceName:String,version:String){ + private func startCheck(deviceName:String,version:String){ var params:[String:Any] = [:] params["sourceVersion"] = version params["deviceId"] = deviceName @@ -50,7 +82,7 @@ class BleUpdateVM:BaseVM{ } } } - func optionUpdate(_ url:String){ + private func optionUpdate(_ url:String){ CustomAlert.showWith(title: nil, messgage: "检测到新版本,是否开始更新?".l10n) { } okCallback: { @@ -58,13 +90,13 @@ class BleUpdateVM:BaseVM{ } } - func forceUpdate(_ url:String){ + private func forceUpdate(_ url:String){ CustomAlert.showWith(title: nil, messgage: "检测到新版本".l10n, ok: "开始更新".l10n,cancelCallback: nil) { self.startUpdate(url: url) } } - func startUpdate(url:String){ + private func startUpdate(url:String){ YLprogressHUD.showLoading() HttpClient.download(url: url,type: "ufw"){ path in if let path = path{ diff --git a/ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoCell.swift b/ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoCell.swift index 7bd880d..a61009f 100644 --- a/ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoCell.swift +++ b/ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoCell.swift @@ -13,6 +13,7 @@ public enum UserInfoCellType: Int { case height case weight case hobbies + case uid case area var title:String{ @@ -31,6 +32,8 @@ public enum UserInfoCellType: Int { return "体重".l10n case .hobbies: return "运动偏好".l10n + case .uid: + return "ID".l10n case .area: return "国家与地区".l10n } @@ -80,6 +83,9 @@ class UserInfoCell: BaseTableViewCell { else if type == .hobbies { valueLabel.text = info.preference } + else if type == .uid { + valueLabel.text = info.userId + } else if type == .avatar{ valueIcon.kf.setImage(with:CacheManager.shared.user.info.avatar.yc.asUrl ) } diff --git a/ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoVC.swift b/ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoVC.swift index fdb1692..0b069d5 100644 --- a/ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoVC.swift +++ b/ShenYin/ShenYin/UI/Mine/UserInfo/UserInfoVC.swift @@ -71,19 +71,16 @@ class UserInfoVC: BaseVC{ genderAction() case .area: areaAction() - break case .birthday: birthdayAction() - break case .height: heightAction() - break case .weight: weightAction() + case .uid: break case .hobbies: hobiesAction() - break } } }