마케팅 정보를 업데이트를 앱을 실행할 때 한번만 실행하도록 수정

로그인/회원가입 시 마케팅 정보를 업데이트 하도록 수정
This commit is contained in:
Yu Sung
2025-03-26 15:59:57 +09:00
parent e8f909035a
commit 236cf4db1e
5 changed files with 11 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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)")