Explorar o código

h5添加新参数

南鑫林 %!s(int64=5) %!d(string=hai) anos
pai
achega
1f215a4ebe
Modificáronse 19 ficheiros con 127 adicións e 19 borrados
  1. 1 0
      RainbowPlanet/Podfile
  2. 10 1
      RainbowPlanet/Podfile.lock
  3. 20 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  4. 2 0
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift
  5. 1 0
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate.swift
  6. 3 3
      RainbowPlanet/RainbowPlanet/Macro/Common.swift
  7. 3 2
      RainbowPlanet/RainbowPlanet/Manager/WebViewJavascriptBridgeManager/WebViewJavascriptBridgeManager.swift
  8. 2 2
      RainbowPlanet/RainbowPlanet/Model/WVJBModel/WVJBModel.swift
  9. 1 3
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoCollectionViewCell.swift
  10. 5 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Planet/CommunityPlanet/CommunityPlanetViewController.swift
  11. 7 1
      RainbowPlanet/RainbowPlanet/Modules/H5Modules/H5Common/ViewController/H5CommonViewController.swift
  12. 1 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MediaConfig/AliyunMediaConfig.h
  13. 4 2
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MediaConfig/AliyunMediaConfig.m
  14. 1 1
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoRecord/Controller/AliyunMagicCameraViewController.m
  15. 3 2
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/Unused/PublishTakeVideo/PublishVideoRecorderController.swift
  16. 1 1
      RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/TopicSelection/View/TopicSelectionCollectionViewCell.swift
  17. 27 0
      RainbowPlanet/RainbowPlanet/Tools/MemoryManager/MemoryManager.swift
  18. 18 0
      RainbowPlanet/RainbowPlanet/Tools/MemoryManager/MemoryManagerCacheCleanerPlugin.swift
  19. 17 0
      RainbowPlanet/RainbowPlanet/Tools/MemoryManager/MemoryManagerRetainCycleLoggerPlugin.swift

+ 1 - 0
RainbowPlanet/Podfile

@@ -65,6 +65,7 @@ target 'RainbowPlanet' do
   pod 'ESTabBarController-swift'
   # 内存泄露
   pod 'MLeaksFinder'
+  pod 'FBMemoryProfiler'
 
 
 #======================第三方平台===========

+ 10 - 1
RainbowPlanet/Podfile.lock

@@ -28,6 +28,10 @@ PODS:
   - EFQRCode (5.0.0):
     - swift_qrcodejs (~> 1.1.1)
   - ESTabBarController-swift (2.7)
+  - FBAllocationTracker (0.1.5)
+  - FBMemoryProfiler (0.1.3):
+    - FBAllocationTracker (~> 0.1)
+    - FBRetainCycleDetector (~> 0.1)
   - FBRetainCycleDetector (0.1.4)
   - FlickerNumber (1.1)
   - FMDB (2.7.5):
@@ -110,6 +114,7 @@ DEPENDENCIES:
   - DPScrollNumberLabel
   - EFQRCode
   - ESTabBarController-swift
+  - FBMemoryProfiler
   - FlickerNumber
   - FMDB
   - FSPagerView
@@ -163,6 +168,8 @@ SPEC REPOS:
     - DPScrollNumberLabel
     - EFQRCode
     - ESTabBarController-swift
+    - FBAllocationTracker
+    - FBMemoryProfiler
     - FBRetainCycleDetector
     - FlickerNumber
     - FMDB
@@ -215,6 +222,8 @@ SPEC CHECKSUMS:
   DPScrollNumberLabel: 5124eaccf3029bb84116de391e1273cba676f4f5
   EFQRCode: 07437cfbce3a1e497397a4f3d766c980d8972608
   ESTabBarController-swift: 4fb52ad03d94d0717ef97bc9eb09a5abfdded0a2
+  FBAllocationTracker: dfdca3f71aceca6a85e95e3c6ec76a9785eba0f1
+  FBMemoryProfiler: 623fc5f8a61f7d02ec75c87e3b97c90f621d8b02
   FBRetainCycleDetector: 46f8179bbb1c587deee3ea838a1a3ee02acf5015
   FlickerNumber: bce41da51904d533393d69e9734df6281ab1c646
   FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
@@ -254,6 +263,6 @@ SPEC CHECKSUMS:
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: ed6220d45b5ce5b4b43a51e5b290058ffc8f7511
+PODFILE CHECKSUM: df2e02ff5d93584b4d9c77c567dc6fc7b6a58532
 
 COCOAPODS: 1.7.4

+ 20 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -439,6 +439,9 @@
 		A7E19FAE22BA2D16009BCCE1 /* SearchContentListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E19FAD22BA2D16009BCCE1 /* SearchContentListViewController.swift */; };
 		A7E19FB122BA3A0D009BCCE1 /* SearchTopicListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E19FB022BA3A0D009BCCE1 /* SearchTopicListTableViewCell.swift */; };
 		A7EE6E102305487700628D39 /* ThumbnailsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7EE6E0F2305487600628D39 /* ThumbnailsManager.swift */; };
+		A7EE6E1223055A5A00628D39 /* MemoryManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7EE6E1123055A5A00628D39 /* MemoryManager.swift */; };
+		A7EE6E1523055A8900628D39 /* MemoryManagerCacheCleanerPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7EE6E1423055A8900628D39 /* MemoryManagerCacheCleanerPlugin.swift */; };
+		A7EE6E1723055B1900628D39 /* MemoryManagerRetainCycleLoggerPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7EE6E1623055B1900628D39 /* MemoryManagerRetainCycleLoggerPlugin.swift */; };
 		A7EF3E0C23013EDE001E4D26 /* CommunityImageAuthModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7EF3E0B23013EDE001E4D26 /* CommunityImageAuthModel.swift */; };
 		A7EF3E0E2302D031001E4D26 /* CommunityVideoBottomActionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7EF3E0D2302D031001E4D26 /* CommunityVideoBottomActionView.swift */; };
 		A7EF3E102303DAEE001E4D26 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A7EF3E0F2303DAEE001E4D26 /* Launch Screen.storyboard */; };
@@ -1170,6 +1173,9 @@
 		A7E19FAD22BA2D16009BCCE1 /* SearchContentListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchContentListViewController.swift; sourceTree = "<group>"; };
 		A7E19FB022BA3A0D009BCCE1 /* SearchTopicListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchTopicListTableViewCell.swift; sourceTree = "<group>"; };
 		A7EE6E0F2305487600628D39 /* ThumbnailsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThumbnailsManager.swift; sourceTree = "<group>"; };
+		A7EE6E1123055A5A00628D39 /* MemoryManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryManager.swift; sourceTree = "<group>"; };
+		A7EE6E1423055A8900628D39 /* MemoryManagerCacheCleanerPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryManagerCacheCleanerPlugin.swift; sourceTree = "<group>"; };
+		A7EE6E1623055B1900628D39 /* MemoryManagerRetainCycleLoggerPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryManagerRetainCycleLoggerPlugin.swift; sourceTree = "<group>"; };
 		A7EF3E0B23013EDE001E4D26 /* CommunityImageAuthModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityImageAuthModel.swift; sourceTree = "<group>"; };
 		A7EF3E0D2302D031001E4D26 /* CommunityVideoBottomActionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityVideoBottomActionView.swift; sourceTree = "<group>"; };
 		A7EF3E0F2303DAEE001E4D26 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
@@ -3375,6 +3381,7 @@
 		A77F2CBC2232022A001BD3F6 /* Tools */ = {
 			isa = PBXGroup;
 			children = (
+				A7EE6E1323055A6000628D39 /* MemoryManager */,
 				A7EF3E112303EB6C001E4D26 /* GuidePageView */,
 				A76068F122E4B0ED008DF18F /* UImage+Gif */,
 				BD5CA89322DDA27000364A67 /* CustomSlider */,
@@ -4489,6 +4496,16 @@
 			path = ThumbnailsManager;
 			sourceTree = "<group>";
 		};
+		A7EE6E1323055A6000628D39 /* MemoryManager */ = {
+			isa = PBXGroup;
+			children = (
+				A7EE6E1123055A5A00628D39 /* MemoryManager.swift */,
+				A7EE6E1423055A8900628D39 /* MemoryManagerCacheCleanerPlugin.swift */,
+				A7EE6E1623055B1900628D39 /* MemoryManagerRetainCycleLoggerPlugin.swift */,
+			);
+			path = MemoryManager;
+			sourceTree = "<group>";
+		};
 		A7EF3E112303EB6C001E4D26 /* GuidePageView */ = {
 			isa = PBXGroup;
 			children = (
@@ -6230,6 +6247,7 @@
 				BDE376E522C22D2B0055E2EA /* AlivcImage.m in Sources */,
 				A71CAB3722C9A40A00D908A8 /* TotalBeanModel.swift in Sources */,
 				A743229B22B8C1510017C367 /* AppStoreManager.swift in Sources */,
+				A7EE6E1223055A5A00628D39 /* MemoryManager.swift in Sources */,
 				BD61225422C355C800D3F513 /* AliyunMagicCameraViewController.m in Sources */,
 				BDAF83A222B330540004BCC3 /* RecommendSimilarCell.swift in Sources */,
 				BDAA40FD228E9CD600CF841D /* OrderApplyRefundPhoneCell.swift in Sources */,
@@ -6411,6 +6429,7 @@
 				A7778CA92244904500C7C47A /* Extension+Gifu.GIFImageView.swift in Sources */,
 				A71738AB22898660000AEA6A /* ShopModel.swift in Sources */,
 				A7FF1557228AC3E800A85748 /* ProductAllCommentViewController.swift in Sources */,
+				A7EE6E1523055A8900628D39 /* MemoryManagerCacheCleanerPlugin.swift in Sources */,
 				A7A98E02227E8900005306E9 /* ProductSearchListModel.swift in Sources */,
 				A7A98E17227EED76005306E9 /* SpecialViewController.swift in Sources */,
 				A763BE6C22F173A0000CE594 /* LoginNowView.swift in Sources */,
@@ -6522,6 +6541,7 @@
 				A71AF0AA226EDDF5001730FE /* SearchView.swift in Sources */,
 				A7FF1583228C843700A85748 /* OrderDetailExpressSelfMentionTableViewCell.swift in Sources */,
 				A7A98E0E227EC0C6005306E9 /* CategoryTableViewCell.swift in Sources */,
+				A7EE6E1723055B1900628D39 /* MemoryManagerRetainCycleLoggerPlugin.swift in Sources */,
 				BD61227522C35A9500D3F513 /* AliyunIConfig.m in Sources */,
 				A770E5E922D383E500CBD0A4 /* CommunityCustomCommnetModel.swift in Sources */,
 				A7D07CC722B774D600186014 /* RainbowBeanPhysicalView.swift in Sources */,

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

@@ -9,6 +9,7 @@
 import UIKit
 import SwiftyMediator
 
+
 extension AppDelegate {
 
     func initWindow(didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
@@ -18,6 +19,7 @@ extension AppDelegate {
         vc.view.backgroundColor = UIColor.clear
         window?.rootViewController = vc
         window?.makeKeyAndVisible()
+//        MemoryManager.shared.initMemoryManager()
         DispatchQueue.global(qos: .default).async {
             [weak self] in
             /// 设置全局的tabbar

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

@@ -16,6 +16,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         //初始化窗口
         initWindow(didFinishLaunchingWithOptions: launchOptions)
+        
         return true
     }
 }

+ 3 - 3
RainbowPlanet/RainbowPlanet/Macro/Common.swift

@@ -320,18 +320,18 @@ func getImageHeight(imgStr:String) -> CGFloat {
 /// - 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*2)),h_\(Int(height*2))"
+        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*2)),h_\(Int(height*2))"
+            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 * 2 * kScaleWidth)),h_\(Int(280 * 2 * kScaleWidth))"
+            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)
         }

+ 3 - 2
RainbowPlanet/RainbowPlanet/Manager/WebViewJavascriptBridgeManager/WebViewJavascriptBridgeManager.swift

