마케팅 정보를 업데이트를 앱을 실행할 때 한번만 실행하도록 수정
로그인/회원가입 시 마케팅 정보를 업데이트 하도록 수정
This commit is contained in:
		| @@ -12,6 +12,7 @@ class AppState: ObservableObject { | ||||
|      | ||||
|     private var appStepBackStack = [AppStep]() | ||||
|      | ||||
|     @Published var alreadyUpdatedMarketingInfo = false | ||||
|     @Published private(set) var appStep: AppStep = .splash | ||||
|      | ||||
|     @Published var isShowPlayer = false { | ||||
|   | ||||
| @@ -15,7 +15,7 @@ final class AppViewModel: ObservableObject { | ||||
|     private let userRepository = UserRepository() | ||||
|      | ||||
|     func fetchAndUpdateIdfa() { | ||||
|         DEBUG_LOG("fetchAndUpdateIdfa") | ||||
|         AppState.shared.alreadyUpdatedMarketingInfo = true | ||||
|         ATTrackingManager.requestTrackingAuthorization { [unowned self] status in | ||||
|             if status == .authorized { | ||||
|                 if !UserDefaults.string(forKey: UserDefaultsKey.token).trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { | ||||
|   | ||||
| @@ -25,10 +25,12 @@ struct SodaLiveApp: App { | ||||
|                 } | ||||
|                 .onReceive(NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)) { _ in | ||||
|                     UIApplication.shared.applicationIconBadgeNumber = 0 | ||||
|                      | ||||
|                     AppsFlyerLib.shared().start() | ||||
|                     viewModel.fetchAndUpdateIdfa() | ||||
|                     viewModel.getMemberInfo() | ||||
|                      | ||||
|                     if !AppState.shared.alreadyUpdatedMarketingInfo { | ||||
|                         viewModel.fetchAndUpdateIdfa() | ||||
|                         viewModel.getMemberInfo() | ||||
|                     } | ||||
|                 } | ||||
|                 .onOpenURL { url in | ||||
|                     DEBUG_LOG("I have received a URL through a custom scheme! \(url.absoluteString)") | ||||
|   | ||||
| @@ -10,6 +10,7 @@ import Moya | ||||
| import Combine | ||||
|  | ||||
| final class LoginViewModel: ObservableObject { | ||||
|     private let appViewModel = AppViewModel() | ||||
|     private let repository = UserRepository() | ||||
|     private var subscription = Set<AnyCancellable>() | ||||
|      | ||||
| @@ -55,6 +56,7 @@ final class LoginViewModel: ObservableObject { | ||||
|                         UserDefaults.set(data.userId, forKey: .userId) | ||||
|                         UserDefaults.set(data.email, forKey: .email) | ||||
|                         UserDefaults.set(data.token, forKey: .token) | ||||
|                         self.appViewModel.fetchAndUpdateIdfa() | ||||
|                         AppState.shared.isChangeAdultContentVisible = true | ||||
|                         AppState.shared.setAppStep(step: .splash) | ||||
|                     } else { | ||||
|   | ||||
| @@ -11,6 +11,7 @@ import Combine | ||||
| import Moya | ||||
|  | ||||
| final class SignUpViewModel: ObservableObject { | ||||
|     private let appViewModel = AppViewModel() | ||||
|     private let repository = UserRepository() | ||||
|     private var subscription = Set<AnyCancellable>() | ||||
|      | ||||
| @@ -58,6 +59,7 @@ final class SignUpViewModel: ObservableObject { | ||||
|                             UserDefaults.set(data.userId, forKey: .userId) | ||||
|                             UserDefaults.set(data.email, forKey: .email) | ||||
|                             UserDefaults.set(data.token, forKey: .token) | ||||
|                             self.appViewModel.fetchAndUpdateIdfa() | ||||
|                             AppState.shared.isChangeAdultContentVisible = true | ||||
|                             AppState.shared.setAppStep(step: .splash) | ||||
|                         } else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung