1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-1952 l10n | Enhancement | Send analytics about interface language (#644)

This commit is contained in:
Evgenii Kozlov 2023-12-05 17:06:41 +01:00 committed by GitHub
parent e21c68ba16
commit 0b1b9cefc1
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 133 additions and 36 deletions

View file

@ -2,4 +2,9 @@ package com.anytypeio.anytype.analytics.props
sealed class UserProperty {
data class AccountId(val id: String?) : UserProperty()
data class InterfaceLanguage(val lang: String) : UserProperty()
companion object {
const val INTERFACE_LANG_KEY = "interfaceLang"
}
}

View file

@ -52,8 +52,18 @@ class AmplitudeTracker(
private suspend fun startRegisteringUserProps() {
analytics.observeUserProperties().collect { prop: UserProperty ->
if (BuildConfig.SEND_EVENTS && prop is UserProperty.AccountId) {
tracker.setUserId(prop.id, true)
Timber.d("Setting user property: $prop")
if (BuildConfig.SEND_EVENTS) {
when(prop) {
is UserProperty.AccountId -> {
tracker.setUserId(prop.id, true)
}
is UserProperty.InterfaceLanguage -> {
tracker.setUserProperties(
JSONObject(mapOf(UserProperty.INTERFACE_LANG_KEY to prop.lang))
)
}
}
}
}
}

View file

@ -13,6 +13,7 @@ import com.anytypeio.anytype.domain.config.ConfigStorage
import com.anytypeio.anytype.domain.config.FeaturesConfigProvider
import com.anytypeio.anytype.domain.config.UserSettingsRepository
import com.anytypeio.anytype.domain.device.PathProvider
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.platform.MetricsProvider
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
@ -61,7 +62,8 @@ object MainEntryModule {
objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
checkAuthorizationStatus: CheckAuthorizationStatus,
configStorage: ConfigStorage,
spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher
spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher,
localeProvider: LocaleProvider
): MainViewModelFactory = MainViewModelFactory(
resumeAccount = resumeAccount,
analytics = analytics,
@ -73,7 +75,8 @@ object MainEntryModule {
objectTypesSubscriptionManager = objectTypesSubscriptionManager,
checkAuthorizationStatus = checkAuthorizationStatus,
configStorage = configStorage,
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher,
localeProvider = localeProvider
)
@JvmStatic

View file

@ -19,6 +19,7 @@ import com.anytypeio.anytype.domain.config.UserSettingsRepository
import com.anytypeio.anytype.domain.device.PathProvider
import com.anytypeio.anytype.domain.launch.GetDefaultObjectType
import com.anytypeio.anytype.domain.launch.SetDefaultObjectType
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.misc.UrlBuilder
import com.anytypeio.anytype.domain.page.CreateObject
import com.anytypeio.anytype.domain.platform.MetricsProvider
@ -190,4 +191,5 @@ interface SplashDependencies : ComponentDependencies {
fun metricsProvider(): MetricsProvider
fun spaceManager(): SpaceManager
fun spaceStatusWatcher(): SpaceDeletedStatusWatcher
fun localeProvider(): LocaleProvider
}

View file

@ -9,6 +9,7 @@ import com.anytypeio.anytype.domain.auth.repo.AuthRepository
import com.anytypeio.anytype.domain.config.ConfigStorage
import com.anytypeio.anytype.domain.config.FeaturesConfigProvider
import com.anytypeio.anytype.domain.device.PathProvider
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.platform.MetricsProvider
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
@ -60,4 +61,5 @@ interface OnboardingMnemonicLoginDependencies : ComponentDependencies {
fun objectTypesSubscriptionManager(): ObjectTypesSubscriptionManager
fun relationsSubscriptionManager(): RelationsSubscriptionManager
fun spaceStatusWatcher(): SpaceDeletedStatusWatcher
fun localeProvider(): LocaleProvider
}

View file

@ -12,13 +12,13 @@ import com.anytypeio.anytype.domain.block.repo.BlockRepository
import com.anytypeio.anytype.domain.config.ConfigStorage
import com.anytypeio.anytype.domain.config.UserSettingsRepository
import com.anytypeio.anytype.domain.device.PathProvider
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.`object`.SetupMobileUseCaseSkip
import com.anytypeio.anytype.domain.platform.MetricsProvider
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
import com.anytypeio.anytype.domain.spaces.SpaceDeletedStatusWatcher
import com.anytypeio.anytype.domain.workspace.SpaceManager
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
import com.anytypeio.anytype.presentation.onboarding.signup.OnboardingSetProfileNameViewModel
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
import dagger.Binds
@ -101,7 +101,6 @@ interface OnboardingSoulCreationDependencies : ComponentDependencies {
fun analytics(): Analytics
fun authRepository(): AuthRepository
fun userSettings(): UserSettingsRepository
fun workspaceManager(): WorkspaceManager
fun relationsSubscriptionManager(): RelationsSubscriptionManager
fun objectTypesSubscriptionManager(): ObjectTypesSubscriptionManager
fun pathProvider(): PathProvider
@ -109,6 +108,7 @@ interface OnboardingSoulCreationDependencies : ComponentDependencies {
fun crashReporter(): CrashReporter
fun spaceManager(): SpaceManager
fun spaceStatusWatcher(): SpaceDeletedStatusWatcher
fun localeProvider(): LocaleProvider
}
@Scope

View file

@ -13,6 +13,7 @@ import com.anytypeio.anytype.domain.block.repo.BlockRepository
import com.anytypeio.anytype.domain.config.ConfigStorage
import com.anytypeio.anytype.domain.config.UserSettingsRepository
import com.anytypeio.anytype.domain.device.PathProvider
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.`object`.SetupMobileUseCaseSkip
import com.anytypeio.anytype.domain.platform.MetricsProvider
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
@ -107,4 +108,5 @@ interface OnboardingVoidDependencies : ComponentDependencies {
fun analytics(): Analytics
fun crashReporter(): CrashReporter
fun spaceManager(): SpaceManager
fun localeProvider(): LocaleProvider
}

View file

@ -3,9 +3,11 @@ package com.anytypeio.anytype.di.main
import android.content.Context
import com.anytypeio.anytype.data.auth.other.DataDownloader
import com.anytypeio.anytype.data.auth.other.Device
import com.anytypeio.anytype.device.DefaultLocalProvider
import com.anytypeio.anytype.device.base.AndroidDevice
import com.anytypeio.anytype.device.download.AndroidDeviceDownloader
import com.anytypeio.anytype.domain.download.Downloader
import com.anytypeio.anytype.domain.misc.LocaleProvider
import dagger.Module
import dagger.Provides
import javax.inject.Singleton
@ -34,4 +36,8 @@ object DeviceModule {
context: Context
): AndroidDeviceDownloader = AndroidDeviceDownloader(context = context)
@JvmStatic
@Provides
@Singleton
fun provideLocaleProvider(context: Context): LocaleProvider = DefaultLocalProvider(context)
}

View file

@ -26,11 +26,15 @@
<TextView
android:id="@+id/error"
style="@style/TextView.UXStyle.Captions.2.Regular"
android:layout_width="wrap_content"
android:fontFamily="monospace"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="100dp"
android:layout_marginBottom="80dp"
android:text="@string/generic_error"
android:textAlignment="center"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:textColor="@color/palette_system_red"
android:visibility="invisible"
tools:ignore="SmallSp"

View file

@ -151,4 +151,6 @@ fun Long.readableFileSize(): String {
val units = arrayOf("B", "KB", "MB", "GB", "TB")
val digitGroups = (log10(this.toDouble()) / log10(1024.0)).toInt()
return DecimalFormat("#,##0.#").format(this / 1024.0.pow(digitGroups.toDouble())) + " " + units[digitGroups]
}
}
fun Throwable.msg(default: String = "Unknown error") = message ?: default

View file

@ -0,0 +1,13 @@
package com.anytypeio.anytype.device
import android.content.Context
import androidx.core.os.ConfigurationCompat
import com.anytypeio.anytype.domain.misc.LocaleProvider
class DefaultLocalProvider(
private val context: Context
): LocaleProvider {
override fun language(): String? {
return ConfigurationCompat.getLocales(context.resources.configuration)[0]?.language
}
}

View file

@ -0,0 +1,5 @@
package com.anytypeio.anytype.domain.misc
interface LocaleProvider {
fun language() : String?
}

View file

@ -41,7 +41,6 @@ import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.DVFilterCondition
import com.anytypeio.anytype.core_models.DVViewerType
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.InternalFlags
import com.anytypeio.anytype.core_models.Key
import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectWrapper
@ -1789,11 +1788,15 @@ suspend fun Analytics.sendSettingsStorageOffloadEvent() {
suspend fun Analytics.proceedWithAccountEvent(
configStorage: ConfigStorage,
startTime: Long,
eventName: String
eventName: String,
lang: String? = null
) {
val analyticsId = configStorage.get().analytics
val userProperty = UserProperty.AccountId(analyticsId)
updateUserProperty(userProperty)
if (lang != null) {
updateUserProperty(UserProperty.InterfaceLanguage(lang))
}
sendEvent(
startTime = startTime,
middleTime = System.currentTimeMillis(),

View file

@ -17,6 +17,7 @@ import com.anytypeio.anytype.domain.auth.model.AuthStatus
import com.anytypeio.anytype.domain.base.BaseUseCase
import com.anytypeio.anytype.domain.base.Interactor
import com.anytypeio.anytype.domain.config.ConfigStorage
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
import com.anytypeio.anytype.domain.spaces.SpaceDeletedStatusWatcher
@ -40,7 +41,8 @@ class MainViewModel(
private val objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
private val checkAuthorizationStatus: CheckAuthorizationStatus,
private val configStorage: ConfigStorage,
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher,
private val localeProvider: LocaleProvider
) : ViewModel() {
val wallpaper = MutableStateFlow<Wallpaper>(Wallpaper.Default)
@ -125,6 +127,12 @@ class MainViewModel(
analytics = analytics,
userProperty = UserProperty.AccountId(analyticsID)
)
localeProvider.language()?.let { lang ->
updateUserProperties(
analytics,
userProperty = UserProperty.InterfaceLanguage(lang)
)
}
}
Timber.d("Restored account after activity recreation")
},

View file

@ -8,6 +8,7 @@ import com.anytypeio.anytype.domain.auth.interactor.CheckAuthorizationStatus
import com.anytypeio.anytype.domain.auth.interactor.Logout
import com.anytypeio.anytype.domain.auth.interactor.ResumeAccount
import com.anytypeio.anytype.domain.config.ConfigStorage
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
import com.anytypeio.anytype.domain.spaces.SpaceDeletedStatusWatcher
@ -26,7 +27,8 @@ class MainViewModelFactory @Inject constructor(
private val objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
private val checkAuthorizationStatus: CheckAuthorizationStatus,
private val configStorage: ConfigStorage,
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher,
private val localeProvider: LocaleProvider
) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(
@ -42,6 +44,7 @@ class MainViewModelFactory @Inject constructor(
objectTypesSubscriptionManager = objectTypesSubscriptionManager,
checkAuthorizationStatus = checkAuthorizationStatus,
configStorage = configStorage,
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher,
localeProvider = localeProvider
) as T
}

View file

@ -19,6 +19,7 @@ import com.anytypeio.anytype.domain.auth.interactor.SelectAccount
import com.anytypeio.anytype.domain.auth.interactor.StartLoadingAccounts
import com.anytypeio.anytype.domain.config.ConfigStorage
import com.anytypeio.anytype.domain.device.PathProvider
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
import com.anytypeio.anytype.domain.spaces.SpaceDeletedStatusWatcher
@ -47,7 +48,8 @@ class OnboardingMnemonicLoginViewModel @Inject constructor(
private val objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher,
private val crashReporter: CrashReporter,
private val configStorage: ConfigStorage
private val configStorage: ConfigStorage,
private val localeProvider: LocaleProvider
) : ViewModel() {
private val jobs = mutableListOf<Job>()
@ -225,7 +227,8 @@ class OnboardingMnemonicLoginViewModel @Inject constructor(
analytics.proceedWithAccountEvent(
configStorage = configStorage,
startTime = startTime,
eventName = EventsDictionary.openAccount
eventName = EventsDictionary.openAccount,
lang = localeProvider.language()
)
crashReporter.setUser(analyticsId)
proceedWithGlobalSubscriptions()
@ -282,7 +285,8 @@ class OnboardingMnemonicLoginViewModel @Inject constructor(
private val objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher,
private val crashReporter: CrashReporter,
private val configStorage: ConfigStorage
private val configStorage: ConfigStorage,
private val localeProvider: LocaleProvider,
) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(modelClass: Class<T>): T {
@ -299,7 +303,8 @@ class OnboardingMnemonicLoginViewModel @Inject constructor(
startLoadingAccounts = startLoadingAccounts,
observeAccounts = observeAccounts,
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher,
selectAccount = selectAccount
selectAccount = selectAccount,
localeProvider = localeProvider
) as T
}
}

View file

@ -16,6 +16,7 @@ import com.anytypeio.anytype.domain.auth.interactor.SetupWallet
import com.anytypeio.anytype.domain.base.fold
import com.anytypeio.anytype.domain.config.ConfigStorage
import com.anytypeio.anytype.domain.device.PathProvider
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.`object`.SetObjectDetails
import com.anytypeio.anytype.domain.`object`.SetupMobileUseCaseSkip
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
@ -25,7 +26,6 @@ import com.anytypeio.anytype.domain.spaces.SpaceDeletedStatusWatcher
import com.anytypeio.anytype.presentation.common.BaseViewModel
import com.anytypeio.anytype.presentation.extension.proceedWithAccountEvent
import com.anytypeio.anytype.presentation.extension.sendAnalyticsOnboardingScreenEvent
import com.anytypeio.anytype.presentation.extension.sendOpenAccountEvent
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
import javax.inject.Inject
import kotlinx.coroutines.delay
@ -47,7 +47,8 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
private val crashReporter: CrashReporter,
private val relationsSubscriptionManager: RelationsSubscriptionManager,
private val objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher,
private val localeProvider: LocaleProvider
) : BaseViewModel() {
val state = MutableStateFlow<ScreenState>(ScreenState.Idle)
@ -179,7 +180,8 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
analytics.proceedWithAccountEvent(
startTime = startTime,
configStorage = configStorage,
eventName = EventsDictionary.createAccount
eventName = EventsDictionary.createAccount,
lang = localeProvider.language()
)
}
}
@ -216,7 +218,8 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
private val relationsSubscriptionManager: RelationsSubscriptionManager,
private val objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
private val crashReporter: CrashReporter,
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher,
private val localeProvider: LocaleProvider
) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(modelClass: Class<T>): T {
@ -233,7 +236,8 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
relationsSubscriptionManager = relationsSubscriptionManager,
objectTypesSubscriptionManager = objectTypesSubscriptionManager,
crashReporter = crashReporter,
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher,
localeProvider = localeProvider
) as T
}
}

View file

@ -17,10 +17,10 @@ import com.anytypeio.anytype.domain.base.Interactor
import com.anytypeio.anytype.domain.base.fold
import com.anytypeio.anytype.domain.config.ConfigStorage
import com.anytypeio.anytype.domain.device.PathProvider
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.`object`.SetupMobileUseCaseSkip
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
import com.anytypeio.anytype.presentation.auth.account.SetupNewAccountViewState
import com.anytypeio.anytype.presentation.common.BaseViewModel
import com.anytypeio.anytype.presentation.extension.proceedWithAccountEvent
import com.anytypeio.anytype.presentation.extension.sendAnalyticsOnboardingScreenEvent
@ -45,6 +45,7 @@ class OnboardingVoidViewModel @Inject constructor(
private val analytics: Analytics,
private val configStorage: ConfigStorage,
private val crashReporter: CrashReporter,
private val localeProvider: LocaleProvider
): BaseViewModel() {
val state = MutableStateFlow<ScreenState>(ScreenState.Idle)
@ -206,7 +207,8 @@ class OnboardingVoidViewModel @Inject constructor(
analytics.proceedWithAccountEvent(
startTime = startTime,
configStorage = configStorage,
eventName = EventsDictionary.createAccount
eventName = EventsDictionary.createAccount,
lang = localeProvider.language()
)
}
}
@ -234,7 +236,8 @@ class OnboardingVoidViewModel @Inject constructor(
private val logout: Logout,
private val analytics: Analytics,
private val configStorage: ConfigStorage,
private val crashReporter: CrashReporter
private val crashReporter: CrashReporter,
private val localeProvider: LocaleProvider
) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(modelClass: Class<T>): T {
@ -250,7 +253,8 @@ class OnboardingVoidViewModel @Inject constructor(
checkAuthorizationStatus = checkAuthorizationStatus,
analytics = analytics,
crashReporter = crashReporter,
configStorage = configStorage
configStorage = configStorage,
localeProvider = localeProvider
) as T
}
}