@@ -29,10 +29,11 @@ class WebViewJavascriptBridgeManager: NSObject {
     /// - Parameters:
     ///   - bridge: 交互对象
     ///   - force: 是否强制
-    func callHandlerH5Refresh(bridge: WebViewJavascriptBridge?,refreshModelType:WVJBRefreshModelType?) {
+    func callHandlerH5Refresh(bridge: WebViewJavascriptBridge?,refreshModelType:WVJBRefreshModelType?,silent:Int? = 0) {
         //获取当前时间
         let refreshModel = WVJBRefreshModel()
         refreshModel.type = refreshModelType?.rawValue
+        refreshModel.silent = silent
         var refreshDic = Dictionary<String,Any>()
         refreshDic.updateValue("refresh", forKey: "type")
         refreshDic.updateValue(refreshModel.toJSON() as Any, forKey: "params")
@@ -56,7 +57,7 @@ class WebViewJavascriptBridgeManager: NSObject {
         })
     }
     
-    func jump(wvjbModel:WVJBModel?,viewController:UIViewController? = nil) {
+    func jump(wvjbModel:WVJBModel?,viewController:BaseJSWebBaseViewController? = nil) {
         // 链接
         if wvjbModel?.modelType == .link {
             Mediator.push(H5RouterModuleType.pushWeb(URLString: wvjbModel!.params!.url!))

+ 2 - 2
RainbowPlanet/RainbowPlanet/Model/WVJBModel/WVJBModel.swift

@@ -170,7 +170,7 @@ enum WVJBRefreshModelType : String {
 
 class WVJBRefreshModel: NSObject, Mappable{
     
-    var force : Bool?
+    var silent : Int?
     var type : String?
     
     
@@ -182,7 +182,7 @@ class WVJBRefreshModel: NSObject, Mappable{
     
     func mapping(map: Map)
     {
-        force <- map["force"]
+        silent <- map["silent"]
         type <- map["type"]
     }
     

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

@@ -67,9 +67,7 @@ class CardContentPicVideoCollectionViewCell: UICollectionViewCell {
     
     var imgStr: String? {
         didSet {
-            iconImageView.kf.setImage(with: kURLImage(name: imgStr ?? ""), placeholder: kImage(name: "default_pic"))
-            KingfisherManager.shared.cache.clearDiskCache()
-            KingfisherManager.shared.cache.clearMemoryCache()
+            iconImageView.kf.setImage(with: kURLImage(name: imgStr ?? ""), placeholder: kImage(name: "default_pic"),options:[.fromMemoryCacheOrRefresh])
         }
     }
     

+ 5 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Planet/CommunityPlanet/CommunityPlanetViewController.swift

@@ -57,7 +57,11 @@ class CommunityPlanetViewController: BaseJSWebViewController {
 
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityModulePlanetTop"), object: nil, queue: OperationQueue.main, using: {
             [weak self] (notification) in
-            WebViewJavascriptBridgeManager.shared.callHandlerH5Refresh(bridge: self?.bridge, refreshModelType: .planet)
+            var silent = notification.object as? Int
+            if silent == nil {
+                silent = 0
+            }
+            WebViewJavascriptBridgeManager.shared.callHandlerH5Refresh(bridge: self?.bridge, refreshModelType: .planet,silent:silent)
         })
         
     }

+ 7 - 1
RainbowPlanet/RainbowPlanet/Modules/H5Modules/H5Common/ViewController/H5CommonViewController.swift

@@ -51,12 +51,18 @@ class H5CommonViewController: BaseJSWebBaseViewController {
             let refreshModelType = notification.object as? WVJBRefreshModelType
             WebViewJavascriptBridgeManager.shared.callHandlerH5Refresh(bridge: self?.bridge, refreshModelType: refreshModelType)
         })
-        
+
         WebViewJavascriptBridgeManager.shared.registerHandlerApp(bridge: bridge) {
            [weak self] (wvjbModel) in
             WebViewJavascriptBridgeManager.shared.jump(wvjbModel: wvjbModel,viewController: self)
         }
         
+        navigationBar.onClickLeftButton = {
+            [weak self] in
+            NotificationCenter.default.post(name: NSNotification.Name("CommunityModulePlanetTop"), object: 1)
+            self?.navigationController?.popViewController(animated: true)
+        }
+        
     }
     
 }

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MediaConfig/AliyunMediaConfig.h

@@ -192,6 +192,7 @@ typedef NS_ENUM(NSInteger, kPhotoMediaType) {
  */
 @property (nonatomic, assign) BOOL hasEnd;
 
+@property(nonatomic, assign) int beautifyValue;
 
 /**
  获取一个裁剪配置信息类

+ 4 - 2
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoCommonFile/Tools/MediaConfig/AliyunMediaConfig.m

@@ -56,7 +56,8 @@
     config.videoQuality = AliyunMediaQualityHight;
     config.gop = 5;
     config.fps = 25;
-    config.bitrate = 1000000;
+    config.bitrate = 2000000;
+    config.beautifyValue = 50;
     return config;
 }
 
@@ -65,8 +66,9 @@
     if (self) {
         _fps = 25;
         _gop = 5;
-        _bitrate = 1000000;
+        _bitrate = 2000000;
         _videoQuality = AliyunMediaQualityHight;
+        _beautifyValue = 50;
         _backgroundColor = [UIColor blackColor];
     }
     return self;

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

@@ -197,7 +197,7 @@
     _recorder.outputPath = _quVideo.outputPath?_quVideo.outputPath:videoSavePath;
     _recorder.taskPath = taskPath;
     _recorder.beautifyStatus = YES;
-    _recorder.beautifyValue = 100;
+    _recorder.beautifyValue = _quVideo.beautifyValue;
     
     _recorder.bitrate = _quVideo.bitrate;
     

+ 3 - 2
RainbowPlanet/RainbowPlanet/Modules/PublishModule/Unused/PublishTakeVideo/PublishVideoRecorderController.swift

@@ -148,7 +148,7 @@ class PublishVideoRecorderController: BaseViewController {
         //视频存储路径
         let videoSavePath: String = taskPath.appending(AliyunPathManager.randomString()).appending(".mp4")
         
-        let recorder = AliyunIRecorder.init(delegate: self, videoSize: CGSize(width: 720, height: 1280))
+        let recorder = AliyunIRecorder.init(delegate: self, videoSize: CGSize(width: 540, height: 960))
         
         // 预览视图,必须设置
         recorder?.preview = videoCameraView.previewView
@@ -172,7 +172,8 @@ class PublishVideoRecorderController: BaseViewController {
         recorder?.beautifyStatus = true;
         
         // 设置美颜度 [0,100]
-        recorder?.beautifyValue = 0;
+        recorder?.beautifyValue = 50
+       
         
         // 后置摄像头采集分辨率 默认:AVCaptureSessionPreset640x480
         recorder?.backCaptureSessionPreset = AVCaptureSession.Preset.hd1280x720.rawValue

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/TopicSelection/View/TopicSelectionCollectionViewCell.swift

@@ -86,7 +86,7 @@ class TopicSelectionCollectionViewCell: UICollectionViewCell {
     
     var communityTopicModel: CommunityTopicModel? {
         didSet {
-            iconImageView.kf.setImage(with: kURLImage(name: communityTopicModel?.img ?? ""), placeholder: kImage(name: "default_pic"))
+            iconImageView.kf.setImage(with: kURLImage(name: communityTopicModel?.img ?? ""), placeholder: kImage(name: "default_pic"),options:[.fromMemoryCacheOrRefresh])
             titleLabel.text = communityTopicModel?.name
             selectionButton.isSelected = communityTopicModel?.isSelected ?? false
         }

+ 27 - 0
RainbowPlanet/RainbowPlanet/Tools/MemoryManager/MemoryManager.swift

@@ -0,0 +1,27 @@
+//
+//  MemoryManager.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/8/15.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+import FBAllocationTracker
+import FBMemoryProfiler
+import FBRetainCycleDetector
+
+class MemoryManager : NSObject {
+    static let shared : MemoryManager = MemoryManager()
+    
+    var memoryProfiler : FBMemoryProfiler?
+    
+    func initMemoryManager() {
+        FBAssociationManager.hook()
+        FBAllocationTrackerManager.shared()?.startTrackingAllocations()
+        FBAllocationTrackerManager.shared()?.enableGenerations()
+        let memoryProfiler = FBMemoryProfiler(plugins: [MemoryManagerCacheCleanerPlugin(),MemoryManagerRetainCycleLoggerPlugin()], retainCycleDetectorConfiguration: nil)
+        memoryProfiler.enable()
+        self.memoryProfiler = memoryProfiler
+    }
+}

+ 18 - 0
RainbowPlanet/RainbowPlanet/Tools/MemoryManager/MemoryManagerCacheCleanerPlugin.swift

@@ -0,0 +1,18 @@
+
+//
+//  MemoryManagerCacheCleanerPlugin.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/8/15.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import FBMemoryProfiler
+
+class MemoryManagerCacheCleanerPlugin: NSObject {}
+extension MemoryManagerCacheCleanerPlugin: FBMemoryProfilerPluggable {
+    func memoryProfilerDidMarkNewGeneration() {
+        URLCache.shared.removeAllCachedResponses()
+    }
+}

+ 17 - 0
RainbowPlanet/RainbowPlanet/Tools/MemoryManager/MemoryManagerRetainCycleLoggerPlugin.swift

@@ -0,0 +1,17 @@
+//
+//  MemoryManagerRetainCycleLoggerPlugin.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/8/15.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import FBMemoryProfiler
+
+class MemoryManagerRetainCycleLoggerPlugin: NSObject {}
+extension MemoryManagerRetainCycleLoggerPlugin :FBMemoryProfilerPluggable {
+    func memoryProfilerDidFindRetainCycles(_ retainCycles: Set<AnyHashable>) {
+        NXLLog(retainCycles)
+    }
+}