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

DROID-3662 Spaces | Fix | Introduce 'SpaceUxType' relation (#2430)

This commit is contained in:
Evgenii Kozlov 2025-05-22 11:50:23 +02:00 committed by GitHub
parent fd5fcb50e8
commit fc286ee1cb
Signed by: github
GPG key ID: B5690EEEBB952194
8 changed files with 23 additions and 29 deletions

View file

@ -12,7 +12,7 @@ import com.anytypeio.anytype.core_models.NotificationPayload
import com.anytypeio.anytype.core_models.NotificationStatus
import com.anytypeio.anytype.core_models.Wallpaper
import com.anytypeio.anytype.core_models.exceptions.NeedToUpdateApplicationException
import com.anytypeio.anytype.core_models.multiplayer.SpaceType
import com.anytypeio.anytype.core_models.multiplayer.SpaceUxType
import com.anytypeio.anytype.core_utils.ext.cancel
import com.anytypeio.anytype.domain.account.AwaitAccountStartManager
import com.anytypeio.anytype.domain.account.InterceptAccountStatus
@ -512,7 +512,7 @@ class MainViewModel(
data class SwitchSpace(
val home: Id,
val chat: Id? = null,
val spaceType: SpaceType? = null
val spaceUxType: SpaceUxType? = null
): SideEffect()
}
}

View file

@ -18,10 +18,9 @@ import com.anytypeio.anytype.core_models.ObjectTypeIds.COLLECTION
import com.anytypeio.anytype.core_models.SupportedLayouts
import com.anytypeio.anytype.core_models.exceptions.AccountMigrationNeededException
import com.anytypeio.anytype.core_models.exceptions.NeedToUpdateApplicationException
import com.anytypeio.anytype.core_models.multiplayer.SpaceType
import com.anytypeio.anytype.core_models.multiplayer.SpaceUxType
import com.anytypeio.anytype.core_models.primitives.SpaceId
import com.anytypeio.anytype.core_models.primitives.TypeKey
import com.anytypeio.anytype.core_models.restrictions.SpaceStatus
import com.anytypeio.anytype.domain.auth.interactor.CheckAuthorizationStatus
import com.anytypeio.anytype.domain.auth.interactor.GetLastOpenedObject
import com.anytypeio.anytype.domain.auth.interactor.LaunchAccount
@ -41,10 +40,8 @@ import com.anytypeio.anytype.presentation.auth.account.MigrationHelperDelegate
import com.anytypeio.anytype.presentation.confgs.ChatConfig
import com.anytypeio.anytype.presentation.extension.sendAnalyticsObjectCreateEvent
import com.anytypeio.anytype.presentation.search.ObjectSearchConstants
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterNot
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.flatMapLatest
@ -258,7 +255,7 @@ class SplashViewModel(
Command.NavigateToObjectSet(
id = target,
space = spaceId,
chat = if (view.spaceType == SpaceType.CHAT) view.chatId else null
chat = if (view.spaceUxType == SpaceUxType.CHAT) view.chatId else null
)
)
} else {
@ -266,7 +263,7 @@ class SplashViewModel(
Command.NavigateToObject(
id = target,
space = spaceId,
chat = if (view.spaceType == SpaceType.CHAT) view.chatId else null
chat = if (view.spaceUxType == SpaceUxType.CHAT) view.chatId else null
)
)
}
@ -318,7 +315,7 @@ class SplashViewModel(
Command.NavigateToObjectSet(
id = id,
space = space,
chat = if (view.spaceType == SpaceType.CHAT) view.chatId else null
chat = if (view.spaceUxType == SpaceUxType.CHAT) view.chatId else null
)
)
ObjectType.Layout.DATE -> {
@ -326,7 +323,7 @@ class SplashViewModel(
Command.NavigateToDateObject(
id = id,
space = space,
chat = if (view.spaceType == SpaceType.CHAT) view.chatId else null
chat = if (view.spaceUxType == SpaceUxType.CHAT) view.chatId else null
)
)
}
@ -335,7 +332,7 @@ class SplashViewModel(
Command.NavigateToObjectType(
id = id,
space = space,
chat = if (view.spaceType == SpaceType.CHAT) view.chatId else null
chat = if (view.spaceUxType == SpaceUxType.CHAT) view.chatId else null
)
)
}
@ -344,7 +341,7 @@ class SplashViewModel(
Command.NavigateToObject(
id = id,
space = space,
chat = if (view.spaceType == SpaceType.CHAT) view.chatId else null
chat = if (view.spaceUxType == SpaceUxType.CHAT) view.chatId else null
)
)
}
@ -401,7 +398,7 @@ class SplashViewModel(
)
)
}
view.spaceType == SpaceType.CHAT -> {
view.spaceUxType == SpaceUxType.CHAT -> {
commands.emit(
Command.NavigateToSpaceLevelChat(
space = space.id,

View file

@ -8,16 +8,13 @@ import com.anytypeio.anytype.analytics.base.EventsDictionary
import com.anytypeio.anytype.analytics.base.EventsPropertiesKey
import com.anytypeio.anytype.analytics.base.sendEvent
import com.anytypeio.anytype.analytics.props.Props
import com.anytypeio.anytype.core_models.Event
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ObjectWrapper
import com.anytypeio.anytype.core_models.Wallpaper
import com.anytypeio.anytype.core_models.multiplayer.SpaceType
import com.anytypeio.anytype.core_models.multiplayer.SpaceUxType
import com.anytypeio.anytype.core_models.primitives.Space
import com.anytypeio.anytype.core_models.primitives.SpaceId
import com.anytypeio.anytype.domain.base.fold
import com.anytypeio.anytype.domain.base.onFailure
import com.anytypeio.anytype.domain.base.onSuccess
import com.anytypeio.anytype.domain.misc.AppActionManager
import com.anytypeio.anytype.domain.misc.DeepLinkResolver
import com.anytypeio.anytype.domain.misc.UrlBuilder
@ -149,7 +146,7 @@ class VaultViewModel(
proceedWithSavingCurrentSpace(
targetSpace = targetSpace,
chat = view.space.chatId?.ifEmpty { null },
spaceType = view.space.spaceType
spaceUxType = view.space.spaceUxType
)
}
)
@ -255,7 +252,7 @@ class VaultViewModel(
private suspend fun proceedWithSavingCurrentSpace(
targetSpace: String,
chat: Id?,
spaceType: SpaceType?
spaceUxType: SpaceUxType?
) {
saveCurrentSpace.async(
SaveCurrentSpace.Params(SpaceId(targetSpace))
@ -264,7 +261,7 @@ class VaultViewModel(
Timber.e(it, "Error while saving current space on vault screen")
},
onSuccess = {
if (spaceType == SpaceType.CHAT && chat != null && ChatConfig.isChatAllowed(space = targetSpace)) {
if (spaceUxType == SpaceUxType.CHAT && chat != null && ChatConfig.isChatAllowed(space = targetSpace)) {
commands.emit(
Command.EnterSpaceLevelChat(
space = Space(targetSpace),