浏览代码

Merge branch 'develop' into feature/publishNew

南鑫林 5 年之前
父节点
当前提交
a34ff84400
共有 22 个文件被更改,包括 353 次插入130 次删除
  1. 31 0
      RainbowPlanet/NotificationService/Info.plist
  2. 93 0
      RainbowPlanet/NotificationService/NotificationService.swift
  3. 16 16
      RainbowPlanet/Podfile.lock
  4. 141 1
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  5. 0 2
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift
  6. 1 1
      RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift
  7. 0 89
      RainbowPlanet/RainbowPlanet/Macro/Common.swift
  8. 4 0
      RainbowPlanet/RainbowPlanet/Model/PushModel/PushModel.swift
  9. 1 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoTableViewCell.swift
  10. 3 3
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  11. 3 3
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift
  12. 1 1
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoCrop/Controller/AliyunCropViewController.m
  13. 2 1
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m
  14. 5 2
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/Controller/AliyunMagicCameraViewController.m
  15. 1 1
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecommendMusicController.swift
  16. 2 2
      RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/BindPhoneNumber/ViewController/BindPhoneNumberViewController.swift
  17. 1 0
      RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/LoginNow/LoginNowView.swift
  18. 5 0
      RainbowPlanet/RainbowPlanet/Router/RouterManager.swift
  19. 1 2
      RainbowPlanet/RainbowPlanet/Tools/Extension/Extension+UIAlertController.swift
  20. 3 2
      RainbowPlanet/RainbowPlanet/Tools/PhotoAndCameraManager/PhotoAndCameraManager.swift
  21. 1 1
      RainbowPlanet/RainbowPlanet/Tools/WRNavigationBar/WRNavigationBar.swift
  22. 38 2
      RainbowPlanet/RainbowPlanet/ViewModel/UserMemberTotalBeanViewModel/UserMemberTotalBeanViewModel.swift

+ 31 - 0
RainbowPlanet/NotificationService/Info.plist

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>$(DEVELOPMENT_LANGUAGE)</string>
+	<key>CFBundleDisplayName</key>
+	<string>NotificationService</string>
+	<key>CFBundleExecutable</key>
+	<string>$(EXECUTABLE_NAME)</string>
+	<key>CFBundleIdentifier</key>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>$(PRODUCT_NAME)</string>
+	<key>CFBundlePackageType</key>
+	<string>XPC!</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+	<key>NSExtension</key>
+	<dict>
+		<key>NSExtensionPointIdentifier</key>
+		<string>com.apple.usernotifications.service</string>
+		<key>NSExtensionPrincipalClass</key>
+		<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
+	</dict>
+</dict>
+</plist>

+ 93 - 0
RainbowPlanet/NotificationService/NotificationService.swift

@@ -0,0 +1,93 @@
+//
+//  NotificationService.swift
+//  NotificationService
+//
+//  Created by 南鑫林 on 2019/9/10.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UserNotifications
+import UIKit
+
+class NotificationService: UNNotificationServiceExtension {
+
+    var contentHandler: ((UNNotificationContent) -> Void)?
+    var bestAttemptContent: UNMutableNotificationContent?
+
+    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
+        self.contentHandler = contentHandler
+        //[modified]这个是一个标示,可以实现对服务器下发下来的内容进行更改
+        bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
+        
+        func failEarly() {
+            contentHandler(request.content)
+        }
+        if let bestAttemptContent = bestAttemptContent {
+            let apsDic = request.content.userInfo["aps"] as? [AnyHashable : Any]
+            let attachUrl = apsDic?["image"] as? String
+            let category = apsDic?["category"] as? String
+            bestAttemptContent.categoryIdentifier = category ?? ""
+            let url = URL(string: attachUrl ?? "")
+            guard let imageData = NSData(contentsOf:url!) else { return failEarly() }
+            
+            let image = UIImage(data: imageData as Data)
+            let identifier = ProcessInfo.processInfo.globallyUniqueString
+            if let attachment = UNNotificationAttachment.create(identifier: identifier, image: image!, options: nil) {
+                // where myImage is any UIImage that follows the
+                bestAttemptContent.attachments = [attachment]
+            }
+            contentHandler(bestAttemptContent)
+        }
+    }
+    
+    override func serviceExtensionTimeWillExpire() {
+        // Called just before the extension will be terminated by the system.
+        // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
+        if let contentHandler = contentHandler, let bestAttemptContent =  bestAttemptContent {
+            contentHandler(bestAttemptContent)
+        }
+    }
+
+}
+
+extension UNNotificationAttachment {
+    
+    static func create(identifier: String, image: UIImage, options: [NSObject : AnyObject]?) -> UNNotificationAttachment? {
+        let fileManager = FileManager.default
+        let tmpSubFolderName = ProcessInfo.processInfo.globallyUniqueString
+        let tmpSubFolderURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(tmpSubFolderName, isDirectory: true)
+        do {
+            try fileManager.createDirectory(at: tmpSubFolderURL, withIntermediateDirectories: true, attributes: nil)
+            let imageFileIdentifier = identifier+".png"
+            let fileURL = tmpSubFolderURL.appendingPathComponent(imageFileIdentifier)
+            guard let imageData = image.pngData() else {
+                return nil
+            }
+            try imageData.write(to: fileURL)
+            let imageAttachment = try UNNotificationAttachment.init(identifier: imageFileIdentifier, url: fileURL, options: options)
+            return imageAttachment
+        } catch {
+            print("error " + error.localizedDescription)
+        }
+        return nil
+    }
+    
+    /// Save the image to disk
+    static func create(imageFileIdentifier: String, data: NSData, options: [NSObject : AnyObject]?) -> UNNotificationAttachment? {
+        let fileManager = FileManager.default
+        let tmpSubFolderName = ProcessInfo.processInfo.globallyUniqueString
+        let tmpSubFolderURL = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(tmpSubFolderName, isDirectory: true)
+        
+        do {
+            try fileManager.createDirectory(at: tmpSubFolderURL!, withIntermediateDirectories: true, attributes: nil)
+            let fileURL = tmpSubFolderURL?.appendingPathComponent(imageFileIdentifier)
+            try data.write(to: fileURL!, options: [])
+            let imageAttachment = try UNNotificationAttachment.init(identifier: imageFileIdentifier, url: fileURL!, options: options)
+            return imageAttachment
+        } catch let error {
+            print("error \(error)")
+        }
+        
+        return nil
+    }
+}

+ 16 - 16
RainbowPlanet/Podfile.lock

@@ -14,36 +14,36 @@ PODS:
   - AFNetworking/Serialization (3.2.1)
   - AFNetworking/UIKit (3.2.1):
     - AFNetworking/NSURLSession
-  - Alamofire (4.8.2)
-  - AlivcConan (0.9.5):
-    - AlivcConan/AlivcConan (= 0.9.5)
-  - AlivcConan/AlivcConan (0.9.5)
+  - Alamofire (4.9.0)
+  - AlivcConan (0.9.5.1):
+    - AlivcConan/AlivcConan (= 0.9.5.1)
+  - AlivcConan/AlivcConan (0.9.5.1)
   - AliyunOSSiOS (2.10.7)
   - AliyunVideoSDKPro (3.11.0)
   - BaiduMapKit (4.4.2)
   - BMKLocationKit (1.5.0)
   - Bugly (2.5.0)
   - Cache (5.2.0)
-  - DeviceKit (2.0.0)
+  - DeviceKit (2.1.0)
   - DPScrollNumberLabel (0.0.2)
   - ESTabBarController-swift (2.7)
   - FBRetainCycleDetector (0.1.4)
   - FMDB (2.7.5):
     - FMDB/standard (= 2.7.5)
   - FMDB/standard (2.7.5)
-  - FSPagerView (0.8.2)
+  - FSPagerView (0.8.3)
   - FWPopupView (4.0.7):
     - SnapKit
   - InputBarAccessoryView (4.3.1):
     - InputBarAccessoryView/Core (= 4.3.1)
   - InputBarAccessoryView/Core (4.3.1)
-  - IQKeyboardManagerSwift (6.4.1)
+  - IQKeyboardManagerSwift (6.4.2)
   - JSONModel (1.7.0)
   - JXSegmentedView (0.0.19)
   - KeychainAccess (3.2.0)
   - Kingfisher (4.10.1)
   - lottie-ios (3.1.2)
-  - LYEmptyView (1.2.5)
+  - LYEmptyView (1.3.0)
   - Masonry (1.1.0)
   - MBProgressHUD (1.1.0)
   - MJRefresh (3.2.0)
@@ -88,7 +88,7 @@ PODS:
   - UMCShare/UI (6.9.6):
     - UMCCommon
     - UMCShare/Core
-  - VODUpload (1.5.1):
+  - VODUpload (1.5.3):
     - AliyunOSSiOS
   - WebViewJavascriptBridge (6.0.3)
   - YYText (1.0.7)
@@ -198,29 +198,29 @@ SPEC REPOS:
 
 SPEC CHECKSUMS:
   AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
-  Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
-  AlivcConan: 9dccc32986024768bb5f50e14ad54490123903c7
+  Alamofire: afc3e7c6db61476cb45cdd23fed06bad03bbc321
+  AlivcConan: 7462cb9a4101b281dfa2434d251149c234424801
   AliyunOSSiOS: 602b6a4e70e62a5f0a6431c20496343141d7e66f
   AliyunVideoSDKPro: da710c1e7fb93b1e9a741b3619814c6608780b4b
   BaiduMapKit: 11acde2e7c06e31b7de60b323880a5eb7c4dccb6
   BMKLocationKit: 40d267478acd8704ddebd0e9deaddc727b13df9f
   Bugly: 3ca9f255c01025582df26f9222893b383c7e4b4e
   Cache: 807c5d86d01a177f06ede9865add3aea269bbfd4
-  DeviceKit: 72d36709552d4b3582abd76a53949148acad9811
+  DeviceKit: 2f6c28410d5a5fe2977be7f8cb9b313d28bdae69
   DPScrollNumberLabel: 5124eaccf3029bb84116de391e1273cba676f4f5
   ESTabBarController-swift: 4fb52ad03d94d0717ef97bc9eb09a5abfdded0a2
   FBRetainCycleDetector: 46f8179bbb1c587deee3ea838a1a3ee02acf5015
   FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
-  FSPagerView: 816a18842306973cc7cc6df8a5332272f7815c30
+  FSPagerView: 670405b2f18e2a87fa37f20b00de783e562c25a8
   FWPopupView: c1dbb33fbe4d223f619f28a7e5e5a00f08c10342
   InputBarAccessoryView: 58a348be7ea2736c7eec60e5c315511c2dbb39fd
-  IQKeyboardManagerSwift: d2df660d0b8d64a15cb2537c9ff303213fa515b2
+  IQKeyboardManagerSwift: 79a3ec200dfb41cb66a89b8575417b5378107c5d
   JSONModel: 840bc0fcffb24b8454d2c026bf26fea454b8e98d
   JXSegmentedView: 6e22381bd1e6f0767fc078bef1947b13b2d337a1
   KeychainAccess: 3b1bf8a77eb4c6ea1ce9404c292e48f948954c6b
   Kingfisher: c148cd7b47ebde9989f6bc7c27dcaa79d81279a0
   lottie-ios: 49cd85b1f24f61a7708ad7ec76a523ab2d0e3100
-  LYEmptyView: b17adfc2dd9ad2988ecaf7c9606efa916e24c767
+  LYEmptyView: bd85bfb78e943b30df3d34bcc2534f21b999938e
   Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
   MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
   MJRefresh: ed450d6eb9d3346a2cb033ab7eb6de090aeef437
@@ -241,7 +241,7 @@ SPEC CHECKSUMS:
   UMCPush: 1edd856027dcf905333effb4040ace5d236a7316
   UMCSecurityPlugins: 0831a08f3988f3cea9f1d3a7626cd9bee4fef150
   UMCShare: e0cef55c0fd6051254c8cda1d0630eb578b27bad
-  VODUpload: d180069b5fcee002079a892de2f310bacdb8e355
+  VODUpload: a76d07081e4faf9bd9e7535265901cde2cea507f
   WebViewJavascriptBridge: 7f5bc4d3581e672e8f32bd0f812d54bc69bb8e29
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966

+ 141 - 1
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -157,6 +157,8 @@
 		A74322A422B8E7F60017C367 /* MyFollowAndFanHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A74322A322B8E7F60017C367 /* MyFollowAndFanHeaderView.swift */; };
 		A74322A922B900180017C367 /* CommunityFindFriendsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A74322A822B900180017C367 /* CommunityFindFriendsViewController.swift */; };
 		A74322AB22B900F00017C367 /* CommunityFindFriendsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A74322AA22B900F00017C367 /* CommunityFindFriendsView.swift */; };
+		A74D9D572327B54100F05C14 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = A74D9D562327B54100F05C14 /* NotificationService.swift */; };
+		A74D9D5B2327B54100F05C14 /* NotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = A74D9D542327B54100F05C14 /* NotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
 		A74DF74922EAAF17007FB505 /* MJDIYFullScreenHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = A74DF74822EAAF17007FB505 /* MJDIYFullScreenHeader.swift */; };
 		A74DF74D22EAEF60007FB505 /* MJRefreshManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A74DF74C22EAEF60007FB505 /* MJRefreshManager.swift */; };
 		A75414FD224B5F28002480B5 /* MobileLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A75414FB224B5F28002480B5 /* MobileLoginViewController.swift */; };
@@ -590,6 +592,13 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
+		A74D9D592327B54100F05C14 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = A77F2C552231FB49001BD3F6 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = A74D9D532327B54100F05C14;
+			remoteInfo = NotificationService;
+		};
 		A77F2C722231FB4A001BD3F6 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = A77F2C552231FB49001BD3F6 /* Project object */;
@@ -606,6 +615,20 @@
 		};
 /* End PBXContainerItemProxy section */
 
+/* Begin PBXCopyFilesBuildPhase section */
+		A74D9D5F2327B54100F05C14 /* Embed App Extensions */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = "";
+			dstSubfolderSpec = 13;
+			files = (
+				A74D9D5B2327B54100F05C14 /* NotificationService.appex in Embed App Extensions */,
+			);
+			name = "Embed App Extensions";
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
 /* Begin PBXFileReference section */
 		57C497E128081597F165C771 /* Pods-RainbowPlanet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RainbowPlanet.release.xcconfig"; path = "Pods/Target Support Files/Pods-RainbowPlanet/Pods-RainbowPlanet.release.xcconfig"; sourceTree = "<group>"; };
 		88DF1EFD2E202DA7C627E8A7 /* Pods_RainbowPlanetUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RainbowPlanetUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -765,6 +788,9 @@
 		A74322A322B8E7F60017C367 /* MyFollowAndFanHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyFollowAndFanHeaderView.swift; sourceTree = "<group>"; };
 		A74322A822B900180017C367 /* CommunityFindFriendsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityFindFriendsViewController.swift; sourceTree = "<group>"; };
 		A74322AA22B900F00017C367 /* CommunityFindFriendsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityFindFriendsView.swift; sourceTree = "<group>"; };
+		A74D9D542327B54100F05C14 /* NotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
+		A74D9D562327B54100F05C14 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
+		A74D9D582327B54100F05C14 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		A74DF74822EAAF17007FB505 /* MJDIYFullScreenHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MJDIYFullScreenHeader.swift; sourceTree = "<group>"; };
 		A74DF74C22EAEF60007FB505 /* MJRefreshManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MJRefreshManager.swift; sourceTree = "<group>"; };
 		A75414FB224B5F28002480B5 /* MobileLoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileLoginViewController.swift; sourceTree = "<group>"; };
@@ -1272,6 +1298,13 @@
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
+		A74D9D512327B54100F05C14 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		A77F2C5A2231FB49001BD3F6 /* Frameworks */ = {
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
@@ -2223,6 +2256,15 @@
 			path = View;
 			sourceTree = "<group>";
 		};
+		A74D9D552327B54100F05C14 /* NotificationService */ = {
+			isa = PBXGroup;
+			children = (
+				A74D9D562327B54100F05C14 /* NotificationService.swift */,
+				A74D9D582327B54100F05C14 /* Info.plist */,
+			);
+			path = NotificationService;
+			sourceTree = "<group>";
+		};
 		A74DF74B22EAEF43007FB505 /* MJRefreshManager */ = {
 			isa = PBXGroup;
 			children = (
@@ -2592,6 +2634,7 @@
 				A77F2C5F2231FB49001BD3F6 /* RainbowPlanet */,
 				A77F2C742231FB4A001BD3F6 /* RainbowPlanetTests */,
 				A77F2C7F2231FB4A001BD3F6 /* RainbowPlanetUITests */,
+				A74D9D552327B54100F05C14 /* NotificationService */,
 				A77F2C5E2231FB49001BD3F6 /* Products */,
 				618631008656829220117ED1 /* Pods */,
 				FA8AAFBADE8BD144A5C36FDB /* Frameworks */,
@@ -2604,6 +2647,7 @@
 				A77F2C5D2231FB49001BD3F6 /* RainbowPlanet.app */,
 				A77F2C712231FB4A001BD3F6 /* RainbowPlanetTests.xctest */,
 				A77F2C7C2231FB4A001BD3F6 /* RainbowPlanetUITests.xctest */,
+				A74D9D542327B54100F05C14 /* NotificationService.appex */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -4925,6 +4969,23 @@
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
+		A74D9D532327B54100F05C14 /* NotificationService */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = A74D9D5E2327B54100F05C14 /* Build configuration list for PBXNativeTarget "NotificationService" */;
+			buildPhases = (
+				A74D9D502327B54100F05C14 /* Sources */,
+				A74D9D512327B54100F05C14 /* Frameworks */,
+				A74D9D522327B54100F05C14 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = NotificationService;
+			productName = NotificationService;
+			productReference = A74D9D542327B54100F05C14 /* NotificationService.appex */;
+			productType = "com.apple.product-type.app-extension";
+		};
 		A77F2C5C2231FB49001BD3F6 /* RainbowPlanet */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = A77F2C852231FB4A001BD3F6 /* Build configuration list for PBXNativeTarget "RainbowPlanet" */;
@@ -4935,10 +4996,12 @@
 				A77F2C5B2231FB49001BD3F6 /* Resources */,
 				696EB1DDE9DE019617B4DAD7 /* [CP] Embed Pods Frameworks */,
 				59501F6F4334279DFBD164A0 /* [CP] Copy Pods Resources */,
+				A74D9D5F2327B54100F05C14 /* Embed App Extensions */,
 			);
 			buildRules = (
 			);
 			dependencies = (
+				A74D9D5A2327B54100F05C14 /* PBXTargetDependency */,
 			);
 			name = RainbowPlanet;
 			productName = RainbowPlanet;
@@ -4987,10 +5050,13 @@
 		A77F2C552231FB49001BD3F6 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastSwiftUpdateCheck = 1010;
+				LastSwiftUpdateCheck = 1030;
 				LastUpgradeCheck = 1010;
 				ORGANIZATIONNAME = RainbowPlanet;
 				TargetAttributes = {
+					A74D9D532327B54100F05C14 = {
+						CreatedOnToolsVersion = 10.3;
+					};
 					A77F2C5C2231FB49001BD3F6 = {
 						CreatedOnToolsVersion = 10.1;
 						LastSwiftMigration = 1020;
@@ -5031,11 +5097,19 @@
 				A77F2C5C2231FB49001BD3F6 /* RainbowPlanet */,
 				A77F2C702231FB4A001BD3F6 /* RainbowPlanetTests */,
 				A77F2C7B2231FB4A001BD3F6 /* RainbowPlanetUITests */,
+				A74D9D532327B54100F05C14 /* NotificationService */,
 			);
 		};
 /* End PBXProject section */
 
 /* Begin PBXResourcesBuildPhase section */
+		A74D9D522327B54100F05C14 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		A77F2C5B2231FB49001BD3F6 /* Resources */ = {
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
@@ -5154,6 +5228,14 @@
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
+		A74D9D502327B54100F05C14 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				A74D9D572327B54100F05C14 /* NotificationService.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		A77F2C592231FB49001BD3F6 /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
@@ -5709,6 +5791,11 @@
 /* End PBXSourcesBuildPhase section */
 
 /* Begin PBXTargetDependency section */
+		A74D9D5A2327B54100F05C14 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = A74D9D532327B54100F05C14 /* NotificationService */;
+			targetProxy = A74D9D592327B54100F05C14 /* PBXContainerItemProxy */;
+		};
 		A77F2C732231FB4A001BD3F6 /* PBXTargetDependency */ = {
 			isa = PBXTargetDependency;
 			target = A77F2C5C2231FB49001BD3F6 /* RainbowPlanet */;
@@ -5722,6 +5809,48 @@
 /* End PBXTargetDependency section */
 
 /* Begin XCBuildConfiguration section */
+		A74D9D5C2327B54100F05C14 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CODE_SIGN_IDENTITY = "iPhone Developer";
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = C6GA87VLB8;
+				INFOPLIST_FILE = NotificationService/Info.plist;
+				IPHONEOS_DEPLOYMENT_TARGET = 12.4;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = com.uptoyo.uptoyo.NotificationService;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SKIP_INSTALL = YES;
+				SWIFT_VERSION = 5.0;
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Debug;
+		};
+		A74D9D5D2327B54100F05C14 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CODE_SIGN_IDENTITY = "iPhone Developer";
+				CODE_SIGN_STYLE = Automatic;
+				DEVELOPMENT_TEAM = C6GA87VLB8;
+				INFOPLIST_FILE = NotificationService/Info.plist;
+				IPHONEOS_DEPLOYMENT_TARGET = 12.4;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = com.uptoyo.uptoyo.NotificationService;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SKIP_INSTALL = YES;
+				SWIFT_VERSION = 5.0;
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Release;
+		};
 		A77F2C832231FB4A001BD3F6 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
