From 09a372bc45fde16fd42257ab6f78b8deeecf720b Mon Sep 17 00:00:00 2001
From: 杨锴 <841720330@qq.com>
Date: 星期三, 16 四月 2025 16:38:05 +0800
Subject: [PATCH] fix bug

---
 XQMuse/Root/Home/HomeVC.swift |   57 ++++++++++++++++++++++++++++-----------------------------
 1 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/XQMuse/Root/Home/HomeVC.swift b/XQMuse/Root/Home/HomeVC.swift
index c9d1add..afabaac 100644
--- a/XQMuse/Root/Home/HomeVC.swift
+++ b/XQMuse/Root/Home/HomeVC.swift
@@ -54,6 +54,7 @@
                     viewModel?.userFirstOpenTreeTask = true
                     UserDefaultSettingViewModel.saveSetting(viewModel!)
                     self?.navigationController?.tabBarController?.selectedIndex = 2
+                    self?.toPlanGuide()
                 }
             }).disposed(by: disposeBag)
 
@@ -71,7 +72,6 @@
 
         if AudioPlayer.getSharedInstance().bgmPlayer != nil && PayMusicVC.getCurrentStatus() != .pause{
             AudioPlayer.getSharedInstance().bgmPlayer?.play()
-//            AudioPlayer.getSharedInstance().masterPlayer?.play()
             return
         }
 
@@ -113,30 +113,7 @@
 
             switch state{
                 case .notRestricted:
-                    if UserDefaultSettingViewModel.getSetting()?.userFirstLaunch ?? true{
-                        DispatchQueue.main.async {[weak self] in
-                            guard let weakSelf = self else { return }
-                            let vc = LoginTreatyVC()
-                            vc.topIndex = 0
-                            vc.clickHandle { state in
-                                if !state{
-                                    exit(0)
-                                }else{
-                                    if var m = UserDefaultSettingViewModel.getSetting(){
-                                        m.userFirstLaunch = false
-                                        UserDefaultSettingViewModel.saveSetting(m)
-                                    }
-                                    //跳转计划引导
-                                    let nav  = BaseNav(rootViewController: PlanGuideVC(isFromFist: true))
-                                    nav.modalPresentationStyle = .fullScreen
-                                    weakSelf.present(nav, animated: true)
-                                }
-                            }
-                            vc.modalPresentationStyle = .custom
-                            weakSelf.present(vc, animated: true)
-                        }
-                    }
-
+                    self?.toPlanGuide()
                     DispatchQueue.main.async {
                         self?.getBGMData()
                         self?.tableView.mj_header?.beginRefreshing()
@@ -389,6 +366,32 @@
         }
     }
 
+    private func toPlanGuide(){
+        if UserDefaultSettingViewModel.getSetting()?.userFirstLaunch ?? true{
+            DispatchQueue.main.async {[weak self] in
+                guard let weakSelf = self else { return }
+                let vc = LoginTreatyVC()
+                vc.topIndex = 0
+                vc.clickHandle { state in
+                    if !state{
+                        exit(0)
+                    }else{
+                        if var m = UserDefaultSettingViewModel.getSetting(){
+                            m.userFirstLaunch = false
+                            UserDefaultSettingViewModel.saveSetting(m)
+                        }
+                        //跳转计划引导
+                        let nav  = BaseNav(rootViewController: PlanGuideVC(isFromFist: true))
+                        nav.modalPresentationStyle = .fullScreen
+                        weakSelf.present(nav, animated: true)
+                    }
+                }
+                vc.modalPresentationStyle = .custom
+                weakSelf.present(vc, animated: true)
+            }
+        }
+    }
+
     private func updateBGMData(userDefaultSettingModel:UserDefaultSettingModel){
         if AudioPlayer.getSharedInstance().bgmPlayer != nil && PayMusicVC.getCurrentStatus() != .pause{
             AudioPlayer.getSharedInstance().bgmPlayer?.play()
@@ -416,10 +419,6 @@
                 }else{
                     self.titleItems[0] = TitleItem(title: "每日疗愈", subTitle: "Daily Meditation")
                 }
-
-
-//                self.tableView.reloadRows(at: [IndexPath(row: 0, section: 0)], with: .none)
-//                self.tableView.reloadRows(at: [IndexPath(row: 1, section: 0)], with: .none)
                 self.tableView.reloadData()
             }).disposed(by: disposeBag)
         }

--
Gitblit v1.7.1