mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-19 15:34:26 +01:00
Change analytics events
This commit is contained in:
@@ -14,6 +14,8 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
|
import no.nordicsemi.android.analytics.Link
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileOpenEvent
|
import no.nordicsemi.android.analytics.ProfileOpenEvent
|
||||||
import no.nordicsemi.android.logger.LoggerAppRunner
|
import no.nordicsemi.android.logger.LoggerAppRunner
|
||||||
import no.nordicsemi.android.nrftoolbox.BuildConfig
|
import no.nordicsemi.android.nrftoolbox.BuildConfig
|
||||||
@@ -57,14 +59,14 @@ fun HomeScreen() {
|
|||||||
|
|
||||||
FeatureButton(R.drawable.ic_gls, R.string.gls_module, R.string.gls_module_full) {
|
FeatureButton(R.drawable.ic_gls, R.string.gls_module, R.string.gls_module_full) {
|
||||||
viewModel.openProfile(ProfileDestination.GLS)
|
viewModel.openProfile(ProfileDestination.GLS)
|
||||||
viewModel.logEvent(ProfileOpenEvent.GLS)
|
viewModel.logEvent(ProfileOpenEvent(Profile.GLS))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_bps, R.string.bps_module, R.string.bps_module_full) {
|
FeatureButton(R.drawable.ic_bps, R.string.bps_module, R.string.bps_module_full) {
|
||||||
viewModel.openProfile(ProfileDestination.BPS)
|
viewModel.openProfile(ProfileDestination.BPS)
|
||||||
viewModel.logEvent(ProfileOpenEvent.BPS)
|
viewModel.logEvent(ProfileOpenEvent(Profile.BPS))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -79,42 +81,42 @@ fun HomeScreen() {
|
|||||||
|
|
||||||
FeatureButton(R.drawable.ic_csc, R.string.csc_module, R.string.csc_module_full, state.isCSCModuleRunning) {
|
FeatureButton(R.drawable.ic_csc, R.string.csc_module, R.string.csc_module_full, state.isCSCModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.CSC)
|
viewModel.openProfile(ProfileDestination.CSC)
|
||||||
viewModel.logEvent(ProfileOpenEvent.CSC)
|
viewModel.logEvent(ProfileOpenEvent(Profile.CSC))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_hrs, R.string.hrs_module, R.string.hrs_module_full, state.isHRSModuleRunning) {
|
FeatureButton(R.drawable.ic_hrs, R.string.hrs_module, R.string.hrs_module_full, state.isHRSModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.HRS)
|
viewModel.openProfile(ProfileDestination.HRS)
|
||||||
viewModel.logEvent(ProfileOpenEvent.HRS)
|
viewModel.logEvent(ProfileOpenEvent(Profile.HRS))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_hts, R.string.hts_module, R.string.hts_module_full, state.isHTSModuleRunning) {
|
FeatureButton(R.drawable.ic_hts, R.string.hts_module, R.string.hts_module_full, state.isHTSModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.HTS)
|
viewModel.openProfile(ProfileDestination.HTS)
|
||||||
viewModel.logEvent(ProfileOpenEvent.HTS)
|
viewModel.logEvent(ProfileOpenEvent(Profile.HTS))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_rscs, R.string.rscs_module, R.string.rscs_module_full, state.isRSCSModuleRunning) {
|
FeatureButton(R.drawable.ic_rscs, R.string.rscs_module, R.string.rscs_module_full, state.isRSCSModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.RSCS)
|
viewModel.openProfile(ProfileDestination.RSCS)
|
||||||
viewModel.logEvent(ProfileOpenEvent.RSCS)
|
viewModel.logEvent(ProfileOpenEvent(Profile.RSCS))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_cgm, R.string.cgm_module, R.string.cgm_module_full, state.isCGMModuleRunning) {
|
FeatureButton(R.drawable.ic_cgm, R.string.cgm_module, R.string.cgm_module_full, state.isCGMModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.CGMS)
|
viewModel.openProfile(ProfileDestination.CGMS)
|
||||||
viewModel.logEvent(ProfileOpenEvent.CGMS)
|
viewModel.logEvent(ProfileOpenEvent(Profile.CGMS))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
FeatureButton(R.drawable.ic_prx, R.string.prx_module, R.string.prx_module_full, state.isPRXModuleRunning) {
|
FeatureButton(R.drawable.ic_prx, R.string.prx_module, R.string.prx_module_full, state.isPRXModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.PRX)
|
viewModel.openProfile(ProfileDestination.PRX)
|
||||||
viewModel.logEvent(ProfileOpenEvent.PRX)
|
viewModel.logEvent(ProfileOpenEvent(Profile.PRX))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -129,7 +131,7 @@ fun HomeScreen() {
|
|||||||
|
|
||||||
FeatureButton(R.drawable.ic_uart, R.string.uart_module, R.string.uart_module_full, state.isUARTModuleRunning) {
|
FeatureButton(R.drawable.ic_uart, R.string.uart_module, R.string.uart_module_full, state.isUARTModuleRunning) {
|
||||||
viewModel.openProfile(ProfileDestination.UART)
|
viewModel.openProfile(ProfileDestination.UART)
|
||||||
viewModel.logEvent(ProfileOpenEvent.UART)
|
viewModel.logEvent(ProfileOpenEvent(Profile.UART))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -149,7 +151,7 @@ fun HomeScreen() {
|
|||||||
} else {
|
} else {
|
||||||
uriHandler.openUri(DFU_LINK)
|
uriHandler.openUri(DFU_LINK)
|
||||||
}
|
}
|
||||||
viewModel.logEvent(ProfileOpenEvent.DFU)
|
viewModel.logEvent(ProfileOpenEvent(Link.DFU))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -160,7 +162,7 @@ fun HomeScreen() {
|
|||||||
|
|
||||||
FeatureButton(R.drawable.ic_logger, R.string.logger_module, R.string.logger_module_full, null, loggerDescription) {
|
FeatureButton(R.drawable.ic_logger, R.string.logger_module, R.string.logger_module_full, null, loggerDescription) {
|
||||||
viewModel.openLogger()
|
viewModel.openLogger()
|
||||||
viewModel.logEvent(ProfileOpenEvent.LOGGER)
|
viewModel.logEvent(ProfileOpenEvent(Link.LOGGER))
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class AppAnalytics @Inject constructor(
|
|||||||
|
|
||||||
private val firebase by lazy { FirebaseAnalytics.getInstance(context) }
|
private val firebase by lazy { FirebaseAnalytics.getInstance(context) }
|
||||||
|
|
||||||
fun logEvent(event: AppEvent) {
|
fun logEvent(event: FirebaseEvent) {
|
||||||
firebase.logEvent(event.eventName, null)
|
firebase.logEvent(event.eventName, event.params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,35 @@
|
|||||||
package no.nordicsemi.android.analytics
|
package no.nordicsemi.android.analytics
|
||||||
|
|
||||||
sealed interface AppEvent {
|
import android.os.Bundle
|
||||||
val eventName: String
|
|
||||||
|
sealed class FirebaseEvent(val eventName: String, val params: Bundle?)
|
||||||
|
|
||||||
|
object AppOpenEvent : FirebaseEvent("APP_OPEN", null)
|
||||||
|
|
||||||
|
class ProfileOpenEvent : FirebaseEvent {
|
||||||
|
|
||||||
|
constructor(profile: Profile) : super(EVENT_NAME, createBundle(profile.displayName))
|
||||||
|
|
||||||
|
constructor(link: Link) : super(EVENT_NAME, createBundle(link.displayName))
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val EVENT_NAME = "PROFILE_OPEN"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object AppOpenEvent : AppEvent {
|
class ProfileConnectedEvent : FirebaseEvent {
|
||||||
override val eventName: String = "APP_OPEN"
|
|
||||||
|
constructor(profile: Profile) : super(EVENT_NAME, createBundle(profile.displayName))
|
||||||
|
|
||||||
|
constructor(link: Link) : super(EVENT_NAME, createBundle(link.displayName))
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val EVENT_NAME = "PROFILE_CONNECTED"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ProfileOpenEvent(override val eventName: String) : AppEvent {
|
const val PROFILE_PARAM_KEY = "PROFILE_NAME"
|
||||||
BPS("BPS_PROFILE_OPEN"),
|
|
||||||
CGMS("CGMS_PROFILE_OPEN"),
|
|
||||||
CSC("CSC_PROFILE_OPEN"),
|
|
||||||
GLS("GLS_PROFILE_OPEN"),
|
|
||||||
HRS("HRS_PROFILE_OPEN"),
|
|
||||||
HTS("HTS_PROFILE_OPEN"),
|
|
||||||
PRX("PRX_PROFILE_OPEN"),
|
|
||||||
RSCS("RSCS_PROFILE_OPEN"),
|
|
||||||
UART("UART_PROFILE_OPEN"),
|
|
||||||
|
|
||||||
DFU("DFU_PROFILE_OPEN"),
|
private fun createBundle(name: String): Bundle {
|
||||||
LOGGER("LOGGER_PROFILE_OPEN"),
|
return Bundle().apply { putString(PROFILE_PARAM_KEY, name) }
|
||||||
}
|
|
||||||
|
|
||||||
enum class ProfileConnectedEvent(override val eventName: String) : AppEvent {
|
|
||||||
BPS("BPS_CONNECTED"),
|
|
||||||
CGMS("CGMS_CONNECTED"),
|
|
||||||
CSC("CSC_CONNECTED"),
|
|
||||||
GLS("GLS_CONNECTED"),
|
|
||||||
HRS("HRS_CONNECTED"),
|
|
||||||
HTS("HTS_CONNECTED"),
|
|
||||||
PRX("PRX_CONNECTED"),
|
|
||||||
RSCS("RSCS_CONNECTED"),
|
|
||||||
UART("UART_CONNECTED"),
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package no.nordicsemi.android.analytics
|
||||||
|
|
||||||
|
enum class Profile(val displayName: String) {
|
||||||
|
BPS("BPS"),
|
||||||
|
CGMS("CGMS"),
|
||||||
|
CSC("CSC"),
|
||||||
|
GLS("GLS"),
|
||||||
|
HRS("HRS"),
|
||||||
|
HTS("HTS"),
|
||||||
|
PRX("PRX"),
|
||||||
|
RSCS("RSCS"),
|
||||||
|
UART("UART");
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class Link(val displayName: String) {
|
||||||
|
DFU("DFU"),
|
||||||
|
LOGGER("LOGGER");
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import kotlinx.coroutines.flow.asStateFlow
|
|||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import no.nordicsemi.android.analytics.AppAnalytics
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
||||||
import no.nordicsemi.android.bps.data.BPS_SERVICE_UUID
|
import no.nordicsemi.android.bps.data.BPS_SERVICE_UUID
|
||||||
import no.nordicsemi.android.bps.repository.BPSRepository
|
import no.nordicsemi.android.bps.repository.BPSRepository
|
||||||
@@ -59,7 +60,7 @@ internal class BPSViewModel @Inject constructor(
|
|||||||
_state.value = WorkingState(it)
|
_state.value = WorkingState(it)
|
||||||
|
|
||||||
(it as? SuccessResult)?.let {
|
(it as? SuccessResult)?.let {
|
||||||
analytics.logEvent(ProfileConnectedEvent.BPS)
|
analytics.logEvent(ProfileConnectedEvent(Profile.BPS))
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
|
|||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import no.nordicsemi.android.analytics.AppAnalytics
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
||||||
import no.nordicsemi.android.cgms.data.CGMS_SERVICE_UUID
|
import no.nordicsemi.android.cgms.data.CGMS_SERVICE_UUID
|
||||||
import no.nordicsemi.android.cgms.repository.CGMRepository
|
import no.nordicsemi.android.cgms.repository.CGMRepository
|
||||||
@@ -39,7 +40,7 @@ internal class CGMViewModel @Inject constructor(
|
|||||||
_state.value = WorkingState(it)
|
_state.value = WorkingState(it)
|
||||||
|
|
||||||
(it as? SuccessResult)?.let {
|
(it as? SuccessResult)?.let {
|
||||||
analytics.logEvent(ProfileConnectedEvent.CGMS)
|
analytics.logEvent(ProfileConnectedEvent(Profile.CGMS))
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
|
|||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import no.nordicsemi.android.analytics.AppAnalytics
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
||||||
import no.nordicsemi.android.csc.data.CSC_SERVICE_UUID
|
import no.nordicsemi.android.csc.data.CSC_SERVICE_UUID
|
||||||
import no.nordicsemi.android.csc.repository.CSCRepository
|
import no.nordicsemi.android.csc.repository.CSCRepository
|
||||||
@@ -38,7 +39,7 @@ internal class CSCViewModel @Inject constructor(
|
|||||||
_state.value = _state.value.copy(cscManagerState = WorkingState(it))
|
_state.value = _state.value.copy(cscManagerState = WorkingState(it))
|
||||||
|
|
||||||
(it as? SuccessResult)?.let {
|
(it as? SuccessResult)?.let {
|
||||||
analytics.logEvent(ProfileConnectedEvent.CSC)
|
analytics.logEvent(ProfileConnectedEvent(Profile.CSC))
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import no.nordicsemi.android.analytics.AppAnalytics
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
||||||
import no.nordicsemi.android.gls.GlsDetailsDestinationId
|
import no.nordicsemi.android.gls.GlsDetailsDestinationId
|
||||||
import no.nordicsemi.android.gls.repository.GLSRepository
|
import no.nordicsemi.android.gls.repository.GLSRepository
|
||||||
@@ -60,7 +61,7 @@ internal class GLSViewModel @Inject constructor(
|
|||||||
_state.value = WorkingState(it)
|
_state.value = WorkingState(it)
|
||||||
|
|
||||||
(it as? SuccessResult)?.let {
|
(it as? SuccessResult)?.let {
|
||||||
analytics.logEvent(ProfileConnectedEvent.GLS)
|
analytics.logEvent(ProfileConnectedEvent(Profile.GLS))
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
|
|||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import no.nordicsemi.android.analytics.AppAnalytics
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
||||||
import no.nordicsemi.android.hrs.data.HRS_SERVICE_UUID
|
import no.nordicsemi.android.hrs.data.HRS_SERVICE_UUID
|
||||||
import no.nordicsemi.android.hrs.service.HRSRepository
|
import no.nordicsemi.android.hrs.service.HRSRepository
|
||||||
@@ -39,7 +40,7 @@ internal class HRSViewModel @Inject constructor(
|
|||||||
_state.value = WorkingState(it, zoomIn)
|
_state.value = WorkingState(it, zoomIn)
|
||||||
|
|
||||||
(it as? SuccessResult)?.let {
|
(it as? SuccessResult)?.let {
|
||||||
analytics.logEvent(ProfileConnectedEvent.HRS)
|
analytics.logEvent(ProfileConnectedEvent(Profile.HRS))
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
|
|||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import no.nordicsemi.android.analytics.AppAnalytics
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
||||||
import no.nordicsemi.android.hts.data.HTS_SERVICE_UUID
|
import no.nordicsemi.android.hts.data.HTS_SERVICE_UUID
|
||||||
import no.nordicsemi.android.hts.repository.HTSRepository
|
import no.nordicsemi.android.hts.repository.HTSRepository
|
||||||
@@ -38,7 +39,7 @@ internal class HTSViewModel @Inject constructor(
|
|||||||
_state.value = _state.value.copy(htsManagerState = WorkingState(it))
|
_state.value = _state.value.copy(htsManagerState = WorkingState(it))
|
||||||
|
|
||||||
(it as? SuccessResult)?.let {
|
(it as? SuccessResult)?.let {
|
||||||
analytics.logEvent(ProfileConnectedEvent.HTS)
|
analytics.logEvent(ProfileConnectedEvent(Profile.HTS))
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
|
|||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import no.nordicsemi.android.analytics.AppAnalytics
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
||||||
import no.nordicsemi.android.navigation.*
|
import no.nordicsemi.android.navigation.*
|
||||||
import no.nordicsemi.android.prx.data.PRX_SERVICE_UUID
|
import no.nordicsemi.android.prx.data.PRX_SERVICE_UUID
|
||||||
@@ -38,7 +39,7 @@ internal class PRXViewModel @Inject constructor(
|
|||||||
_state.value = WorkingState(it)
|
_state.value = WorkingState(it)
|
||||||
|
|
||||||
(it as? SuccessResult)?.let {
|
(it as? SuccessResult)?.let {
|
||||||
analytics.logEvent(ProfileConnectedEvent.PRX)
|
analytics.logEvent(ProfileConnectedEvent(Profile.PRX))
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
|
|||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import no.nordicsemi.android.analytics.AppAnalytics
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
||||||
import no.nordicsemi.android.navigation.*
|
import no.nordicsemi.android.navigation.*
|
||||||
import no.nordicsemi.android.rscs.data.RSCS_SERVICE_UUID
|
import no.nordicsemi.android.rscs.data.RSCS_SERVICE_UUID
|
||||||
@@ -38,7 +39,7 @@ internal class RSCSViewModel @Inject constructor(
|
|||||||
_state.value = WorkingState(it)
|
_state.value = WorkingState(it)
|
||||||
|
|
||||||
(it as? SuccessResult)?.let {
|
(it as? SuccessResult)?.let {
|
||||||
analytics.logEvent(ProfileConnectedEvent.RSCS)
|
analytics.logEvent(ProfileConnectedEvent(Profile.RSCS))
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import no.nordicsemi.android.analytics.AppAnalytics
|
import no.nordicsemi.android.analytics.AppAnalytics
|
||||||
|
import no.nordicsemi.android.analytics.Profile
|
||||||
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
import no.nordicsemi.android.analytics.ProfileConnectedEvent
|
||||||
import no.nordicsemi.android.navigation.*
|
import no.nordicsemi.android.navigation.*
|
||||||
import no.nordicsemi.android.service.IdleResult
|
import no.nordicsemi.android.service.IdleResult
|
||||||
@@ -47,7 +48,7 @@ internal class UARTViewModel @Inject constructor(
|
|||||||
_state.value = _state.value.copy(uartManagerState = WorkingState(it))
|
_state.value = _state.value.copy(uartManagerState = WorkingState(it))
|
||||||
|
|
||||||
(it as? SuccessResult)?.let {
|
(it as? SuccessResult)?.let {
|
||||||
analytics.logEvent(ProfileConnectedEvent.UART)
|
analytics.logEvent(ProfileConnectedEvent(Profile.UART))
|
||||||
}
|
}
|
||||||
}.launchIn(viewModelScope)
|
}.launchIn(viewModelScope)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user