mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-01-26 01:54:27 +01:00
Add AppOpen analytics event
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package no.nordicsemi.android.analytics
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
@Singleton
|
||||
class AppAnalytics @Inject constructor(
|
||||
@ApplicationContext
|
||||
@@ -14,7 +16,7 @@ class AppAnalytics @Inject constructor(
|
||||
|
||||
private val firebase by lazy { FirebaseAnalytics.getInstance(context) }
|
||||
|
||||
fun logEvent(event: ProfileOpenEvent) {
|
||||
firebase.logEvent(event.firebaseName, null)
|
||||
fun logEvent(event: AppEvent) {
|
||||
firebase.logEvent(event.eventName, null)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
package no.nordicsemi.android.analytics
|
||||
|
||||
enum class ProfileOpenEvent(internal val firebaseName: String) {
|
||||
sealed interface AppEvent {
|
||||
val eventName: String
|
||||
}
|
||||
|
||||
object AppOpenEvent : AppEvent {
|
||||
override val eventName: String = "APP_OPEN"
|
||||
}
|
||||
|
||||
enum class ProfileOpenEvent(override val eventName: String) : AppEvent {
|
||||
BPS("BPS_PROFILE_OPEN"),
|
||||
CGMS("CGMS_PROFILE_OPEN"),
|
||||
CSC("CSC_PROFILE_OPEN"),
|
||||
|
||||
Reference in New Issue
Block a user