Intercom and thread updates

This commit is contained in:
Jackson Harper
2024-07-12 15:19:14 +08:00
parent 7ac3729a72
commit 47727f1321
3 changed files with 6 additions and 2 deletions

View File

@ -44,6 +44,7 @@ public final class Authenticator: ObservableObject {
isLoggedIn = false
}
@MainActor
public func logout(dataService: DataService, isAccountDeletion: Bool = false) {
dataService.resetLocalStorage()

View File

@ -4,6 +4,7 @@ import Foundation
import PostHog
#endif
@MainActor
public enum EventTracker {
#if os(iOS)
public static var posthog: PHGPostHog? = {

View File

@ -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()
}
}