Skip to content

Commit 80b30fd

Browse files
committed
[feat] #208 amplitude - 앱 실행 시
1 parent 54bb9b5 commit 80b30fd

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Projects/App/Sources/AppDelegate/AppDelegate.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,25 @@
66
//
77

88
import SwiftUI
9+
import UIKit
910

1011
import ComposableArchitecture
1112
import Firebase
1213
import FirebaseMessaging
1314
import GoogleSignIn
15+
import Dependencies
1416

1517
final class AppDelegate: NSObject {
18+
@Dependency(\.amplitude)
19+
private var amplitude
20+
1621
let store = Store(initialState: AppDelegateFeature.State()) {
1722
AppDelegateFeature()
1823
}
1924
}
2025
//MARK: - UIApplicationDelegate
2126
extension AppDelegate: UIApplicationDelegate {
27+
2228
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
2329
if GIDSignIn.sharedInstance.handle(url) { return true }
2430
return false
@@ -30,6 +36,14 @@ extension AppDelegate: UIApplicationDelegate {
3036
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
3137
) -> Bool {
3238
self.store.send(.didFinishLaunching)
39+
40+
// 운영체제 버전 (ex: "iOS 18.0.0")
41+
let osVersion = "iOS \(UIDevice.current.systemVersion)"
42+
43+
// 앱 번들 버전 (ex: "2.0.1")
44+
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
45+
46+
amplitude.track(.app_open(deviceOS: osVersion, appVersion: appVersion))
3347
return true
3448
}
3549

0 commit comments

Comments
 (0)