mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2758 Analytics | Fix | Fix onboarding analytics (#1500)
This commit is contained in:
parent
2ad338501e
commit
1705151670
5 changed files with 35 additions and 26 deletions
|
@ -253,7 +253,8 @@ object EventsDictionary {
|
|||
}
|
||||
|
||||
enum class ScreenOnboardingStep(val value: String) {
|
||||
VOID("Void"),
|
||||
VAULT("Vault"),
|
||||
SOUL("Soul"),
|
||||
PHRASE("Phrase")
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ import com.anytypeio.anytype.presentation.onboarding.OnboardingStartViewModel
|
|||
import com.anytypeio.anytype.presentation.onboarding.OnboardingStartViewModel.SideEffect
|
||||
import com.anytypeio.anytype.presentation.onboarding.OnboardingViewModel
|
||||
import com.anytypeio.anytype.presentation.onboarding.login.OnboardingMnemonicLoginViewModel
|
||||
import com.anytypeio.anytype.presentation.onboarding.signup.OnboardingMnemonicViewModel
|
||||
import com.anytypeio.anytype.presentation.onboarding.signup.OnboardingSetProfileNameViewModel
|
||||
import com.anytypeio.anytype.ui.home.HomeScreenFragment
|
||||
import com.anytypeio.anytype.ui.onboarding.screens.AuthScreenWrapper
|
||||
|
@ -545,18 +546,6 @@ class OnboardingFragment : Fragment() {
|
|||
val vm = daggerViewModel { component.get().getViewModel() }
|
||||
MnemonicPhraseScreenWrapper(
|
||||
viewModel = vm,
|
||||
onCheckLaterClicked = {
|
||||
findNavController().navigate(
|
||||
R.id.action_openHome,
|
||||
HomeScreenFragment.args(deepLink)
|
||||
)
|
||||
},
|
||||
onGoToAppClicked = {
|
||||
findNavController().navigate(
|
||||
R.id.action_openHome,
|
||||
HomeScreenFragment.args(deepLink)
|
||||
)
|
||||
},
|
||||
copyMnemonicToClipboard = ::copyMnemonicToClipboard,
|
||||
vm = vm,
|
||||
mnemonicColorPalette = mnemonicColorPalette
|
||||
|
@ -564,6 +553,22 @@ class OnboardingFragment : Fragment() {
|
|||
DisposableEffect(Unit) {
|
||||
onDispose { component.release() }
|
||||
}
|
||||
LaunchedEffect(Unit) {
|
||||
vm.commands.collect { command ->
|
||||
when(command) {
|
||||
OnboardingMnemonicViewModel.Command.OpenHome -> {
|
||||
runCatching {
|
||||
findNavController().navigate(
|
||||
R.id.action_openHome,
|
||||
HomeScreenFragment.args(deepLink)
|
||||
)
|
||||
}.onFailure {
|
||||
Timber.e(it, "Error while navigation to home")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyMnemonicToClipboard(mnemonicPhrase: String) {
|
||||
|
|
|
@ -52,8 +52,6 @@ import com.anytypeio.anytype.ui.onboarding.MnemonicStub
|
|||
@Composable
|
||||
fun MnemonicPhraseScreenWrapper(
|
||||
viewModel: OnboardingMnemonicViewModel,
|
||||
onCheckLaterClicked: () -> Unit,
|
||||
onGoToAppClicked: () -> Unit,
|
||||
copyMnemonicToClipboard: (String) -> Unit,
|
||||
vm: OnboardingMnemonicViewModel,
|
||||
mnemonicColorPalette: List<Color>
|
||||
|
@ -62,18 +60,10 @@ fun MnemonicPhraseScreenWrapper(
|
|||
MnemonicPhraseScreen(
|
||||
state = state,
|
||||
reviewMnemonic = { viewModel.openMnemonic() },
|
||||
onCheckLaterClicked = {
|
||||
onCheckLaterClicked().also {
|
||||
vm.onCheckLaterClicked()
|
||||
}
|
||||
},
|
||||
onCheckLaterClicked = vm::onCheckLaterClicked,
|
||||
copyMnemonicToClipboard = copyMnemonicToClipboard,
|
||||
mnemonicColorPalette = mnemonicColorPalette,
|
||||
onGoToAppClicked = {
|
||||
onGoToAppClicked().also {
|
||||
vm.onGoToTheAppClicked()
|
||||
}
|
||||
}
|
||||
onGoToAppClicked = vm::onGoToTheAppClicked
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.anytypeio.anytype.presentation.extension.sendAnalyticsOnboardingClick
|
|||
import com.anytypeio.anytype.presentation.extension.sendAnalyticsOnboardingScreenEvent
|
||||
import com.anytypeio.anytype.presentation.extension.sendOpenAccountEvent
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
|
@ -22,6 +23,7 @@ class OnboardingMnemonicViewModel @Inject constructor(
|
|||
) : ViewModel() {
|
||||
|
||||
val state = MutableStateFlow<State>(State.Idle(""))
|
||||
val commands = MutableSharedFlow<Command>()
|
||||
|
||||
init {
|
||||
Timber.i("OnboardingMnemonicViewModel, init")
|
||||
|
@ -56,7 +58,10 @@ class OnboardingMnemonicViewModel @Inject constructor(
|
|||
analytics.sendOpenAccountEvent(
|
||||
analytics = config.analytics
|
||||
)
|
||||
} else {
|
||||
Timber.w("config was missing before the end of onboarding")
|
||||
}
|
||||
commands.emit(Command.OpenHome)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +72,10 @@ class OnboardingMnemonicViewModel @Inject constructor(
|
|||
analytics.sendOpenAccountEvent(
|
||||
analytics = config.analytics
|
||||
)
|
||||
} else {
|
||||
Timber.w("config was missing before the end of onboarding")
|
||||
}
|
||||
commands.emit(Command.OpenHome)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,4 +113,7 @@ class OnboardingMnemonicViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
sealed class Command {
|
||||
data object OpenHome : Command()
|
||||
}
|
||||
}
|
|
@ -51,7 +51,7 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
|
|||
Timber.i("OnboardingSetProfileNameViewModel, init")
|
||||
viewModelScope.launch {
|
||||
sendAnalyticsOnboardingScreenEvent(analytics,
|
||||
EventsDictionary.ScreenOnboardingStep.VOID
|
||||
EventsDictionary.ScreenOnboardingStep.SOUL
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -122,6 +122,8 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
|
|||
crashReporter.setUser(config.analytics)
|
||||
setupGlobalSubscriptions()
|
||||
proceedWithSettingUpMobileUseCase(config.space, name)
|
||||
} else {
|
||||
Timber.w("Config was missing after account creation")
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue