南鑫林 5 yıl önce
ebeveyn
işleme
cec823d66b
17 değiştirilmiş dosya ile 476 ekleme ve 26 silme
  1. 51 7
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 8 0
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift
  3. 3 0
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate.swift
  4. 0 3
      RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift
  5. 2 0
      RainbowPlanet/RainbowPlanet/Macro/ColorMacro.swift
  6. 3 3
      RainbowPlanet/RainbowPlanet/Tools/AppStoreReview/AppStoreReview.swift
  7. 67 0
      RainbowPlanet/RainbowPlanet/Manager/UpdateVersionManager/Model/UpdateVersionModel.swift
  8. 193 0
      RainbowPlanet/RainbowPlanet/Manager/UpdateVersionManager/View/UpdateVersionView.swift
  9. 87 0
      RainbowPlanet/RainbowPlanet/Manager/UpdateVersionManager/ViewModel/UpdateVersionManager.swift
  10. 1 1
      RainbowPlanet/RainbowPlanet/Modules/MineModule/Set/ViewController/SetViewController.swift
  11. 14 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift
  12. 17 4
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaServiceConfigApi.swift
  13. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/my_set_pic_upgrade_popup.imageset/Contents.json
  14. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/my_set_pic_upgrade_popup.imageset/my_set_pic_upgrade_popup@2x.png
  15. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/my_set_pic_upgrade_popup.imageset/my_set_pic_upgrade_popup@3x.png
  16. 7 7
      RainbowPlanet/RainbowPlanet/Supporting Files/Info.plist
  17. 1 1
      RainbowPlanet/RainbowPlanet/Tools/AppInfo/AppInfo.swift

+ 51 - 7
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -174,9 +174,12 @@
 		A739121D229F75F50033177E /* JXPagingListContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7391216229F75F50033177E /* JXPagingListContainerView.swift */; };
 		A73A56D322DC59A3004920FE /* PushModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73A56D222DC59A3004920FE /* PushModel.swift */; };
 		A73A56D522DC5E34004920FE /* UMPushRouterModuleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73A56D422DC5E34004920FE /* UMPushRouterModuleType.swift */; };
+		A73A56D922DC8378004920FE /* UpdateVersionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73A56D822DC8378004920FE /* UpdateVersionView.swift */; };
+		A73A56DB22DC9AB5004920FE /* UpdateVersionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73A56DA22DC9AB5004920FE /* UpdateVersionModel.swift */; };
+		A73A56DE22DC9CCE004920FE /* UpdateVersionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73A56DD22DC9CCE004920FE /* UpdateVersionManager.swift */; };
 		A73D7C682268A032002A4CE3 /* SwiftyStarRatingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73D7C672268A032002A4CE3 /* SwiftyStarRatingView.swift */; };
 		A743229422B88ED30017C367 /* EnumMacro.swift in Sources */ = {isa = PBXBuildFile; fileRef = A743229322B88ED30017C367 /* EnumMacro.swift */; };
-		A743229B22B8C1510017C367 /* AppStoreReview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A743229A22B8C1510017C367 /* AppStoreReview.swift */; };
+		A743229B22B8C1510017C367 /* AppStoreManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A743229A22B8C1510017C367 /* AppStoreManager.swift */; };
 		A74322A022B8D1F30017C367 /* MyFollowAndFanViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A743229F22B8D1F30017C367 /* MyFollowAndFanViewController.swift */; };
 		A74322A222B8D5A90017C367 /* SearchUserLitTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A74322A122B8D5A90017C367 /* SearchUserLitTableViewCell.swift */; };
 		A74322A422B8E7F60017C367 /* MyFollowAndFanHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A74322A322B8E7F60017C367 /* MyFollowAndFanHeaderView.swift */; };
@@ -856,9 +859,12 @@
 		A7391216229F75F50033177E /* JXPagingListContainerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JXPagingListContainerView.swift; sourceTree = "<group>"; };
 		A73A56D222DC59A3004920FE /* PushModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushModel.swift; sourceTree = "<group>"; };
 		A73A56D422DC5E34004920FE /* UMPushRouterModuleType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UMPushRouterModuleType.swift; sourceTree = "<group>"; };
+		A73A56D822DC8378004920FE /* UpdateVersionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateVersionView.swift; sourceTree = "<group>"; };
+		A73A56DA22DC9AB5004920FE /* UpdateVersionModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UpdateVersionModel.swift; sourceTree = "<group>"; };
+		A73A56DD22DC9CCE004920FE /* UpdateVersionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateVersionManager.swift; sourceTree = "<group>"; };
 		A73D7C672268A032002A4CE3 /* SwiftyStarRatingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftyStarRatingView.swift; sourceTree = "<group>"; };
 		A743229322B88ED30017C367 /* EnumMacro.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumMacro.swift; sourceTree = "<group>"; };
-		A743229A22B8C1510017C367 /* AppStoreReview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStoreReview.swift; sourceTree = "<group>"; };
+		A743229A22B8C1510017C367 /* AppStoreManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStoreManager.swift; sourceTree = "<group>"; };
 		A743229F22B8D1F30017C367 /* MyFollowAndFanViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyFollowAndFanViewController.swift; sourceTree = "<group>"; };
 		A74322A122B8D5A90017C367 /* SearchUserLitTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchUserLitTableViewCell.swift; sourceTree = "<group>"; };
 		A74322A322B8E7F60017C367 /* MyFollowAndFanHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyFollowAndFanHeaderView.swift; sourceTree = "<group>"; };
@@ -2247,6 +2253,8 @@
 		A72A725422321B9400B21995 /* Manager */ = {
 			isa = PBXGroup;
 			children = (
+				A743229922B8C1440017C367 /* AppStoreManager */,
+				A73A56DC22DC9CB8004920FE /* UpdateVersionManager */,
 				A797FDE922C5AC570076DCB3 /* CacheManager */,
 				A7D5F24E22BC7B0500F8E9AF /* WebViewJavascriptBridgeManager */,
 				A73911AB229CD6080033177E /* AlamofireReachabilityManager */,
@@ -2503,6 +2511,40 @@
 			path = PushModel;
 			sourceTree = "<group>";
 		};
+		A73A56D722DC835A004920FE /* View */ = {
+			isa = PBXGroup;
+			children = (
+				A73A56D822DC8378004920FE /* UpdateVersionView.swift */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
+		A73A56DC22DC9CB8004920FE /* UpdateVersionManager */ = {
+			isa = PBXGroup;
+			children = (
+				A73A56E122DCA435004920FE /* ViewModel */,
+				A73A56DF22DCA418004920FE /* Model */,
+				A73A56D722DC835A004920FE /* View */,
+			);
+			path = UpdateVersionManager;
+			sourceTree = "<group>";
+		};
+		A73A56DF22DCA418004920FE /* Model */ = {
+			isa = PBXGroup;
+			children = (
+				A73A56DA22DC9AB5004920FE /* UpdateVersionModel.swift */,
+			);
+			path = Model;
+			sourceTree = "<group>";
+		};
+		A73A56E122DCA435004920FE /* ViewModel */ = {
+			isa = PBXGroup;
+			children = (
+				A73A56DD22DC9CCE004920FE /* UpdateVersionManager.swift */,
+			);
+			path = ViewModel;
+			sourceTree = "<group>";
+		};
 		A73D7C662268A032002A4CE3 /* SwiftyStarRatingView */ = {
 			isa = PBXGroup;
 			children = (
@@ -2511,12 +2553,12 @@
 			path = SwiftyStarRatingView;
 			sourceTree = "<group>";
 		};
-		A743229922B8C1440017C367 /* AppStoreReview */ = {
+		A743229922B8C1440017C367 /* AppStoreManager */ = {
 			isa = PBXGroup;
 			children = (
-				A743229A22B8C1510017C367 /* AppStoreReview.swift */,
+				A743229A22B8C1510017C367 /* AppStoreManager.swift */,
 			);
-			path = AppStoreReview;
+			path = AppStoreManager;
 			sourceTree = "<group>";
 		};
 		A743229C22B8D13B0017C367 /* MyFollowAndFan */ = {
@@ -3155,7 +3197,6 @@
 				A7D5F25222BF8E6A00F8E9AF /* WaterFallLayout */,
 				A7DF50D922A556C300998908 /* BrowsePictures */,
 				A790706222B9DF81008CE279 /* TextLimitTool */,
-				A743229922B8C1440017C367 /* AppStoreReview */,
 				BD108C8D22A60A2000837DAB /* HGImagePicker */,
 				A7391212229F75F50033177E /* JXPagingView-Swift */,
 				A7146346228EFCE20066099B /* SKUDataFilter */,
@@ -5832,6 +5873,7 @@
 				BD108C9522A60C2100837DAB /* HGImageCollectionViewCell.swift in Sources */,
 				A7FF1589228C854900A85748 /* OrderDetailBottomView.swift in Sources */,
 				A770E5DB22CED8C600CBD0A4 /* RouterManager.swift in Sources */,
+				A73A56DE22DC9CCE004920FE /* UpdateVersionManager.swift in Sources */,
 				A7D5F22B22BB687100F8E9AF /* BaseJSWebViewController.swift in Sources */,
 				BD1DC6C5228CFD0B00B89C57 /* SwiftMoyaNetWorkServiceOrder.swift in Sources */,
 				BD7AB83D228438020030646A /* OrderPayExpressInfoShowCell.swift in Sources */,
@@ -5887,6 +5929,7 @@
 				A770E5E722D3422800CBD0A4 /* CommentInputView.swift in Sources */,
 				A71AF0AE226EF0A3001730FE /* SearchHeaderCollectionReusableView.swift in Sources */,
 				A7636AC52268139C00374F9E /* LocationViewController.swift in Sources */,
+				A73A56DB22DC9AB5004920FE /* UpdateVersionModel.swift in Sources */,
 				A7D46090227617D200A5A54E /* SQLModel.swift in Sources */,
 				A790706522B9DFAD008CE279 /* TextLimitTool.m in Sources */,
 				A72C01222275404A0065E0C3 /* ProvinceCityAreaModel.swift in Sources */,
@@ -5955,7 +5998,7 @@
 				BD12B68322B4EFF000AEB10B /* KSMediaPickerView.swift in Sources */,
 				BDE376E522C22D2B0055E2EA /* AlivcImage.m in Sources */,
 				A71CAB3722C9A40A00D908A8 /* TotalBeanModel.swift in Sources */,
-				A743229B22B8C1510017C367 /* AppStoreReview.swift in Sources */,
+				A743229B22B8C1510017C367 /* AppStoreManager.swift in Sources */,
 				BD61225422C355C800D3F513 /* AliyunMagicCameraViewController.m in Sources */,
 				BDAF83A222B330540004BCC3 /* RecommendSimilarCell.swift in Sources */,
 				BDAA40FD228E9CD600CF841D /* OrderApplyRefundPhoneCell.swift in Sources */,
@@ -6380,6 +6423,7 @@
 				A70B2C492288416F00B2449F /* ProductDetailHotSellCollectionViewCell.swift in Sources */,
 				A71901692275464000104A50 /* ProvinceCityAreaView.swift in Sources */,
 				BD12204422AF996E0051C7C2 /* MessageListController.swift in Sources */,
+				A73A56D922DC8378004920FE /* UpdateVersionView.swift in Sources */,
 				BD477F6322C23D66008BE2CB /* AliyunReachability.m in Sources */,
 				A7778CDD2246121500C7C47A /* PhoneCountryAreaListMdoel.swift in Sources */,
 				A72A733522325A4B00B21995 /* AppDelegate+HandleOpen.swift in Sources */,

+ 8 - 0
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift

@@ -55,6 +55,9 @@ extension AppDelegate {
         
         /// 引导页
         setGuidePageView()
+        /// 版本更新
+//        setconfigUpGrade()
+        
     }
     
     /// 设置Tabbar
@@ -108,4 +111,9 @@ extension AppDelegate {
         
     }
     
+//    //版本更新
+//    func setconfigUpGrade() {
+//        _ = VersionManager.shared
+//    }
+    
 }

+ 3 - 0
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate.swift

@@ -16,6 +16,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         //初始化窗口
         initWindow()
+        //版本更新
+        _ = UpdateVersionManager.shared
         
         DispatchQueue.global(qos: .default).async {
             //初始化百度地图
@@ -24,6 +26,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
             DispatchQueue.main.async {
                 //初始化友盟
                 UMManager.shared.initUM(launchOptions: launchOptions)
+
                 IQKeyboardManagerSwiftManager.shared().initIQKeyboardManagerSwift()
             }
         }

+ 0 - 3
RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift

@@ -44,9 +44,6 @@ class BaseTabbarViewController: UITabBarController {
         tabBarItemStyle(vc: v5, normalImg: "tabbar_my", selectorImg: "tabbar_my_pre", title: "我的")
         v5.tabBarItem.tag = 4
 
-        
-        
-
         // Do any additional setup after loading the view.
     }
     

+ 2 - 0
RainbowPlanet/RainbowPlanet/Macro/ColorMacro.swift

@@ -145,3 +145,5 @@ let kFEFEFEColor = UIColor(hexString: "#FEFEFE")
 let k7AD489Color = UIColor(hexString: "7AD489")
 
 let kFF5E5EColor = UIColor(hexString: "FF5E5E")
+
+let kE5E5E5Color = UIColor(hexString: "E5E5E5")

+ 3 - 3
RainbowPlanet/RainbowPlanet/Tools/AppStoreReview/AppStoreReview.swift

@@ -9,8 +9,8 @@
 import UIKit
 import StoreKit
 
-class AppStore: NSObject {
-    static let shared : AppStore = AppStore()
+class AppStoreManager: NSObject {
+    static let shared : AppStoreManager = AppStoreManager()
     let kAppStoreAppId = "1166892045"
     /// 跳转到appStoreUrl
     let kAppStore = String(describing: "https://itunes.apple.com/cn/app/1166892045")
@@ -54,7 +54,7 @@ class AppStore: NSObject {
     }
 }
 
-extension AppStore: SKStoreProductViewControllerDelegate {
+extension AppStoreManager: SKStoreProductViewControllerDelegate {
     func productViewControllerDidFinish(_ viewController: SKStoreProductViewController) {
         self.viewController?.dismiss(animated: true) {
             

+ 67 - 0
RainbowPlanet/RainbowPlanet/Manager/UpdateVersionManager/Model/UpdateVersionModel.swift

@@ -0,0 +1,67 @@
+//
+//	UpGradeModel.swift
+//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
+
+import Foundation 
+import ObjectMapper
+import SwiftyJSON
+
+
+enum UpGradeModelType : Int {
+    case ignore = 0
+    case update = 1
+    case strongUpdate = 2
+}
+
+class UpdateVersionModel : NSObject, Mappable{
+    
+    static let shared : UpdateVersionModel = UpdateVersionModel()
+
+	var content : String = ""
+	var title : String = ""
+    var upgrade : Int = 0 {
+        didSet {
+            upGradeModelType = UpGradeModelType(rawValue: upgrade) ?? .ignore
+        }
+    }
+    var upGradeModelType : UpGradeModelType = .ignore
+	var url : String = ""
+    var version : String = AppInfo.clientVersion {
+        didSet {
+            isUpdate = UpdateVersionManager.shared.systemVersion(over: version)
+        }
+    }
+    var isUpdate: Bool = false
+
+
+	class func newInstance(map: Map) -> Mappable?{
+		return UpdateVersionModel()
+	}
+	required init?(map: Map){}
+    override init(){}
+
+	func mapping(map: Map)
+	{
+		content <- map["content"]
+		title <- map["title"]
+		upgrade <- map["upgrade"]
+		url <- map["url"]
+		version <- map["version"]
+        isUpdate <- map["isUpdate"]
+        upGradeModelType <- map["upGradeModelType"]
+		
+	}
+    
+    func saveObject(model: UpdateVersionModel) {
+        var cacheModel = CacheModel()
+        cacheModel.data = jsonToData(jsonDic: model.toJSON())
+        CacheManager.default.setObjectSync(cacheModel, forKey: "UpGradeModel")
+    }
+    
+    func object() -> UpdateVersionModel? {
+        let  cacheModel = CacheManager.default.objectSync(forKey: "UpGradeModel")
+        let json = try? JSON(data: cacheModel?.data ?? Data())
+        return UpdateVersionModel(JSONString: json?.description ?? "")
+    }
+
+}

+ 193 - 0
RainbowPlanet/RainbowPlanet/Manager/UpdateVersionManager/View/UpdateVersionView.swift

@@ -0,0 +1,193 @@
+//
+//  UpdatedVersionView.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/7/15.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import FWPopupView
+import RxSwift
+
+class UpdateVersionView: FWPopupView {
+    
+    let disposeBag = DisposeBag()
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        setupViews()
+        setupLayouts()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    func setupViews() {
+        frame = CGRect(x: 0, y: 0, width: 302, height: 405)
+        cornerRadius = 8
+        backgroundColor = UIColor.white
+        addSubview(topImageView)
+        addSubview(titleLabel)
+        addSubview(detailTitleLabel)
+        addSubview(scrollView)
+        scrollView.addSubview(contentLabel)
+        addSubview(lineLabel)
+        addSubview(v_lineLabel)
+        addSubview(leftButton)
+        addSubview(rightButton)
+    }
+    
+    func setupLayouts() {
+        titleLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(topImageView.snp.bottom).offset(5)
+            make.centerX.equalToSuperview()
+            make.height.equalTo(25)
+        }
+        detailTitleLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(titleLabel.snp.bottom)
+            make.centerX.equalToSuperview()
+            make.height.equalTo(25)
+        }
+        scrollView.snp.makeConstraints { (make) in
+            make.top.equalTo(detailTitleLabel.snp.bottom).offset(10)
+            make.right.equalTo(-20)
+            make.left.equalTo(20)
+            make.height.equalTo(132)
+        }
+        contentLabel.snp.makeConstraints { (make) in
+            make.top.left.width.equalToSuperview()
+            make.height.equalTo(str.heightForComment(font: kRegularFont14!, width: 302 - 40))
+        }
+        
+        lineLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(scrollView.snp.bottom).offset(10)
+            make.left.right.equalToSuperview()
+            make.height.equalTo(0.5)
+        }
+        v_lineLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(lineLabel.snp.bottom).offset(20)
+            make.bottom.equalTo(-20)
+            make.width.equalTo(0.5)
+            make.centerX.equalToSuperview()
+        }
+        leftButton.snp.makeConstraints { (make) in
+            make.top.equalTo(lineLabel.snp.bottom)
+            make.left.bottom.equalToSuperview()
+            make.right.equalTo(v_lineLabel.snp.left)
+        }
+        rightButton.snp.makeConstraints { (make) in
+            make.top.equalTo(lineLabel.snp.bottom)
+            make.right.bottom.equalToSuperview()
+            make.left.equalTo(v_lineLabel.snp.right)
+        }
+    }
+    
+    lazy var topImageView: UIImageView = {
+        let topImageView = UIImageView()
+        topImageView.frame = CGRect(x: 0, y: -20, width: self.width, height: 157)
+        topImageView.image = kImage(name: "my_set_pic_upgrade_popup")
+        return topImageView
+    }()
+    
+    lazy var titleLabel: UILabel = {
+        let titleLabel = UILabel()
+        titleLabel.text = "新版本上线"
+        titleLabel.textColor = k333333Color
+        titleLabel.font = kMediumFont18
+        return titleLabel
+    }()
+    
+    lazy var detailTitleLabel: UILabel = {
+        let detailTitleLabel = UILabel()
+        detailTitleLabel.text = "更多功能,更多乐趣"
+        detailTitleLabel.textColor = k333333Color
+        detailTitleLabel.font = kMediumFont18
+        return detailTitleLabel
+    }()
+    
+    lazy var scrollView: UIScrollView = {
+        let scrollView = UIScrollView()
+        scrollView.contentSize = CGSize(width: 302-40, height: str.heightForComment(font: kRegularFont14!, width: 302 - 40))
+        return scrollView
+    }()
+    
+    let str = "升级功能:\n1、全新首页为你改变,资产事项一目了然。\n2、全新兑换专区,淘U票好物,享生活优惠。\n3、关注名家专栏,发现更多你感兴趣的内容。"
+    
+    lazy var contentLabel: UILabel = {
+        let contentLabel = UILabel()
+        contentLabel.text = str
+        contentLabel.textColor = k666666Color
+        contentLabel.font = kRegularFont14
+        contentLabel.numberOfLines = 0
+        return contentLabel
+    }()
+    
+    lazy var lineLabel: UILabel = {
+        let lineLabel = UILabel()
+        lineLabel.backgroundColor = kE5E5E5Color
+        return lineLabel
+    }()
+    
+    lazy var leftButton: UIButton = {
+        let leftButton = UIButton(type: UIButton.ButtonType.custom)
+        leftButton.setTitle("稍后再说", for: UIControl.State.normal)
+        leftButton.setTitleColor(k999999Color, for: UIControl.State.normal)
+        leftButton.titleLabel?.font = kRegularFont17
+        return leftButton
+    }()
+    
+    lazy var rightButton: UIButton = {
+        let rightButton = UIButton(type: UIButton.ButtonType.custom)
+        rightButton.setTitle("立即更新", for: UIControl.State.normal)
+        rightButton.setTitleColor(kThemeColor, for: UIControl.State.normal)
+        rightButton.titleLabel?.font = kBoldFont17
+        return rightButton
+    }()
+    
+    lazy var v_lineLabel: UILabel = {
+        let v_lineLabel = UILabel()
+        v_lineLabel.backgroundColor = kE5E5E5Color
+        return v_lineLabel
+    }()
+    
+    /// 隐藏View
+    class func dismissView() {
+        
+    }
+    
+    class func updateVersionView() -> UpdateVersionView {
+        let view = UpdateVersionView()
+        let vProperty = FWPopupViewProperty()
+        vProperty.popupCustomAlignment = .center
+        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        vProperty.popupAnimationType = .scale
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
+        vProperty.touchWildToHide = "1"
+        view.vProperty = vProperty
+        view.show()
+        view.leftButton.rx.tap.subscribe(onNext: { (data) in
+            let upGradeModel = UpdateVersionModel.shared.object()
+            switch upGradeModel?.upGradeModelType {
+            case .ignore?:
+                break
+            case .update?:
+                view.hide()
+                break
+            case .strongUpdate?:
+                exit(0)
+                break
+            case .none:
+                break
+            }
+        }).disposed(by: view.disposeBag)
+        
+        view.rightButton.rx.tap.subscribe(onNext: {(data) in
+            AppStoreManager.shared.appStore()
+            view.hide()
+        }).disposed(by: view.disposeBag)
+        return view
+    }
+
+}

+ 87 - 0
RainbowPlanet/RainbowPlanet/Manager/UpdateVersionManager/ViewModel/UpdateVersionManager.swift

@@ -0,0 +1,87 @@
+//
+//  VersionManager.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/7/15.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+
+class UpdateVersionManager: NSObject {
+    
+    var updateVersionView : UpdateVersionView?
+    
+    deinit {
+        if observe != nil {
+            NotificationCenter.default.removeObserver(observe!)
+        }
+    }
+    weak var observe : NSObjectProtocol?
+    
+    static let shared : UpdateVersionManager = UpdateVersionManager()
+
+    override init() {
+        super.init()
+        observe = NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.configUpGrade()
+        })
+        observe = NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            if self?.updateVersionView != nil {
+                self?.updateVersionView?.hide()
+            }
+        })
+    }
+    // 用于判断当前系统版本是否低于指定版本
+    func systemVersion(below aVersionString: String) -> Bool
+    {
+        return UIDevice.current.systemVersion.isOlder(than: aVersionString)
+    }
+    
+    /// 用于判断当前系统版本是否高于指定版本
+    func systemVersion(over aVersionString: String) -> Bool
+    {
+        return UIDevice.current.systemVersion.isNewer(than: aVersionString)
+    }
+    
+    /// 用于判断当前系统版本是否等于指定版本
+    func systemVersion(sameAs aVersionString: String) -> Bool
+    {
+        return UIDevice.current.systemVersion.isSame(to: aVersionString)
+    }
+    
+    /// 版本更新
+    func configUpGrade() {
+        SwiftMoyaNetWorkServiceConfig.shared().configUpGradeApi {
+            [weak self] (data) -> (Void) in
+            if UpdateVersionModel.shared.object()?.isUpdate ?? false {
+                self?.updateVersionView = UpdateVersionView.updateVersionView()
+            }
+        }
+    }
+    
+    func appStoreVersion() {
+        
+    }
+    
+}
+
+extension String {
+    func ck_compare(with version: String) -> ComparisonResult {
+        return compare(version, options: .numeric, range: nil, locale: nil)
+    }
+    
+    func isNewer(than aVersionString: String) -> Bool {
+        return ck_compare(with: aVersionString) == .orderedDescending
+    }
+    
+    func isOlder(than aVersionString: String) -> Bool {
+        return ck_compare(with: aVersionString) == .orderedAscending
+    }
+    
+    func isSame(to aVersionString: String) -> Bool {
+        return ck_compare(with: aVersionString) == .orderedSame
+    }
+}

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/MineModule/Set/ViewController/SetViewController.swift

@@ -57,7 +57,7 @@ class SetViewController: BaseViewController {
                     break
                 // AppStore
                 case 1:
-                    AppStore.shared.appStore()
+                    AppStoreManager.shared.appStore()
                     break
                 // 分享彩虹星球app
                 case 3:

+ 14 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift

@@ -160,5 +160,19 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
             completion(data)
         }
     }
+    
+    
+    /// 系统升级接口
+    ///
+    /// - Parameter completion: <#completion description#>
+    func configUpGradeApi(completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue("ios", forKey: "os")
+        parameters.updateValue(AppInfo.clientBuildVersion, forKey: "version_code")
+        SwiftMoyaNetWorkManager.shared.requestObject(UpdateVersionModel.self,target: MultiTarget(SwiftMoyaServiceConfigApi.configUpgrade(parameters: parameters))) { (updateVersionModel) in
+            UpdateVersionModel.shared.saveObject(model: updateVersionModel as? UpdateVersionModel ?? UpdateVersionModel())
+            completion(updateVersionModel)
+        }
+    }
             
 }

