diff --git a/apple/OmnivoreKit/Sources/Services/Authentication/Authenticator.swift b/apple/OmnivoreKit/Sources/Services/Authentication/Authenticator.swift index c639057d9..c3f66937e 100644 --- a/apple/OmnivoreKit/Sources/Services/Authentication/Authenticator.swift +++ b/apple/OmnivoreKit/Sources/Services/Authentication/Authenticator.swift @@ -44,6 +44,7 @@ public final class Authenticator: ObservableObject { isLoggedIn = false } + @MainActor public func logout(dataService: DataService, isAccountDeletion: Bool = false) { dataService.resetLocalStorage() diff --git a/apple/OmnivoreKit/Sources/Utils/EventTracking/EventTracker.swift b/apple/OmnivoreKit/Sources/Utils/EventTracking/EventTracker.swift index 245cd8094..57439b61c 100644 --- a/apple/OmnivoreKit/Sources/Utils/EventTracking/EventTracker.swift +++ b/apple/OmnivoreKit/Sources/Utils/EventTracking/EventTracker.swift @@ -4,6 +4,7 @@ import Foundation import PostHog #endif +@MainActor public enum EventTracker { #if os(iOS) public static var posthog: PHGPostHog? = { diff --git a/apple/Sources/AppDelegate.swift b/apple/Sources/AppDelegate.swift index 3082ddc91..0a9f3941b 100644 --- a/apple/Sources/AppDelegate.swift +++ b/apple/Sources/AppDelegate.swift @@ -47,9 +47,11 @@ private let logger = Logger(subsystem: "app.omnivore", category: "app-delegate") Intercom.setApiKey(intercomKeys.apiKey, forAppId: intercomKeys.appID) if let userId = UserDefaults.standard.string(forKey: Keys.userIdKey) { - Intercom.registerUser(withUserId: userId) + let userAttributes = ICMUserAttributes() + userAttributes.userId = userId + Intercom.loginUser(with: userAttributes) } else { - Intercom.registerUnidentifiedUser() + Intercom.loginUnidentifiedUser() } }