pid 업데이트 로직
- 로그인 된 사람만 실행되도록 수정
This commit is contained in:
		| @@ -18,32 +18,36 @@ final class AppViewModel: ObservableObject { | ||||
|         DEBUG_LOG("fetchAndUpdateIdfa") | ||||
|         ATTrackingManager.requestTrackingAuthorization { [unowned self] status in | ||||
|             if status == .authorized { | ||||
|                 let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString | ||||
|                 let pid = UserDefaults.string(forKey: .marketingPid) | ||||
|                 self.userRepository.updateMarketingInfo(request: MarketingInfoUpdateRequest(adid: idfa, pid: pid)) | ||||
|                     .sink { result in | ||||
|                         switch result { | ||||
|                         case .finished: | ||||
|                             DEBUG_LOG("finish") | ||||
|                         case .failure(let error): | ||||
|                             ERROR_LOG(error.localizedDescription) | ||||
|                 if !UserDefaults.string(forKey: UserDefaultsKey.token).trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { | ||||
|                     let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString | ||||
|                     let pid = UserDefaults.string(forKey: .marketingPid) | ||||
|                     self.userRepository.updateMarketingInfo(request: MarketingInfoUpdateRequest(adid: idfa, pid: pid)) | ||||
|                         .sink { result in | ||||
|                             switch result { | ||||
|                             case .finished: | ||||
|                                 DEBUG_LOG("finish") | ||||
|                             case .failure(let error): | ||||
|                                 ERROR_LOG(error.localizedDescription) | ||||
|                             } | ||||
|                         } receiveValue: { _ in | ||||
|                         } | ||||
|                     } receiveValue: { _ in | ||||
|                     } | ||||
|                     .store(in: &self.subscription) | ||||
|                         .store(in: &self.subscription) | ||||
|                 } | ||||
|             } else { | ||||
|                 let pid = UserDefaults.string(forKey: .marketingPid) | ||||
|                 self.userRepository.updateMarketingInfo(request: MarketingInfoUpdateRequest(adid: "", pid: pid)) | ||||
|                     .sink { result in | ||||
|                         switch result { | ||||
|                         case .finished: | ||||
|                             DEBUG_LOG("finish") | ||||
|                         case .failure(let error): | ||||
|                             ERROR_LOG(error.localizedDescription) | ||||
|                 if !UserDefaults.string(forKey: UserDefaultsKey.token).trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { | ||||
|                     let pid = UserDefaults.string(forKey: .marketingPid) | ||||
|                     self.userRepository.updateMarketingInfo(request: MarketingInfoUpdateRequest(adid: "", pid: pid)) | ||||
|                         .sink { result in | ||||
|                             switch result { | ||||
|                             case .finished: | ||||
|                                 DEBUG_LOG("finish") | ||||
|                             case .failure(let error): | ||||
|                                 ERROR_LOG(error.localizedDescription) | ||||
|                             } | ||||
|                         } receiveValue: { _ in | ||||
|                         } | ||||
|                     } receiveValue: { _ in | ||||
|                     } | ||||
|                     .store(in: &self.subscription) | ||||
|                         .store(in: &self.subscription) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung