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

DROID-3151 Spaces | Enhancement | Apply empty use if user has more than two spaces when creating new space (#1907)

This commit is contained in:
Evgenii Kozlov 2024-12-11 22:18:15 +01:00 committed by Evgenii Kozlov
parent 2b751772fc
commit a7274257f3
9 changed files with 43 additions and 20 deletions

View file

@ -730,12 +730,8 @@ class BlockMiddleware(
middleware.spaceDelete(space)
}
override suspend fun createWorkspace(
details: Struct,
withChat: Boolean
): Id = middleware.workspaceCreate(
details = details,
withChat = withChat
override suspend fun createWorkspace(command: Command.CreateSpace): Id = middleware.workspaceCreate(
command = command
)
override suspend fun getSpaceConfig(space: Id): Config = middleware.workspaceOpen(

View file

@ -1935,11 +1935,14 @@ class Middleware @Inject constructor(
}
@Throws(Exception::class)
fun workspaceCreate(details: Struct, withChat: Boolean): Id {
fun workspaceCreate(command: Command.CreateSpace): Id {
val request = Rpc.Workspace.Create.Request(
details = details,
useCase = Rpc.Object.ImportUseCase.Request.UseCase.GET_STARTED,
withChat = withChat
details = command.details,
useCase = if (command.shouldApplyEmptyUseCase)
Rpc.Object.ImportUseCase.Request.UseCase.EMPTY
else
Rpc.Object.ImportUseCase.Request.UseCase.GET_STARTED,
withChat = command.withChat
)
logRequestIfDebug(request)
val (response, time) = measureTimedValue { service.workspaceCreate(request) }