+ 17 - 4
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaServiceConfigApi.swift

@@ -33,6 +33,12 @@ public let kConfigConfigApi = "/config/config"
 /// 邀请海报
 public let kConfigPosterInviteApi = "/config/poster/invite"
 
+// MARK: - 系统升级接口
+/// 系统升级接口
+public let kConfigUpgradeApi = "/config/upgrade"
+
+
+
 
 /// 基础配置
 ///
@@ -50,6 +56,7 @@ public enum SwiftMoyaServiceConfigApi {
     case configUploadSingleImgWithoutHud(parameters:Dictionary<String, Any>,dataArray:Array<Any>)
     case configUploadMultiImg(parameters:Dictionary<String, Any>,dataArray:Array<Any>)
     case configPosterInvite(parameters:Dictionary<String, Any>)
+    case configUpgrade(parameters:Dictionary<String, Any>)
 }
 
 extension SwiftMoyaServiceConfigApi: TargetType {
@@ -62,7 +69,8 @@ extension SwiftMoyaServiceConfigApi: TargetType {
              .configUploadSingleImg,
              .configUploadSingleImgWithoutHud,
              .configUploadMultiImg,
-             .configPosterInvite
+             .configPosterInvite,
+             .configUpgrade
             :
             return URL(string: kApiDataPrefix())!
         }
@@ -83,6 +91,8 @@ extension SwiftMoyaServiceConfigApi: TargetType {
             return kConfigUploadMultiImgApi
         case .configPosterInvite:
             return kConfigPosterInviteApi
+        case .configUpgrade:
+            return kConfigUpgradeApi
         }
     }
     
