parent
72d37b6bb6
commit
96dbe50a09
|
@ -18,32 +18,36 @@ final class AppViewModel: ObservableObject {
|
||||||
DEBUG_LOG("fetchAndUpdateIdfa")
|
DEBUG_LOG("fetchAndUpdateIdfa")
|
||||||
ATTrackingManager.requestTrackingAuthorization { [unowned self] status in
|
ATTrackingManager.requestTrackingAuthorization { [unowned self] status in
|
||||||
if status == .authorized {
|
if status == .authorized {
|
||||||
let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
|
if !UserDefaults.string(forKey: UserDefaultsKey.token).trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||||
let pid = UserDefaults.string(forKey: .marketingPid)
|
let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
|
||||||
self.userRepository.updateMarketingInfo(request: MarketingInfoUpdateRequest(adid: idfa, pid: pid))
|
let pid = UserDefaults.string(forKey: .marketingPid)
|
||||||
.sink { result in
|
self.userRepository.updateMarketingInfo(request: MarketingInfoUpdateRequest(adid: idfa, pid: pid))
|
||||||
switch result {
|
.sink { result in
|
||||||
case .finished:
|
switch result {
|
||||||
DEBUG_LOG("finish")
|
case .finished:
|
||||||
case .failure(let error):
|
DEBUG_LOG("finish")
|
||||||
ERROR_LOG(error.localizedDescription)
|
case .failure(let error):
|
||||||
|
ERROR_LOG(error.localizedDescription)
|
||||||
|
}
|
||||||
|
} receiveValue: { _ in
|
||||||
}
|
}
|
||||||
} receiveValue: { _ in
|
.store(in: &self.subscription)
|
||||||
}
|
}
|
||||||
.store(in: &self.subscription)
|
|
||||||
} else {
|
} else {
|
||||||
let pid = UserDefaults.string(forKey: .marketingPid)
|
if !UserDefaults.string(forKey: UserDefaultsKey.token).trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||||
self.userRepository.updateMarketingInfo(request: MarketingInfoUpdateRequest(adid: "", pid: pid))
|
let pid = UserDefaults.string(forKey: .marketingPid)
|
||||||
.sink { result in
|
self.userRepository.updateMarketingInfo(request: MarketingInfoUpdateRequest(adid: "", pid: pid))
|
||||||
switch result {
|
.sink { result in
|
||||||
case .finished:
|
switch result {
|
||||||
DEBUG_LOG("finish")
|
case .finished:
|
||||||
case .failure(let error):
|
DEBUG_LOG("finish")
|
||||||
ERROR_LOG(error.localizedDescription)
|
case .failure(let error):
|
||||||
|
ERROR_LOG(error.localizedDescription)
|
||||||
|
}
|
||||||
|
} receiveValue: { _ in
|
||||||
}
|
}
|
||||||
} receiveValue: { _ in
|
.store(in: &self.subscription)
|
||||||
}
|
}
|
||||||
.store(in: &self.subscription)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue