DROID-2115 Onboarding | Tech | Fix import use case request (#762)
This commit is contained in:
parent
e2d3b0faf6
commit
becf81be82
|
@ -13,7 +13,7 @@ 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.`object`.ImportGetStartedUseCase
|
||||
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
||||
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||
|
@ -83,7 +83,7 @@ object OnboardingSoulCreationModule {
|
|||
fun provideSetupSkipUseCase(
|
||||
repository: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
) = SetupMobileUseCaseSkip(
|
||||
) = ImportGetStartedUseCase(
|
||||
repo = repository,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
|
|
|
@ -232,7 +232,7 @@ class BlockDataRepository(
|
|||
Undo.Result.Exhausted
|
||||
}
|
||||
|
||||
override suspend fun importUseCaseSkip(space: Id) = remote.importUseCaseSkip(space = space)
|
||||
override suspend fun importGetStartedUseCase(space: Id) = remote.importGetStartedUseCase(space = space)
|
||||
|
||||
override suspend fun redo(
|
||||
command: Command.Redo
|
||||
|
|
|
@ -74,7 +74,7 @@ interface BlockRemote {
|
|||
suspend fun createBookmarkObject(space: Id, url: Url, details: Struct): Id
|
||||
suspend fun fetchBookmarkObject(ctx: Id, url: Url)
|
||||
suspend fun undo(command: Command.Undo): Payload
|
||||
suspend fun importUseCaseSkip(space: Id)
|
||||
suspend fun importGetStartedUseCase(space: Id)
|
||||
suspend fun redo(command: Command.Redo): Payload
|
||||
suspend fun turnIntoDocument(command: Command.TurnIntoDocument): List<Id>
|
||||
suspend fun paste(command: Command.Paste): Response.Clipboard.Paste
|
||||
|
|
|
@ -132,7 +132,7 @@ interface BlockRepository {
|
|||
|
||||
suspend fun undo(command: Command.Undo): Undo.Result
|
||||
|
||||
suspend fun importUseCaseSkip(space: Id)
|
||||
suspend fun importGetStartedUseCase(space: Id)
|
||||
|
||||
suspend fun redo(command: Command.Redo): Redo.Result
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@ import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
|||
import com.anytypeio.anytype.domain.base.ResultInteractor
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
|
||||
class SetupMobileUseCaseSkip(
|
||||
class ImportGetStartedUseCase(
|
||||
private val repo: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): ResultInteractor<SetupMobileUseCaseSkip.Params, Unit>(dispatchers.io) {
|
||||
): ResultInteractor<ImportGetStartedUseCase.Params, Unit>(dispatchers.io) {
|
||||
|
||||
override suspend fun doWork(params: Params) {
|
||||
repo.importUseCaseSkip(params.space)
|
||||
repo.importGetStartedUseCase(params.space)
|
||||
}
|
||||
|
||||
data class Params(val space: Id)
|
|
@ -192,9 +192,9 @@ class BlockMiddleware(
|
|||
command: Command.Undo
|
||||
): Payload = middleware.objectUndo(command)
|
||||
|
||||
override suspend fun importUseCaseSkip(
|
||||
override suspend fun importGetStartedUseCase(
|
||||
space: Id
|
||||
) = middleware.objectImportUseCaseSkip(
|
||||
) = middleware.objectImportUseCaseGetStarted(
|
||||
space = space
|
||||
)
|
||||
|
||||
|
|
|
@ -1587,9 +1587,10 @@ class Middleware @Inject constructor(
|
|||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
fun objectImportUseCaseSkip(space: Id) {
|
||||
fun objectImportUseCaseGetStarted(space: Id) {
|
||||
val request = Rpc.Object.ImportUseCase.Request(
|
||||
spaceId = space
|
||||
spaceId = space,
|
||||
useCase = Rpc.Object.ImportUseCase.Request.UseCase.GET_STARTED
|
||||
)
|
||||
if (BuildConfig.DEBUG) logRequest(request)
|
||||
val response = service.objectImportUseCase(request)
|
||||
|
|
|
@ -17,8 +17,8 @@ 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`.ImportGetStartedUseCase
|
||||
import com.anytypeio.anytype.domain.`object`.SetObjectDetails
|
||||
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.domain.spaces.SetSpaceDetails
|
||||
|
@ -41,7 +41,7 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
|
|||
private val analytics: Analytics,
|
||||
private val createAccount: CreateAccount,
|
||||
private val setupWallet: SetupWallet,
|
||||
private val setupMobileUseCaseSkip: SetupMobileUseCaseSkip,
|
||||
private val importGetStartedUseCase: ImportGetStartedUseCase,
|
||||
private val pathProvider: PathProvider,
|
||||
private val spaceGradientProvider: SpaceGradientProvider,
|
||||
private val crashReporter: CrashReporter,
|
||||
|
@ -185,7 +185,7 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
|
|||
|
||||
private fun proceedWithSettingUpMobileUseCase(space: Id, name: String) {
|
||||
viewModelScope.launch {
|
||||
setupMobileUseCaseSkip.async(SetupMobileUseCaseSkip.Params(space)).fold(
|
||||
importGetStartedUseCase.async(ImportGetStartedUseCase.Params(space)).fold(
|
||||
onFailure = {
|
||||
proceedWithSettingAccountName(name)
|
||||
},
|
||||
|
@ -211,7 +211,7 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
|
|||
private val spaceGradientProvider: SpaceGradientProvider,
|
||||
private val createAccount: CreateAccount,
|
||||
private val setupWallet: SetupWallet,
|
||||
private val setupMobileUseCaseSkip: SetupMobileUseCaseSkip,
|
||||
private val importGetStartedUseCase: ImportGetStartedUseCase,
|
||||
private val relationsSubscriptionManager: RelationsSubscriptionManager,
|
||||
private val objectTypesSubscriptionManager: ObjectTypesSubscriptionManager,
|
||||
private val crashReporter: CrashReporter,
|
||||
|
@ -227,7 +227,7 @@ class OnboardingSetProfileNameViewModel @Inject constructor(
|
|||
analytics = analytics,
|
||||
createAccount = createAccount,
|
||||
setupWallet = setupWallet,
|
||||
setupMobileUseCaseSkip = setupMobileUseCaseSkip,
|
||||
importGetStartedUseCase = importGetStartedUseCase,
|
||||
pathProvider = pathProvider,
|
||||
spaceGradientProvider = spaceGradientProvider,
|
||||
relationsSubscriptionManager = relationsSubscriptionManager,
|
||||
|
|
|
@ -18,7 +18,7 @@ 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.`object`.ImportGetStartedUseCase
|
||||
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||
import com.anytypeio.anytype.presentation.common.BaseViewModel
|
||||
|
@ -35,7 +35,7 @@ import timber.log.Timber
|
|||
class OnboardingVoidViewModel @Inject constructor(
|
||||
private val createAccount: CreateAccount,
|
||||
private val setupWallet: SetupWallet,
|
||||
private val setupMobileUseCaseSkip: SetupMobileUseCaseSkip,
|
||||
private val importGetStartedUseCase: ImportGetStartedUseCase,
|
||||
private val pathProvider: PathProvider,
|
||||
private val spaceGradientProvider: SpaceGradientProvider,
|
||||
private val relationsSubscriptionManager: RelationsSubscriptionManager,
|
||||
|
@ -123,7 +123,7 @@ class OnboardingVoidViewModel @Inject constructor(
|
|||
|
||||
private fun proceedWithSettingUpMobileUseCase(space: Id) {
|
||||
viewModelScope.launch {
|
||||
setupMobileUseCaseSkip.async(SetupMobileUseCaseSkip.Params(space)).fold(
|
||||
importGetStartedUseCase.async(ImportGetStartedUseCase.Params(space)).fold(
|
||||
onFailure = {
|
||||
Timber.e(it, "Error while importing use case")
|
||||
navigation.emit(Navigation.NavigateToMnemonic)
|
||||
|
@ -228,7 +228,7 @@ class OnboardingVoidViewModel @Inject constructor(
|
|||
class Factory @Inject constructor(
|
||||
private val createAccount: CreateAccount,
|
||||
private val setupWallet: SetupWallet,
|
||||
private val setupMobileUseCaseSkip: SetupMobileUseCaseSkip,
|
||||
private val importGetStartedUseCase: ImportGetStartedUseCase,
|
||||
private val pathProvider: PathProvider,
|
||||
private val spaceGradientProvider: SpaceGradientProvider,
|
||||
private val relationsSubscriptionManager: RelationsSubscriptionManager,
|
||||
|
@ -245,7 +245,7 @@ class OnboardingVoidViewModel @Inject constructor(
|
|||
return OnboardingVoidViewModel(
|
||||
createAccount = createAccount,
|
||||
setupWallet = setupWallet,
|
||||
setupMobileUseCaseSkip = setupMobileUseCaseSkip,
|
||||
importGetStartedUseCase = importGetStartedUseCase,
|
||||
pathProvider = pathProvider,
|
||||
spaceGradientProvider = spaceGradientProvider,
|
||||
relationsSubscriptionManager = relationsSubscriptionManager,
|
||||
|
|
Loading…
Reference in New Issue