Skip to content

Commit

Permalink
refactor: No message in app-launched (#128)
Browse files Browse the repository at this point in the history
refactor: app-launched no msg
  • Loading branch information
fabriziodemaria authored May 28, 2024
1 parent f31fe85 commit 91604eb
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Sources/Confidence/ConfidenceAppLifecycleProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,14 @@ public class ConfidenceAppLifecycleProducer: ConfidenceEventProducer, Confidence
let currentVersion: String = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
let currentBuild: String = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""

let message: ConfidenceStruct = [
Self.versionNameContextKey: .init(string: currentVersion),
Self.buildNumberContextKey: .init(string: currentBuild)
]

if eventName == Self.appLaunchedEventName {
if previousBuild == nil && previousVersion == nil {
events.send(Event(name: ConfidenceAppLifecycleProducer.appInstalledEventName, message: message))
events.send(Event(name: ConfidenceAppLifecycleProducer.appInstalledEventName, message: [:]))
} else if previousBuild != currentBuild || previousVersion != currentVersion {
events.send(Event(name: ConfidenceAppLifecycleProducer.appUpdatedEventName, message: message))
events.send(Event(name: ConfidenceAppLifecycleProducer.appUpdatedEventName, message: [:]))
}
}
events.send(Event(name: eventName, message: message))
events.send(Event(name: eventName, message: [:]))

UserDefaults.standard.setValue(currentVersion, forKey: Self.userDefaultVersionNameKey)
UserDefaults.standard.setValue(currentBuild, forKey: Self.userDefaultBuildNameKey)
Expand Down

0 comments on commit 91604eb

Please sign in to comment.