@@ -5844,6 +5973,7 @@
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = BD9052C044FD3AE4E62D3929 /* Pods-RainbowPlanet.debug.xcconfig */;
 			buildSettings = {
+				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = "RainbowPlanet/Supporting Files/RainbowPlanet.entitlements";
@@ -6093,6 +6223,7 @@
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 57C497E128081597F165C771 /* Pods-RainbowPlanet.release.xcconfig */;
 			buildSettings = {
+				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = "RainbowPlanet/Supporting Files/RainbowPlanet.entitlements";
@@ -6427,6 +6558,15 @@
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
+		A74D9D5E2327B54100F05C14 /* Build configuration list for PBXNativeTarget "NotificationService" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				A74D9D5C2327B54100F05C14 /* Debug */,
+				A74D9D5D2327B54100F05C14 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
 		A77F2C582231FB49001BD3F6 /* Build configuration list for PBXProject "RainbowPlanet" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (

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

@@ -95,8 +95,6 @@ extension AppDelegate {
         BaseTabbarViewController.shared.setBadge()
         //添加登录view
         LoginNowView.initLoginNowView()
-        
-
 
         // 退出登录
         NotificationCenter.default.post(name: NSNotification.Name("loginOut"), object: nil)

+ 1 - 1
RainbowPlanet/RainbowPlanet/Base/BaseTabbarViewController/BaseTabbarViewController.swift

@@ -242,7 +242,7 @@ extension ESTabBar {
         
         let view  = super.hitTest(point, with: event)
         if view == nil {
-            if UserModel.isTokenNil() && (getCurrentVC() is CommunityViewController || getCurrentVC() is RedemptionAreaViewController) {
+            if UserModel.isTokenNil() && LoginNowView.shared.loginNowView != nil {
                 for subView in subviews {
                     if !subView.subviews.isEmpty {
                         for subView in subView.subviews {

+ 0 - 89
RainbowPlanet/RainbowPlanet/Macro/Common.swift

@@ -132,16 +132,6 @@ func delay(by delayTime: TimeInterval, qosClass: DispatchQoS.QoSClass? = nil,
     dispatchQueue.asyncAfter(deadline: DispatchTime.now() + delayTime, execute: closure)
 }
 
-func getCurrentVC() -> UIViewController? {
-    let keywindow = (UIApplication.shared.delegate as? AppDelegate)?.window
-    let firstView: UIView? = keywindow?.subviews.first
-    let secondView: UIView? = firstView?.subviews.first
-    var vc = viewForController(view: secondView)
-    vc = ((vc as? UITabBarController)?.selectedViewController as? UINavigationController)?.visibleViewController
-
-    return vc
-}
-
 private func viewForController(view:UIView?)->UIViewController?{
     var next:UIView? = view
     repeat{
@@ -153,58 +143,6 @@ private func viewForController(view:UIView?)->UIViewController?{
     return nil
 }
 
-//classType: 当前页面类类型
-func vcResult(classType: UIViewController.Type) -> Bool {
-    return (getCurrentVC()?.isKind(of: classType))!
-}
-
-
-///获取当前显示的控制器 UIWindow (Visible)
-func getCurrentVC2() -> UIViewController {
-    let keywindow = (UIApplication.shared.delegate as! AppDelegate).window?.rootViewController//UIApplication.shared.keyWindow
-    let rootVC = keywindow!//UIApplication.shared.keyWindow!.rootViewController!
-    return getVisibleViewControllerFrom(vc: rootVC)
-}
-
-//方法1
-func getVisibleViewControllerFrom(vc: UIViewController) -> UIViewController {
-    
-    if vc.isKind(of: UINavigationController.self) {
-        return getVisibleViewControllerFrom(vc: (vc as! UINavigationController).visibleViewController!)
-    } else if vc.isKind(of: UITabBarController.self) {
-        return getVisibleViewControllerFrom(vc: (vc as! UITabBarController).selectedViewController!)
-    } else {
-        if (vc.presentedViewController != nil) {
-            return getVisibleViewControllerFrom(vc: vc.presentedViewController!)
-        } else {
-            return vc
-        }
-    }
-    
-}
-
-//方法2
-func topViewControllerWithRootViewController(rootVC: UIViewController) -> UIViewController {
-    
-    if rootVC.isKind(of: UITabBarController.self) {
-        let tabVC = rootVC as! UITabBarController
-        return topViewControllerWithRootViewController(rootVC: tabVC.selectedViewController!)
-    } else if rootVC.isKind(of: UINavigationController.self) {
-        let navc = rootVC as! UINavigationController
-        return topViewControllerWithRootViewController(rootVC: navc.visibleViewController!)
-    } else if (rootVC.presentedViewController != nil) {
-        return topViewControllerWithRootViewController(rootVC: rootVC.presentedViewController!)
-    } else {
-        return rootVC
-    }
-    
-}
-
-///验证
-func vcResult2(classType: UIViewController.Type) -> Bool {
-    return getCurrentVC2().isKind(of: classType)
-}
-
 func showSwiftProgressHUDInfo() {
     SwiftProgressHUD.shared().showText("该功能暂未开通,敬请期待!!!")
 }
@@ -312,33 +250,6 @@ func getImageHeight(imgStr:String) -> CGFloat {
 }
 
 
-/// 获取缩略图
-///
-/// - Parameters:
-///   - imgStr: 图片地址
-///   - width: 宽度
-///   - height: 高度
-/// - Returns: 返回图片地址
-func getImageUrlStr(imgStr:String,width:CGFloat,height:CGFloat) -> String {
-    if imgStr.contains("*") {
-        let imgStr1 = imgStr + "?x-oss-process=image/resize,m_fill,w_\(Int(width*1.5)),h_\(Int(height*1.5))"
-//        NXLLog(imgStr1)
-        return String(imgStr1)
-    }else {
-        if imgStr.contains("?") {
-            var imgStr1 = imgStr.prefix(upTo:(imgStr.lastIndex(of: "?"))!)
-            imgStr1 = imgStr1 + "?x-oss-process=image/resize,m_fill,w_\(Int(width*1.5)),h_\(Int(height*1.5))"
-//            NXLLog(imgStr1)
-
-            return String(imgStr1)
-        }else {
-            let imgStr1 = imgStr + "?x-oss-process=image/resize,m_fill,w_\(Int(280 * 1.5 * kScaleWidth)),h_\(Int(280 * 1.5 * kScaleWidth))"
-//            NXLLog(imgStr1)
-            return String(imgStr1)
-        }
-    }
-}
-
 /// url字符串转字典
 ///
 /// - Parameter urlString: urlString字符串

+ 4 - 0
RainbowPlanet/RainbowPlanet/Model/PushModel/PushModel.swift

@@ -12,11 +12,15 @@ import ObjectMapper
 /// - post: 跳转到帖子详情
 /// - recommend: 跳转到推荐首页
 /// - star:  跳转到星球首页
+/// - activity:  跳转到活动详情
+/// - product:   跳转到商品详情
 enum PushActionType : String {
     case none = ""
     case post = "post"
     case recommend = "recommend"
     case star = "star"
+    case activity = "activity"
+    case product = "product"
 }
 
 class PushModel : NSObject, Mappable{

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoTableViewCell.swift

@@ -130,7 +130,7 @@ class CardContentPicVideoTableViewCell: UITableViewCell {
                 make.top.equalToSuperview()
                 make.left.equalTo(14)
                 make.right.equalTo(-14)
-                make.bottom.equalTo(-20)
+                make.bottom.equalTo(-15)
             }
             collectionView.reloadData()
         }

+ 3 - 3
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift

@@ -586,7 +586,7 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
                     cardContentPicVideoModel.number = 1
                     cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
                     cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
-                    return cardContentPicVideoModel.collectionViewHeight() + 20
+                    return cardContentPicVideoModel.collectionViewHeight() + 15
                 }else {
                     return 0
                 }
@@ -596,13 +596,13 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
                         cardContentPicVideoModel.number = 1
                         cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
                         cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
-                        return cardContentPicVideoModel.collectionViewHeight() + 20
+                        return cardContentPicVideoModel.collectionViewHeight() + 15
                     }else {
                         return 0
                     }
                 }else {
                     cardContentPicVideoModel.number = communityFollowDataModel?.relateData?.imgs?.count ?? 0
-                    return cardContentPicVideoModel.collectionViewHeight() + 20
+                    return cardContentPicVideoModel.collectionViewHeight() + 15
                 }
             }
         //内容标题

+ 3 - 3
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift

@@ -517,7 +517,7 @@ extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableVie
                     cardContentPicVideoModel.number = 1
                     cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
                     cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
-                    return cardContentPicVideoModel.collectionViewHeight() + 20
+                    return cardContentPicVideoModel.collectionViewHeight() + 15
                 }else {
                     return 0
                 }
@@ -527,13 +527,13 @@ extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableVie
                         cardContentPicVideoModel.number = 1
                         cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
                         cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
-                        return cardContentPicVideoModel.collectionViewHeight() + 20
+                        return cardContentPicVideoModel.collectionViewHeight() + 15
                     }else {
                         return 0
                     }
                 }else {
                     cardContentPicVideoModel.number = communityRecommendDataModel.imgs?.count ?? 0
-                    return cardContentPicVideoModel.collectionViewHeight() + 20
+                    return cardContentPicVideoModel.collectionViewHeight() + 15
                 }
             }
         //内容标题

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoCrop/Controller/AliyunCropViewController.m

@@ -150,7 +150,7 @@ typedef NS_ENUM(NSInteger, AliyunCropPlayerStatus) {
         self.progressView = [[AliyunCycleProgressView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
         self.progressView.backgroundColor = [UIColor clearColor];
         self.progressView.center = self.view.center;
-        self.progressView.progressColor = [UIColor colorWithHexString:@"#62CC74"];
+        self.progressView.progressColor = [UIColor colorWithHexString:@"#25E0CD"];
         self.progressView.progressBackgroundColor = RGBToColor(160, 168, 183);
         [self.view addSubview:self.progressView];
     }

+ 2 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m

@@ -218,6 +218,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
  添加各种视图
  */
 - (void)addSubviews {
+    
     self.view.backgroundColor = [UIColor blackColor];
     //播放视图
     CGFloat factor = _outputSize.height / _outputSize.width;
@@ -306,7 +307,7 @@ AliyunIExporterCallback, AliyunIPlayerCallback>
     self.progressView = [[AliyunCycleProgressView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
     self.progressView.backgroundColor = [UIColor clearColor];
     self.progressView.center = self.view.center;
-    self.progressView.progressColor = [UIColor colorWithHexString:@"#62CC74"];
+    self.progressView.progressColor = [UIColor colorWithHexString:@"#25E0CD"];
     self.progressView.progressBackgroundColor = RGBToColor(160, 168, 183);
     [self.view addSubview:self.progressView];
     

+ 5 - 2
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/Controller/AliyunMagicCameraViewController.m

@@ -220,11 +220,14 @@
     
     
     [self.dbHelper openResourceDBSuccess:nil failure:nil];
-    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
-    
 
 }
 
+- (UIStatusBarStyle)preferredStatusBarStyle {
+    return UIStatusBarStyleLightContent;
+}
+
+
 /**
  设置UI
  */

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecommendMusicController.swift

@@ -184,7 +184,7 @@ extension PublishRecommendMusicController {
         let userName = UserModel.shared().getModel()?.username ?? ""
         let uid = UserModel.shared().getModel()?.uid ?? 0
         
-        SwiftMoyaNetWorkServiceCommunity.shared().communityUploadMusicApi(name: name, username: userName, url: url, uid: uid) {[weak self] (data) -> (Void) in
+        SwiftMoyaNetWorkServiceCommunity.shared().communityUploadMusicApi(name: name.trimmingCharacters(in: .whitespaces), username: userName, url: url, uid: uid) {[weak self] (data) -> (Void) in
             // 上传成功,返回
             SwiftProgressHUD.shared().showText("提交成功")
             self?.navigationController?.popViewController(animated: true)

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/BindPhoneNumber/ViewController/BindPhoneNumberViewController.swift

@@ -64,12 +64,12 @@ class BindPhoneNumberViewController: BaseViewController {
             
             switch self?.bindPhoneNumberVCType {
             case .weixinlogin?:
-                SwiftMoyaNetWorkServiceUser.shared().userBindMobileApi(mobile: phoneNumber, smsCode: sms, unionId: self?.userModel?.bindWeixinUserModel?.unionId ?? "", openId: self?.userModel?.bindWeixinUserModel?.unionId ?? "", invitationCode: invitationCode, completion: { [weak self] (data) -> (Void) in
+                SwiftMoyaNetWorkServiceUser.shared().userBindMobileApi(mobile: phoneNumber, smsCode: sms, unionId: self?.userModel?.bindWeixinUserModel?.unionId ?? "", openId: self?.userModel?.bindWeixinUserModel?.openId ?? "", invitationCode: invitationCode, completion: { [weak self] (data) -> (Void) in
                     RegisterLoginManager.registerLoginSuccessApi(vc: self!)
                 })
                 break
             case .qqLogin?:
-                SwiftMoyaNetWorkServiceUser.shared().userBindMobileApi(mobile: phoneNumber, smsCode: sms, unionId: self?.userModel?.bindQQUserModel?.unionId ?? "", openId: self?.userModel?.bindQQUserModel?.unionId ?? "", invitationCode: invitationCode, completion: { [weak self] (data) -> (Void) in
+                SwiftMoyaNetWorkServiceUser.shared().userBindMobileApi(mobile: phoneNumber, smsCode: sms, unionId: self?.userModel?.bindQQUserModel?.unionId ?? "", openId: self?.userModel?.bindQQUserModel?.openId ?? "", invitationCode: invitationCode, completion: { [weak self] (data) -> (Void) in
                     RegisterLoginManager.registerLoginSuccessApi(vc: self!)
                 })
                 break

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/LoginNow/LoginNowView.swift

@@ -116,5 +116,6 @@ class LoginNowView: UIView {
     class func removeLoginNowView() {
         guard let loginNowView = LoginNowView.shared.loginNowView else { return }
         loginNowView.removeFromSuperview()
+        LoginNowView.shared.loginNowView = nil
     }
 }

+ 5 - 0
RainbowPlanet/RainbowPlanet/Router/RouterManager.swift

@@ -81,6 +81,11 @@ class RouterManager: NSObject {
             } else {
                 vc?.navigationController?.popToRootViewController(animated: false)
             }
+        case .activity?: //活动
+            Mediator.push(H5RouterModuleType.pushActivityId(id: "\(pushModel.actionId ?? 0)"))
+            break
+        case .product?: //商品
+            Mediator.push(H5RouterModuleType.pushDetail(id: "\(pushModel.actionId ?? 0)"))
             break
         case .none?:
             break

+ 1 - 2
RainbowPlanet/RainbowPlanet/Tools/Extension/Extension+UIAlertController.swift

@@ -77,7 +77,6 @@ extension UIAlertController {
         albumAction.setValue(kThemeColor, forKey: "titleTextColor")
         alert.addAction(albumAction)
 
-        let viewController = getCurrentVC()
-        viewController?.present(alert, animated: true)
+        UIViewController.topMost?.present(alert, animated: true)
     }
 }

+ 3 - 2
RainbowPlanet/RainbowPlanet/Tools/PhotoAndCameraManager/PhotoAndCameraManager.swift

@@ -7,6 +7,7 @@
 //
 
 import UIKit
+import SwiftyMediator
 
 class PhotoAndCameraManager: NSObject {
     private static let _sharedInstance = PhotoAndCameraManager()
@@ -42,7 +43,7 @@ class PhotoAndCameraManager: NSObject {
                         picker.automaticallyAdjustsScrollViewInsets = true
                     }
                 }
-                getCurrentVC()?.present(picker, animated: true, completion: nil)
+               UIViewController.topMost?.present(picker, animated: true, completion: nil)
             } else {
                 LBXPermissions.jumpToSystemPrivacySetting()
             }
@@ -67,7 +68,7 @@ class PhotoAndCameraManager: NSObject {
                         picker.automaticallyAdjustsScrollViewInsets = true
                     }
                 }
-                getCurrentVC()?.present(picker, animated: true, completion: nil)
+                UIViewController.topMost?.present(picker, animated: true, completion: nil)
             } else {
                 LBXPermissions.jumpToSystemPrivacySetting()
             }

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

@@ -489,7 +489,7 @@ extension UINavigationController: UINavigationBarDelegate
 //=============================================================================
 // MARK: - store navigationBar barTintColor and tintColor every viewController
 //=============================================================================
-extension UIViewController: WRAwakeProtocol
+@objc extension UIViewController: WRAwakeProtocol
 {
     fileprivate struct AssociatedKeys
     {

+ 38 - 2
RainbowPlanet/RainbowPlanet/ViewModel/UserMemberTotalBeanViewModel/UserMemberTotalBeanViewModel.swift

@@ -11,10 +11,20 @@ import RxSwift
 
 class UserMemberTotalBeanViewModel: NSObject {
     
+    deinit {
+        if observe != nil {
+            NotificationCenter.default.removeObserver(observe!)
+        }
+    }
+    weak var observe : NSObjectProtocol?
+    
     let disposeBag = DisposeBag()
     
     static let shared : UserMemberTotalBeanViewModel = UserMemberTotalBeanViewModel()
     
+    private var isBackstage : Bool? = true
+    
+    
     func userMemberGetTotalBeanApi() {
         if UserModel.shared().getModel()?.token != nil {
             SwiftMoyaNetWorkServiceUser.shared().userMemberGetTotalBeanApi(completion: { (totalBeanModel) -> (Void) in
@@ -24,8 +34,9 @@ class UserMemberTotalBeanViewModel: NSObject {
     }
     
     func userMemberGetTotalBeanApiInterval() {
-        Observable<Int>.interval(60, scheduler: MainScheduler.instance).subscribe(onNext: { _ in
-            if UserModel.shared().getModel()?.token != nil && (UserModel.shared().getModel()?.isFollowSuggestTopic != nil || UserModel.shared().getModel()?.isFollowSuggestTopic != 0) {
+        application()
+        Observable<Int>.interval(60, scheduler: MainScheduler.instance).subscribe(onNext: { [weak self] _ in
+            if UserModel.shared().getModel()?.token != nil && (UserModel.shared().getModel()?.isFollowSuggestTopic != nil || UserModel.shared().getModel()?.isFollowSuggestTopic != 0) && (self?.isBackstage)! {
                 SwiftMoyaNetWorkServiceUser.shared().userMemberGetTotalBeanApi(completion: { (totalBeanModel) -> (Void) in
                     NotificationCenter.default.post(name: NSNotification.Name(rawValue: "userMemberGetTotalBean"), object: totalBeanModel)
                     
@@ -34,4 +45,29 @@ class UserMemberTotalBeanViewModel: NSObject {
         }).disposed(by: disposeBag)
     }
     
+    func application() {
+        //启动程序
+        observe = NotificationCenter.default.addObserver(forName: UIApplication.didFinishLaunchingNotification, object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.isBackstage = true
+        })
+        //程序进入后台
+        observe = NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.isBackstage = false
+        })
+        //将要进入前台的时候
+        observe = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+           self?.isBackstage = true
+           self?.userMemberGetTotalBeanApi()
+        })
+    }
+    
+   
+    
+    
+    
+    
+    
 }