mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-1734 Analytics | Fix | Events for space and account settings (#530)
This commit is contained in:
parent
5f642f6b99
commit
400417deac
5 changed files with 21 additions and 11 deletions
|
@ -20,6 +20,7 @@ object EventsDictionary {
|
|||
// Settings events
|
||||
|
||||
const val screenSettingSpacesSpaceIndex = "ScreenSettingsSpaceIndex"
|
||||
const val screenSettingsAccount = "ScreenSettingsAccount"
|
||||
const val clickDeleteSpace = "ClickDeleteSpace"
|
||||
const val clickDeleteSpaceWarning = "ClickDeleteSpaceWarning"
|
||||
const val deleteSpace = "DeleteSpace"
|
||||
|
|
|
@ -48,8 +48,7 @@ object ProfileModule {
|
|||
setObjectDetails: SetObjectDetails,
|
||||
configStorage: ConfigStorage,
|
||||
urlBuilder: UrlBuilder,
|
||||
setDocumentImageIcon: SetDocumentImageIcon,
|
||||
spaceGradientProvider: SpaceGradientProvider
|
||||
setDocumentImageIcon: SetDocumentImageIcon
|
||||
): ProfileSettingsViewModel.Factory = ProfileSettingsViewModel.Factory(
|
||||
deleteAccount = deleteAccount,
|
||||
analytics = analytics,
|
||||
|
@ -57,8 +56,7 @@ object ProfileModule {
|
|||
setObjectDetails = setObjectDetails,
|
||||
configStorage = configStorage,
|
||||
urlBuilder = urlBuilder,
|
||||
setDocumentImageIcon = setDocumentImageIcon,
|
||||
spaceGradientProvider = spaceGradientProvider
|
||||
setDocumentImageIcon = setDocumentImageIcon
|
||||
)
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -35,6 +35,7 @@ import kotlinx.coroutines.flow.stateIn
|
|||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
|
||||
@Deprecated("Legacy. To be deleted")
|
||||
class MainSettingsViewModel(
|
||||
private val analytics: Analytics,
|
||||
private val storelessSubscriptionContainer: StorelessSubscriptionContainer,
|
||||
|
|
|
@ -55,6 +55,12 @@ class SpaceSettingsViewModel(
|
|||
val spaceViewState = MutableStateFlow<ViewState<SpaceData>>(ViewState.Init)
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
analytics.sendEvent(
|
||||
eventName = EventsDictionary.screenSettingSpacesSpaceIndex
|
||||
)
|
||||
}
|
||||
|
||||
viewModelScope.launch {
|
||||
spaceManager
|
||||
.observe()
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.anytypeio.anytype.presentation.common.BaseViewModel
|
|||
import com.anytypeio.anytype.presentation.extension.sendScreenSettingsDeleteEvent
|
||||
import com.anytypeio.anytype.presentation.profile.ProfileIconView
|
||||
import com.anytypeio.anytype.presentation.profile.profileIcon
|
||||
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
|
@ -39,8 +38,7 @@ class ProfileSettingsViewModel(
|
|||
private val setObjectDetails: SetObjectDetails,
|
||||
private val configStorage: ConfigStorage,
|
||||
private val urlBuilder: UrlBuilder,
|
||||
private val setImageIcon: SetDocumentImageIcon,
|
||||
private val spaceGradientProvider: SpaceGradientProvider
|
||||
private val setImageIcon: SetDocumentImageIcon
|
||||
) : BaseViewModel() {
|
||||
|
||||
private val jobs = mutableListOf<Job>()
|
||||
|
@ -74,6 +72,14 @@ class ProfileSettingsViewModel(
|
|||
AccountProfile.Idle
|
||||
)
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
analytics.sendEvent(
|
||||
eventName = EventsDictionary.screenSettingsAccount
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun onNameChange(name: String) {
|
||||
Timber.d("onNameChange, name:[$name]")
|
||||
viewModelScope.launch {
|
||||
|
@ -163,8 +169,7 @@ class ProfileSettingsViewModel(
|
|||
private val setObjectDetails: SetObjectDetails,
|
||||
private val configStorage: ConfigStorage,
|
||||
private val urlBuilder: UrlBuilder,
|
||||
private val setDocumentImageIcon: SetDocumentImageIcon,
|
||||
private val spaceGradientProvider: SpaceGradientProvider
|
||||
private val setDocumentImageIcon: SetDocumentImageIcon
|
||||
) : ViewModelProvider.Factory {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
|
@ -175,8 +180,7 @@ class ProfileSettingsViewModel(
|
|||
setObjectDetails = setObjectDetails,
|
||||
configStorage = configStorage,
|
||||
urlBuilder = urlBuilder,
|
||||
setImageIcon = setDocumentImageIcon,
|
||||
spaceGradientProvider = spaceGradientProvider
|
||||
setImageIcon = setDocumentImageIcon
|
||||
) as T
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue