Inject PlatformAnalytics directly (#3358)

This commit is contained in:
Phil Oliver 2025-10-06 14:30:18 -04:00 committed by GitHub
parent 95ec4877df
commit 1fb79d8887
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 29 additions and 30 deletions

View file

@ -19,9 +19,7 @@ package com.geeksville.mesh
import android.app.Application
import dagger.hilt.android.HiltAndroidApp
import org.meshtastic.core.analytics.platform.PlatformAnalytics
import timber.log.Timber
import javax.inject.Inject
/**
* The main application class for Meshtastic.
@ -30,26 +28,7 @@ import javax.inject.Inject
* application components, including analytics and platform-specific helpers, and manages analytics consent based on
* user preferences.
*/
@HiltAndroidApp
class MeshUtilApplication : Application() {
@Inject lateinit var platformAnalytics: PlatformAnalytics
companion object {
/**
* Provides access to the platform-specific analytics provider. Initialized via the injected [PlatformAnalytics]
* during [onCreate].
*/
lateinit var analytics: PlatformAnalytics
private set
}
override fun onCreate() {
super.onCreate()
// Initialize platform-specific features (analytics, crash reporting, etc.)
analytics = platformAnalytics
}
}
@HiltAndroidApp class MeshUtilApplication : Application()
fun logAssert(executeReliableWrite: Boolean) {
if (!executeReliableWrite) {