TelemetryRepository

The app's whole telemetry in one type: AnalyticsReporter, DiagnosticsReporter and TelemetryCollection.

The analytics and crash SDKs are its data sources, so callers reach them through this contract and never depend on a vendor. The implementation is the only place that touches an SDK; :library:integration:firebase binds FirebaseTelemetryRepository, and telemetryModule binds the three narrower contracts to the same instance.

It is what the UI layer uses: ViewModels take it, LoggedScreenViewModel reports through it, and composables read it as val telemetry = LocalTelemetry.current. A screen view or a tap is a UI event, and sending it through a ViewModel would add an event per tap and change nothing about what is reported. Code under data/ and domain/ takes DiagnosticsReporter, and TelemetryCollection where it applies consent, instead.

Inheritors

Functions

Link copied to clipboard
abstract fun logBreadcrumb(message: String, attributes: Map<String, String> = emptyMap())

Adds a breadcrumb to the crash log, for tracing what happened before a failure.

Link copied to clipboard
abstract fun logEvent(event: AnalyticsEvent)
Link copied to clipboard
abstract fun logScreenView(screenName: String, screenClass: String? = null)
Link copied to clipboard

Logs standard GA4 search event with parameter search_term.

Link copied to clipboard
fun AnalyticsReporter.logSelectContent(contentType: String, itemId: String)

Logs standard GA4 select_content event with parameters content_type and item_id.

Link copied to clipboard
fun AnalyticsReporter.logShare(method: String, contentType: String, itemId: String)

Logs standard GA4 share event with parameters method, content_type, and item_id.

Link copied to clipboard

Logs standard GA4 tutorial_begin event.

Link copied to clipboard

Logs standard GA4 tutorial_complete event.

Link copied to clipboard

Logs standard GA4 unlock_achievement event with parameter achievement_id.

Link copied to clipboard
fun AnalyticsReporter.logViewItem(itemId: String, itemName: String, itemCategory: String? = null)

Logs standard GA4 view_item event with parameters item_id, item_name, and optional item_category.

Link copied to clipboard
fun AnalyticsReporter.logViewItemList(itemListId: String? = null, itemListName: String? = null)

Logs standard GA4 view_item_list event with optional parameters item_list_id and item_list_name.

Link copied to clipboard
abstract fun recordNonFatal(throwable: Throwable, attributes: Map<String, String> = emptyMap())

Records a non-fatal throwable that has no ViewModel context.

Link copied to clipboard
abstract fun reportViewModelError(viewModelName: String, action: String, throwable: Throwable, extraKeys: Map<String, String> = emptyMap())

Reports a ViewModel flow failure with useful context.

Link copied to clipboard
abstract fun setAnalyticsEnabled(enabled: Boolean)

Enables or disables analytics collection for the current process.

Link copied to clipboard
abstract fun setCrashlyticsEnabled(enabled: Boolean)

Enables or disables crash reporting for the current process.

Link copied to clipboard
abstract fun setPerformanceEnabled(enabled: Boolean)

Enables or disables performance monitoring for the current process.

Link copied to clipboard
abstract fun setUserProperty(name: String, value: String?)
Link copied to clipboard
abstract fun updateConsent(analyticsGranted: Boolean, adStorageGranted: Boolean, adUserDataGranted: Boolean, adPersonalizationGranted: Boolean)

Updates the consent configuration used by analytics and ads measurement.