南鑫林 %!s(int64=5) %!d(string=hai) anos
pai
achega
cdf84230bf
Modificáronse 15 ficheiros con 207 adicións e 56 borrados
  1. 1 1
      RainbowPlanet/Podfile
  2. 9 1
      RainbowPlanet/Podfile.lock
  3. 34 34
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift
  4. 1 0
      RainbowPlanet/RainbowPlanet/Manager/AliyunVodManager/AliyunVodUpToyoPublishManager/AliyunVodupToyoPublishManager.swift
  5. 21 2
      RainbowPlanet/RainbowPlanet/Manager/RegisterLoginManager/RegisterLoginManager.swift
  6. 4 0
      RainbowPlanet/RainbowPlanet/Model/UserModel/MessageIndexModel.swift
  7. 5 0
      RainbowPlanet/RainbowPlanet/Model/UserModel/UserModel.swift
  8. 41 8
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/CommunityNavigationBarView.swift
  9. 11 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  10. 24 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift
  11. 13 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Planet/CommunityPlanet/CommunityPlanetViewController.swift
  12. 10 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift
  13. 12 0
      RainbowPlanet/RainbowPlanet/Modules/RedemptionAreaModule/RedemptionArea/ViewController/RedemptionAreaViewController.swift
  14. 11 0
      RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/LoginNow/LoginNowView.swift
  15. 10 10
      RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/RegisterLogin/ViewController/RegisterLoginViewController.swift

+ 1 - 1
RainbowPlanet/Podfile

@@ -71,7 +71,7 @@ target 'RainbowPlanet' do
   # 生成二维码
 #  pod 'EFQRCode'
   # 内存泄露
-#  pod 'MLeaksFinder'
+  pod 'MLeaksFinder'
 #  pod 'FBMemoryProfiler'
 
 

+ 9 - 1
RainbowPlanet/Podfile.lock

@@ -27,6 +27,7 @@ PODS:
   - DeviceKit (2.0.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)
@@ -45,6 +46,8 @@ PODS:
   - LYEmptyView (1.2.5)
   - MBProgressHUD (1.1.0)
   - MJRefresh (3.2.0)
+  - MLeaksFinder (1.0.0):
+    - FBRetainCycleDetector
   - Moya/Core (13.0.1):
     - Alamofire (~> 4.1)
     - Result (~> 4.1)
@@ -116,6 +119,7 @@ DEPENDENCIES:
   - LYEmptyView
   - MBProgressHUD
   - MJRefresh
+  - MLeaksFinder
   - Moya/RxSwift
   - ObjectMapper
   - PPBadgeViewSwift
@@ -153,6 +157,7 @@ SPEC REPOS:
     - DeviceKit
     - DPScrollNumberLabel
     - ESTabBarController-swift
+    - FBRetainCycleDetector
     - FMDB
     - FSPagerView
     - FWPopupView
@@ -166,6 +171,7 @@ SPEC REPOS:
     - LYEmptyView
     - MBProgressHUD
     - MJRefresh
+    - MLeaksFinder
     - Moya
     - ObjectMapper
     - PPBadgeViewSwift
@@ -200,6 +206,7 @@ SPEC CHECKSUMS:
   DeviceKit: 72d36709552d4b3582abd76a53949148acad9811
   DPScrollNumberLabel: 5124eaccf3029bb84116de391e1273cba676f4f5
   ESTabBarController-swift: 4fb52ad03d94d0717ef97bc9eb09a5abfdded0a2
+  FBRetainCycleDetector: 46f8179bbb1c587deee3ea838a1a3ee02acf5015
   FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
   FSPagerView: 816a18842306973cc7cc6df8a5332272f7815c30
   FWPopupView: c1dbb33fbe4d223f619f28a7e5e5a00f08c10342
@@ -213,6 +220,7 @@ SPEC CHECKSUMS:
   LYEmptyView: b17adfc2dd9ad2988ecaf7c9606efa916e24c767
   MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
   MJRefresh: ed450d6eb9d3346a2cb033ab7eb6de090aeef437
+  MLeaksFinder: 8c435bd2f6d070af18cff082b503b21adc130fc0
   Moya: f4a4b80ff2f8a4ffc208dfb31cd91636622fee6e
   ObjectMapper: 70187b8941977c62ccfb423caf6b50be405cabf0
   PPBadgeViewSwift: 18a219a9897f418342c22dd1a54f7b18ac56546b
