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:
parent
fd5fcb50e8
commit
fc286ee1cb
8 changed files with 23 additions and 29 deletions
|
@ -30,7 +30,7 @@ import com.anytypeio.anytype.app.DefaultAppActionManager
|
|||
import com.anytypeio.anytype.core_models.Relations
|
||||
import com.anytypeio.anytype.core_models.ThemeMode
|
||||
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.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.Mimetype
|
||||
import com.anytypeio.anytype.core_utils.ext.parseActionSendMultipleUris
|
||||
|
@ -238,7 +238,7 @@ class MainActivity : AppCompatActivity(R.layout.activity_main), AppNavigation.Pr
|
|||
runCatching {
|
||||
val controller = findNavController(R.id.fragment)
|
||||
controller.popBackStack(R.id.vaultScreen, false)
|
||||
if (effect.chat != null && effect.spaceType == SpaceType.CHAT) {
|
||||
if (effect.chat != null && effect.spaceUxType == SpaceUxType.CHAT) {
|
||||
controller.navigate(
|
||||
R.id.actionOpenChatFromVault,
|
||||
ChatFragment.args(
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.anytypeio.anytype.core_models.ext.typeOf
|
|||
import com.anytypeio.anytype.core_models.multiplayer.ParticipantStatus
|
||||
import com.anytypeio.anytype.core_models.multiplayer.SpaceAccessType
|
||||
import com.anytypeio.anytype.core_models.multiplayer.SpaceMemberPermissions
|
||||
import com.anytypeio.anytype.core_models.multiplayer.SpaceType
|
||||
import com.anytypeio.anytype.core_models.multiplayer.SpaceUxType
|
||||
import com.anytypeio.anytype.core_models.restrictions.ObjectRestriction
|
||||
import com.anytypeio.anytype.core_models.restrictions.SpaceStatus
|
||||
|
||||
|
@ -332,10 +332,10 @@ sealed class ObjectWrapper {
|
|||
.firstOrNull { it.code == code?.toInt() }
|
||||
}
|
||||
|
||||
val spaceType: SpaceType?
|
||||
val spaceUxType: SpaceUxType?
|
||||
get() {
|
||||
val code = getValue<Double?>(Relations.SPACE_TYPE)
|
||||
return SpaceType
|
||||
val code = getValue<Double?>(Relations.SPACE_UX_TYPE)
|
||||
return SpaceUxType
|
||||
.entries
|
||||
.firstOrNull { it.code == code?.toInt() }
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ object Relations {
|
|||
const val FEATURED_RELATIONS = "featuredRelations"
|
||||
const val SNIPPET = "snippet"
|
||||
const val SPACE_ID = "spaceId"
|
||||
const val SPACE_TYPE = "spaceType"
|
||||
const val SPACE_UX_TYPE = "spaceUxType"
|
||||
const val TARGET_SPACE_ID = "targetSpaceId"
|
||||
const val SET_OF = "setOf"
|
||||
const val URL = "url"
|
||||
|
|
|
@ -55,7 +55,7 @@ enum class SpaceAccessType(val code: Int) {
|
|||
SHARED(2)
|
||||
}
|
||||
|
||||
enum class SpaceType(val code: Int) {
|
||||
enum class SpaceUxType(val code: Int) {
|
||||
DATA(0),
|
||||
CHAT(1)
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ interface SpaceViewSubscriptionContainer {
|
|||
subscription = GLOBAL_SUBSCRIPTION,
|
||||
keys = listOf(
|
||||
Relations.ID,
|
||||
Relations.SPACE_TYPE,
|
||||
Relations.SPACE_UX_TYPE,
|
||||
Relations.TARGET_SPACE_ID,
|
||||
Relations.CHAT_ID,
|
||||
Relations.SPACE_ACCOUNT_STATUS,
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue