pid를 심어놓은 광고를 타고 들어온 경우 항상 AppLaunch 이벤트를 실행하는 코드
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Combine
|
||||
|
||||
import notifly_sdk
|
||||
import AppsFlyerLib
|
||||
@@ -17,6 +18,9 @@ import FirebaseMessaging
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
private let gcmMessageIDKey = "gcm.message_id"
|
||||
private let adTrackingRepository = AdTrackingRepository()
|
||||
|
||||
private var subscription = Set<AnyCancellable>()
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
|
||||
FirebaseApp.configure()
|
||||
@@ -87,6 +91,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
private func logUtmInFirebase() {
|
||||
FirebaseTracking.shared.logUtm()
|
||||
}
|
||||
|
||||
private func adTrackingAppLaunch(pid: String) {
|
||||
adTrackingRepository.adTrackingAppLaunch(pid: pid)
|
||||
.sink { result in
|
||||
switch result {
|
||||
case .finished:
|
||||
DEBUG_LOG("finish")
|
||||
case .failure(let error):
|
||||
ERROR_LOG(error.localizedDescription)
|
||||
}
|
||||
} receiveValue: { _ in
|
||||
}
|
||||
.store(in: &self.subscription)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
extension AppDelegate: AppsFlyerLibDelegate {
|
||||
@@ -96,6 +115,7 @@ extension AppDelegate: AppsFlyerLibDelegate {
|
||||
let pid = conversionInfo["deep_link_sub1"] as? String ?? ""
|
||||
if !pid.isEmpty {
|
||||
UserDefaults.set(pid, forKey: .marketingPid)
|
||||
adTrackingAppLaunch(pid: pid)
|
||||
}
|
||||
|
||||
if let utmSource = conversionInfo["deep_link_sub2"] as? String {
|
||||
@@ -155,6 +175,7 @@ extension AppDelegate: DeepLinkDelegate {
|
||||
let pid = deepLinkObj.clickEvent["deep_link_sub1"] as? String ?? ""
|
||||
if !pid.isEmpty {
|
||||
UserDefaults.set(pid, forKey: .marketingPid)
|
||||
adTrackingAppLaunch(pid: pid)
|
||||
}
|
||||
|
||||
if let utmSource = deepLinkObj.clickEvent["deep_link_sub2"] as? String {
|
||||
|
Reference in New Issue
Block a user