@@ -234,6 +242,6 @@ SPEC CHECKSUMS:
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: 962e167b43307f3ec7a4be9628a9699982f01c22
+PODFILE CHECKSUM: 157702051212486747c9c4b46e9727f2888bace5
 
 COCOAPODS: 1.7.4

+ 34 - 34
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift

@@ -33,7 +33,7 @@ extension AppDelegate {
             /// 设置全局的TableView
             self?.setTableViewAppearance()
             /// 城市转换
-//            self?.setBaiduToCityFactory()
+            self?.setBaiduToCityFactory()
             /// 设置默认为快递
             let deliveryMethodTypeModel = DeliveryMethodTypeModel.shared()
             deliveryMethodTypeModel.deliveryMethodType = "2"
@@ -47,61 +47,61 @@ extension AppDelegate {
     
     /// 设置Tabbar
     func setTabbarController() {
-
-        setTabbarViewBarNil()
         /// 判断初始化页面
         if (UserModel.shared().getModel()?.token) != nil { //是否已经登录
             SwiftMoyaNetWorkServiceUser.shared().userRefreshApi {
                 [weak self] _ in
 
                 if(UserModel.shared().getModel()?.isFollowSuggestTopic == 0 || UserModel.shared().getModel()?.isFollowSuggestTopic == nil ) {//设置性别话题
-                    self?.setLoginOut()
+                    self?.setNoLoginOut()
                 }else {
                     self?.window?.rootViewController = BaseTabbarViewController.shared.tabBarViewController()
-                    //U米
-                    UserMemberTotalBeanViewModel.shared.userMemberGetTotalBeanApiInterval()
-                    //获取消息的小红点
-                    MessageModuleManager.shared.userMemberMessageIndexApi()
+                    self?.setData()
                 }
             }
         }else {// 进入首页
-            self.window?.rootViewController = BaseTabbarViewController.shared.tabBarViewController()
-            //添加登录view
-            LoginNowView.initLoginNowView()
+            setNoLoginOut()
         }
     }
     
-    func setTabbarViewBarNil() {
-        BaseTabbarViewController.shared.v1 = nil
-        BaseTabbarViewController.shared.v2 = nil
-        BaseTabbarViewController.shared.v3 = nil
-        BaseTabbarViewController.shared.v4 = nil
-        BaseTabbarViewController.shared.v5 = nil
-        BaseTabbarViewController.shared.lottieAnimateContentView1 = nil
-        BaseTabbarViewController.shared.lottieAnimateContentView2 = nil
-        BaseTabbarViewController.shared.lottieAnimateContentView4 = nil
-        BaseTabbarViewController.shared.lottieAnimateContentView5 = nil
-        BaseTabbarViewController.shared.esTabBarController = nil
-        KingfisherManager.shared.cache.clearMemoryCache()
-        KingfisherManager.shared.cache.clearDiskCache()
+    
+    /// 设置登录时用的数据
+    func setData() {
+        //U米
+        UserMemberTotalBeanViewModel.shared.userMemberGetTotalBeanApiInterval()
+        //获取消息的小红点
+        MessageModuleManager.shared.userMemberMessageIndexApi()
     }
     
-
-    /// 登录
-    func setLogin() {
-        Mediator.present(RegisterLoginRouterModuleType.presentRegisterLogin)
+    /// 未登录
+    func setNoLoginOut() {
+        // 移除本地用户信息
+        UserModel.shared().removeLoginModel()
+        // 移除快递信息
+        DeliveryMethodTypeModel.shared().removeLoginModel()
+        // 设置tabBar
+        self.window?.rootViewController = BaseTabbarViewController.shared.tabBarViewController()
+        //添加登录view
+        LoginNowView.initLoginNowView()
     }
     
     /// 退出登录
     func setLoginOut() {
-        //移除本地用户信息
+        // 移除本地用户信息
         UserModel.shared().removeLoginModel()
-        //移除快递信息
+        // 移除快递信息
         DeliveryMethodTypeModel.shared().removeLoginModel()
-        //置空
-        setTabbarViewBarNil()
-        //进入到首页
-        setTabbarController()
+        // 选择中index
+        BaseTabbarViewController.shared.setBadge()
+        //添加登录view
+        LoginNowView.initLoginNowView()
+        // 退出登录
+        NotificationCenter.default.post(name: NSNotification.Name("loginOut"), object: nil)
+    }
+    
+    /// 登录
+    func setLogin() {
+        Mediator.present(RegisterLoginRouterModuleType.presentRegisterLogin)
     }
 
      /// 设置全局的navigation

+ 1 - 0
RainbowPlanet/RainbowPlanet/Manager/AliyunVodManager/AliyunVodUpToyoPublishManager/AliyunVodupToyoPublishManager.swift

@@ -62,6 +62,7 @@ class AliyunVodUpToyoPublishManager: NSObject {
         self.isUploadingVideo = true
         self.curTimes = 0
         self.imagesProgressValue = 0.0
+        self.progressView?.curUploadStatus = nil
     }
 
 }

+ 21 - 2
RainbowPlanet/RainbowPlanet/Manager/RegisterLoginManager/RegisterLoginManager.swift

@@ -17,8 +17,27 @@ class RegisterLoginManager: NSObject {
         if UserModel.shared().getModel()?.isFollowSuggestTopic == 0 || UserModel.shared().getModel()?.isFollowSuggestTopic == nil  { //设置性别
             vc?.navigationController?.pushViewController(GenderSelectionViewController(), animated: true)
         }else {// 设置首页
-            vc?.navigationController?.dismiss(animated: false, completion: {})
-            kAppDelegate.setTabbarController()
+            if vc?.presentingViewController != nil {
+                if vc?.navigationController?.presentationController != nil {
+                        vc?.navigationController?.dismiss(animated: false, completion: {
+                            NotificationCenter.default.post(name: NSNotification.Name("login"), object: nil)
+                            LoginNowView.removeLoginNowView()
+                            kAppDelegate.setData()
+                        })
+                }else {
+                    vc?.dismiss(animated: false, completion: {
+                        NotificationCenter.default.post(name: NSNotification.Name("login"), object: nil)
+                        LoginNowView.removeLoginNowView()
+                        kAppDelegate.setData()
+                    })
+                }
+                
+            } else {
+                vc?.navigationController?.popToRootViewController(animated: false)
+                NotificationCenter.default.post(name: NSNotification.Name("login"), object: nil)
+                LoginNowView.removeLoginNowView()
+                kAppDelegate.setData()
+            }
         }
     }
 }

+ 4 - 0
RainbowPlanet/RainbowPlanet/Model/UserModel/MessageIndexModel.swift

@@ -44,6 +44,10 @@ class MessageIndexModel : NSObject, Mappable{
         let json = try? JSON(data: cacheModel?.data ?? Data())
         return MessageIndexModel(JSONString: json?.description ?? "")
     }
+    
+    func removeObject()  {
+        CacheManager.default.removeObjectCacheSync("MessageIndexModel")
+    }
 
 }
 

+ 5 - 0
RainbowPlanet/RainbowPlanet/Model/UserModel/UserModel.swift

@@ -4,6 +4,7 @@
 
 import Foundation 
 import ObjectMapper
+import Kingfisher
 
 
 public class UserModel : NSObject, NSCoding, Mappable{
@@ -167,6 +168,10 @@ public class UserModel : NSObject, NSCoding, Mappable{
         //移除友盟别名
         UMManager.shared.removeAlias()
         UserDefaults.standard.removeObject(forKey: "UserModel")
+        MessageIndexModel.shared.removeObject()
+        //清除缓存
+        KingfisherManager.shared.cache.clearMemoryCache()
+        KingfisherManager.shared.cache.clearDiskCache()
     }
     
     

+ 41 - 8
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/CommunityNavigationBarView.swift

@@ -25,6 +25,33 @@ class CommunityNavigationBarView: BaseView {
     var searchClosure:SearchClosure?
     var scrollNumberLabel : DPScrollNumberLabel?
     
+    func isTokenNil() {
+        UserMemberTotalBeanViewModel.shared.userMemberGetTotalBeanApi()
+        if UserModel.isTokenNil() {
+            self.scrollNumberLabel?.isHidden  = true
+            self.rightButton.snp.remakeConstraints { (make) in
+                make.centerY.equalToSuperview()
+                make.right.equalTo(-14)
+                make.size.equalTo(25)
+                
+            }
+            self.scrollNumberLabel?.isHidden  = true
+        }else {
+            self.scrollNumberLabel?.isHidden  = false
+            self.scrollNumberLabel!.snp_remakeConstraints {[weak self] (make) in
+                make.centerY.equalToSuperview()
+                make.size.equalTo((self?.scrollNumberLabel?.frame.size)!)
+                make.right.equalToSuperview().offset(-14)
+            }
+            self.rightButton.snp.remakeConstraints {[weak self] (make) in
+                make.centerY.equalToSuperview()
+                make.right.equalTo((self?.scrollNumberLabel?.snp_left)!).offset(-2)
+                make.size.equalTo(25)
+                
+            }
+        }
+    }
+    
     override func setupViews() {
         scrollNumberLabel = DPScrollNumberLabel.init(number: 0, fontSize: 16, textColor: kFFA42FColor, signSetting: SignSetting.unsigned)
         scrollNumberLabel?.addTapGesture(1, target: self, action: #selector(skittles))
@@ -34,20 +61,31 @@ class CommunityNavigationBarView: BaseView {
         addSubview(searchBgView)
         searchBgView.addSubview(searchIconImageView)
         searchBgView.addSubview(searchTextField)
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("login"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.isTokenNil()
+        })
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("loginOut"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.isTokenNil()
+        })
+        
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("userMemberGetTotalBean"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
             let totalBeanModel = notification.object as? TotalBeanModel
+            
 //            self?.rightButton.play()
             self?.scrollNumberLabel!.change(to: NSNumber(value: totalBeanModel?.todayBean ?? 0) , animated: true)
             
             if totalBeanModel?.todayBean == 0 {
                 self?.scrollNumberLabel?.isHidden  = true
-                self?.rightButton.snp.makeConstraints { (make) in
+                self?.rightButton.snp.remakeConstraints { (make) in
                     make.centerY.equalToSuperview()
                     make.right.equalTo(-14)
                     make.size.equalTo(25)
-
                 }
             }else {
+                self?.scrollNumberLabel?.isHidden  = false
                 self?.scrollNumberLabel!.snp_remakeConstraints { (make) in
                     make.centerY.equalToSuperview()
                     make.size.equalTo((self?.scrollNumberLabel!.frame.size)!)
@@ -61,12 +99,7 @@ class CommunityNavigationBarView: BaseView {
                 }
             }
         }
-        UserMemberTotalBeanViewModel.shared.userMemberGetTotalBeanApi()
-        if UserModel.isTokenNil() {
-            scrollNumberLabel?.isHidden  = true
-        }else {
-            scrollNumberLabel?.isHidden  = false
-        }
+        isTokenNil()
     }
     
     override func setupLayouts() {

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

@@ -39,6 +39,7 @@ class CommunityFollowViewController: BaseViewController {
     }
     
     override func setupViews() {
+        navigationBar.isHidden = true
         view.backgroundColor = kf7f8faColor
         view.addSubview(tableView)
     }
@@ -80,6 +81,16 @@ class CommunityFollowViewController: BaseViewController {
             self?.communityFollowFeedApi(page: page)
         })
         
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("login"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.tableView.mj_header.beginRefreshing()
+        })
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("loginOut"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.tableView.mj_header.beginRefreshing()
+        })
+        
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("followApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
             let followStatusModel = notification.object as? FollowStatusModel
             

+ 24 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift

@@ -36,6 +36,17 @@ class CommunityViewController: BaseViewController {
         }
     }
     weak var observe : NSObjectProtocol?
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+        self.view.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight-kTabBarTotalHeight)
+        self.view.layoutIfNeeded()
+    }
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+        self.view.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight-kTabBarTotalHeight)
+        self.view.layoutIfNeeded()
+    }
+
     
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -108,6 +119,19 @@ class CommunityViewController: BaseViewController {
             }
         }
         
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("login"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.tabBarController?.selectedIndex = 0
+            self?.reloadSegmentedView()
+        })
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("loginOut"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.tabBarController?.selectedIndex = 0
+            self?.reloadSegmentedView()
+            
+        })
+        
         // 找朋友 查看全部推荐关注
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityFindFriends"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
             let vc = CommunityFindFriendsViewController()