@@ -91,7 +101,8 @@ extension SwiftMoyaServiceConfigApi: TargetType {
         case .configConfig,
              .configPickupNodeIndex,
              .configCityManagementIndex,
-             .configPosterInvite
+             .configPosterInvite,
+             .configUpgrade
             :
             return .get
         case .configUploadSingleImg,
@@ -108,7 +119,8 @@ extension SwiftMoyaServiceConfigApi: TargetType {
         case .configConfig(var parameters),
              .configPickupNodeIndex(var parameters),
              .configCityManagementIndex(var parameters),
-             .configPosterInvite(var parameters)
+             .configPosterInvite(var parameters),
+             .configUpgrade(var parameters)
             :
             let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
             parameters.updateValue(sign, forKey: "sign")
@@ -138,7 +150,8 @@ extension SwiftMoyaServiceConfigApi: TargetType {
     public var headers: [String : String]? {
         //同task,具体选择看后台 有application/x-www-form-urlencoded 、application/json
         switch self {
-        case .configConfig
+        case .configConfig,
+             .configUpgrade
             :
             return (headerParameters(headerType: .defaultHeader) as! [String : String])
         case .configPickupNodeIndex,

+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/my_set_pic_upgrade_popup.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "my_set_pic_upgrade_popup@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "my_set_pic_upgrade_popup@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/my_set_pic_upgrade_popup.imageset/my_set_pic_upgrade_popup@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/my_set_pic_upgrade_popup.imageset/my_set_pic_upgrade_popup@3x.png


+ 7 - 7
RainbowPlanet/RainbowPlanet/Supporting Files/Info.plist

@@ -10,12 +10,17 @@
 	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
+	<key>CFBundleLocalizations</key>
+	<array>
+		<string>en</string>
+		<string>zh</string>
+	</array>
 	<key>CFBundleName</key>
 	<string>$(PRODUCT_NAME)</string>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.0.0</string>
+	<string>0.2.3</string>
 	<key>CFBundleURLTypes</key>
 	<array>
 		<dict>
@@ -70,7 +75,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>1</string>
+	<string>0</string>
 	<key>LSApplicationQueriesSchemes</key>
 	<array>
 		<string>wechat</string>
@@ -233,11 +238,6 @@
 	</array>
 	<key>UIRequiresFullScreen</key>
 	<true/>
-	<key>CFBundleLocalizations</key>
-	<array>
-		<string>en</string>
-		<string>zh</string>
-	</array>
 	<key>UISupportedInterfaceOrientations</key>
 	<array>
 		<string>UIInterfaceOrientationPortrait</string>

+ 1 - 1
RainbowPlanet/RainbowPlanet/Tools/AppInfo/AppInfo.swift

@@ -23,7 +23,7 @@ struct  AppInfo {
     static let clientVersion = Bundle.main.infoDictionary! ["CFBundleShortVersionString"] as! String
 
     /// 客户端构建版本号
-    static let clientBuild_Version = Bundle.main.infoDictionary! ["CFBundleVersion"] as! String
+    static let clientBuildVersion = Bundle.main.infoDictionary! ["CFBundleVersion"] as! String
 
     /// 系统名称
     static let osName = UIDevice.current.systemName