idfa 업데이트 추가
This commit is contained in:
@@ -114,6 +114,7 @@ struct HomeView: View {
|
||||
}
|
||||
.onAppear {
|
||||
pushTokenUpdate()
|
||||
viewModel.fetchAndUpdateIdfa()
|
||||
viewModel.getMemberInfo()
|
||||
viewModel.getEventPopup()
|
||||
viewModel.addAllPlaybackTracking()
|
||||
|
@@ -8,6 +8,9 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
import AppTrackingTransparency
|
||||
import AdSupport
|
||||
|
||||
final class HomeViewModel: ObservableObject {
|
||||
|
||||
private var subscription = Set<AnyCancellable>()
|
||||
@@ -37,6 +40,25 @@ final class HomeViewModel: ObservableObject {
|
||||
.store(in: &subscription)
|
||||
}
|
||||
|
||||
func fetchAndUpdateIdfa() {
|
||||
ATTrackingManager.requestTrackingAuthorization { [unowned self] status in
|
||||
if status == .authorized {
|
||||
let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
|
||||
self.userRepository.updateIdfa(request: IdfaUpdateRequest(adid: idfa))
|
||||
.sink { result in
|
||||
switch result {
|
||||
case .finished:
|
||||
DEBUG_LOG("finish")
|
||||
case .failure(let error):
|
||||
ERROR_LOG(error.localizedDescription)
|
||||
}
|
||||
} receiveValue: { _ in
|
||||
}
|
||||
.store(in: &self.subscription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getMemberInfo() {
|
||||
userRepository.getMemberInfo()
|
||||
.sink { result in
|
||||
|
Reference in New Issue
Block a user