mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3252 Space-level chat | Fix | Apply feature-toggle (#2004)
This commit is contained in:
parent
55c8f277cc
commit
5f564c8261
8 changed files with 31 additions and 53 deletions
|
@ -23,11 +23,4 @@ class DefaultFeatureToggles @Inject constructor(
|
|||
override val isAutoUpdateEnabled: Boolean = false
|
||||
|
||||
override val isConciseLogging: Boolean = true
|
||||
|
||||
override val enableDiscussionDemo: Boolean = true
|
||||
|
||||
override val isSpaceLevelChatWidgetEnabled: Boolean
|
||||
get() = false
|
||||
|
||||
override val isNewSpaceHomeEnabled: Boolean = buildProvider.isDebug()
|
||||
}
|
|
@ -497,33 +497,11 @@ class HomeScreenFragment : BaseComposeFragment(),
|
|||
componentManager().homeScreenComponent.release()
|
||||
}
|
||||
|
||||
override fun onApplyWindowRootInsets(view: View) {
|
||||
if (featureToggles.isNewSpaceHomeEnabled || spacesWithSpaceLevelChat.contains(space)) {
|
||||
// Do nothing.
|
||||
} else {
|
||||
super.onApplyWindowRootInsets(view)
|
||||
}
|
||||
// Do not apply window insets on fragment container.
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val SHOW_MNEMONIC_KEY = "arg.home-screen.show-mnemonic"
|
||||
const val DEEP_LINK_KEY = "arg.home-screen.deep-link"
|
||||
const val SPACE_ID_KEY = "arg.home-screen.space-id"
|
||||
|
||||
/**
|
||||
* Spaces for beta-testing space-level chats
|
||||
*/
|
||||
|
||||
val spacesWithSpaceLevelChat = listOf(
|
||||
"bafyreiezhzb4ggnhjwejmh67pd5grilk6jn3jt7y2rnfpbkjwekilreola.1t123w9f2lgn5",
|
||||
"bafyreifikxj75r4duzhqxqelmi66rwlzqml5jnad35dnukxwlawtfrql5a.21584urzltddb",
|
||||
"bafyreia4jsiobrq7ptpuxsv6nmpj4vis7o5p73yibjb5w4crhxl2oqocoq.9tkr2p3mb0pj",
|
||||
"bafyreibj7du7epctmeiwix7ccjiyogfew36eztgfob4mgmi6ulcwzqatcy.2t4tpsucpkt93",
|
||||
"bafyreihzeo4dd3zvw7pkoztwit6edjku6w3jfrfnserxm6slmc6qiu2sim.3rqqcnrgm797n",
|
||||
"bafyreig67rszl52id767endswgzordgg4pj6hpx7dw3cjrvoimehqonb4q.2t4tpsucpkt93"
|
||||
)
|
||||
|
||||
fun args(
|
||||
space: Id,
|
||||
deeplink: String? = null
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.anytypeio.anytype.core_utils.ui.ViewState
|
|||
import com.anytypeio.anytype.databinding.FragmentSplashBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.other.DefaultDeepLinkResolver
|
||||
import com.anytypeio.anytype.presentation.confgs.ChatConfig
|
||||
import com.anytypeio.anytype.presentation.splash.SplashViewModel
|
||||
import com.anytypeio.anytype.presentation.splash.SplashViewModelFactory
|
||||
import com.anytypeio.anytype.ui.chats.ChatFragment
|
||||
|
@ -152,7 +153,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>(R.layout.fragment_spl
|
|||
runCatching {
|
||||
findNavController().navigate(R.id.actionOpenVaultFromSplash)
|
||||
val chat = command.chat
|
||||
if (chat == null) {
|
||||
if (chat == null || !ChatConfig.isChatAllowed(space = command.space)) {
|
||||
findNavController().navigate(
|
||||
R.id.actionOpenSpaceFromVault,
|
||||
args = HomeScreenFragment.args(
|
||||
|
@ -184,7 +185,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>(R.layout.fragment_spl
|
|||
runCatching {
|
||||
findNavController().navigate(R.id.actionOpenVaultFromSplash)
|
||||
val chat = command.chat
|
||||
if (chat == null) {
|
||||
if (chat == null || !ChatConfig.isChatAllowed(space = command.space)) {
|
||||
findNavController().navigate(
|
||||
R.id.actionOpenSpaceFromVault,
|
||||
args = HomeScreenFragment.args(
|
||||
|
@ -216,7 +217,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>(R.layout.fragment_spl
|
|||
runCatching {
|
||||
findNavController().navigate(R.id.actionOpenVaultFromSplash)
|
||||
val chat = command.chat
|
||||
if (chat == null) {
|
||||
if (chat == null || !ChatConfig.isChatAllowed(space = command.space)) {
|
||||
findNavController().navigate(
|
||||
R.id.actionOpenSpaceFromVault,
|
||||
args = HomeScreenFragment.args(
|
||||
|
|
|
@ -1,22 +1,10 @@
|
|||
package com.anytypeio.anytype.core_utils.tools
|
||||
|
||||
interface FeatureToggles {
|
||||
|
||||
val isAutoUpdateEnabled: Boolean
|
||||
|
||||
val isLogFromGoProcess: Boolean
|
||||
|
||||
val isLogMiddlewareInteraction: Boolean
|
||||
|
||||
val isConciseLogging: Boolean
|
||||
|
||||
val isLogEditorViewModelEvents: Boolean
|
||||
|
||||
val isLogEditorControlPanelMachine: Boolean
|
||||
|
||||
val enableDiscussionDemo: Boolean
|
||||
|
||||
val isSpaceLevelChatWidgetEnabled: Boolean
|
||||
|
||||
val isNewSpaceHomeEnabled: Boolean
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.anytypeio.anytype.core_models.Block
|
|||
import com.anytypeio.anytype.core_models.Hash
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.ObjectWrapper
|
||||
import com.anytypeio.anytype.feature_chats.BuildConfig
|
||||
import com.anytypeio.anytype.presentation.objects.ObjectIcon
|
||||
import com.anytypeio.anytype.presentation.search.GlobalSearchItemView
|
||||
|
||||
|
@ -88,8 +89,4 @@ sealed interface ChatView {
|
|||
data class Image(val hash: Hash): Avatar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object ChatConfig {
|
||||
const val MAX_ATTACHMENT_COUNT = 10
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.anytypeio.anytype.presentation.confgs
|
||||
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.presentation.BuildConfig
|
||||
|
||||
object ChatConfig {
|
||||
const val MAX_ATTACHMENT_COUNT = 10
|
||||
|
||||
/**
|
||||
* Spaces for beta-testing space-level chats
|
||||
*/
|
||||
val spacesWithSpaceLevelChat = listOf(
|
||||
"bafyreiezhzb4ggnhjwejmh67pd5grilk6jn3jt7y2rnfpbkjwekilreola.1t123w9f2lgn5",
|
||||
"bafyreifikxj75r4duzhqxqelmi66rwlzqml5jnad35dnukxwlawtfrql5a.21584urzltddb",
|
||||
"bafyreia4jsiobrq7ptpuxsv6nmpj4vis7o5p73yibjb5w4crhxl2oqocoq.9tkr2p3mb0pj",
|
||||
"bafyreibj7du7epctmeiwix7ccjiyogfew36eztgfob4mgmi6ulcwzqatcy.2t4tpsucpkt93",
|
||||
"bafyreihzeo4dd3zvw7pkoztwit6edjku6w3jfrfnserxm6slmc6qiu2sim.3rqqcnrgm797n",
|
||||
"bafyreig67rszl52id767endswgzordgg4pj6hpx7dw3cjrvoimehqonb4q.2t4tpsucpkt93"
|
||||
)
|
||||
|
||||
fun isChatAllowed(space: Id): Boolean {
|
||||
return BuildConfig.DEBUG || spacesWithSpaceLevelChat.contains(space)
|
||||
}
|
||||
}
|
|
@ -240,7 +240,6 @@ class HomeScreenViewModel(
|
|||
private val treeWidgetBranchStateHolder = TreeWidgetBranchStateHolder()
|
||||
|
||||
private val allContentWidget = AllContentWidgetContainer()
|
||||
private val spaceChatWidget = SpaceChatWidgetContainer()
|
||||
|
||||
private val spaceWidgetView = spaceWidgetContainer.view
|
||||
|
||||
|
@ -414,9 +413,6 @@ class HomeScreenViewModel(
|
|||
combine(
|
||||
flows = buildList<Flow<WidgetView>> {
|
||||
add(spaceWidgetView)
|
||||
if (featureToggles.isSpaceLevelChatWidgetEnabled) {
|
||||
add(spaceChatWidget.view)
|
||||
}
|
||||
add(allContentWidget.view)
|
||||
addAll(list.map { m -> m.view })
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.anytypeio.anytype.domain.vault.SetVaultSpaceOrder
|
|||
import com.anytypeio.anytype.domain.wallpaper.GetSpaceWallpapers
|
||||
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||
import com.anytypeio.anytype.presentation.BuildConfig
|
||||
import com.anytypeio.anytype.presentation.confgs.ChatConfig
|
||||
import com.anytypeio.anytype.presentation.home.OpenObjectNavigation
|
||||
import com.anytypeio.anytype.presentation.home.navigation
|
||||
import com.anytypeio.anytype.presentation.navigation.DeepLinkToObjectDelegate
|
||||
|
@ -258,7 +259,7 @@ class VaultViewModel(
|
|||
Timber.e(it, "Error while saving current space on vault screen")
|
||||
},
|
||||
onSuccess = {
|
||||
if (chat != null) {
|
||||
if (chat != null && ChatConfig.isChatAllowed(space = targetSpace)) {
|
||||
commands.emit(
|
||||
Command.EnterSpaceLevelChat(
|
||||
space = Space(targetSpace),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue