From be284887a23b83bd10538635653d42c8b6c3a15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Santos?= Date: Tue, 17 Sep 2024 19:26:14 +0200 Subject: [PATCH] Fix Application Installed (#359) --- .../Plugins/Platforms/iOS/iOSLifecycleEvents.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/Segment/Plugins/Platforms/iOS/iOSLifecycleEvents.swift b/Sources/Segment/Plugins/Platforms/iOS/iOSLifecycleEvents.swift index dcc340e..5783c65 100644 --- a/Sources/Segment/Plugins/Platforms/iOS/iOSLifecycleEvents.swift +++ b/Sources/Segment/Plugins/Platforms/iOS/iOSLifecycleEvents.swift @@ -40,19 +40,19 @@ class iOSLifecycleEvents: PlatformPlugin, iOSLifecycle { let currentVersion: String = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "" let currentBuild: String = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "" - if let previousBuild, + if previousBuild == nil { + analytics?.track(name: "Application Installed", properties: [ + "version": currentVersion, + "build": currentBuild + ]) + } else if let previousBuild, currentBuild != previousBuild { analytics?.track(name: "Application Updated", properties: [ "previous_version": previousVersion ?? "", "previous_build": previousBuild, "version": currentVersion, "build": currentBuild - ]) - } else { - analytics?.track(name: "Application Installed", properties: [ - "version": currentVersion, - "build": currentBuild - ]) + ]) } let sourceApp: String = launchOptions?[UIApplication.LaunchOptionsKey.sourceApplication] as? String ?? ""