View file

@ -11,11 +11,11 @@ import com.anytypeio.anytype.core_models.FileLimitsEvent
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_utils.ext.bytesToHumanReadableSizeLocal
import com.anytypeio.anytype.core_utils.ext.cancel
import com.anytypeio.anytype.core_utils.ext.msg
import com.anytypeio.anytype.core_utils.ext.readableFileSize
import com.anytypeio.anytype.core_utils.ext.throttleFirst
import com.anytypeio.anytype.device.BuildProvider
import com.anytypeio.anytype.domain.account.DeleteAccount
import com.anytypeio.anytype.domain.auth.interactor.GetAccount
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
import com.anytypeio.anytype.domain.base.BaseUseCase
import com.anytypeio.anytype.domain.base.Interactor
@ -300,9 +300,9 @@ class FilesStorageViewModel(
)
Timber.d("Successfully deleted account, status")
},
failure = {
Timber.e(it, "Error while deleting account").also {
sendToast("Error while deleting account")
failure = { e ->
Timber.e(e, "Error while deleting account").also {
sendToast("Error while deleting account: ${e.msg()}")
}
}
)

View file

@ -24,6 +24,7 @@ import com.anytypeio.anytype.domain.auth.interactor.LaunchWallet
import com.anytypeio.anytype.domain.auth.model.AuthStatus
import com.anytypeio.anytype.domain.base.BaseUseCase
import com.anytypeio.anytype.domain.base.fold
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.page.CreateObject
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
@ -51,7 +52,8 @@ class SplashViewModel(
private val objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
private val featureToggles: FeatureToggles,
private val crashReporter: CrashReporter,
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher,
private val localeProvider: LocaleProvider
) : ViewModel() {
val state = MutableStateFlow<ViewState<Any>>(ViewState.Init)
@ -219,6 +221,12 @@ class SplashViewModel(
analytics = analytics,
userProperty = UserProperty.AccountId(id)
)
localeProvider.language()?.let { lang ->
viewModelScope.updateUserProperties(
analytics = analytics,
userProperty = UserProperty.InterfaceLanguage(lang)
)
}
}
private fun sendEvent(startTime: Long, event: String, props: Props) {

View file

@ -2,13 +2,14 @@ package com.anytypeio.anytype.presentation.splash
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.anytypeio.anytype.CrashReporter
import com.anytypeio.anytype.analytics.base.Analytics
import com.anytypeio.anytype.core_utils.tools.FeatureToggles
import com.anytypeio.anytype.domain.auth.interactor.CheckAuthorizationStatus
import com.anytypeio.anytype.domain.auth.interactor.GetLastOpenedObject
import com.anytypeio.anytype.domain.auth.interactor.LaunchAccount
import com.anytypeio.anytype.domain.auth.interactor.LaunchWallet
import com.anytypeio.anytype.CrashReporter
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.page.CreateObject
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
@ -31,7 +32,8 @@ class SplashViewModelFactory @Inject constructor(
private val objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
private val featureToggles: FeatureToggles,
private val crashReporter: CrashReporter,
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher
private val spaceDeletedStatusWatcher: SpaceDeletedStatusWatcher,
private val localeProvider: LocaleProvider
) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
@ -47,6 +49,7 @@ class SplashViewModelFactory @Inject constructor(
objectTypesSubscriptionManager = objectTypesSubscriptionManager,
featureToggles = featureToggles,
crashReporter = crashReporter,
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher,
localeProvider = localeProvider
) as T
}

View file

@ -12,6 +12,7 @@ import com.anytypeio.anytype.domain.auth.model.AuthStatus
import com.anytypeio.anytype.domain.auth.repo.AuthRepository
import com.anytypeio.anytype.domain.base.Either
import com.anytypeio.anytype.domain.block.repo.BlockRepository
import com.anytypeio.anytype.domain.misc.LocaleProvider
import com.anytypeio.anytype.domain.page.CreateObject
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
@ -76,6 +77,9 @@ class SplashViewModelTest {
@Mock
private lateinit var crashReporter: CrashReporter
@Mock
lateinit var localeProvider: LocaleProvider
lateinit var vm: SplashViewModel
@Before
@ -99,7 +103,8 @@ class SplashViewModelTest {
objectTypesSubscriptionManager = objectTypesSubscriptionManager,
featureToggles = featureToggles,
crashReporter = crashReporter,
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher
spaceDeletedStatusWatcher = spaceDeletedStatusWatcher,
localeProvider = localeProvider
)
}