+ 13 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Planet/CommunityPlanet/CommunityPlanetViewController.swift

@@ -26,6 +26,7 @@ class CommunityPlanetViewController: BaseJSWebViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         self.URLString = kH5PlanetUrl
+        navigationBar.isHidden = true
         setupViews()
         setupData()
         
@@ -54,6 +55,18 @@ class CommunityPlanetViewController: BaseJSWebViewController {
                 WebViewJavascriptBridgeManager.shared.callHandlerH5(bridge: self?.bridge)
             }
         }
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("login"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            WebViewJavascriptBridgeManager.shared.callHandlerH5(bridge: self?.bridge)
+
+        })
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("loginOut"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            WebViewJavascriptBridgeManager.shared.callHandlerH5(bridge: self?.bridge)
+
+        })
 
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityModulePlanetTop"), object: nil, queue: OperationQueue.main, using: {
             [weak self] (notification) in

+ 10 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift

@@ -56,6 +56,16 @@ class CommunityRecommnendViewController: UIViewController {
             [weak self] (page) in
             self?.communityPostSuggestApi(page:page)
         })
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("login"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.tableView.mj_header.beginRefreshing()
+        })
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("loginOut"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.tableView.mj_header.beginRefreshing()
+        })
 
         
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("followApi"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in

+ 12 - 0
RainbowPlanet/RainbowPlanet/Modules/RedemptionAreaModule/RedemptionArea/ViewController/RedemptionAreaViewController.swift

@@ -50,6 +50,8 @@ class RedemptionAreaViewController: BaseViewController {
         return tableView
     }()
     
+    
+    
     override func setupData() {
         tableView.addHeader(withBeginRefresh: true, animation: true) {
             [weak self] (page) in
@@ -68,6 +70,16 @@ class RedemptionAreaViewController: BaseViewController {
             }
         })
         
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("login"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.tableView.mj_header.beginRefreshing()
+        })
+        
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("loginOut"), object: nil, queue: OperationQueue.main, using: {
+            [weak self] (notification) in
+            self?.tableView.mj_header.beginRefreshing()
+        })
+        
     }
     
 }

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

