|
@@ -49,4 +49,47 @@ class LocalManager {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //验证版本
|
|
|
+ static func verifyVersiondo(){
|
|
|
+ LocalManager.loginService.dictRequest(dictType: "coach_version").subscribe(onSuccess: { cityItems in
|
|
|
+ var server_version = "" //服务端版本
|
|
|
+ var message = "有新版本,请到appstore更新" //提示内容
|
|
|
+ var isSup = 0 //是否强制更新
|
|
|
+ for cityItem in cityItems {
|
|
|
+ if cityItem.dictCode == 207 {
|
|
|
+ server_version = cityItem.dictValue.replacingOccurrences(of: ".", with: "")
|
|
|
+ let array = cityItem.remark.components(separatedBy: ":")
|
|
|
+ if array.count>1 {
|
|
|
+ isSup = Int(array[0])!
|
|
|
+ message = array[1]
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //当前版本<服务器ios版本提示更新
|
|
|
+ let appVersion:String = (NYMacros.appVersion as! String).replacingOccurrences(of: ".", with: "")
|
|
|
+ if Int(appVersion)!<Int(server_version)! {
|
|
|
+// https://apps.apple.com/cn/app/%E6%95%99%E7%BB%83%E7%AE%A1%E5%AE%B6/id1214203182
|
|
|
+ let action1 = QMUIAlertAction(title: "取消", style: .cancel, handler: nil)
|
|
|
+ let action2 = QMUIAlertAction(title: "下载", style: .destructive) { vc, action in
|
|
|
+ if let url = URL(string: "itms-apps://itunes.apple.com/cn/app/jiao-li-guan-jia/id1214203182?l=en&mt=8") {
|
|
|
+ UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let alertController = QMUIAlertController(title: "提示", message: message, preferredStyle: .alert)
|
|
|
+ if isSup == 0 {
|
|
|
+ alertController.addAction(action1)
|
|
|
+ }
|
|
|
+ alertController.addAction(action2)
|
|
|
+ let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
|
|
|
+ visualEffectView.qmui_foregroundColor = UIColor(255, 255, 255,0.7) // UIColorMakeWithRGBA(255, 255, 255, 0.7) // Use the default value in most cases, only demonstrate how to set here
|
|
|
+ alertController.mainVisualEffectView = visualEffectView
|
|
|
+ alertController.alertHeaderBackgroundColor = nil // Remove these background colors when you need to use the blur effect
|
|
|
+ alertController.alertButtonBackgroundColor = nil
|
|
|
+ alertController.showWith(animated: true)
|
|
|
+
|
|
|
+ }
|
|
|
+ },onError: { Error in
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
+ }
|
|
|
}
|