Skip to content

πŸ“Š Analytics: restore UI events, Firebase Analytics on iOS - #29

Merged
ngapp-dev merged 4 commits into
masterfrom
feature/analytics
Oct 3, 2026
Merged

ngapp-dev merged 4 commits into
masterfrom
feature/analytics

Conversation

@ngapp-dev

@ngapp-dev ngapp-dev commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

πŸ› Analytics UI events were never sent

  • Since the KMP migration nothing provided LocalAnalyticsHelper, so every event logged from the UI (screen views, opened stations, news and careers, language changes) went to its NoOpAnalyticsHelper default. Only data-layer and sync events reached Firebase.
  • MetanMobileApp now provides the Koin AnalyticsHelper at the root, as the old MainActivity did.
  • Restored the Cabinet screen view, lost in the migration. All other pre-KMP analytics call sites were checked and are present (the old Station detail screen logged its view twice; it now logs once).

✨ Firebase Analytics on iOS

  • iOS logged nothing (NoOpAnalyticsHelper). The shared code's events now go to Firebase Analytics, the same project as Android, so both platforms report the same events.
  • core:analytics: AnalyticsBridge (implemented in Swift) and BridgedAnalyticsHelper, which truncates params to Firebase's limits like Android's FirebaseAnalyticsHelper; exported in the framework.
  • initSharedKoin takes the bridge; FirebaseAnalyticsBridge and FirebaseApp.configure() in MetanMobileApp.swift.
  • Xcode: firebase-ios-sdk (FirebaseAnalytics) on the app target.
  • Sync events (network_sync_started / _successful / _failed) on iOS too: the helpers move to sync:work's commonMain; IosSyncManager (per attempt) and the BGTaskScheduler refresh log them, like Android's SyncWorker.

βš™οΈ CI: iOS on the xcode-27 image

Review notes

  • GoogleService-Info.plist is gitignored like google-services.json: put it in iosApp/MetanMobileApp/ to build the app. CI doesn't build the app target, so it's unaffected.
  • Verified: Android emulator logs screen_view with screen names (HomeScreen, StationDetailScreen); the iOS simulator registers with Firebase Installations and its local measurement DB counts screen_view growing while navigating and network_sync_started / network_sync_successful after launch, with the upload queue emptying.
  • Android debug builds still get "Firebase Installations Service is unavailable": the API key is restricted in Google Cloud Credentials to com.ngapp.metanmobile only (HTTP 403 API_KEY_ANDROID_APP_BLOCKED). Release is fine. Fix in the console by adding com.ngapp.metanmobile.debug + the debug SHA-1 to the key's Android restrictions.
  • Tests: BridgedAnalyticsHelper on the JVM and the iOS simulator.

ngapps added 4 commits October 3, 2026 02:29
Since the KMP migration nothing provided LocalAnalyticsHelper, so every
event logged from the UI (screen views, opened stations, news and
careers, language changes) went to its NoOpAnalyticsHelper default;
only data-layer and sync events reached Firebase. MetanMobileApp now
provides the Koin AnalyticsHelper at the root, as MainActivity did.

Also restores the Cabinet screen view, lost in the migration.
iOS logged nothing (NoOpAnalyticsHelper). The shared code's events now
go to Firebase Analytics, the same project as Android, so both
platforms report the same events.

- core:analytics: AnalyticsBridge, implemented in Swift, and
  BridgedAnalyticsHelper, which truncates params to Firebase's limits
  like Android's FirebaseAnalyticsHelper; exported in the framework.
- initSharedKoin takes the bridge; FirebaseAnalyticsBridge and
  FirebaseApp.configure() in MetanMobileApp.swift.
- Xcode: firebase-ios-sdk (FirebaseAnalytics) on the app target.
- GoogleService-Info.plist is gitignored like google-services.json:
  put it in iosApp/MetanMobileApp/ to build the app.

Tests: BridgedAnalyticsHelper (JVM + iOS simulator).
macos-latest only has Xcode 26.x, so setup-xcode failed with "Could not
find Xcode version that satisfied version spec: '27'". Xcode 27 is on
the xcode-27 preview image (actions/runner-images#14404).
iOS syncs didn't log network_sync_started / _successful / _failed;
Android's SyncWorker did. The event helpers move to sync:work's
commonMain and both iOS sync paths log them per attempt, like each
SyncWorker run: IosSyncManager (launch/foreground sync, with retries)
and the BGTaskScheduler background refresh.
@ngapp-dev
ngapp-dev merged commit 27e3365 into master Oct 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant