Fix iOS analytics by calling Swift AnalyticsManager instead of Kotlin no-op stub
PostHogAnalytics.shared.initialize() was calling the Kotlin actual object which is a no-op on iOS. Replaced with AnalyticsManager.shared.configure() so the PostHog SDK actually initializes. Also switched to anonymous-only person profiles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,9 +41,8 @@ final class AnalyticsManager {
|
|||||||
|
|
||||||
let config = PostHogConfig(apiKey: Self.apiKey, host: Self.host)
|
let config = PostHogConfig(apiKey: Self.apiKey, host: Self.host)
|
||||||
|
|
||||||
// Person profiles — required so events create person records
|
// Anonymous-only — no user identification, events use anonymous IDs
|
||||||
// and appear in the PostHog Events Explorer / Activity view.
|
config.personProfiles = .never
|
||||||
config.personProfiles = .always
|
|
||||||
|
|
||||||
// Auto-capture
|
// Auto-capture
|
||||||
config.captureElementInteractions = true
|
config.captureElementInteractions = true
|
||||||
|
|||||||
@@ -146,8 +146,6 @@ class LoginViewModel: ObservableObject {
|
|||||||
// APILayer.logout clears DataManager
|
// APILayer.logout clears DataManager
|
||||||
try? await APILayer.shared.logout()
|
try? await APILayer.shared.logout()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SubscriptionCacheWrapper.shared.clear()
|
SubscriptionCacheWrapper.shared.clear()
|
||||||
PushNotificationManager.shared.clearRegistrationCache()
|
PushNotificationManager.shared.clearRegistrationCache()
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ struct iOSApp: App {
|
|||||||
TokenStorage.shared.initialize(manager: TokenManager.Companion.shared.getInstance())
|
TokenStorage.shared.initialize(manager: TokenManager.Companion.shared.getInstance())
|
||||||
|
|
||||||
if !UITestRuntime.isEnabled {
|
if !UITestRuntime.isEnabled {
|
||||||
// Initialize PostHog Analytics
|
// Initialize PostHog Analytics (must use Swift AnalyticsManager, not the Kotlin stub)
|
||||||
PostHogAnalytics.shared.initialize()
|
AnalyticsManager.shared.configure()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize lookups at app start (public endpoints, no auth required)
|
// Initialize lookups at app start (public endpoints, no auth required)
|
||||||
|
|||||||
Reference in New Issue
Block a user