@@ -11,6 +11,8 @@ import ESTabBarController_swift
 
 class LoginNowView: UIView {
     
+    static let shared : LoginNowView = LoginNowView()
+    
     deinit {
         NXLLog("deinit")
     }
@@ -101,9 +103,18 @@ class LoginNowView: UIView {
         return loginNowButton
     }()
     
+    var loginNowView : LoginNowView?
+    
     class func initLoginNowView() {
         let loginNowView = LoginNowView(frame:CGRect(x: 0, y: -50, width: kScreenWidth, height: 50))
         let tabbar = BaseTabbarViewController.shared.esTabBarController.tabBar as? ESTabBar
         tabbar?.addSubview(loginNowView)
+        LoginNowView.shared.loginNowView = loginNowView
+    }
+    
+    
+    class func removeLoginNowView() {
+        guard let loginNowView = LoginNowView.shared.loginNowView else { return }
+        loginNowView.removeFromSuperview()
     }
 }

+ 10 - 10
RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/RegisterLogin/ViewController/RegisterLoginViewController.swift

@@ -176,10 +176,10 @@ class RegisterLoginViewController: BaseViewController {
         let videoURL = URL(fileURLWithPath: filePath!)
         //定义一个playerItem,并监听相关的通知
         let playerItem = AVPlayerItem(url: videoURL)
-//        NotificationCenter.default.addObserver(self,
-//                                               selector: #selector(playerDidFinishPlaying),
-//                                               name: NSNotification.Name.AVPlayerItemDidPlayToEndTime,
-//                                               object: playerItem)
+        NotificationCenter.default.addObserver(self,
+                                               selector: #selector(playerDidFinishPlaying),
+                                               name: NSNotification.Name.AVPlayerItemDidPlayToEndTime,
+                                               object: playerItem)
         let player = AVPlayer(playerItem: playerItem)
         //设置大小和位置(全屏)
         let playerLayer = AVPlayerLayer(player: player)
@@ -190,12 +190,12 @@ class RegisterLoginViewController: BaseViewController {
         return player
     }()
     
-//    @objc func playerDidFinishPlaying(notification:Notification) {
-//
-//        player.seek(to: .zero, toleranceBefore: .zero, toleranceAfter: .zero) {[weak self] (finished) in
-//            self?.player.play()
-//        }
-//    }
+    @objc func playerDidFinishPlaying(notification:Notification) {
+
+        player.seek(to: .zero, toleranceBefore: .zero, toleranceAfter: .zero) {[weak self] (finished) in
+            self?.player.play()
+        }
+    }
     
     //第三方登录
     func tripartiteLogin(platformType:UMSocialPlatformType,loginType:LoginType) {