DROID-1654 App | Feature | Multispaces + Misc. enhancements (#300)
Co-authored-by: Konstantin Ivanov <54908981+konstantiniiv@users.noreply.github.com>
This commit is contained in:
parent
490e97589c
commit
5886fc1ae5
|
@ -1,4 +1,4 @@
|
||||||
version.versionMajor=0
|
version.versionMajor=0
|
||||||
version.versionMinor=26
|
version.versionMinor=26
|
||||||
version.versionPatch=0
|
version.versionPatch=0
|
||||||
version.useDatedVersionName=false
|
version.useDatedVersionName=false
|
|
@ -18,7 +18,6 @@ import com.anytypeio.anytype.domain.device.PathProvider
|
||||||
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
||||||
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
|
||||||
import com.anytypeio.anytype.features.auth.fragments.TestSetupSelectedAccountFragment
|
import com.anytypeio.anytype.features.auth.fragments.TestSetupSelectedAccountFragment
|
||||||
import com.anytypeio.anytype.presentation.auth.account.SetupSelectedAccountViewModel
|
import com.anytypeio.anytype.presentation.auth.account.SetupSelectedAccountViewModel
|
||||||
import com.anytypeio.anytype.presentation.auth.account.SetupSelectedAccountViewModelFactory
|
import com.anytypeio.anytype.presentation.auth.account.SetupSelectedAccountViewModelFactory
|
||||||
|
@ -72,9 +71,6 @@ class SetupSelectedAccountTest {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var configStorage: ConfigStorage
|
lateinit var configStorage: ConfigStorage
|
||||||
|
|
||||||
@Mock
|
|
||||||
lateinit var workspaceManager: WorkspaceManager
|
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private lateinit var relationsSubscriptionManager: RelationsSubscriptionManager
|
private lateinit var relationsSubscriptionManager: RelationsSubscriptionManager
|
||||||
|
|
||||||
|
@ -87,9 +83,6 @@ class SetupSelectedAccountTest {
|
||||||
@Mock
|
@Mock
|
||||||
private lateinit var metricsProvider: MetricsProvider
|
private lateinit var metricsProvider: MetricsProvider
|
||||||
|
|
||||||
@Mock
|
|
||||||
private lateinit var config: ConfigStorage
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
MockitoAnnotations.openMocks(this)
|
MockitoAnnotations.openMocks(this)
|
||||||
|
@ -97,7 +90,6 @@ class SetupSelectedAccountTest {
|
||||||
repository = authRepository,
|
repository = authRepository,
|
||||||
featuresConfigProvider = featuresConfigProvider,
|
featuresConfigProvider = featuresConfigProvider,
|
||||||
configStorage = configStorage,
|
configStorage = configStorage,
|
||||||
workspaceManager = workspaceManager,
|
|
||||||
metricsProvider = metricsProvider
|
metricsProvider = metricsProvider
|
||||||
)
|
)
|
||||||
TestSetupSelectedAccountFragment.testViewModelFactory =
|
TestSetupSelectedAccountFragment.testViewModelFactory =
|
||||||
|
|
|
@ -48,6 +48,7 @@ import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.clipboard.Clipboard
|
import com.anytypeio.anytype.domain.clipboard.Clipboard
|
||||||
import com.anytypeio.anytype.domain.clipboard.Copy
|
import com.anytypeio.anytype.domain.clipboard.Copy
|
||||||
import com.anytypeio.anytype.domain.clipboard.Paste
|
import com.anytypeio.anytype.domain.clipboard.Paste
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.Gateway
|
import com.anytypeio.anytype.domain.config.Gateway
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.cover.RemoveDocCover
|
import com.anytypeio.anytype.domain.cover.RemoveDocCover
|
||||||
|
@ -89,6 +90,7 @@ import com.anytypeio.anytype.domain.unsplash.DownloadUnsplashImage
|
||||||
import com.anytypeio.anytype.domain.unsplash.UnsplashRepository
|
import com.anytypeio.anytype.domain.unsplash.UnsplashRepository
|
||||||
import com.anytypeio.anytype.domain.workspace.FileLimitsEventChannel
|
import com.anytypeio.anytype.domain.workspace.FileLimitsEventChannel
|
||||||
import com.anytypeio.anytype.domain.workspace.InterceptFileLimitEvents
|
import com.anytypeio.anytype.domain.workspace.InterceptFileLimitEvents
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||||
import com.anytypeio.anytype.presentation.common.Delegator
|
import com.anytypeio.anytype.presentation.common.Delegator
|
||||||
import com.anytypeio.anytype.presentation.editor.DocumentExternalEventReducer
|
import com.anytypeio.anytype.presentation.editor.DocumentExternalEventReducer
|
||||||
|
@ -273,6 +275,12 @@ open class EditorTestSetup {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var setObjectInternalFlags: SetObjectInternalFlags
|
lateinit var setObjectInternalFlags: SetObjectInternalFlags
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var spaceManager: SpaceManager
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var configStorage: ConfigStorage
|
||||||
|
|
||||||
lateinit var interceptFileLimitEvents: InterceptFileLimitEvents
|
lateinit var interceptFileLimitEvents: InterceptFileLimitEvents
|
||||||
|
|
||||||
lateinit var addRelationToObject: AddRelationToObject
|
lateinit var addRelationToObject: AddRelationToObject
|
||||||
|
@ -319,8 +327,13 @@ open class EditorTestSetup {
|
||||||
turnIntoDocument = TurnIntoDocument(repo)
|
turnIntoDocument = TurnIntoDocument(repo)
|
||||||
updateFields = UpdateFields(repo)
|
updateFields = UpdateFields(repo)
|
||||||
setObjectType = SetObjectType(repo)
|
setObjectType = SetObjectType(repo)
|
||||||
createObjectAsMentionOrLink =
|
createObjectAsMentionOrLink = CreateObjectAsMentionOrLink(
|
||||||
CreateObjectAsMentionOrLink(repo, getDefaultPageType, getTemplates, dispatchers)
|
repo = repo,
|
||||||
|
getDefaultPageType = getDefaultPageType,
|
||||||
|
getTemplates = getTemplates,
|
||||||
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
|
)
|
||||||
getSearchObjects = SearchObjects(repo)
|
getSearchObjects = SearchObjects(repo)
|
||||||
interceptThreadStatus = InterceptThreadStatus(channel = threadStatusChannel)
|
interceptThreadStatus = InterceptThreadStatus(channel = threadStatusChannel)
|
||||||
downloadUnsplashImage = DownloadUnsplashImage(unsplashRepository)
|
downloadUnsplashImage = DownloadUnsplashImage(unsplashRepository)
|
||||||
|
@ -351,10 +364,11 @@ open class EditorTestSetup {
|
||||||
turnIntoStyle = TurnIntoStyle(repo)
|
turnIntoStyle = TurnIntoStyle(repo)
|
||||||
updateDetail = UpdateDetail(repo)
|
updateDetail = UpdateDetail(repo)
|
||||||
getDefaultPageType = GetDefaultPageType(
|
getDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
repo,
|
blockRepository = repo,
|
||||||
workspaceManager,
|
dispatchers = dispatchers,
|
||||||
dispatchers
|
spaceManager = spaceManager,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
createObjectSet = CreateObjectSet(repo)
|
createObjectSet = CreateObjectSet(repo)
|
||||||
findObjectSetForType = FindObjectSetForType(repo)
|
findObjectSetForType = FindObjectSetForType(repo)
|
||||||
|
@ -466,12 +480,12 @@ open class EditorTestSetup {
|
||||||
storeOfObjectTypes = storeOfObjectTypes,
|
storeOfObjectTypes = storeOfObjectTypes,
|
||||||
featureToggles = featureToggles,
|
featureToggles = featureToggles,
|
||||||
tableDelegate = tableDelegate,
|
tableDelegate = tableDelegate,
|
||||||
workspaceManager = workspaceManager,
|
|
||||||
getObjectTypes = getObjectTypes,
|
getObjectTypes = getObjectTypes,
|
||||||
objectToCollection = objectToCollection,
|
objectToCollection = objectToCollection,
|
||||||
interceptFileLimitEvents = interceptFileLimitEvents,
|
interceptFileLimitEvents = interceptFileLimitEvents,
|
||||||
addRelationToObject = addRelationToObject,
|
addRelationToObject = addRelationToObject,
|
||||||
setObjectInternalFlags = setObjectInternalFlags
|
setObjectInternalFlags = setObjectInternalFlags,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.anytypeio.anytype.domain.objects.ObjectStore
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||||
import com.anytypeio.anytype.domain.relations.CreateRelationOption
|
import com.anytypeio.anytype.domain.relations.CreateRelationOption
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationDVViewModel
|
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationDVViewModel
|
||||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvider
|
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvider
|
||||||
|
@ -81,6 +82,9 @@ class AddRelationStatusValueTest {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var objectDetailProvider: ObjectDetailProvider
|
lateinit var objectDetailProvider: ObjectDetailProvider
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var spaceManager: SpaceManager
|
||||||
|
|
||||||
private lateinit var createRelationOption: CreateRelationOption
|
private lateinit var createRelationOption: CreateRelationOption
|
||||||
private lateinit var updateDetail: UpdateDetail
|
private lateinit var updateDetail: UpdateDetail
|
||||||
private lateinit var getOptions: GetOptions
|
private lateinit var getOptions: GetOptions
|
||||||
|
@ -120,7 +124,8 @@ class AddRelationStatusValueTest {
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
createRelationOption = createRelationOption,
|
createRelationOption = createRelationOption,
|
||||||
detailsProvider = objectDetailProvider,
|
detailsProvider = objectDetailProvider,
|
||||||
getOptions = getOptions
|
getOptions = getOptions,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +546,8 @@ class AddRelationStatusValueTest {
|
||||||
createRelationOption(
|
createRelationOption(
|
||||||
relation = any(),
|
relation = any(),
|
||||||
color = any(),
|
color = any(),
|
||||||
name = any()
|
name = any(),
|
||||||
|
space = any()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,7 +563,8 @@ class AddRelationStatusValueTest {
|
||||||
createRelationOption(
|
createRelationOption(
|
||||||
relation = relation,
|
relation = relation,
|
||||||
color = color,
|
color = color,
|
||||||
name = name
|
name = name,
|
||||||
|
space = any()
|
||||||
)
|
)
|
||||||
} doReturn StubRelationOptionObject(
|
} doReturn StubRelationOptionObject(
|
||||||
id = id,
|
id = id,
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.anytypeio.anytype.domain.objects.ObjectStore
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||||
import com.anytypeio.anytype.domain.relations.CreateRelationOption
|
import com.anytypeio.anytype.domain.relations.CreateRelationOption
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
import com.anytypeio.anytype.presentation.relations.ObjectSetConfig
|
||||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationDVViewModel
|
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationDVViewModel
|
||||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvider
|
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvider
|
||||||
|
@ -79,6 +80,9 @@ class AddRelationTagValueTest {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var objectDetailProvider: ObjectDetailProvider
|
lateinit var objectDetailProvider: ObjectDetailProvider
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var spaceManager: SpaceManager
|
||||||
|
|
||||||
private lateinit var createRelationOption: CreateRelationOption
|
private lateinit var createRelationOption: CreateRelationOption
|
||||||
private lateinit var updateDetail: UpdateDetail
|
private lateinit var updateDetail: UpdateDetail
|
||||||
private lateinit var getOptions: GetOptions
|
private lateinit var getOptions: GetOptions
|
||||||
|
@ -115,7 +119,8 @@ class AddRelationTagValueTest {
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
setObjectDetail = updateDetail,
|
setObjectDetail = updateDetail,
|
||||||
detailsProvider = objectDetailProvider,
|
detailsProvider = objectDetailProvider,
|
||||||
getOptions = getOptions
|
getOptions = getOptions,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +496,8 @@ class AddRelationTagValueTest {
|
||||||
createRelationOption(
|
createRelationOption(
|
||||||
relation = any(),
|
relation = any(),
|
||||||
color = any(),
|
color = any(),
|
||||||
name = any()
|
name = any(),
|
||||||
|
space = any()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -506,7 +512,8 @@ class AddRelationTagValueTest {
|
||||||
createRelationOption(
|
createRelationOption(
|
||||||
relation = any(),
|
relation = any(),
|
||||||
color = any(),
|
color = any(),
|
||||||
name = any()
|
name = any(),
|
||||||
|
space = any()
|
||||||
)
|
)
|
||||||
} doReturn StubRelationOptionObject(
|
} doReturn StubRelationOptionObject(
|
||||||
id = id,
|
id = id,
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.anytypeio.anytype.domain.base.Result
|
||||||
import com.anytypeio.anytype.domain.block.interactor.UpdateText
|
import com.anytypeio.anytype.domain.block.interactor.UpdateText
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.collections.AddObjectToCollection
|
import com.anytypeio.anytype.domain.collections.AddObjectToCollection
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.Gateway
|
import com.anytypeio.anytype.domain.config.Gateway
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.cover.SetDocCoverImage
|
import com.anytypeio.anytype.domain.cover.SetDocCoverImage
|
||||||
|
@ -49,6 +50,7 @@ import com.anytypeio.anytype.domain.templates.CreateTemplate
|
||||||
import com.anytypeio.anytype.domain.templates.GetTemplates
|
import com.anytypeio.anytype.domain.templates.GetTemplates
|
||||||
import com.anytypeio.anytype.domain.unsplash.DownloadUnsplashImage
|
import com.anytypeio.anytype.domain.unsplash.DownloadUnsplashImage
|
||||||
import com.anytypeio.anytype.domain.unsplash.UnsplashRepository
|
import com.anytypeio.anytype.domain.unsplash.UnsplashRepository
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||||
import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider
|
import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider
|
||||||
import com.anytypeio.anytype.presentation.common.Action
|
import com.anytypeio.anytype.presentation.common.Action
|
||||||
|
@ -144,6 +146,12 @@ abstract class TestObjectSetSetup {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var viewerDelegate: ViewerDelegate
|
lateinit var viewerDelegate: ViewerDelegate
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var spaceManager: SpaceManager
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var configStorage: ConfigStorage
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var createTemplate: CreateTemplate
|
lateinit var createTemplate: CreateTemplate
|
||||||
|
|
||||||
|
@ -155,7 +163,6 @@ abstract class TestObjectSetSetup {
|
||||||
private val paginator = ObjectSetPaginator()
|
private val paginator = ObjectSetPaginator()
|
||||||
private val store: ObjectStore = DefaultObjectStore()
|
private val store: ObjectStore = DefaultObjectStore()
|
||||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||||
private val workspaceManager: WorkspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
|
||||||
|
|
||||||
private lateinit var database: ObjectSetDatabase
|
private lateinit var database: ObjectSetDatabase
|
||||||
private lateinit var dataViewSubscriptionContainer: DataViewSubscriptionContainer
|
private lateinit var dataViewSubscriptionContainer: DataViewSubscriptionContainer
|
||||||
|
@ -199,19 +206,18 @@ abstract class TestObjectSetSetup {
|
||||||
setDataViewQuery = SetDataViewQuery(repo)
|
setDataViewQuery = SetDataViewQuery(repo)
|
||||||
updateText = UpdateText(repo)
|
updateText = UpdateText(repo)
|
||||||
openObjectSet = OpenObjectSet(repo, auth)
|
openObjectSet = OpenObjectSet(repo, auth)
|
||||||
runBlocking {
|
|
||||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
|
||||||
}
|
|
||||||
getDefaultPageType = GetDefaultPageType(
|
getDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository = userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
blockRepository = repo,
|
blockRepository = repo,
|
||||||
workspaceManager = workspaceManager,
|
spaceManager = spaceManager,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
createDataViewObject = CreateDataViewObject(
|
createDataViewObject = CreateDataViewObject(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
setObjectDetails = UpdateDetail(repo)
|
setObjectDetails = UpdateDetail(repo)
|
||||||
updateDataViewViewer = UpdateDataViewViewer(repo, dispatchers)
|
updateDataViewViewer = UpdateDataViewViewer(repo, dispatchers)
|
||||||
|
@ -255,7 +261,6 @@ abstract class TestObjectSetSetup {
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
objectStateReducer = DefaultObjectStateReducer(),
|
objectStateReducer = DefaultObjectStateReducer(),
|
||||||
dataViewSubscription = DefaultDataViewSubscription(dataViewSubscriptionContainer),
|
dataViewSubscription = DefaultDataViewSubscription(dataViewSubscriptionContainer),
|
||||||
workspaceManager = workspaceManager,
|
|
||||||
objectToCollection = convertObjectToCollection,
|
objectToCollection = convertObjectToCollection,
|
||||||
setQueryToObjectSet = setQueryToObjectSet,
|
setQueryToObjectSet = setQueryToObjectSet,
|
||||||
objectStore = objectStore,
|
objectStore = objectStore,
|
||||||
|
@ -267,6 +272,7 @@ abstract class TestObjectSetSetup {
|
||||||
setObjectListIsArchived = setObjectListIsArchived,
|
setObjectListIsArchived = setObjectListIsArchived,
|
||||||
duplicateObjects = duplicateObjects,
|
duplicateObjects = duplicateObjects,
|
||||||
viewerDelegate = viewerDelegate,
|
viewerDelegate = viewerDelegate,
|
||||||
|
spaceManager = spaceManager,
|
||||||
createTemplate = createTemplate
|
createTemplate = createTemplate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||||
|
@ -41,7 +41,6 @@ import com.anytypeio.anytype.ui.sets.modals.filter.CreateFilterFromSelectedValue
|
||||||
import com.anytypeio.anytype.utils.CoroutinesTestRule
|
import com.anytypeio.anytype.utils.CoroutinesTestRule
|
||||||
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -68,6 +67,9 @@ class CreateSelectedFilterTest {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var analytics: Analytics
|
lateinit var analytics: Analytics
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var spaceManager: SpaceManager
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var dispatchers: AppCoroutineDispatchers
|
lateinit var dispatchers: AppCoroutineDispatchers
|
||||||
|
|
||||||
|
@ -84,9 +86,6 @@ class CreateSelectedFilterTest {
|
||||||
private val objectStore: ObjectStore = DefaultObjectStore()
|
private val objectStore: ObjectStore = DefaultObjectStore()
|
||||||
private val db = ObjectSetDatabase(store = objectStore)
|
private val db = ObjectSetDatabase(store = objectStore)
|
||||||
|
|
||||||
lateinit var workspaceManager: WorkspaceManager
|
|
||||||
val workspaceId = MockDataFactory.randomString()
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
MockitoAnnotations.openMocks(this)
|
MockitoAnnotations.openMocks(this)
|
||||||
|
@ -94,10 +93,6 @@ class CreateSelectedFilterTest {
|
||||||
searchObjects = SearchObjects(repo)
|
searchObjects = SearchObjects(repo)
|
||||||
getOptions = GetOptions(repo)
|
getOptions = GetOptions(repo)
|
||||||
urlBuilder = UrlBuilder(gateway)
|
urlBuilder = UrlBuilder(gateway)
|
||||||
workspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
|
||||||
runBlocking {
|
|
||||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
|
||||||
}
|
|
||||||
TestCreateSelectedFilterFragment.testVmFactory = FilterViewModel.Factory(
|
TestCreateSelectedFilterFragment.testVmFactory = FilterViewModel.Factory(
|
||||||
updateDataViewViewer = updateDataViewViewer,
|
updateDataViewViewer = updateDataViewViewer,
|
||||||
dispatcher = dispatcher,
|
dispatcher = dispatcher,
|
||||||
|
@ -109,7 +104,7 @@ class CreateSelectedFilterTest {
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
objectSetDatabase = db,
|
objectSetDatabase = db,
|
||||||
getOptions = getOptions,
|
getOptions = getOptions,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||||
|
@ -44,7 +44,6 @@ import com.anytypeio.anytype.ui.sets.modals.filter.ModifyFilterFromInputFieldVal
|
||||||
import com.anytypeio.anytype.utils.CoroutinesTestRule
|
import com.anytypeio.anytype.utils.CoroutinesTestRule
|
||||||
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
@ -76,6 +75,9 @@ class ModifyInputValueFilterTest {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var dispatchers: AppCoroutineDispatchers
|
lateinit var dispatchers: AppCoroutineDispatchers
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var spaceManager: SpaceManager
|
||||||
|
|
||||||
private lateinit var updateDataViewViewer: UpdateDataViewViewer
|
private lateinit var updateDataViewViewer: UpdateDataViewViewer
|
||||||
private lateinit var searchObjects: SearchObjects
|
private lateinit var searchObjects: SearchObjects
|
||||||
private lateinit var getOptions: GetOptions
|
private lateinit var getOptions: GetOptions
|
||||||
|
@ -89,19 +91,12 @@ class ModifyInputValueFilterTest {
|
||||||
private val objectStore: ObjectStore = DefaultObjectStore()
|
private val objectStore: ObjectStore = DefaultObjectStore()
|
||||||
private val db = ObjectSetDatabase(store = objectStore)
|
private val db = ObjectSetDatabase(store = objectStore)
|
||||||
|
|
||||||
lateinit var workspaceManager: WorkspaceManager
|
|
||||||
val workspaceId = MockDataFactory.randomString()
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
MockitoAnnotations.openMocks(this)
|
MockitoAnnotations.openMocks(this)
|
||||||
updateDataViewViewer = UpdateDataViewViewer(repo, dispatchers)
|
updateDataViewViewer = UpdateDataViewViewer(repo, dispatchers)
|
||||||
searchObjects = SearchObjects(repo)
|
searchObjects = SearchObjects(repo)
|
||||||
urlBuilder = UrlBuilder(gateway)
|
urlBuilder = UrlBuilder(gateway)
|
||||||
workspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
|
||||||
runBlocking {
|
|
||||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
|
||||||
}
|
|
||||||
TestModifyFilterFromInputFieldValueFragment.testVmFactory = FilterViewModel.Factory(
|
TestModifyFilterFromInputFieldValueFragment.testVmFactory = FilterViewModel.Factory(
|
||||||
objectState = state,
|
objectState = state,
|
||||||
updateDataViewViewer = updateDataViewViewer,
|
updateDataViewViewer = updateDataViewViewer,
|
||||||
|
@ -113,7 +108,7 @@ class ModifyInputValueFilterTest {
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
objectSetDatabase = db,
|
objectSetDatabase = db,
|
||||||
getOptions = getOptions,
|
getOptions = getOptions,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||||
|
@ -43,7 +43,6 @@ import com.anytypeio.anytype.ui.sets.modals.filter.ModifyFilterFromSelectedValue
|
||||||
import com.anytypeio.anytype.utils.CoroutinesTestRule
|
import com.anytypeio.anytype.utils.CoroutinesTestRule
|
||||||
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import org.hamcrest.CoreMatchers.not
|
import org.hamcrest.CoreMatchers.not
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
|
@ -75,6 +74,9 @@ class ModifyStatusFilterTest {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var analytics: Analytics
|
lateinit var analytics: Analytics
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var spaceManager: SpaceManager
|
||||||
|
|
||||||
private lateinit var updateDataViewViewer: UpdateDataViewViewer
|
private lateinit var updateDataViewViewer: UpdateDataViewViewer
|
||||||
private lateinit var searchObjects: SearchObjects
|
private lateinit var searchObjects: SearchObjects
|
||||||
private lateinit var getOptions: GetOptions
|
private lateinit var getOptions: GetOptions
|
||||||
|
@ -88,9 +90,6 @@ class ModifyStatusFilterTest {
|
||||||
private val objectStore: ObjectStore = DefaultObjectStore()
|
private val objectStore: ObjectStore = DefaultObjectStore()
|
||||||
private val db = ObjectSetDatabase(store = objectStore)
|
private val db = ObjectSetDatabase(store = objectStore)
|
||||||
|
|
||||||
lateinit var workspaceManager: WorkspaceManager
|
|
||||||
val workspaceId = MockDataFactory.randomString()
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
MockitoAnnotations.openMocks(this)
|
MockitoAnnotations.openMocks(this)
|
||||||
|
@ -98,10 +97,6 @@ class ModifyStatusFilterTest {
|
||||||
searchObjects = SearchObjects(repo)
|
searchObjects = SearchObjects(repo)
|
||||||
getOptions = GetOptions(repo)
|
getOptions = GetOptions(repo)
|
||||||
urlBuilder = UrlBuilder(gateway)
|
urlBuilder = UrlBuilder(gateway)
|
||||||
workspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
|
||||||
runBlocking {
|
|
||||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
|
||||||
}
|
|
||||||
TestModifyFilterFromSelectedValueFragment.testVmFactory = FilterViewModel.Factory(
|
TestModifyFilterFromSelectedValueFragment.testVmFactory = FilterViewModel.Factory(
|
||||||
objectState = state,
|
objectState = state,
|
||||||
updateDataViewViewer = updateDataViewViewer,
|
updateDataViewViewer = updateDataViewViewer,
|
||||||
|
@ -113,7 +108,7 @@ class ModifyStatusFilterTest {
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
objectSetDatabase = db,
|
objectSetDatabase = db,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||||
|
@ -43,7 +43,6 @@ import com.anytypeio.anytype.ui.sets.modals.filter.ModifyFilterFromSelectedValue
|
||||||
import com.anytypeio.anytype.utils.CoroutinesTestRule
|
import com.anytypeio.anytype.utils.CoroutinesTestRule
|
||||||
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import org.hamcrest.CoreMatchers.not
|
import org.hamcrest.CoreMatchers.not
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
|
@ -74,6 +73,9 @@ class ModifyTagFilterTest {
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var analytics: Analytics
|
lateinit var analytics: Analytics
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
lateinit var spaceManager: SpaceManager
|
||||||
|
|
||||||
private lateinit var updateDataViewViewer: UpdateDataViewViewer
|
private lateinit var updateDataViewViewer: UpdateDataViewViewer
|
||||||
private lateinit var searchObjects: SearchObjects
|
private lateinit var searchObjects: SearchObjects
|
||||||
private lateinit var getOptions: GetOptions
|
private lateinit var getOptions: GetOptions
|
||||||
|
@ -87,9 +89,6 @@ class ModifyTagFilterTest {
|
||||||
private val objectStore: ObjectStore = DefaultObjectStore()
|
private val objectStore: ObjectStore = DefaultObjectStore()
|
||||||
private val db = ObjectSetDatabase(store = objectStore)
|
private val db = ObjectSetDatabase(store = objectStore)
|
||||||
|
|
||||||
lateinit var workspaceManager: WorkspaceManager
|
|
||||||
val workspaceId = MockDataFactory.randomString()
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
fun setup() {
|
fun setup() {
|
||||||
MockitoAnnotations.openMocks(this)
|
MockitoAnnotations.openMocks(this)
|
||||||
|
@ -97,10 +96,6 @@ class ModifyTagFilterTest {
|
||||||
searchObjects = SearchObjects(repo)
|
searchObjects = SearchObjects(repo)
|
||||||
getOptions = GetOptions(repo)
|
getOptions = GetOptions(repo)
|
||||||
urlBuilder = UrlBuilder(gateway)
|
urlBuilder = UrlBuilder(gateway)
|
||||||
workspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
|
||||||
runBlocking {
|
|
||||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
|
||||||
}
|
|
||||||
TestModifyFilterFromSelectedValueFragment.testVmFactory = FilterViewModel.Factory(
|
TestModifyFilterFromSelectedValueFragment.testVmFactory = FilterViewModel.Factory(
|
||||||
objectState = state,
|
objectState = state,
|
||||||
updateDataViewViewer = updateDataViewViewer,
|
updateDataViewViewer = updateDataViewViewer,
|
||||||
|
@ -112,7 +107,7 @@ class ModifyTagFilterTest {
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
objectSetDatabase = db,
|
objectSetDatabase = db,
|
||||||
getOptions = getOptions,
|
getOptions = getOptions,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,10 @@ class DefaultAppActionManager(val context: Context) : AppActionManager {
|
||||||
try {
|
try {
|
||||||
when (action) {
|
when (action) {
|
||||||
is AppActionManager.Action.CreateNew -> {
|
is AppActionManager.Action.CreateNew -> {
|
||||||
val label = context.resources.getString(R.string.shortcut_create_new, action.name)
|
val name = action.name.ifEmpty {
|
||||||
|
context.resources.getString(R.string.unknown_type)
|
||||||
|
}
|
||||||
|
val label = context.resources.getString(R.string.shortcut_create_new, name)
|
||||||
val shortcut = ShortcutInfoCompat.Builder(context, ACTION_CREATE_NEW_ID)
|
val shortcut = ShortcutInfoCompat.Builder(context, ACTION_CREATE_NEW_ID)
|
||||||
.setShortLabel(label)
|
.setShortLabel(label)
|
||||||
.setLongLabel(label)
|
.setLongLabel(label)
|
||||||
|
@ -28,7 +31,7 @@ class DefaultAppActionManager(val context: Context) : AppActionManager {
|
||||||
.setIntent(
|
.setIntent(
|
||||||
Intent(Intent.ACTION_VIEW, null).apply {
|
Intent(Intent.ACTION_VIEW, null).apply {
|
||||||
setClass(context, MainActivity::class.java)
|
setClass(context, MainActivity::class.java)
|
||||||
putExtra(ACTION_CREATE_NEW_TYPE_KEY, action.type)
|
putExtra(ACTION_CREATE_NEW_TYPE_KEY, action.type.key)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.anytypeio.anytype.app
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import com.anytypeio.anytype.BuildConfig
|
import com.anytypeio.anytype.BuildConfig
|
||||||
import com.anytypeio.anytype.R
|
|
||||||
import com.anytypeio.anytype.core_utils.tools.FeatureToggles
|
import com.anytypeio.anytype.core_utils.tools.FeatureToggles
|
||||||
import com.anytypeio.anytype.device.BuildProvider
|
import com.anytypeio.anytype.device.BuildProvider
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -33,4 +32,6 @@ class DefaultFeatureToggles @Inject constructor(
|
||||||
override val isAutoUpdateEnabled: Boolean = false
|
override val isAutoUpdateEnabled: Boolean = false
|
||||||
|
|
||||||
override val isConciseLogging: Boolean = true
|
override val isConciseLogging: Boolean = true
|
||||||
|
|
||||||
|
override val enableSpaces: Boolean = true
|
||||||
}
|
}
|
|
@ -92,6 +92,9 @@ import com.anytypeio.anytype.di.feature.settings.DaggerFilesStorageComponent
|
||||||
import com.anytypeio.anytype.di.feature.settings.LogoutWarningModule
|
import com.anytypeio.anytype.di.feature.settings.LogoutWarningModule
|
||||||
import com.anytypeio.anytype.di.feature.settings.MainSettingsModule
|
import com.anytypeio.anytype.di.feature.settings.MainSettingsModule
|
||||||
import com.anytypeio.anytype.di.feature.settings.ProfileModule
|
import com.anytypeio.anytype.di.feature.settings.ProfileModule
|
||||||
|
import com.anytypeio.anytype.di.feature.spaces.DaggerCreateSpaceComponent
|
||||||
|
import com.anytypeio.anytype.di.feature.spaces.DaggerSelectSpaceComponent
|
||||||
|
import com.anytypeio.anytype.di.feature.spaces.DaggerSpaceSettingsComponent
|
||||||
import com.anytypeio.anytype.di.feature.templates.DaggerTemplateBlankComponent
|
import com.anytypeio.anytype.di.feature.templates.DaggerTemplateBlankComponent
|
||||||
import com.anytypeio.anytype.di.feature.templates.DaggerTemplateSelectComponent
|
import com.anytypeio.anytype.di.feature.templates.DaggerTemplateSelectComponent
|
||||||
import com.anytypeio.anytype.di.feature.types.DaggerTypeCreationComponent
|
import com.anytypeio.anytype.di.feature.types.DaggerTypeCreationComponent
|
||||||
|
@ -961,6 +964,24 @@ class ComponentManager(
|
||||||
.create(findComponentDependencies())
|
.create(findComponentDependencies())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val selectSpaceComponent = Component {
|
||||||
|
DaggerSelectSpaceComponent
|
||||||
|
.factory()
|
||||||
|
.create(findComponentDependencies())
|
||||||
|
}
|
||||||
|
|
||||||
|
val createSpaceComponent = Component {
|
||||||
|
DaggerCreateSpaceComponent
|
||||||
|
.factory()
|
||||||
|
.create(findComponentDependencies())
|
||||||
|
}
|
||||||
|
|
||||||
|
val spaceSettingsComponent = Component {
|
||||||
|
DaggerSpaceSettingsComponent
|
||||||
|
.factory()
|
||||||
|
.create(findComponentDependencies())
|
||||||
|
}
|
||||||
|
|
||||||
class Component<T>(private val builder: () -> T) {
|
class Component<T>(private val builder: () -> T) {
|
||||||
|
|
||||||
private var instance: T? = null
|
private var instance: T? = null
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.anytypeio.anytype.core_utils.di.scope.PerDialog
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.relations.add.AddObjectRelationViewModel
|
import com.anytypeio.anytype.presentation.relations.add.AddObjectRelationViewModel
|
||||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProvider
|
import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProvider
|
||||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectValueProvider
|
import com.anytypeio.anytype.presentation.relations.providers.ObjectValueProvider
|
||||||
|
@ -39,8 +39,13 @@ object AddObjectRelationModule {
|
||||||
storeOfObjectTypes: StoreOfObjectTypes,
|
storeOfObjectTypes: StoreOfObjectTypes,
|
||||||
searchObjects: SearchObjects,
|
searchObjects: SearchObjects,
|
||||||
urlBuilder: UrlBuilder,
|
urlBuilder: UrlBuilder,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): AddObjectRelationViewModel.Factory = AddObjectRelationViewModel.Factory(
|
): AddObjectRelationViewModel.Factory = AddObjectRelationViewModel.Factory(
|
||||||
relations, values, searchObjects, urlBuilder, storeOfObjectTypes, workspaceManager
|
relations = relations,
|
||||||
|
values = values,
|
||||||
|
searchObjects = searchObjects,
|
||||||
|
urlBuilder = urlBuilder,
|
||||||
|
storeOfObjectTypes = storeOfObjectTypes,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.`object`.UpdateDetail
|
import com.anytypeio.anytype.domain.`object`.UpdateDetail
|
||||||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||||
import com.anytypeio.anytype.domain.relations.CreateRelationOption
|
import com.anytypeio.anytype.domain.relations.CreateRelationOption
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationDVViewModel
|
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationDVViewModel
|
||||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvider
|
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvider
|
||||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationViewModel
|
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationViewModel
|
||||||
|
@ -49,7 +50,8 @@ object AddObjectRelationValueModule {
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
setObjectDetail: UpdateDetail,
|
setObjectDetail: UpdateDetail,
|
||||||
detailsProvider: ObjectDetailProvider,
|
detailsProvider: ObjectDetailProvider,
|
||||||
getOptions: GetOptions
|
getOptions: GetOptions,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): AddOptionsRelationDVViewModel.Factory = AddOptionsRelationDVViewModel.Factory(
|
): AddOptionsRelationDVViewModel.Factory = AddOptionsRelationDVViewModel.Factory(
|
||||||
relations = relations,
|
relations = relations,
|
||||||
values = values,
|
values = values,
|
||||||
|
@ -59,7 +61,8 @@ object AddObjectRelationValueModule {
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
setObjectDetail = setObjectDetail,
|
setObjectDetail = setObjectDetail,
|
||||||
detailsProvider = detailsProvider,
|
detailsProvider = detailsProvider,
|
||||||
getOptions = getOptions
|
getOptions = getOptions,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -73,7 +76,8 @@ object AddObjectRelationValueModule {
|
||||||
updateDetail: UpdateDetail,
|
updateDetail: UpdateDetail,
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
detailsProvider: ObjectDetailProvider,
|
detailsProvider: ObjectDetailProvider,
|
||||||
getOptions: GetOptions
|
getOptions: GetOptions,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): AddOptionsRelationViewModel.Factory = AddOptionsRelationViewModel.Factory(
|
): AddOptionsRelationViewModel.Factory = AddOptionsRelationViewModel.Factory(
|
||||||
relations = relations,
|
relations = relations,
|
||||||
values = values,
|
values = values,
|
||||||
|
@ -83,7 +87,8 @@ object AddObjectRelationValueModule {
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
optionsProvider = AddOptionsRelationProvider(),
|
optionsProvider = AddOptionsRelationProvider(),
|
||||||
detailProvider = detailsProvider,
|
detailProvider = detailsProvider,
|
||||||
getOptions = getOptions
|
getOptions = getOptions,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -23,7 +23,6 @@ import com.anytypeio.anytype.domain.`object`.SetupMobileUseCaseSkip
|
||||||
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
||||||
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
|
||||||
import com.anytypeio.anytype.presentation.auth.account.CreateAccountViewModelFactory
|
import com.anytypeio.anytype.presentation.auth.account.CreateAccountViewModelFactory
|
||||||
import com.anytypeio.anytype.presentation.auth.account.SelectAccountViewModelFactory
|
import com.anytypeio.anytype.presentation.auth.account.SelectAccountViewModelFactory
|
||||||
import com.anytypeio.anytype.presentation.auth.account.SetupNewAccountViewModelFactory
|
import com.anytypeio.anytype.presentation.auth.account.SetupNewAccountViewModelFactory
|
||||||
|
@ -244,12 +243,10 @@ object SetupNewAccountModule {
|
||||||
fun provideCreateAccountUseCase(
|
fun provideCreateAccountUseCase(
|
||||||
repository: AuthRepository,
|
repository: AuthRepository,
|
||||||
configStorage: ConfigStorage,
|
configStorage: ConfigStorage,
|
||||||
workspaceManager: WorkspaceManager,
|
|
||||||
metricsProvider: MetricsProvider
|
metricsProvider: MetricsProvider
|
||||||
): CreateAccount = CreateAccount(
|
): CreateAccount = CreateAccount(
|
||||||
repository = repository,
|
repository = repository,
|
||||||
configStorage = configStorage,
|
configStorage = configStorage,
|
||||||
workspaceManager = workspaceManager,
|
|
||||||
metricsProvider = metricsProvider
|
metricsProvider = metricsProvider
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -299,14 +296,12 @@ object SetupSelectedAccountModule {
|
||||||
repository: AuthRepository,
|
repository: AuthRepository,
|
||||||
configStorage: ConfigStorage,
|
configStorage: ConfigStorage,
|
||||||
featuresConfigProvider: FeaturesConfigProvider,
|
featuresConfigProvider: FeaturesConfigProvider,
|
||||||
workspaceManager: WorkspaceManager,
|
|
||||||
metricsProvider: MetricsProvider
|
metricsProvider: MetricsProvider
|
||||||
): SelectAccount {
|
): SelectAccount {
|
||||||
return SelectAccount(
|
return SelectAccount(
|
||||||
repository = repository,
|
repository = repository,
|
||||||
configStorage = configStorage,
|
configStorage = configStorage,
|
||||||
featuresConfigProvider = featuresConfigProvider,
|
featuresConfigProvider = featuresConfigProvider,
|
||||||
workspaceManager = workspaceManager,
|
|
||||||
metricsProvider = metricsProvider
|
metricsProvider = metricsProvider
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||||
import com.anytypeio.anytype.presentation.linking.BackLinkOrAddToObjectViewModelFactory
|
import com.anytypeio.anytype.presentation.linking.BackLinkOrAddToObjectViewModelFactory
|
||||||
import com.anytypeio.anytype.ui.linking.BacklinkOrAddToObjectFragment
|
import com.anytypeio.anytype.ui.linking.BacklinkOrAddToObjectFragment
|
||||||
|
@ -77,4 +78,5 @@ interface BacklinkOrAddToObjectDependencies : ComponentDependencies {
|
||||||
fun urlBuilder(): UrlBuilder
|
fun urlBuilder(): UrlBuilder
|
||||||
fun dispatchers(): AppCoroutineDispatchers
|
fun dispatchers(): AppCoroutineDispatchers
|
||||||
fun analytics(): Analytics
|
fun analytics(): Analytics
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
}
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
package com.anytypeio.anytype.di.feature
|
package com.anytypeio.anytype.di.feature
|
||||||
|
|
||||||
import com.anytypeio.anytype.core_models.Block
|
|
||||||
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
||||||
import com.anytypeio.anytype.domain.page.CreateObject
|
import com.anytypeio.anytype.domain.page.CreateObject
|
||||||
import com.anytypeio.anytype.domain.templates.GetTemplates
|
import com.anytypeio.anytype.domain.templates.GetTemplates
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.objects.CreateObjectViewModel
|
import com.anytypeio.anytype.presentation.objects.CreateObjectViewModel
|
||||||
import com.anytypeio.anytype.ui.editor.CreateObjectFragment
|
import com.anytypeio.anytype.ui.editor.CreateObjectFragment
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
@ -36,14 +36,14 @@ object CreateObjectModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun getCreateObject(
|
fun getCreateObject(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
getTemplates: GetTemplates,
|
|
||||||
getDefaultPageType: GetDefaultPageType,
|
getDefaultPageType: GetDefaultPageType,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): CreateObject = CreateObject(
|
): CreateObject = CreateObject(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
getTemplates = getTemplates,
|
|
||||||
getDefaultPageType = getDefaultPageType,
|
getDefaultPageType = getDefaultPageType,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -52,13 +52,15 @@ object CreateObjectModule {
|
||||||
fun provideGetDefaultPageType(
|
fun provideGetDefaultPageType(
|
||||||
blockRepository: BlockRepository,
|
blockRepository: BlockRepository,
|
||||||
userSettingsRepository: UserSettingsRepository,
|
userSettingsRepository: UserSettingsRepository,
|
||||||
workspaceManager: WorkspaceManager,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
dispatchers: AppCoroutineDispatchers
|
spaceManager: SpaceManager,
|
||||||
|
configStorage: ConfigStorage
|
||||||
): GetDefaultPageType = GetDefaultPageType(
|
): GetDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
blockRepository,
|
blockRepository = blockRepository,
|
||||||
workspaceManager,
|
dispatchers = dispatchers,
|
||||||
dispatchers
|
spaceManager = spaceManager,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -44,6 +44,7 @@ import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.clipboard.Clipboard
|
import com.anytypeio.anytype.domain.clipboard.Clipboard
|
||||||
import com.anytypeio.anytype.domain.clipboard.Copy
|
import com.anytypeio.anytype.domain.clipboard.Copy
|
||||||
import com.anytypeio.anytype.domain.clipboard.Paste
|
import com.anytypeio.anytype.domain.clipboard.Paste
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.cover.SetDocCoverImage
|
import com.anytypeio.anytype.domain.cover.SetDocCoverImage
|
||||||
import com.anytypeio.anytype.domain.download.DownloadFile
|
import com.anytypeio.anytype.domain.download.DownloadFile
|
||||||
|
@ -97,7 +98,7 @@ import com.anytypeio.anytype.domain.unsplash.DownloadUnsplashImage
|
||||||
import com.anytypeio.anytype.domain.unsplash.UnsplashRepository
|
import com.anytypeio.anytype.domain.unsplash.UnsplashRepository
|
||||||
import com.anytypeio.anytype.domain.workspace.FileLimitsEventChannel
|
import com.anytypeio.anytype.domain.workspace.FileLimitsEventChannel
|
||||||
import com.anytypeio.anytype.domain.workspace.InterceptFileLimitEvents
|
import com.anytypeio.anytype.domain.workspace.InterceptFileLimitEvents
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.common.Action
|
import com.anytypeio.anytype.presentation.common.Action
|
||||||
import com.anytypeio.anytype.presentation.common.Delegator
|
import com.anytypeio.anytype.presentation.common.Delegator
|
||||||
import com.anytypeio.anytype.presentation.editor.DocumentExternalEventReducer
|
import com.anytypeio.anytype.presentation.editor.DocumentExternalEventReducer
|
||||||
|
@ -276,7 +277,7 @@ object EditorSessionModule {
|
||||||
objectToSet: ConvertObjectToSet,
|
objectToSet: ConvertObjectToSet,
|
||||||
featureToggles: FeatureToggles,
|
featureToggles: FeatureToggles,
|
||||||
tableDelegate: EditorTableDelegate,
|
tableDelegate: EditorTableDelegate,
|
||||||
workspaceManager: WorkspaceManager,
|
spaceManager: SpaceManager,
|
||||||
getObjectTypes: GetObjectTypes,
|
getObjectTypes: GetObjectTypes,
|
||||||
objectToCollection: ConvertObjectToCollection,
|
objectToCollection: ConvertObjectToCollection,
|
||||||
interceptFileLimitEvents: InterceptFileLimitEvents,
|
interceptFileLimitEvents: InterceptFileLimitEvents,
|
||||||
|
@ -314,7 +315,7 @@ object EditorSessionModule {
|
||||||
objectToSet = objectToSet,
|
objectToSet = objectToSet,
|
||||||
featureToggles = featureToggles,
|
featureToggles = featureToggles,
|
||||||
tableDelegate = tableDelegate,
|
tableDelegate = tableDelegate,
|
||||||
workspaceManager = workspaceManager,
|
spaceManager = spaceManager,
|
||||||
getObjectTypes = getObjectTypes,
|
getObjectTypes = getObjectTypes,
|
||||||
objectToCollection = objectToCollection,
|
objectToCollection = objectToCollection,
|
||||||
interceptFileLimitEvents = interceptFileLimitEvents,
|
interceptFileLimitEvents = interceptFileLimitEvents,
|
||||||
|
@ -730,12 +731,14 @@ object EditorUseCaseModule {
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
getDefaultPageType: GetDefaultPageType,
|
getDefaultPageType: GetDefaultPageType,
|
||||||
getTemplates: GetTemplates,
|
getTemplates: GetTemplates,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): CreateObjectAsMentionOrLink = CreateObjectAsMentionOrLink(
|
): CreateObjectAsMentionOrLink = CreateObjectAsMentionOrLink(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
getDefaultPageType = getDefaultPageType,
|
getDefaultPageType = getDefaultPageType,
|
||||||
getTemplates = getTemplates,
|
getTemplates = getTemplates,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -983,13 +986,15 @@ object EditorUseCaseModule {
|
||||||
fun provideGetDefaultPageType(
|
fun provideGetDefaultPageType(
|
||||||
repo: UserSettingsRepository,
|
repo: UserSettingsRepository,
|
||||||
blockRepository: BlockRepository,
|
blockRepository: BlockRepository,
|
||||||
workspaceManager: WorkspaceManager,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
dispatchers: AppCoroutineDispatchers
|
spaceManager: SpaceManager,
|
||||||
|
configStorage: ConfigStorage
|
||||||
): GetDefaultPageType = GetDefaultPageType(
|
): GetDefaultPageType = GetDefaultPageType(
|
||||||
repo,
|
userSettingsRepository = repo,
|
||||||
blockRepository,
|
blockRepository = blockRepository,
|
||||||
workspaceManager,
|
spaceManager = spaceManager,
|
||||||
dispatchers
|
dispatchers = dispatchers,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -1181,14 +1186,14 @@ object EditorUseCaseModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun getCreateObject(
|
fun getCreateObject(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
getTemplates: GetTemplates,
|
|
||||||
getDefaultPageType: GetDefaultPageType,
|
getDefaultPageType: GetDefaultPageType,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): CreateObject = CreateObject(
|
): CreateObject = CreateObject(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
getTemplates = getTemplates,
|
|
||||||
getDefaultPageType = getDefaultPageType,
|
getDefaultPageType = getDefaultPageType,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
|
|
@ -5,9 +5,9 @@ import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.linking.LinkToObjectViewModelFactory
|
import com.anytypeio.anytype.presentation.linking.LinkToObjectViewModelFactory
|
||||||
import com.anytypeio.anytype.ui.linking.LinkToObjectFragment
|
import com.anytypeio.anytype.ui.linking.LinkToObjectFragment
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
@ -39,14 +39,14 @@ object LinkToObjectModule {
|
||||||
urlBuilder: UrlBuilder,
|
urlBuilder: UrlBuilder,
|
||||||
getObjectTypes: GetObjectTypes,
|
getObjectTypes: GetObjectTypes,
|
||||||
searchObjects: SearchObjects,
|
searchObjects: SearchObjects,
|
||||||
workspaceManager: WorkspaceManager,
|
analytics: Analytics,
|
||||||
analytics: Analytics
|
spaceManager: SpaceManager
|
||||||
): LinkToObjectViewModelFactory = LinkToObjectViewModelFactory(
|
): LinkToObjectViewModelFactory = LinkToObjectViewModelFactory(
|
||||||
urlBuilder = urlBuilder,
|
urlBuilder = urlBuilder,
|
||||||
getObjectTypes = getObjectTypes,
|
getObjectTypes = getObjectTypes,
|
||||||
searchObjects = searchObjects,
|
searchObjects = searchObjects,
|
||||||
workspaceManager = workspaceManager,
|
analytics = analytics,
|
||||||
analytics = analytics
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.anytypeio.anytype.core_utils.tools.UrlValidator
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.editor.Editor
|
import com.anytypeio.anytype.presentation.editor.Editor
|
||||||
import com.anytypeio.anytype.presentation.linking.LinkToObjectOrWebViewModelFactory
|
import com.anytypeio.anytype.presentation.linking.LinkToObjectOrWebViewModelFactory
|
||||||
import com.anytypeio.anytype.ui.linking.LinkToObjectOrWebPagesFragment
|
import com.anytypeio.anytype.ui.linking.LinkToObjectOrWebPagesFragment
|
||||||
|
@ -42,7 +42,7 @@ object LinkToObjectOrWebModule {
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
stores: Editor.Storage,
|
stores: Editor.Storage,
|
||||||
urlValidator: UrlValidator,
|
urlValidator: UrlValidator,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): LinkToObjectOrWebViewModelFactory = LinkToObjectOrWebViewModelFactory(
|
): LinkToObjectOrWebViewModelFactory = LinkToObjectOrWebViewModelFactory(
|
||||||
urlBuilder = urlBuilder,
|
urlBuilder = urlBuilder,
|
||||||
storeOfObjectTypes = storeOfObjectTypes,
|
storeOfObjectTypes = storeOfObjectTypes,
|
||||||
|
@ -50,6 +50,6 @@ object LinkToObjectOrWebModule {
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
stores = stores,
|
stores = stores,
|
||||||
urlValidator = urlValidator,
|
urlValidator = urlValidator,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -19,7 +19,8 @@ import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.theme.GetTheme
|
import com.anytypeio.anytype.domain.theme.GetTheme
|
||||||
import com.anytypeio.anytype.domain.wallpaper.ObserveWallpaper
|
import com.anytypeio.anytype.domain.wallpaper.ObserveWallpaper
|
||||||
import com.anytypeio.anytype.domain.wallpaper.RestoreWallpaper
|
import com.anytypeio.anytype.domain.wallpaper.RestoreWallpaper
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.wallpaper.WallpaperStore
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.main.MainViewModelFactory
|
import com.anytypeio.anytype.presentation.main.MainViewModelFactory
|
||||||
import com.anytypeio.anytype.ui.main.MainActivity
|
import com.anytypeio.anytype.ui.main.MainActivity
|
||||||
import com.anytypeio.anytype.ui_settings.appearance.ThemeApplicator
|
import com.anytypeio.anytype.ui_settings.appearance.ThemeApplicator
|
||||||
|
@ -79,14 +80,12 @@ object MainEntryModule {
|
||||||
pathProvider: PathProvider,
|
pathProvider: PathProvider,
|
||||||
configStorage: ConfigStorage,
|
configStorage: ConfigStorage,
|
||||||
featuresConfigProvider: FeaturesConfigProvider,
|
featuresConfigProvider: FeaturesConfigProvider,
|
||||||
workspaceManager: WorkspaceManager,
|
|
||||||
metricsProvider: MetricsProvider
|
metricsProvider: MetricsProvider
|
||||||
): ResumeAccount = ResumeAccount(
|
): ResumeAccount = ResumeAccount(
|
||||||
repository = authRepository,
|
repository = authRepository,
|
||||||
pathProvider = pathProvider,
|
pathProvider = pathProvider,
|
||||||
configStorage = configStorage,
|
configStorage = configStorage,
|
||||||
featuresConfigProvider = featuresConfigProvider,
|
featuresConfigProvider = featuresConfigProvider,
|
||||||
workspaceManager = workspaceManager,
|
|
||||||
metricsProvider = metricsProvider
|
metricsProvider = metricsProvider
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -99,8 +98,15 @@ object MainEntryModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
@Provides
|
@Provides
|
||||||
fun provideRestoreWallpaperUseCase(
|
fun provideRestoreWallpaperUseCase(
|
||||||
repo: UserSettingsRepository
|
repo: UserSettingsRepository,
|
||||||
): RestoreWallpaper = RestoreWallpaper(repo)
|
spaceManager: SpaceManager,
|
||||||
|
dispatchers: AppCoroutineDispatchers
|
||||||
|
): RestoreWallpaper = RestoreWallpaper(
|
||||||
|
repo = repo,
|
||||||
|
spaceManager = spaceManager,
|
||||||
|
store = WallpaperStore.Default,
|
||||||
|
dispatchers = dispatchers
|
||||||
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@PerScreen
|
@PerScreen
|
||||||
|
@ -132,12 +138,14 @@ object MainEntryModule {
|
||||||
repo: AuthRepository,
|
repo: AuthRepository,
|
||||||
provider: ConfigStorage,
|
provider: ConfigStorage,
|
||||||
user: UserSettingsRepository,
|
user: UserSettingsRepository,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): Logout = Logout(
|
): Logout = Logout(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
user = user,
|
user = user,
|
||||||
config = provider,
|
config = provider,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -5,9 +5,9 @@ import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.moving.MoveToViewModelFactory
|
import com.anytypeio.anytype.presentation.moving.MoveToViewModelFactory
|
||||||
import com.anytypeio.anytype.ui.moving.MoveToFragment
|
import com.anytypeio.anytype.ui.moving.MoveToFragment
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
@ -53,12 +53,12 @@ object MoveToModule {
|
||||||
getObjectTypes: GetObjectTypes,
|
getObjectTypes: GetObjectTypes,
|
||||||
searchObjects: SearchObjects,
|
searchObjects: SearchObjects,
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): MoveToViewModelFactory = MoveToViewModelFactory(
|
): MoveToViewModelFactory = MoveToViewModelFactory(
|
||||||
urlBuilder = urlBuilder,
|
urlBuilder = urlBuilder,
|
||||||
getObjectTypes = getObjectTypes,
|
getObjectTypes = getObjectTypes,
|
||||||
searchObjects = searchObjects,
|
searchObjects = searchObjects,
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ import com.anytypeio.anytype.core_utils.di.scope.PerDialog
|
||||||
import com.anytypeio.anytype.core_utils.tools.UrlValidator
|
import com.anytypeio.anytype.core_utils.tools.UrlValidator
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.objects.CreateBookmarkObject
|
import com.anytypeio.anytype.domain.objects.CreateBookmarkObject
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.sets.ObjectSetCreateBookmarkRecordViewModel
|
import com.anytypeio.anytype.presentation.sets.ObjectSetCreateBookmarkRecordViewModel
|
||||||
import com.anytypeio.anytype.ui.sets.modals.SetObjectCreateBookmarkRecordFragment
|
import com.anytypeio.anytype.ui.sets.modals.SetObjectCreateBookmarkRecordFragment
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
@ -30,10 +31,12 @@ object ObjectSetCreateBookmarkRecordModule {
|
||||||
@PerDialog
|
@PerDialog
|
||||||
fun provideObjectSetRecordViewModelFactory(
|
fun provideObjectSetRecordViewModelFactory(
|
||||||
createBookmarkObject: CreateBookmarkObject,
|
createBookmarkObject: CreateBookmarkObject,
|
||||||
urlValidator: UrlValidator
|
urlValidator: UrlValidator,
|
||||||
): ObjectSetCreateBookmarkRecordViewModel.Factory = ObjectSetCreateBookmarkRecordViewModel.Factory(
|
spaceManager: SpaceManager
|
||||||
createBookmarkObject = createBookmarkObject,
|
) = ObjectSetCreateBookmarkRecordViewModel.Factory(
|
||||||
urlValidator = urlValidator
|
createBookmarkObject = createBookmarkObject,
|
||||||
|
urlValidator = urlValidator,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.interactor.UpdateText
|
import com.anytypeio.anytype.domain.block.interactor.UpdateText
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.collections.AddObjectToCollection
|
import com.anytypeio.anytype.domain.collections.AddObjectToCollection
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.cover.SetDocCoverImage
|
import com.anytypeio.anytype.domain.cover.SetDocCoverImage
|
||||||
import com.anytypeio.anytype.domain.dataview.interactor.AddDataViewViewer
|
import com.anytypeio.anytype.domain.dataview.interactor.AddDataViewViewer
|
||||||
|
@ -62,7 +63,7 @@ import com.anytypeio.anytype.domain.templates.CreateTemplate
|
||||||
import com.anytypeio.anytype.domain.templates.GetTemplates
|
import com.anytypeio.anytype.domain.templates.GetTemplates
|
||||||
import com.anytypeio.anytype.domain.unsplash.DownloadUnsplashImage
|
import com.anytypeio.anytype.domain.unsplash.DownloadUnsplashImage
|
||||||
import com.anytypeio.anytype.domain.unsplash.UnsplashRepository
|
import com.anytypeio.anytype.domain.unsplash.UnsplashRepository
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.common.Action
|
import com.anytypeio.anytype.presentation.common.Action
|
||||||
import com.anytypeio.anytype.presentation.common.Delegator
|
import com.anytypeio.anytype.presentation.common.Delegator
|
||||||
import com.anytypeio.anytype.presentation.editor.cover.CoverImageHashProvider
|
import com.anytypeio.anytype.presentation.editor.cover.CoverImageHashProvider
|
||||||
|
@ -213,7 +214,6 @@ object ObjectSetModule {
|
||||||
storeOfRelations: StoreOfRelations,
|
storeOfRelations: StoreOfRelations,
|
||||||
objectStateReducer: ObjectStateReducer,
|
objectStateReducer: ObjectStateReducer,
|
||||||
dataViewSubscription: DataViewSubscription,
|
dataViewSubscription: DataViewSubscription,
|
||||||
workspaceManager: WorkspaceManager,
|
|
||||||
@Named("object-set-store") objectStore: ObjectStore,
|
@Named("object-set-store") objectStore: ObjectStore,
|
||||||
addObjectToCollection: AddObjectToCollection,
|
addObjectToCollection: AddObjectToCollection,
|
||||||
convertObjectToCollection: ConvertObjectToCollection,
|
convertObjectToCollection: ConvertObjectToCollection,
|
||||||
|
@ -223,8 +223,9 @@ object ObjectSetModule {
|
||||||
duplicateObjects: DuplicateObjects,
|
duplicateObjects: DuplicateObjects,
|
||||||
templatesContainer: ObjectTypeTemplatesContainer,
|
templatesContainer: ObjectTypeTemplatesContainer,
|
||||||
setObjectListIsArchived: SetObjectListIsArchived,
|
setObjectListIsArchived: SetObjectListIsArchived,
|
||||||
|
createTemplate: CreateTemplate,
|
||||||
viewerDelegate: ViewerDelegate,
|
viewerDelegate: ViewerDelegate,
|
||||||
createTemplate: CreateTemplate
|
spaceManager: SpaceManager
|
||||||
): ObjectSetViewModelFactory = ObjectSetViewModelFactory(
|
): ObjectSetViewModelFactory = ObjectSetViewModelFactory(
|
||||||
openObjectSet = openObjectSet,
|
openObjectSet = openObjectSet,
|
||||||
closeBlock = closeBlock,
|
closeBlock = closeBlock,
|
||||||
|
@ -250,7 +251,6 @@ object ObjectSetModule {
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
objectStateReducer = objectStateReducer,
|
objectStateReducer = objectStateReducer,
|
||||||
dataViewSubscription = dataViewSubscription,
|
dataViewSubscription = dataViewSubscription,
|
||||||
workspaceManager = workspaceManager,
|
|
||||||
objectStore = objectStore,
|
objectStore = objectStore,
|
||||||
addObjectToCollection = addObjectToCollection,
|
addObjectToCollection = addObjectToCollection,
|
||||||
objectToCollection = convertObjectToCollection,
|
objectToCollection = convertObjectToCollection,
|
||||||
|
@ -261,6 +261,7 @@ object ObjectSetModule {
|
||||||
templatesContainer = templatesContainer,
|
templatesContainer = templatesContainer,
|
||||||
setObjectListIsArchived = setObjectListIsArchived,
|
setObjectListIsArchived = setObjectListIsArchived,
|
||||||
viewerDelegate = viewerDelegate,
|
viewerDelegate = viewerDelegate,
|
||||||
|
spaceManager = spaceManager,
|
||||||
createTemplate = createTemplate
|
createTemplate = createTemplate
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -280,14 +281,14 @@ object ObjectSetModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun getCreateObject(
|
fun getCreateObject(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
getTemplates: GetTemplates,
|
|
||||||
getDefaultPageType: GetDefaultPageType,
|
getDefaultPageType: GetDefaultPageType,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): CreateObject = CreateObject(
|
): CreateObject = CreateObject(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
getTemplates = getTemplates,
|
|
||||||
getDefaultPageType = getDefaultPageType,
|
getDefaultPageType = getDefaultPageType,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -304,13 +305,15 @@ object ObjectSetModule {
|
||||||
fun provideGetDefaultPageType(
|
fun provideGetDefaultPageType(
|
||||||
userSettingsRepository: UserSettingsRepository,
|
userSettingsRepository: UserSettingsRepository,
|
||||||
blockRepository: BlockRepository,
|
blockRepository: BlockRepository,
|
||||||
workspaceManager: WorkspaceManager,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
dispatchers: AppCoroutineDispatchers
|
spaceManager: SpaceManager,
|
||||||
|
configStorage: ConfigStorage
|
||||||
): GetDefaultPageType = GetDefaultPageType(
|
): GetDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository = userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
blockRepository = blockRepository,
|
blockRepository = blockRepository,
|
||||||
workspaceManager = workspaceManager,
|
dispatchers = dispatchers,
|
||||||
dispatchers = dispatchers
|
spaceManager = spaceManager,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -327,11 +330,15 @@ object ObjectSetModule {
|
||||||
fun provideCreateDataViewRecordUseCase(
|
fun provideCreateDataViewRecordUseCase(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
storeOfRelations: StoreOfRelations,
|
storeOfRelations: StoreOfRelations,
|
||||||
|
getDefaultPageType: GetDefaultPageType,
|
||||||
|
getTemplates: GetTemplates,
|
||||||
|
spaceManager: SpaceManager,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers
|
||||||
): CreateDataViewObject = CreateDataViewObject(
|
): CreateDataViewObject = CreateDataViewObject(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -4,10 +4,11 @@ import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
||||||
import com.anytypeio.anytype.domain.workspace.AddObjectToWorkspace
|
import com.anytypeio.anytype.domain.spaces.AddObjectTypeToSpace
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.objects.ObjectTypeChangeViewModelFactory
|
import com.anytypeio.anytype.presentation.objects.ObjectTypeChangeViewModelFactory
|
||||||
import com.anytypeio.anytype.ui.objects.types.pickers.AppDefaultObjectTypeFragment
|
import com.anytypeio.anytype.ui.objects.types.pickers.AppDefaultObjectTypeFragment
|
||||||
import com.anytypeio.anytype.ui.objects.types.pickers.DataViewSelectSourceFragment
|
import com.anytypeio.anytype.ui.objects.types.pickers.DataViewSelectSourceFragment
|
||||||
|
@ -43,16 +44,16 @@ object ObjectTypeChangeModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun provideObjectTypeViewModelFactory(
|
fun provideObjectTypeViewModelFactory(
|
||||||
getObjectTypes: GetObjectTypes,
|
getObjectTypes: GetObjectTypes,
|
||||||
addObjectToWorkspace: AddObjectToWorkspace,
|
addObjectTypeToSpace: AddObjectTypeToSpace,
|
||||||
dispatchers: AppCoroutineDispatchers,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
workspaceManager: WorkspaceManager,
|
spaceManager: SpaceManager,
|
||||||
getDefaultPageType: GetDefaultPageType
|
getDefaultPageType: GetDefaultPageType
|
||||||
): ObjectTypeChangeViewModelFactory {
|
): ObjectTypeChangeViewModelFactory {
|
||||||
return ObjectTypeChangeViewModelFactory(
|
return ObjectTypeChangeViewModelFactory(
|
||||||
getObjectTypes = getObjectTypes,
|
getObjectTypes = getObjectTypes,
|
||||||
addObjectToWorkspace = addObjectToWorkspace,
|
addObjectTypeToSpace = addObjectTypeToSpace,
|
||||||
dispatchers = dispatchers,
|
dispatchers = dispatchers,
|
||||||
workspaceManager = workspaceManager,
|
spaceManager = spaceManager,
|
||||||
getDefaultPageType = getDefaultPageType
|
getDefaultPageType = getDefaultPageType
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -68,10 +69,10 @@ object ObjectTypeChangeModule {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Provides
|
@Provides
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun addObjectToWorkspace(
|
fun provideAddObjectTypeToSpace(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers
|
||||||
) : AddObjectToWorkspace = AddObjectToWorkspace(
|
) : AddObjectTypeToSpace = AddObjectTypeToSpace(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers
|
||||||
)
|
)
|
||||||
|
@ -82,13 +83,15 @@ object ObjectTypeChangeModule {
|
||||||
fun provideGetDefaultPageType(
|
fun provideGetDefaultPageType(
|
||||||
userSettingsRepository: UserSettingsRepository,
|
userSettingsRepository: UserSettingsRepository,
|
||||||
blockRepository: BlockRepository,
|
blockRepository: BlockRepository,
|
||||||
workspaceManager: WorkspaceManager,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
dispatchers: AppCoroutineDispatchers
|
spaceManager: SpaceManager,
|
||||||
|
configStorage: ConfigStorage
|
||||||
): GetDefaultPageType = GetDefaultPageType(
|
): GetDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository = userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
blockRepository = blockRepository,
|
blockRepository = blockRepository,
|
||||||
workspaceManager = workspaceManager,
|
dispatchers = dispatchers,
|
||||||
dispatchers = dispatchers
|
spaceManager = spaceManager,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
|
@ -4,12 +4,13 @@ import com.anytypeio.anytype.analytics.base.Analytics
|
||||||
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.device.ClearFileCache
|
import com.anytypeio.anytype.domain.device.ClearFileCache
|
||||||
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
||||||
import com.anytypeio.anytype.domain.launch.SetDefaultEditorType
|
import com.anytypeio.anytype.domain.launch.SetDefaultObjectType
|
||||||
import com.anytypeio.anytype.domain.misc.AppActionManager
|
import com.anytypeio.anytype.domain.misc.AppActionManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.settings.OtherSettingsViewModel
|
import com.anytypeio.anytype.presentation.settings.OtherSettingsViewModel
|
||||||
import com.anytypeio.anytype.ui.settings.OtherSettingsFragment
|
import com.anytypeio.anytype.ui.settings.OtherSettingsFragment
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
@ -38,20 +39,27 @@ object OtherSettingsModule {
|
||||||
fun provideGetDefaultPageType(
|
fun provideGetDefaultPageType(
|
||||||
userSettingsRepository: UserSettingsRepository,
|
userSettingsRepository: UserSettingsRepository,
|
||||||
blockRepository: BlockRepository,
|
blockRepository: BlockRepository,
|
||||||
workspaceManager: WorkspaceManager,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
dispatchers: AppCoroutineDispatchers
|
spaceManager: SpaceManager,
|
||||||
|
configStorage: ConfigStorage
|
||||||
): GetDefaultPageType = GetDefaultPageType(
|
): GetDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository = userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
blockRepository = blockRepository,
|
blockRepository = blockRepository,
|
||||||
workspaceManager = workspaceManager,
|
dispatchers = dispatchers,
|
||||||
dispatchers = dispatchers
|
spaceManager = spaceManager,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@PerScreen
|
@PerScreen
|
||||||
@Provides
|
@Provides
|
||||||
fun provideSetDefaultPageType(repo: UserSettingsRepository): SetDefaultEditorType =
|
fun provideSetDefaultPageType(
|
||||||
SetDefaultEditorType(repo)
|
repo: UserSettingsRepository,
|
||||||
|
dispatchers: AppCoroutineDispatchers
|
||||||
|
): SetDefaultObjectType = SetDefaultObjectType(
|
||||||
|
repo = repo,
|
||||||
|
dispatchers = dispatchers
|
||||||
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@PerScreen
|
@PerScreen
|
||||||
|
@ -63,15 +71,17 @@ object OtherSettingsModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun provideOtherSettingsFactory(
|
fun provideOtherSettingsFactory(
|
||||||
getDefaultPageType: GetDefaultPageType,
|
getDefaultPageType: GetDefaultPageType,
|
||||||
setDefaultEditorType: SetDefaultEditorType,
|
setDefaultObjectType: SetDefaultObjectType,
|
||||||
clearFileCache: ClearFileCache,
|
clearFileCache: ClearFileCache,
|
||||||
appActionManager: AppActionManager,
|
appActionManager: AppActionManager,
|
||||||
analytics: Analytics
|
analytics: Analytics,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): OtherSettingsViewModel.Factory = OtherSettingsViewModel.Factory(
|
): OtherSettingsViewModel.Factory = OtherSettingsViewModel.Factory(
|
||||||
getDefaultPageType = getDefaultPageType,
|
getDefaultPageType = getDefaultPageType,
|
||||||
setDefaultEditorType = setDefaultEditorType,
|
setDefaultObjectType = setDefaultObjectType,
|
||||||
clearFileCache = clearFileCache,
|
clearFileCache = clearFileCache,
|
||||||
appActionManager = appActionManager,
|
appActionManager = appActionManager,
|
||||||
analytics = analytics
|
analytics = analytics,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -5,9 +5,9 @@ import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.search.ObjectSearchViewModelFactory
|
import com.anytypeio.anytype.presentation.search.ObjectSearchViewModelFactory
|
||||||
import com.anytypeio.anytype.ui.search.ObjectSearchFragment
|
import com.anytypeio.anytype.ui.search.ObjectSearchFragment
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
@ -51,12 +51,12 @@ object ObjectSearchModule {
|
||||||
getObjectTypes: GetObjectTypes,
|
getObjectTypes: GetObjectTypes,
|
||||||
searchObjects: SearchObjects,
|
searchObjects: SearchObjects,
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): ObjectSearchViewModelFactory = ObjectSearchViewModelFactory(
|
): ObjectSearchViewModelFactory = ObjectSearchViewModelFactory(
|
||||||
urlBuilder = urlBuilder,
|
urlBuilder = urlBuilder,
|
||||||
searchObjects = searchObjects,
|
searchObjects = searchObjects,
|
||||||
getObjectTypes = getObjectTypes,
|
getObjectTypes = getObjectTypes,
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -18,13 +18,14 @@ import com.anytypeio.anytype.domain.config.FeaturesConfigProvider
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.device.PathProvider
|
import com.anytypeio.anytype.domain.device.PathProvider
|
||||||
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
||||||
import com.anytypeio.anytype.domain.launch.SetDefaultEditorType
|
import com.anytypeio.anytype.domain.launch.SetDefaultObjectType
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.page.CreateObject
|
import com.anytypeio.anytype.domain.page.CreateObject
|
||||||
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
||||||
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.templates.GetTemplates
|
import com.anytypeio.anytype.domain.templates.GetTemplates
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||||
import com.anytypeio.anytype.presentation.splash.SplashViewModelFactory
|
import com.anytypeio.anytype.presentation.splash.SplashViewModelFactory
|
||||||
import com.anytypeio.anytype.ui.splash.SplashFragment
|
import com.anytypeio.anytype.ui.splash.SplashFragment
|
||||||
|
@ -71,15 +72,17 @@ object SplashModule {
|
||||||
pathProvider: PathProvider,
|
pathProvider: PathProvider,
|
||||||
featuresConfigProvider: FeaturesConfigProvider,
|
featuresConfigProvider: FeaturesConfigProvider,
|
||||||
configStorage: ConfigStorage,
|
configStorage: ConfigStorage,
|
||||||
workspaceManager: WorkspaceManager,
|
spaceManager: SpaceManager,
|
||||||
metricsProvider: MetricsProvider
|
metricsProvider: MetricsProvider,
|
||||||
|
userSettings: UserSettingsRepository
|
||||||
): LaunchAccount = LaunchAccount(
|
): LaunchAccount = LaunchAccount(
|
||||||
repository = authRepository,
|
repository = authRepository,
|
||||||
pathProvider = pathProvider,
|
pathProvider = pathProvider,
|
||||||
featuresConfigProvider = featuresConfigProvider,
|
featuresConfigProvider = featuresConfigProvider,
|
||||||
configStorage = configStorage,
|
configStorage = configStorage,
|
||||||
workspaceManager = workspaceManager,
|
spaceManager = spaceManager,
|
||||||
metricsProvider = metricsProvider
|
metricsProvider = metricsProvider,
|
||||||
|
settings = userSettings
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -111,34 +114,41 @@ object SplashModule {
|
||||||
fun provideGetDefaultPageType(
|
fun provideGetDefaultPageType(
|
||||||
userSettingsRepository: UserSettingsRepository,
|
userSettingsRepository: UserSettingsRepository,
|
||||||
blockRepository: BlockRepository,
|
blockRepository: BlockRepository,
|
||||||
workspaceManager: WorkspaceManager,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
dispatchers: AppCoroutineDispatchers
|
spaceManager: SpaceManager,
|
||||||
|
configStorage: ConfigStorage
|
||||||
): GetDefaultPageType = GetDefaultPageType(
|
): GetDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
blockRepository,
|
blockRepository = blockRepository,
|
||||||
workspaceManager,
|
spaceManager = spaceManager,
|
||||||
dispatchers
|
dispatchers = dispatchers,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@PerScreen
|
@PerScreen
|
||||||
@Provides
|
@Provides
|
||||||
fun provideSetDefaultPageType(repo: UserSettingsRepository): SetDefaultEditorType =
|
fun provideSetDefaultPageType(
|
||||||
SetDefaultEditorType(repo)
|
repo: UserSettingsRepository,
|
||||||
|
dispatchers: AppCoroutineDispatchers
|
||||||
|
): SetDefaultObjectType = SetDefaultObjectType(
|
||||||
|
repo = repo,
|
||||||
|
dispatchers = dispatchers
|
||||||
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Provides
|
@Provides
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun getCreateObject(
|
fun getCreateObject(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
getTemplates: GetTemplates,
|
|
||||||
getDefaultPageType: GetDefaultPageType,
|
getDefaultPageType: GetDefaultPageType,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): CreateObject = CreateObject(
|
): CreateObject = CreateObject(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
getTemplates = getTemplates,
|
|
||||||
getDefaultPageType = getDefaultPageType,
|
getDefaultPageType = getDefaultPageType,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -177,4 +187,5 @@ interface SplashDependencies : ComponentDependencies {
|
||||||
fun dispatchers(): AppCoroutineDispatchers
|
fun dispatchers(): AppCoroutineDispatchers
|
||||||
fun crashReporter(): CrashReporter
|
fun crashReporter(): CrashReporter
|
||||||
fun metricsProvider(): MetricsProvider
|
fun metricsProvider(): MetricsProvider
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
}
|
}
|
|
@ -13,6 +13,7 @@ import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.misc.AppActionManager
|
import com.anytypeio.anytype.domain.misc.AppActionManager
|
||||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.ext.DefaultDateHelper
|
import com.anytypeio.anytype.ext.DefaultDateHelper
|
||||||
import com.anytypeio.anytype.presentation.auth.account.DeletedAccountViewModel
|
import com.anytypeio.anytype.presentation.auth.account.DeletedAccountViewModel
|
||||||
import com.anytypeio.anytype.ui.auth.account.DeletedAccountFragment
|
import com.anytypeio.anytype.ui.auth.account.DeletedAccountFragment
|
||||||
|
@ -60,12 +61,14 @@ object DeletedAccountModule {
|
||||||
repo: AuthRepository,
|
repo: AuthRepository,
|
||||||
provider: ConfigStorage,
|
provider: ConfigStorage,
|
||||||
dispatchers: AppCoroutineDispatchers,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
user: UserSettingsRepository
|
user: UserSettingsRepository,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): Logout = Logout(
|
): Logout = Logout(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
config = provider,
|
config = provider,
|
||||||
user = user,
|
user = user,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -93,4 +96,5 @@ interface DeletedAccountDependencies : ComponentDependencies {
|
||||||
fun configStorage(): ConfigStorage
|
fun configStorage(): ConfigStorage
|
||||||
fun authRepository(): AuthRepository
|
fun authRepository(): AuthRepository
|
||||||
fun userSettingsRepository(): UserSettingsRepository
|
fun userSettingsRepository(): UserSettingsRepository
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
}
|
}
|
|
@ -31,6 +31,7 @@ import com.anytypeio.anytype.domain.page.CloseBlock
|
||||||
import com.anytypeio.anytype.domain.page.CreateObject
|
import com.anytypeio.anytype.domain.page.CreateObject
|
||||||
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
||||||
import com.anytypeio.anytype.domain.templates.GetTemplates
|
import com.anytypeio.anytype.domain.templates.GetTemplates
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||||
import com.anytypeio.anytype.presentation.home.HomeScreenViewModel
|
import com.anytypeio.anytype.presentation.home.HomeScreenViewModel
|
||||||
import com.anytypeio.anytype.presentation.home.Unsubscriber
|
import com.anytypeio.anytype.presentation.home.Unsubscriber
|
||||||
|
@ -124,11 +125,11 @@ object HomeScreenModule {
|
||||||
fun emptyBin(
|
fun emptyBin(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
dispatchers: AppCoroutineDispatchers,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
) : EmptyBin = EmptyBin(
|
) : EmptyBin = EmptyBin(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
dispatchers = dispatchers,
|
dispatchers = dispatchers,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -149,12 +150,12 @@ object HomeScreenModule {
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
dispatchers: AppCoroutineDispatchers,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
getDefaultEditorType: GetDefaultPageType,
|
getDefaultEditorType: GetDefaultPageType,
|
||||||
getTemplates: GetTemplates
|
spaceManager: SpaceManager
|
||||||
): CreateObject = CreateObject(
|
): CreateObject = CreateObject(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
dispatchers = dispatchers,
|
dispatchers = dispatchers,
|
||||||
getTemplates = getTemplates,
|
getDefaultPageType = getDefaultEditorType,
|
||||||
getDefaultPageType = getDefaultEditorType
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -163,13 +164,15 @@ object HomeScreenModule {
|
||||||
fun getDefaultPageType(
|
fun getDefaultPageType(
|
||||||
userSettingsRepository: UserSettingsRepository,
|
userSettingsRepository: UserSettingsRepository,
|
||||||
blockRepository: BlockRepository,
|
blockRepository: BlockRepository,
|
||||||
workspaceManager: WorkspaceManager,
|
|
||||||
dispatchers: AppCoroutineDispatchers,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager,
|
||||||
|
configStorage: ConfigStorage
|
||||||
) : GetDefaultPageType = GetDefaultPageType(
|
) : GetDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository = userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
blockRepository = blockRepository,
|
blockRepository = blockRepository,
|
||||||
workspaceManager = workspaceManager,
|
dispatchers = dispatchers,
|
||||||
dispatchers = dispatchers
|
spaceManager = spaceManager,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -259,4 +262,5 @@ interface HomeScreenDependencies : ComponentDependencies {
|
||||||
fun appActionManager(): AppActionManager
|
fun appActionManager(): AppActionManager
|
||||||
fun storeOfObjectTypes(): StoreOfObjectTypes
|
fun storeOfObjectTypes(): StoreOfObjectTypes
|
||||||
fun logger(): Logger
|
fun logger(): Logger
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
import com.anytypeio.anytype.di.common.ComponentDependencies
|
import com.anytypeio.anytype.di.common.ComponentDependencies
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.debugging.Logger
|
import com.anytypeio.anytype.domain.debugging.Logger
|
||||||
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
import com.anytypeio.anytype.domain.launch.GetDefaultPageType
|
||||||
|
@ -18,6 +19,7 @@ import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
||||||
import com.anytypeio.anytype.domain.templates.GetTemplates
|
import com.anytypeio.anytype.domain.templates.GetTemplates
|
||||||
import com.anytypeio.anytype.domain.workspace.AddObjectToWorkspace
|
import com.anytypeio.anytype.domain.workspace.AddObjectToWorkspace
|
||||||
import com.anytypeio.anytype.domain.workspace.RemoveObjectsFromWorkspace
|
import com.anytypeio.anytype.domain.workspace.RemoveObjectsFromWorkspace
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||||
import com.anytypeio.anytype.presentation.library.LibraryListDelegate
|
import com.anytypeio.anytype.presentation.library.LibraryListDelegate
|
||||||
import com.anytypeio.anytype.presentation.library.LibraryResourceManager
|
import com.anytypeio.anytype.presentation.library.LibraryResourceManager
|
||||||
|
@ -64,11 +66,16 @@ object LibraryModule {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun provideMyTypesDelegate(
|
fun provideMyTypesDelegate(
|
||||||
container: StorelessSubscriptionContainer,
|
container: StorelessSubscriptionContainer,
|
||||||
workspaceManager: WorkspaceManager,
|
spaceManager: SpaceManager,
|
||||||
urlBuilder: UrlBuilder,
|
urlBuilder: UrlBuilder,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers
|
||||||
): LibraryListDelegate {
|
): LibraryListDelegate {
|
||||||
return MyTypesDelegate(container, workspaceManager, urlBuilder, dispatchers)
|
return MyTypesDelegate(
|
||||||
|
container = container,
|
||||||
|
spaceManager = spaceManager,
|
||||||
|
urlBuilder = urlBuilder,
|
||||||
|
dispatchers = dispatchers
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@PerScreen
|
@PerScreen
|
||||||
|
@ -87,11 +94,16 @@ object LibraryModule {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun provideMyRelationsDelegate(
|
fun provideMyRelationsDelegate(
|
||||||
container: StorelessSubscriptionContainer,
|
container: StorelessSubscriptionContainer,
|
||||||
workspaceManager: WorkspaceManager,
|
spaceManager: SpaceManager,
|
||||||
urlBuilder: UrlBuilder,
|
urlBuilder: UrlBuilder,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers
|
||||||
): LibraryListDelegate {
|
): LibraryListDelegate {
|
||||||
return MyRelationsDelegate(container, workspaceManager, urlBuilder, dispatchers)
|
return MyRelationsDelegate(
|
||||||
|
container = container,
|
||||||
|
spaceManager = spaceManager,
|
||||||
|
urlBuilder = urlBuilder,
|
||||||
|
dispatchers = dispatchers
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@PerScreen
|
@PerScreen
|
||||||
|
@ -129,14 +141,14 @@ object LibraryModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun getCreateObject(
|
fun getCreateObject(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
getTemplates: GetTemplates,
|
|
||||||
getDefaultPageType: GetDefaultPageType,
|
getDefaultPageType: GetDefaultPageType,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager,
|
||||||
): CreateObject = CreateObject(
|
): CreateObject = CreateObject(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
getTemplates = getTemplates,
|
|
||||||
getDefaultPageType = getDefaultPageType,
|
getDefaultPageType = getDefaultPageType,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -145,13 +157,15 @@ object LibraryModule {
|
||||||
fun provideGetDefaultPageType(
|
fun provideGetDefaultPageType(
|
||||||
userSettingsRepository: UserSettingsRepository,
|
userSettingsRepository: UserSettingsRepository,
|
||||||
blockRepository: BlockRepository,
|
blockRepository: BlockRepository,
|
||||||
workspaceManager: WorkspaceManager,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
dispatchers: AppCoroutineDispatchers
|
spaceManager: SpaceManager,
|
||||||
|
configStorage: ConfigStorage
|
||||||
): GetDefaultPageType = GetDefaultPageType(
|
): GetDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository = userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
blockRepository = blockRepository,
|
blockRepository = blockRepository,
|
||||||
workspaceManager = workspaceManager,
|
dispatchers = dispatchers,
|
||||||
dispatchers = dispatchers
|
spaceManager = spaceManager,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -199,7 +213,8 @@ interface LibraryDependencies : ComponentDependencies {
|
||||||
fun channel(): SubscriptionEventChannel
|
fun channel(): SubscriptionEventChannel
|
||||||
fun dispatchers(): AppCoroutineDispatchers
|
fun dispatchers(): AppCoroutineDispatchers
|
||||||
fun userSettingsRepository(): UserSettingsRepository
|
fun userSettingsRepository(): UserSettingsRepository
|
||||||
|
|
||||||
fun analytics(): Analytics
|
fun analytics(): Analytics
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
|
fun config(): ConfigStorage
|
||||||
fun logger(): Logger
|
fun logger(): Logger
|
||||||
}
|
}
|
|
@ -6,12 +6,10 @@ import com.anytypeio.anytype.di.common.ComponentDependencies
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.config.ConfigStorage
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.`object`.SetObjectDetails
|
|
||||||
import com.anytypeio.anytype.presentation.onboarding.signup.OnboardingSoulCreationViewModel
|
import com.anytypeio.anytype.presentation.onboarding.signup.OnboardingSoulCreationViewModel
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Component
|
import dagger.Component
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
|
||||||
import javax.inject.Scope
|
import javax.inject.Scope
|
||||||
|
|
||||||
@Component(
|
@Component(
|
||||||
|
@ -34,26 +32,11 @@ interface OnboardingSoulCreationComponent {
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
object OnboardingSoulCreationModule {
|
object OnboardingSoulCreationModule {
|
||||||
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@Provides
|
|
||||||
@SoulCreationScreenScope
|
|
||||||
fun provideSetObjectDetailsUseCase(
|
|
||||||
repository: BlockRepository,
|
|
||||||
dispatchers: AppCoroutineDispatchers
|
|
||||||
): SetObjectDetails = SetObjectDetails(
|
|
||||||
repo = repository,
|
|
||||||
dispatchers = dispatchers
|
|
||||||
)
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
interface Declarations {
|
interface Declarations {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
@SoulCreationScreenScope
|
@SoulCreationScreenScope
|
||||||
fun bindViewModelFactory(factory: OnboardingSoulCreationViewModel.Factory): ViewModelProvider.Factory
|
fun bindViewModelFactory(factory: OnboardingSoulCreationViewModel.Factory): ViewModelProvider.Factory
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import com.anytypeio.anytype.domain.`object`.SetupMobileUseCaseSkip
|
||||||
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
||||||
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||||
import com.anytypeio.anytype.presentation.onboarding.signup.OnboardingVoidViewModel
|
import com.anytypeio.anytype.presentation.onboarding.signup.OnboardingVoidViewModel
|
||||||
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
||||||
|
@ -57,12 +58,10 @@ object OnboardingVoidModule {
|
||||||
fun provideCreateAccountUseCase(
|
fun provideCreateAccountUseCase(
|
||||||
authRepository: AuthRepository,
|
authRepository: AuthRepository,
|
||||||
configStorage: ConfigStorage,
|
configStorage: ConfigStorage,
|
||||||
workspaceManager: WorkspaceManager,
|
|
||||||
metricsProvider: MetricsProvider
|
metricsProvider: MetricsProvider
|
||||||
): CreateAccount = CreateAccount(
|
): CreateAccount = CreateAccount(
|
||||||
repository = authRepository,
|
repository = authRepository,
|
||||||
configStorage = configStorage,
|
configStorage = configStorage,
|
||||||
workspaceManager = workspaceManager,
|
|
||||||
metricsProvider = metricsProvider
|
metricsProvider = metricsProvider
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -107,4 +106,5 @@ interface OnboardingVoidDependencies : ComponentDependencies {
|
||||||
fun dispatchers(): AppCoroutineDispatchers
|
fun dispatchers(): AppCoroutineDispatchers
|
||||||
fun analytics(): Analytics
|
fun analytics(): Analytics
|
||||||
fun crashReporter(): CrashReporter
|
fun crashReporter(): CrashReporter
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
}
|
}
|
|
@ -11,10 +11,11 @@ import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.relations.AddRelationToObject
|
import com.anytypeio.anytype.domain.relations.AddRelationToObject
|
||||||
import com.anytypeio.anytype.domain.relations.GetRelations
|
import com.anytypeio.anytype.domain.relations.GetRelations
|
||||||
import com.anytypeio.anytype.domain.workspace.AddObjectToWorkspace
|
import com.anytypeio.anytype.domain.workspace.AddObjectToWorkspace
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.relations.RelationAddToDataViewViewModel
|
import com.anytypeio.anytype.presentation.relations.RelationAddToDataViewViewModel
|
||||||
import com.anytypeio.anytype.presentation.relations.RelationAddToObjectViewModel
|
import com.anytypeio.anytype.presentation.relations.RelationAddToObjectViewModel
|
||||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProvider
|
import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProvider
|
||||||
|
import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProvider.Companion.DATA_VIEW_PROVIDER_TYPE
|
||||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProvider.Companion.INTRINSIC_PROVIDER_TYPE
|
import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProvider.Companion.INTRINSIC_PROVIDER_TYPE
|
||||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||||
|
@ -55,7 +56,7 @@ object RelationAddToObjectModule {
|
||||||
getRelations: GetRelations,
|
getRelations: GetRelations,
|
||||||
appCoroutineDispatchers: AppCoroutineDispatchers,
|
appCoroutineDispatchers: AppCoroutineDispatchers,
|
||||||
addObjectToWorkspace: AddObjectToWorkspace,
|
addObjectToWorkspace: AddObjectToWorkspace,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): RelationAddToObjectViewModel.Factory = RelationAddToObjectViewModel.Factory(
|
): RelationAddToObjectViewModel.Factory = RelationAddToObjectViewModel.Factory(
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
addRelationToObject = addRelationToObject,
|
addRelationToObject = addRelationToObject,
|
||||||
|
@ -65,7 +66,7 @@ object RelationAddToObjectModule {
|
||||||
getRelations = getRelations,
|
getRelations = getRelations,
|
||||||
appCoroutineDispatchers = appCoroutineDispatchers,
|
appCoroutineDispatchers = appCoroutineDispatchers,
|
||||||
addObjectToWorkspace = addObjectToWorkspace,
|
addObjectToWorkspace = addObjectToWorkspace,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -110,11 +111,11 @@ object RelationAddToDataViewModule {
|
||||||
state: MutableStateFlow<ObjectState>,
|
state: MutableStateFlow<ObjectState>,
|
||||||
updateDataViewViewer: UpdateDataViewViewer,
|
updateDataViewViewer: UpdateDataViewViewer,
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
@Named(INTRINSIC_PROVIDER_TYPE) relationsProvider: ObjectRelationProvider,
|
@Named(DATA_VIEW_PROVIDER_TYPE) relationsProvider: ObjectRelationProvider,
|
||||||
appCoroutineDispatchers: AppCoroutineDispatchers,
|
appCoroutineDispatchers: AppCoroutineDispatchers,
|
||||||
getRelations: GetRelations,
|
getRelations: GetRelations,
|
||||||
addObjectToWorkspace: AddObjectToWorkspace,
|
addObjectToWorkspace: AddObjectToWorkspace,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): RelationAddToDataViewViewModel.Factory = RelationAddToDataViewViewModel.Factory(
|
): RelationAddToDataViewViewModel.Factory = RelationAddToDataViewViewModel.Factory(
|
||||||
addRelationToDataView = addRelationToDataView,
|
addRelationToDataView = addRelationToDataView,
|
||||||
dispatcher = dispatcher,
|
dispatcher = dispatcher,
|
||||||
|
@ -125,7 +126,7 @@ object RelationAddToDataViewModule {
|
||||||
appCoroutineDispatchers = appCoroutineDispatchers,
|
appCoroutineDispatchers = appCoroutineDispatchers,
|
||||||
getRelations = getRelations,
|
getRelations = getRelations,
|
||||||
addObjectToWorkspace = addObjectToWorkspace,
|
addObjectToWorkspace = addObjectToWorkspace,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.relations.CreateRelation
|
import com.anytypeio.anytype.domain.relations.CreateRelation
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.relations.RelationCreateFromLibraryViewModel
|
import com.anytypeio.anytype.presentation.relations.RelationCreateFromLibraryViewModel
|
||||||
import com.anytypeio.anytype.presentation.relations.model.CreateFromScratchState
|
import com.anytypeio.anytype.presentation.relations.model.CreateFromScratchState
|
||||||
import com.anytypeio.anytype.presentation.relations.model.StateHolder
|
import com.anytypeio.anytype.presentation.relations.model.StateHolder
|
||||||
|
@ -91,4 +92,5 @@ object RelationCreateFromLibraryModule {
|
||||||
interface RelationCreateFromLibraryDependencies : ComponentDependencies {
|
interface RelationCreateFromLibraryDependencies : ComponentDependencies {
|
||||||
fun blockRepository(): BlockRepository
|
fun blockRepository(): BlockRepository
|
||||||
fun urlBuilder(): UrlBuilder
|
fun urlBuilder(): UrlBuilder
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
}
|
}
|
|
@ -11,6 +11,7 @@ import com.anytypeio.anytype.domain.dataview.interactor.UpdateDataViewViewer
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.relations.AddRelationToObject
|
import com.anytypeio.anytype.domain.relations.AddRelationToObject
|
||||||
import com.anytypeio.anytype.domain.relations.CreateRelation
|
import com.anytypeio.anytype.domain.relations.CreateRelation
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForDataViewViewModel
|
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForDataViewViewModel
|
||||||
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForObjectBlockViewModel
|
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForObjectBlockViewModel
|
||||||
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForObjectViewModel
|
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForObjectViewModel
|
||||||
|
@ -39,7 +40,7 @@ interface RelationCreateFromScratchForObjectSubComponent {
|
||||||
fun inject(fragment: RelationCreateFromScratchForObjectFragment)
|
fun inject(fragment: RelationCreateFromScratchForObjectFragment)
|
||||||
|
|
||||||
fun relationFormatPickerComponent(): RelationFormatPickerSubcomponent.Builder
|
fun relationFormatPickerComponent(): RelationFormatPickerSubcomponent.Builder
|
||||||
fun limitObjectTypeComponent() : LimitObjectTypeSubComponent.Builder
|
fun limitObjectTypeComponent(): LimitObjectTypeSubComponent.Builder
|
||||||
}
|
}
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
@ -53,13 +54,15 @@ object RelationCreateFromScratchForObjectModule {
|
||||||
dispatcher: Dispatcher<Payload>,
|
dispatcher: Dispatcher<Payload>,
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
createFromScratchState: StateHolder<CreateFromScratchState>,
|
createFromScratchState: StateHolder<CreateFromScratchState>,
|
||||||
createRelation: CreateRelation
|
createRelation: CreateRelation,
|
||||||
|
spaceManager: SpaceManager
|
||||||
) = RelationCreateFromScratchForObjectViewModel.Factory(
|
) = RelationCreateFromScratchForObjectViewModel.Factory(
|
||||||
addRelationToObject = addRelationToObject,
|
addRelationToObject = addRelationToObject,
|
||||||
createRelation = createRelation,
|
createRelation = createRelation,
|
||||||
dispatcher = dispatcher,
|
dispatcher = dispatcher,
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
createFromScratchState = createFromScratchState
|
createFromScratchState = createFromScratchState,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -96,7 +99,7 @@ interface RelationCreateFromScratchForDataViewSubComponent {
|
||||||
fun inject(fragment: RelationCreateFromScratchForDataViewFragment)
|
fun inject(fragment: RelationCreateFromScratchForDataViewFragment)
|
||||||
|
|
||||||
fun relationFormatPickerComponent(): RelationFormatPickerSubcomponent.Builder
|
fun relationFormatPickerComponent(): RelationFormatPickerSubcomponent.Builder
|
||||||
fun limitObjectTypeComponent() : LimitObjectTypeSubComponent.Builder
|
fun limitObjectTypeComponent(): LimitObjectTypeSubComponent.Builder
|
||||||
}
|
}
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
@ -112,15 +115,17 @@ object RelationCreateFromScratchForDataViewModule {
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
createFromScratchState: StateHolder<CreateFromScratchState>,
|
createFromScratchState: StateHolder<CreateFromScratchState>,
|
||||||
createRelation: CreateRelation,
|
createRelation: CreateRelation,
|
||||||
addRelationToDataView: AddRelationToDataView
|
addRelationToDataView: AddRelationToDataView,
|
||||||
|
spaceManager: SpaceManager
|
||||||
) = RelationCreateFromScratchForDataViewViewModel.Factory(
|
) = RelationCreateFromScratchForDataViewViewModel.Factory(
|
||||||
addRelationToDataView = addRelationToDataView,
|
addRelationToDataView = addRelationToDataView,
|
||||||
dispatcher = dispatcher,
|
dispatcher = dispatcher,
|
||||||
objectState = state,
|
objectState = state,
|
||||||
updateDataViewViewer = updateDataViewViewer,
|
updateDataViewViewer = updateDataViewViewer,
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
createFromScratchState = createFromScratchState,
|
createFromScratchState = createFromScratchState,
|
||||||
createRelation = createRelation
|
createRelation = createRelation,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -162,7 +167,7 @@ interface RelationCreateFromScratchForObjectBlockSubComponent {
|
||||||
fun inject(fragment: RelationCreateFromScratchForObjectBlockFragment)
|
fun inject(fragment: RelationCreateFromScratchForObjectBlockFragment)
|
||||||
|
|
||||||
fun relationFormatPickerComponent(): RelationFormatPickerSubcomponent.Builder
|
fun relationFormatPickerComponent(): RelationFormatPickerSubcomponent.Builder
|
||||||
fun limitObjectTypeComponent() : LimitObjectTypeSubComponent.Builder
|
fun limitObjectTypeComponent(): LimitObjectTypeSubComponent.Builder
|
||||||
}
|
}
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
@ -176,13 +181,15 @@ object RelationCreateFromScratchForObjectBlockModule {
|
||||||
createRelation: CreateRelation,
|
createRelation: CreateRelation,
|
||||||
dispatcher: Dispatcher<Payload>,
|
dispatcher: Dispatcher<Payload>,
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
createFromScratchState: StateHolder<CreateFromScratchState>
|
createFromScratchState: StateHolder<CreateFromScratchState>,
|
||||||
|
spaceManager: SpaceManager
|
||||||
) = RelationCreateFromScratchForObjectBlockViewModel.Factory(
|
) = RelationCreateFromScratchForObjectBlockViewModel.Factory(
|
||||||
addRelationToObject = addRelationToObject,
|
addRelationToObject = addRelationToObject,
|
||||||
createRelation = createRelation,
|
createRelation = createRelation,
|
||||||
dispatcher = dispatcher,
|
dispatcher = dispatcher,
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
createFromScratchState = createFromScratchState
|
createFromScratchState = createFromScratchState,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||||
|
@ -52,7 +52,7 @@ object CreateFilterModule {
|
||||||
objectSetDatabase: ObjectSetDatabase,
|
objectSetDatabase: ObjectSetDatabase,
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
getOptions: GetOptions,
|
getOptions: GetOptions,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): FilterViewModel.Factory = FilterViewModel.Factory(
|
): FilterViewModel.Factory = FilterViewModel.Factory(
|
||||||
objectState = state,
|
objectState = state,
|
||||||
dispatcher = dispatcher,
|
dispatcher = dispatcher,
|
||||||
|
@ -64,6 +64,6 @@ object CreateFilterModule {
|
||||||
objectSetDatabase = objectSetDatabase,
|
objectSetDatabase = objectSetDatabase,
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
getOptions = getOptions,
|
getOptions = getOptions,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.anytypeio.anytype.domain.objects.StoreOfObjectTypes
|
||||||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||||
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
import com.anytypeio.anytype.domain.objects.options.GetOptions
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
import com.anytypeio.anytype.presentation.sets.ObjectSetDatabase
|
||||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||||
|
@ -52,7 +52,7 @@ object ModifyFilterModule {
|
||||||
objectSetDatabase: ObjectSetDatabase,
|
objectSetDatabase: ObjectSetDatabase,
|
||||||
getOptions: GetOptions,
|
getOptions: GetOptions,
|
||||||
storeOfRelations: StoreOfRelations,
|
storeOfRelations: StoreOfRelations,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): FilterViewModel.Factory = FilterViewModel.Factory(
|
): FilterViewModel.Factory = FilterViewModel.Factory(
|
||||||
objectState = state,
|
objectState = state,
|
||||||
dispatcher = dispatcher,
|
dispatcher = dispatcher,
|
||||||
|
@ -64,6 +64,6 @@ object ModifyFilterModule {
|
||||||
storeOfRelations = storeOfRelations,
|
storeOfRelations = storeOfRelations,
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
getOptions = getOptions,
|
getOptions = getOptions,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
||||||
import com.anytypeio.anytype.domain.workspace.FileLimitsEventChannel
|
import com.anytypeio.anytype.domain.workspace.FileLimitsEventChannel
|
||||||
import com.anytypeio.anytype.domain.workspace.FileSpaceUsage
|
import com.anytypeio.anytype.domain.workspace.FileSpaceUsage
|
||||||
import com.anytypeio.anytype.domain.workspace.InterceptFileLimitEvents
|
import com.anytypeio.anytype.domain.workspace.InterceptFileLimitEvents
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.settings.FilesStorageViewModel
|
import com.anytypeio.anytype.presentation.settings.FilesStorageViewModel
|
||||||
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
||||||
import com.anytypeio.anytype.ui.settings.FilesStorageFragment
|
import com.anytypeio.anytype.ui.settings.FilesStorageFragment
|
||||||
|
@ -79,8 +80,9 @@ object FilesStorageModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun provideSpaceUsage(
|
fun provideSpaceUsage(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
): FileSpaceUsage = FileSpaceUsage(repo, dispatchers)
|
spaceManager: SpaceManager
|
||||||
|
): FileSpaceUsage = FileSpaceUsage(repo, spaceManager, dispatchers)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Provides
|
@Provides
|
||||||
|
@ -118,4 +120,5 @@ interface FilesStorageDependencies : ComponentDependencies {
|
||||||
fun buildProvider(): BuildProvider
|
fun buildProvider(): BuildProvider
|
||||||
fun authRepo(): AuthRepository
|
fun authRepo(): AuthRepository
|
||||||
fun logger(): Logger
|
fun logger(): Logger
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@ import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.misc.AppActionManager
|
import com.anytypeio.anytype.domain.misc.AppActionManager
|
||||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.ui.settings.LogoutWarningFragment
|
import com.anytypeio.anytype.ui.settings.LogoutWarningFragment
|
||||||
import com.anytypeio.anytype.ui_settings.account.LogoutWarningViewModel
|
import com.anytypeio.anytype.ui_settings.account.LogoutWarningViewModel
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
@ -53,11 +54,13 @@ object LogoutWarningModule {
|
||||||
repo: AuthRepository,
|
repo: AuthRepository,
|
||||||
provider: ConfigStorage,
|
provider: ConfigStorage,
|
||||||
user: UserSettingsRepository,
|
user: UserSettingsRepository,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): Logout = Logout(
|
): Logout = Logout(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
config = provider,
|
config = provider,
|
||||||
user = user,
|
user = user,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -5,12 +5,13 @@ import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
import com.anytypeio.anytype.device.share.debug.DebugSpaceDeviceFileContentSaver
|
import com.anytypeio.anytype.device.share.debug.DebugSpaceDeviceFileContentSaver
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.config.ConfigStorage
|
|
||||||
import com.anytypeio.anytype.domain.debugging.DebugSpaceContentSaver
|
import com.anytypeio.anytype.domain.debugging.DebugSpaceContentSaver
|
||||||
import com.anytypeio.anytype.domain.debugging.DebugSpaceShareDownloader
|
import com.anytypeio.anytype.domain.debugging.DebugSpaceShareDownloader
|
||||||
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.`object`.SetObjectDetails
|
import com.anytypeio.anytype.domain.`object`.SetObjectDetails
|
||||||
|
import com.anytypeio.anytype.domain.spaces.SetSpaceDetails
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.settings.MainSettingsViewModel
|
import com.anytypeio.anytype.presentation.settings.MainSettingsViewModel
|
||||||
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
||||||
import com.anytypeio.anytype.presentation.util.downloader.UriFileProvider
|
import com.anytypeio.anytype.presentation.util.downloader.UriFileProvider
|
||||||
|
@ -64,19 +65,19 @@ object MainSettingsModule {
|
||||||
fun provideViewModelFactory(
|
fun provideViewModelFactory(
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
storelessSubscriptionContainer: StorelessSubscriptionContainer,
|
storelessSubscriptionContainer: StorelessSubscriptionContainer,
|
||||||
configStorage: ConfigStorage,
|
|
||||||
urlBuilder: UrlBuilder,
|
urlBuilder: UrlBuilder,
|
||||||
setObjectDetails: SetObjectDetails,
|
|
||||||
spaceGradientProvider: SpaceGradientProvider,
|
spaceGradientProvider: SpaceGradientProvider,
|
||||||
debugSpaceShareDownloader: DebugSpaceShareDownloader
|
debugSpaceShareDownloader: DebugSpaceShareDownloader,
|
||||||
|
spaceManager: SpaceManager,
|
||||||
|
setSpaceDetails: SetSpaceDetails
|
||||||
): MainSettingsViewModel.Factory = MainSettingsViewModel.Factory(
|
): MainSettingsViewModel.Factory = MainSettingsViewModel.Factory(
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
storelessSubscriptionContainer = storelessSubscriptionContainer,
|
storelessSubscriptionContainer = storelessSubscriptionContainer,
|
||||||
configStorage = configStorage,
|
|
||||||
urlBuilder = urlBuilder,
|
urlBuilder = urlBuilder,
|
||||||
setObjectDetails = setObjectDetails,
|
setSpaceDetails = setSpaceDetails,
|
||||||
spaceGradientProvider = spaceGradientProvider,
|
spaceGradientProvider = spaceGradientProvider,
|
||||||
debugSpaceShareDownloader = debugSpaceShareDownloader
|
debugSpaceShareDownloader = debugSpaceShareDownloader,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.anytypeio.anytype.domain.icon.SetDocumentImageIcon
|
||||||
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.`object`.SetObjectDetails
|
import com.anytypeio.anytype.domain.`object`.SetObjectDetails
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
||||||
import com.anytypeio.anytype.ui.settings.ProfileFragment
|
import com.anytypeio.anytype.ui.settings.ProfileFragment
|
||||||
import com.anytypeio.anytype.ui_settings.account.ProfileViewModel
|
import com.anytypeio.anytype.ui_settings.account.ProfileViewModel
|
||||||
|
@ -78,12 +79,14 @@ object ProfileModule {
|
||||||
repo: AuthRepository,
|
repo: AuthRepository,
|
||||||
provider: ConfigStorage,
|
provider: ConfigStorage,
|
||||||
user: UserSettingsRepository,
|
user: UserSettingsRepository,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): Logout = Logout(
|
): Logout = Logout(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
config = provider,
|
config = provider,
|
||||||
user = user,
|
user = user,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.anytypeio.anytype.di.feature.spaces
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import com.anytypeio.anytype.analytics.base.Analytics
|
||||||
|
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
|
import com.anytypeio.anytype.di.common.ComponentDependencies
|
||||||
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.CreateSpaceViewModel
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
||||||
|
import com.anytypeio.anytype.ui.spaces.CreateSpaceFragment
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Component
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
|
||||||
|
@Component(
|
||||||
|
dependencies = [CreateSpaceDependencies::class],
|
||||||
|
modules = [
|
||||||
|
CreateSpaceModule::class,
|
||||||
|
CreateSpaceModule.Declarations::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@PerScreen
|
||||||
|
interface CreateSpaceComponent {
|
||||||
|
@Component.Factory
|
||||||
|
interface Builder {
|
||||||
|
fun create(dependencies: CreateSpaceDependencies): CreateSpaceComponent
|
||||||
|
}
|
||||||
|
|
||||||
|
fun inject(fragment: CreateSpaceFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Module
|
||||||
|
object CreateSpaceModule {
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@Provides
|
||||||
|
@PerScreen
|
||||||
|
fun provideSpaceGradientProvider(): SpaceGradientProvider = SpaceGradientProvider.Default
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface Declarations {
|
||||||
|
@Binds
|
||||||
|
@PerScreen
|
||||||
|
fun bindViewModelFactory(factory: CreateSpaceViewModel.Factory): ViewModelProvider.Factory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CreateSpaceDependencies : ComponentDependencies {
|
||||||
|
fun repo(): BlockRepository
|
||||||
|
fun analytics(): Analytics
|
||||||
|
fun dispatchers(): AppCoroutineDispatchers
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.anytypeio.anytype.di.feature.spaces
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import com.anytypeio.anytype.analytics.base.Analytics
|
||||||
|
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
|
import com.anytypeio.anytype.di.common.ComponentDependencies
|
||||||
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
|
import com.anytypeio.anytype.domain.debugging.Logger
|
||||||
|
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
||||||
|
import com.anytypeio.anytype.domain.misc.AppActionManager
|
||||||
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
|
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SelectSpaceViewModel
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
||||||
|
import com.anytypeio.anytype.ui.spaces.SelectSpaceFragment
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Component
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
|
||||||
|
@Component(
|
||||||
|
dependencies = [SelectSpaceDependencies::class],
|
||||||
|
modules = [
|
||||||
|
SelectSpaceModule::class,
|
||||||
|
SelectSpaceModule.Declarations::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@PerScreen
|
||||||
|
interface SelectSpaceComponent {
|
||||||
|
@Component.Factory
|
||||||
|
interface Builder {
|
||||||
|
fun create(dependencies: SelectSpaceDependencies): SelectSpaceComponent
|
||||||
|
}
|
||||||
|
|
||||||
|
fun inject(fragment: SelectSpaceFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Module
|
||||||
|
object SelectSpaceModule {
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@Provides
|
||||||
|
@PerScreen
|
||||||
|
fun provideSpaceGradientProvider(): SpaceGradientProvider = SpaceGradientProvider.Default
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface Declarations {
|
||||||
|
@PerScreen
|
||||||
|
@Binds
|
||||||
|
fun container(container: StorelessSubscriptionContainer.Impl): StorelessSubscriptionContainer
|
||||||
|
@Binds
|
||||||
|
@PerScreen
|
||||||
|
fun bindViewModelFactory(factory: SelectSpaceViewModel.Factory): ViewModelProvider.Factory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SelectSpaceDependencies : ComponentDependencies {
|
||||||
|
fun repo(): BlockRepository
|
||||||
|
fun subscriptionEventChannel(): SubscriptionEventChannel
|
||||||
|
fun analytics(): Analytics
|
||||||
|
fun dispatchers(): AppCoroutineDispatchers
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
|
fun urlBuilder(): UrlBuilder
|
||||||
|
fun userSettings(): UserSettingsRepository
|
||||||
|
fun logger(): Logger
|
||||||
|
fun appActionManager(): AppActionManager
|
||||||
|
fun configStorage(): ConfigStorage
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.anytypeio.anytype.di.feature.spaces
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import com.anytypeio.anytype.analytics.base.Analytics
|
||||||
|
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||||
|
import com.anytypeio.anytype.di.common.ComponentDependencies
|
||||||
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
|
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
||||||
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SpaceSettingsViewModel
|
||||||
|
import com.anytypeio.anytype.ui.settings.space.SpaceSettingsFragment
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Component
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
|
||||||
|
@Component(
|
||||||
|
dependencies = [SpaceSettingsDependencies::class],
|
||||||
|
modules = [
|
||||||
|
SpaceSettingsModule::class,
|
||||||
|
SpaceSettingsModule.Bindings::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@PerScreen
|
||||||
|
interface SpaceSettingsComponent {
|
||||||
|
@Component.Factory
|
||||||
|
interface Builder {
|
||||||
|
fun create(dependencies: SpaceSettingsDependencies): SpaceSettingsComponent
|
||||||
|
}
|
||||||
|
fun inject(fragment: SpaceSettingsFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Module
|
||||||
|
object SpaceSettingsModule {
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@Provides
|
||||||
|
@PerScreen
|
||||||
|
fun provideSpaceGradientProvider(): SpaceGradientProvider = SpaceGradientProvider.Default
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface Bindings {
|
||||||
|
@PerScreen
|
||||||
|
@Binds
|
||||||
|
fun factory(factory: SpaceSettingsViewModel.Factory): ViewModelProvider.Factory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SpaceSettingsDependencies : ComponentDependencies {
|
||||||
|
fun blockRepo(): BlockRepository
|
||||||
|
fun urlBuilder(): UrlBuilder
|
||||||
|
fun analytics(): Analytics
|
||||||
|
fun dispatchers(): AppCoroutineDispatchers
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
|
fun container(): StorelessSubscriptionContainer
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.types.CreateType
|
import com.anytypeio.anytype.domain.types.CreateType
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.emojifier.data.Emoji
|
import com.anytypeio.anytype.emojifier.data.Emoji
|
||||||
import com.anytypeio.anytype.emojifier.data.EmojiProvider
|
import com.anytypeio.anytype.emojifier.data.EmojiProvider
|
||||||
import com.anytypeio.anytype.presentation.types.TypeCreationViewModel
|
import com.anytypeio.anytype.presentation.types.TypeCreationViewModel
|
||||||
|
@ -67,4 +68,5 @@ interface TypeCreationDependencies : ComponentDependencies {
|
||||||
fun dispatchers(): AppCoroutineDispatchers
|
fun dispatchers(): AppCoroutineDispatchers
|
||||||
fun urlBuilder(): UrlBuilder
|
fun urlBuilder(): UrlBuilder
|
||||||
fun analytics(): Analytics
|
fun analytics(): Analytics
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ import com.anytypeio.anytype.device.DefaultGradientCollectionProvider
|
||||||
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
import com.anytypeio.anytype.domain.config.UserSettingsRepository
|
||||||
import com.anytypeio.anytype.domain.cover.GetCoverGradientCollection
|
import com.anytypeio.anytype.domain.cover.GetCoverGradientCollection
|
||||||
import com.anytypeio.anytype.domain.wallpaper.SetWallpaper
|
import com.anytypeio.anytype.domain.wallpaper.SetWallpaper
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.wallpaper.WallpaperSelectViewModel
|
import com.anytypeio.anytype.presentation.wallpaper.WallpaperSelectViewModel
|
||||||
import com.anytypeio.anytype.ui.dashboard.WallpaperSelectFragment
|
import com.anytypeio.anytype.ui.dashboard.WallpaperSelectFragment
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
@ -35,11 +36,13 @@ object WallpaperSelectModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun provideViewModelFactory(
|
fun provideViewModelFactory(
|
||||||
setWallpaper: SetWallpaper,
|
setWallpaper: SetWallpaper,
|
||||||
analytics: Analytics
|
analytics: Analytics,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): WallpaperSelectViewModel.Factory = WallpaperSelectViewModel.Factory(
|
): WallpaperSelectViewModel.Factory = WallpaperSelectViewModel.Factory(
|
||||||
setWallpaper = setWallpaper,
|
setWallpaper = setWallpaper,
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
getGradients = GetCoverGradientCollection(DefaultGradientCollectionProvider)
|
getGradients = GetCoverGradientCollection(DefaultGradientCollectionProvider),
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -2,13 +2,12 @@ package com.anytypeio.anytype.di.feature.widgets
|
||||||
|
|
||||||
import com.anytypeio.anytype.analytics.base.Analytics
|
import com.anytypeio.anytype.analytics.base.Analytics
|
||||||
import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
import com.anytypeio.anytype.core_utils.di.scope.PerModal
|
||||||
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
import com.anytypeio.anytype.domain.block.interactor.sets.GetObjectTypes
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||||
import com.anytypeio.anytype.domain.search.SearchObjects
|
import com.anytypeio.anytype.domain.search.SearchObjects
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||||
import com.anytypeio.anytype.presentation.widgets.SelectWidgetSourceViewModel
|
import com.anytypeio.anytype.presentation.widgets.SelectWidgetSourceViewModel
|
||||||
import com.anytypeio.anytype.presentation.widgets.WidgetDispatchEvent
|
import com.anytypeio.anytype.presentation.widgets.WidgetDispatchEvent
|
||||||
|
@ -41,17 +40,17 @@ object SelectWidgetSourceModule {
|
||||||
fun factory(
|
fun factory(
|
||||||
urlBuilder: UrlBuilder,
|
urlBuilder: UrlBuilder,
|
||||||
analytics: Analytics,
|
analytics: Analytics,
|
||||||
workspaceManager: WorkspaceManager,
|
|
||||||
searchObjects: SearchObjects,
|
searchObjects: SearchObjects,
|
||||||
getObjectTypes: GetObjectTypes,
|
getObjectTypes: GetObjectTypes,
|
||||||
dispatcher: Dispatcher<WidgetDispatchEvent>
|
dispatcher: Dispatcher<WidgetDispatchEvent>,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): SelectWidgetSourceViewModel.Factory = SelectWidgetSourceViewModel.Factory(
|
): SelectWidgetSourceViewModel.Factory = SelectWidgetSourceViewModel.Factory(
|
||||||
urlBuilder = urlBuilder,
|
urlBuilder = urlBuilder,
|
||||||
searchObjects = searchObjects,
|
searchObjects = searchObjects,
|
||||||
analytics = analytics,
|
analytics = analytics,
|
||||||
workspaceManager = workspaceManager,
|
|
||||||
getObjectTypes = getObjectTypes,
|
getObjectTypes = getObjectTypes,
|
||||||
dispatcher = dispatcher
|
dispatcher = dispatcher,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package com.anytypeio.anytype.di.main
|
package com.anytypeio.anytype.di.main
|
||||||
|
|
||||||
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
|
||||||
import com.anytypeio.anytype.data.auth.repo.config.GatewayProvider
|
import com.anytypeio.anytype.data.auth.repo.config.GatewayProvider
|
||||||
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.config.ConfigStorage
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
import com.anytypeio.anytype.domain.config.Gateway
|
import com.anytypeio.anytype.domain.config.Gateway
|
||||||
|
import com.anytypeio.anytype.domain.debugging.Logger
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -17,8 +18,12 @@ object ConfigModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideGateway(
|
fun provideGateway(
|
||||||
provider: ConfigStorage
|
spaceManager: SpaceManager,
|
||||||
): Gateway = GatewayProvider(provider)
|
logger: Logger
|
||||||
|
): Gateway = GatewayProvider(
|
||||||
|
spaceManager = spaceManager,
|
||||||
|
logger = logger
|
||||||
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -37,6 +37,9 @@ import com.anytypeio.anytype.di.feature.settings.FilesStorageDependencies
|
||||||
import com.anytypeio.anytype.di.feature.settings.LogoutWarningSubComponent
|
import com.anytypeio.anytype.di.feature.settings.LogoutWarningSubComponent
|
||||||
import com.anytypeio.anytype.di.feature.settings.MainSettingsSubComponent
|
import com.anytypeio.anytype.di.feature.settings.MainSettingsSubComponent
|
||||||
import com.anytypeio.anytype.di.feature.settings.ProfileSubComponent
|
import com.anytypeio.anytype.di.feature.settings.ProfileSubComponent
|
||||||
|
import com.anytypeio.anytype.di.feature.spaces.CreateSpaceDependencies
|
||||||
|
import com.anytypeio.anytype.di.feature.spaces.SelectSpaceDependencies
|
||||||
|
import com.anytypeio.anytype.di.feature.spaces.SpaceSettingsDependencies
|
||||||
import com.anytypeio.anytype.di.feature.templates.TemplateBlankDependencies
|
import com.anytypeio.anytype.di.feature.templates.TemplateBlankDependencies
|
||||||
import com.anytypeio.anytype.di.feature.templates.TemplateSelectDependencies
|
import com.anytypeio.anytype.di.feature.templates.TemplateSelectDependencies
|
||||||
import com.anytypeio.anytype.di.feature.templates.TemplateSubComponent
|
import com.anytypeio.anytype.di.feature.templates.TemplateSubComponent
|
||||||
|
@ -97,7 +100,10 @@ interface MainComponent :
|
||||||
AboutAppDependencies,
|
AboutAppDependencies,
|
||||||
OnboardingSoulCreationAnimDependencies,
|
OnboardingSoulCreationAnimDependencies,
|
||||||
TemplateBlankDependencies,
|
TemplateBlankDependencies,
|
||||||
TemplateSelectDependencies {
|
TemplateSelectDependencies,
|
||||||
|
SelectSpaceDependencies,
|
||||||
|
CreateSpaceDependencies,
|
||||||
|
SpaceSettingsDependencies {
|
||||||
|
|
||||||
fun inject(app: AndroidApplication)
|
fun inject(app: AndroidApplication)
|
||||||
|
|
||||||
|
@ -257,4 +263,19 @@ private abstract class ComponentDependenciesModule private constructor() {
|
||||||
@IntoMap
|
@IntoMap
|
||||||
@ComponentDependenciesKey(TemplateSelectDependencies::class)
|
@ComponentDependenciesKey(TemplateSelectDependencies::class)
|
||||||
abstract fun provideTemplateSelectDependencies(component: MainComponent): ComponentDependencies
|
abstract fun provideTemplateSelectDependencies(component: MainComponent): ComponentDependencies
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@ComponentDependenciesKey(SelectSpaceDependencies::class)
|
||||||
|
abstract fun provideSelectSpaceDependencies(component: MainComponent): ComponentDependencies
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@ComponentDependenciesKey(CreateSpaceDependencies::class)
|
||||||
|
abstract fun provideCreateSpaceDependencies(component: MainComponent): ComponentDependencies
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@ComponentDependenciesKey(SpaceSettingsDependencies::class)
|
||||||
|
abstract fun provideSpaceSettingsDependencies(component: MainComponent): ComponentDependencies
|
||||||
}
|
}
|
|
@ -11,10 +11,9 @@ import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionContainer
|
import com.anytypeio.anytype.domain.search.RelationsSubscriptionContainer
|
||||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||||
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
@ -65,10 +64,10 @@ object SubscriptionsModule {
|
||||||
@Singleton
|
@Singleton
|
||||||
fun relationsSubscriptionManager(
|
fun relationsSubscriptionManager(
|
||||||
subscription: RelationsSubscriptionContainer,
|
subscription: RelationsSubscriptionContainer,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): RelationsSubscriptionManager = RelationsSubscriptionManager(
|
): RelationsSubscriptionManager = RelationsSubscriptionManager(
|
||||||
subscription = subscription,
|
subscription = subscription,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -76,9 +75,9 @@ object SubscriptionsModule {
|
||||||
@Singleton
|
@Singleton
|
||||||
fun objectTypesSubscriptionManager(
|
fun objectTypesSubscriptionManager(
|
||||||
subscription: ObjectTypesSubscriptionContainer,
|
subscription: ObjectTypesSubscriptionContainer,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): ObjectTypesSubscriptionManager = ObjectTypesSubscriptionManager(
|
): ObjectTypesSubscriptionManager = ObjectTypesSubscriptionManager(
|
||||||
subscription = subscription,
|
subscription = subscription,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -4,14 +4,12 @@ import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
import com.anytypeio.anytype.domain.debugging.Logger
|
import com.anytypeio.anytype.domain.debugging.Logger
|
||||||
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
||||||
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer.Companion.SUBSCRIPTION_TEMPLATES
|
|
||||||
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.templates.DefaultObjectTypeTemplatesContainer
|
import com.anytypeio.anytype.presentation.templates.DefaultObjectTypeTemplatesContainer
|
||||||
import com.anytypeio.anytype.presentation.templates.ObjectTypeTemplatesContainer
|
import com.anytypeio.anytype.presentation.templates.ObjectTypeTemplatesContainer
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import javax.inject.Named
|
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
@ -33,10 +31,10 @@ object TemplatesModule {
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideTemplatesContainer(
|
fun provideTemplatesContainer(
|
||||||
storage: StorelessSubscriptionContainer,
|
storage: StorelessSubscriptionContainer,
|
||||||
workspaceManager: WorkspaceManager
|
spaceManager: SpaceManager
|
||||||
): ObjectTypeTemplatesContainer =
|
): ObjectTypeTemplatesContainer =
|
||||||
DefaultObjectTypeTemplatesContainer(
|
DefaultObjectTypeTemplatesContainer(
|
||||||
storage = storage,
|
storage = storage,
|
||||||
workspaceManager = workspaceManager
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -1,5 +1,10 @@
|
||||||
package com.anytypeio.anytype.di.main
|
package com.anytypeio.anytype.di.main
|
||||||
|
|
||||||
|
import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers
|
||||||
|
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||||
|
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||||
|
import com.anytypeio.anytype.domain.debugging.Logger
|
||||||
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
|
@ -10,4 +15,18 @@ object WorkspaceModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun manager() : WorkspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
fun manager() : WorkspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun spaces(
|
||||||
|
repo: BlockRepository,
|
||||||
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
configStorage: ConfigStorage,
|
||||||
|
logger: Logger
|
||||||
|
) : SpaceManager = SpaceManager.Impl(
|
||||||
|
dispatchers = dispatchers,
|
||||||
|
repo = repo,
|
||||||
|
configStorage = configStorage,
|
||||||
|
logger = logger
|
||||||
|
)
|
||||||
}
|
}
|
|
@ -72,9 +72,9 @@ class Navigator : AppNavigation {
|
||||||
|
|
||||||
override fun workspace() {}
|
override fun workspace() {}
|
||||||
|
|
||||||
override fun openSettings() {
|
override fun openSpaceSettings() {
|
||||||
try {
|
try {
|
||||||
navController?.navigate(R.id.action_open_settings)
|
navController?.navigate(R.id.action_open_space_settings)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Timber.e(e, "Error while opening settings")
|
Timber.e(e, "Error while opening settings")
|
||||||
}
|
}
|
||||||
|
@ -89,12 +89,13 @@ class Navigator : AppNavigation {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openModalEditor(id: String, targetObjectType: Id) {
|
override fun openModalEditor(id: String, targetTypeId: Id, targetTypeKey: Id) {
|
||||||
navController?.navigate(
|
navController?.navigate(
|
||||||
R.id.nav_editor_modal,
|
R.id.nav_editor_modal,
|
||||||
bundleOf(
|
bundleOf(
|
||||||
EditorModalFragment.ARG_ID to id,
|
EditorModalFragment.ARG_ID to id,
|
||||||
EditorModalFragment.ARG_TARGET_OBJECT_TYPE to targetObjectType
|
EditorModalFragment.ARG_TARGET_TYPE_ID to targetTypeId,
|
||||||
|
EditorModalFragment.ARG_TARGET_TYPE_KEY to targetTypeKey
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ class BasicLogger @Inject constructor() : Logger {
|
||||||
Timber.w(msg)
|
Timber.w(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun logException(e: Exception) {
|
override fun logException(e: Throwable) {
|
||||||
Timber.e(e)
|
Timber.e(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,10 +30,12 @@ class NavigationRouter(
|
||||||
)
|
)
|
||||||
|
|
||||||
is AppNavigation.Command.ConfirmPinCodeScreen -> navigation.confirmPinCode(command.code)
|
is AppNavigation.Command.ConfirmPinCodeScreen -> navigation.confirmPinCode(command.code)
|
||||||
is AppNavigation.Command.OpenSettings -> navigation.openSettings()
|
is AppNavigation.Command.OpenSettings -> navigation.openSpaceSettings()
|
||||||
is AppNavigation.Command.OpenObject -> navigation.openDocument(command.id)
|
is AppNavigation.Command.OpenObject -> navigation.openDocument(command.id)
|
||||||
is AppNavigation.Command.OpenModalEditor -> navigation.openModalEditor(
|
is AppNavigation.Command.OpenModalEditor -> navigation.openModalEditor(
|
||||||
id = command.id, targetObjectType = command.targetObjectType
|
id = command.id,
|
||||||
|
targetTypeId = command.targetTypeId,
|
||||||
|
targetTypeKey = command.targetTypeKey
|
||||||
)
|
)
|
||||||
is AppNavigation.Command.OpenSetOrCollection -> navigation.openObjectSet(
|
is AppNavigation.Command.OpenSetOrCollection -> navigation.openObjectSet(
|
||||||
command.target,
|
command.target,
|
||||||
|
|
|
@ -8,6 +8,7 @@ import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.navigation.NavOptions
|
import androidx.navigation.NavOptions
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import com.anytypeio.anytype.R
|
import com.anytypeio.anytype.R
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_utils.ext.arg
|
import com.anytypeio.anytype.core_utils.ext.arg
|
||||||
import com.anytypeio.anytype.core_utils.ext.subscribe
|
import com.anytypeio.anytype.core_utils.ext.subscribe
|
||||||
import com.anytypeio.anytype.core_utils.ext.toast
|
import com.anytypeio.anytype.core_utils.ext.toast
|
||||||
|
@ -23,7 +24,7 @@ class CreateObjectFragment : BaseFragment<FragmentCreateObjectBinding>(R.layout.
|
||||||
lateinit var factory: CreateObjectViewModel.Factory
|
lateinit var factory: CreateObjectViewModel.Factory
|
||||||
private val vm by viewModels<CreateObjectViewModel> { factory }
|
private val vm by viewModels<CreateObjectViewModel> { factory }
|
||||||
|
|
||||||
private val mType get() = arg<String>(TYPE_KEY)
|
private val mType get() = arg<Key>(TYPE_KEY)
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
jobs += lifecycleScope.subscribe(vm.createObjectStatus) { state ->
|
jobs += lifecycleScope.subscribe(vm.createObjectStatus) { state ->
|
||||||
|
|
|
@ -2071,12 +2071,20 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
||||||
vm.proceedToCreateObjectAndAddToTextAsLink(name)
|
vm.proceedToCreateObjectAndAddToTextAsLink(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onProceedWithUpdateType(id: Id) {
|
override fun onProceedWithUpdateType(id: Id, key: Key) {
|
||||||
vm.onObjectTypeChanged(type = id, applyTemplate = false)
|
vm.onObjectTypeChanged(
|
||||||
|
type = id,
|
||||||
|
key = key,
|
||||||
|
applyTemplate = false
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onProceedWithDraftUpdateType(id: Id) {
|
override fun onProceedWithDraftUpdateType(id: Id, key: Key) {
|
||||||
vm.onObjectTypeChanged(type = id, applyTemplate = true)
|
vm.onObjectTypeChanged(
|
||||||
|
type = id,
|
||||||
|
key = key,
|
||||||
|
applyTemplate = true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAddRelationToTarget(target: Id, relationKey: Key) {
|
override fun onAddRelationToTarget(target: Id, relationKey: Key) {
|
||||||
|
|
|
@ -14,14 +14,16 @@ import com.anytypeio.anytype.ui.templates.EditorTemplateFragment
|
||||||
class EditorModalFragment : BaseBottomSheetFragment<MyFragmentContainerBinding>() {
|
class EditorModalFragment : BaseBottomSheetFragment<MyFragmentContainerBinding>() {
|
||||||
|
|
||||||
private val ctx get() = arg<Id>(ARG_ID)
|
private val ctx get() = arg<Id>(ARG_ID)
|
||||||
private val targetObjectType get() = arg<Id>(ARG_TARGET_OBJECT_TYPE)
|
private val targetTypeId get() = arg<Id>(ARG_TARGET_TYPE_ID)
|
||||||
|
private val targetTypeKey get() = arg<Id>(ARG_TARGET_TYPE_KEY)
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setStyle(STYLE_NORMAL, R.style.AppBottomSecondarySheetDialogTheme)
|
setStyle(STYLE_NORMAL, R.style.AppBottomSecondarySheetDialogTheme)
|
||||||
val editorFragment = EditorTemplateFragment.newInstance(
|
val editorFragment = EditorTemplateFragment.newInstance(
|
||||||
id = ctx,
|
id = ctx,
|
||||||
targetObjectType = targetObjectType
|
targetTypeId = targetTypeId,
|
||||||
|
targetTypeKey = targetTypeKey
|
||||||
)
|
)
|
||||||
childFragmentManager.beginTransaction()
|
childFragmentManager.beginTransaction()
|
||||||
.add(R.id.fragment_container_view, editorFragment)
|
.add(R.id.fragment_container_view, editorFragment)
|
||||||
|
@ -52,6 +54,7 @@ class EditorModalFragment : BaseBottomSheetFragment<MyFragmentContainerBinding>(
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val ARG_ID = "arg_id"
|
const val ARG_ID = "arg_id"
|
||||||
const val ARG_TARGET_OBJECT_TYPE = "arg_target_object_type"
|
const val ARG_TARGET_TYPE_ID = "arg_target_object_type"
|
||||||
|
const val ARG_TARGET_TYPE_KEY = "arg_target_object_type_key"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -68,6 +68,7 @@ import com.anytypeio.anytype.ui.widgets.types.DataViewListWidgetCard
|
||||||
import com.anytypeio.anytype.ui.widgets.types.LibraryWidgetCard
|
import com.anytypeio.anytype.ui.widgets.types.LibraryWidgetCard
|
||||||
import com.anytypeio.anytype.ui.widgets.types.LinkWidgetCard
|
import com.anytypeio.anytype.ui.widgets.types.LinkWidgetCard
|
||||||
import com.anytypeio.anytype.ui.widgets.types.ListWidgetCard
|
import com.anytypeio.anytype.ui.widgets.types.ListWidgetCard
|
||||||
|
import com.anytypeio.anytype.ui.widgets.types.SpaceWidgetCard
|
||||||
import com.anytypeio.anytype.ui.widgets.types.TreeWidgetCard
|
import com.anytypeio.anytype.ui.widgets.types.TreeWidgetCard
|
||||||
import org.burnoutcrew.reorderable.ReorderableItem
|
import org.burnoutcrew.reorderable.ReorderableItem
|
||||||
import org.burnoutcrew.reorderable.detectReorderAfterLongPress
|
import org.burnoutcrew.reorderable.detectReorderAfterLongPress
|
||||||
|
@ -92,10 +93,12 @@ fun HomeScreen(
|
||||||
onExitEditMode: () -> Unit,
|
onExitEditMode: () -> Unit,
|
||||||
onSearchClicked: () -> Unit,
|
onSearchClicked: () -> Unit,
|
||||||
onLibraryClicked: () -> Unit,
|
onLibraryClicked: () -> Unit,
|
||||||
|
onOpenSpacesClicked: () -> Unit,
|
||||||
onCreateNewObjectClicked: () -> Unit,
|
onCreateNewObjectClicked: () -> Unit,
|
||||||
onSpaceClicked: () -> Unit,
|
onSpaceClicked: () -> Unit,
|
||||||
onMove: (List<WidgetView>, FromIndex, ToIndex) -> Unit,
|
onObjectCheckboxClicked: (Id, Boolean) -> Unit,
|
||||||
onObjectCheckboxClicked: (Id, Boolean) -> Unit
|
onSpaceWidgetClicked: () -> Unit,
|
||||||
|
onMove: (List<WidgetView>, FromIndex, ToIndex) -> Unit
|
||||||
) {
|
) {
|
||||||
|
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
|
@ -111,6 +114,8 @@ fun HomeScreen(
|
||||||
onChangeWidgetView = onChangeWidgetView,
|
onChangeWidgetView = onChangeWidgetView,
|
||||||
onEditWidgets = onEditWidgets,
|
onEditWidgets = onEditWidgets,
|
||||||
onLibraryClicked = onLibraryClicked,
|
onLibraryClicked = onLibraryClicked,
|
||||||
|
onOpenSpacesClicked = onOpenSpacesClicked,
|
||||||
|
onSpaceWidgetClicked = onSpaceWidgetClicked,
|
||||||
onMove = onMove,
|
onMove = onMove,
|
||||||
onObjectCheckboxClicked = onObjectCheckboxClicked
|
onObjectCheckboxClicked = onObjectCheckboxClicked
|
||||||
)
|
)
|
||||||
|
@ -176,7 +181,9 @@ private fun WidgetList(
|
||||||
onEditWidgets: () -> Unit,
|
onEditWidgets: () -> Unit,
|
||||||
onLibraryClicked: () -> Unit,
|
onLibraryClicked: () -> Unit,
|
||||||
onMove: (List<WidgetView>, FromIndex, ToIndex) -> Unit,
|
onMove: (List<WidgetView>, FromIndex, ToIndex) -> Unit,
|
||||||
onObjectCheckboxClicked: (Id, Boolean) -> Unit
|
onObjectCheckboxClicked: (Id, Boolean) -> Unit,
|
||||||
|
onOpenSpacesClicked: () -> Unit,
|
||||||
|
onSpaceWidgetClicked: () -> Unit
|
||||||
) {
|
) {
|
||||||
val views = remember { mutableStateOf(widgets) }
|
val views = remember { mutableStateOf(widgets) }
|
||||||
views.value = widgets
|
views.value = widgets
|
||||||
|
@ -208,6 +215,13 @@ private fun WidgetList(
|
||||||
key = { _, item -> item.id }
|
key = { _, item -> item.id }
|
||||||
) { index, item ->
|
) { index, item ->
|
||||||
when (item) {
|
when (item) {
|
||||||
|
is WidgetView.SpaceWidget.View -> {
|
||||||
|
SpaceWidgetCard(
|
||||||
|
onClick = onSpaceWidgetClicked,
|
||||||
|
name = item.space.name.orEmpty(),
|
||||||
|
icon = item.icon
|
||||||
|
)
|
||||||
|
}
|
||||||
is WidgetView.Tree -> {
|
is WidgetView.Tree -> {
|
||||||
ReorderableItem(lazyListState, key = item.id) { isDragged ->
|
ReorderableItem(lazyListState, key = item.id) { isDragged ->
|
||||||
val alpha = animateFloatAsState(if (isDragged) 0.8f else 1.0f)
|
val alpha = animateFloatAsState(if (isDragged) 0.8f else 1.0f)
|
||||||
|
@ -435,6 +449,25 @@ private fun WidgetList(
|
||||||
mode = mode
|
mode = mode
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
is WidgetView.Space -> {
|
||||||
|
Box(
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 12.dp)
|
||||||
|
.animateItemPlacement(
|
||||||
|
spring(
|
||||||
|
stiffness = Spring.StiffnessHigh,
|
||||||
|
visibilityThreshold = IntOffset.Zero
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
WidgetActionButton(
|
||||||
|
label = "Open spaces",
|
||||||
|
onClick = onOpenSpacesClicked,
|
||||||
|
modifier = Modifier.align(Alignment.TopCenter)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
is WidgetView.Library -> {
|
is WidgetView.Library -> {
|
||||||
LibraryWidgetCard(
|
LibraryWidgetCard(
|
||||||
onDropDownMenuAction = { action ->
|
onDropDownMenuAction = { action ->
|
||||||
|
|
|
@ -84,7 +84,13 @@ class HomeScreenFragment : BaseComposeFragment() {
|
||||||
vm.onCreateNewObjectClicked()
|
vm.onCreateNewObjectClicked()
|
||||||
},
|
},
|
||||||
onSpaceClicked = {
|
onSpaceClicked = {
|
||||||
navigation().openSettings()
|
findNavController().navigate(R.id.action_open_spaces)
|
||||||
|
},
|
||||||
|
onSpaceWidgetClicked = {
|
||||||
|
findNavController().navigate(R.id.action_open_space_settings)
|
||||||
|
},
|
||||||
|
onOpenSpacesClicked = {
|
||||||
|
findNavController().navigate(R.id.action_open_spaces)
|
||||||
},
|
},
|
||||||
onBundledWidgetClicked = vm::onBundledWidgetClicked,
|
onBundledWidgetClicked = vm::onBundledWidgetClicked,
|
||||||
onMove = vm::onMove,
|
onMove = vm::onMove,
|
||||||
|
|
|
@ -10,6 +10,7 @@ import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.anytypeio.anytype.R
|
import com.anytypeio.anytype.R
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_ui.features.objects.ObjectTypeVerticalAdapter
|
import com.anytypeio.anytype.core_ui.features.objects.ObjectTypeVerticalAdapter
|
||||||
import com.anytypeio.anytype.core_ui.reactive.textChanges
|
import com.anytypeio.anytype.core_ui.reactive.textChanges
|
||||||
import com.anytypeio.anytype.core_utils.ext.argOrNull
|
import com.anytypeio.anytype.core_utils.ext.argOrNull
|
||||||
|
@ -27,7 +28,7 @@ abstract class BaseObjectTypeChangeFragment :
|
||||||
|
|
||||||
abstract fun setTitle()
|
abstract fun setTitle()
|
||||||
abstract fun startWithParams()
|
abstract fun startWithParams()
|
||||||
abstract fun onItemClicked(id: Id, name: String)
|
abstract fun onItemClicked(id: Id, key: Key, name: String)
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var factory: ObjectTypeChangeViewModelFactory
|
lateinit var factory: ObjectTypeChangeViewModelFactory
|
||||||
|
@ -66,11 +67,13 @@ abstract class BaseObjectTypeChangeFragment :
|
||||||
jobs += subscribe(binding.searchObjectTypeInput.textChanges()) {
|
jobs += subscribe(binding.searchObjectTypeInput.textChanges()) {
|
||||||
vm.onQueryChanged(it.toString())
|
vm.onQueryChanged(it.toString())
|
||||||
}
|
}
|
||||||
|
jobs += subscribe(vm.toasts) { toast -> toast(toast) }
|
||||||
jobs += subscribe(vm.commands) { command ->
|
jobs += subscribe(vm.commands) { command ->
|
||||||
when (command) {
|
when (command) {
|
||||||
is Command.DispatchType -> {
|
is Command.DispatchType -> {
|
||||||
onItemClicked(
|
onItemClicked(
|
||||||
id = command.id,
|
id = command.id,
|
||||||
|
key = command.key,
|
||||||
name = command.name
|
name = command.name
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.ui.objects.types.pickers
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import com.anytypeio.anytype.R
|
import com.anytypeio.anytype.R
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
||||||
import com.anytypeio.anytype.core_utils.ext.withParent
|
import com.anytypeio.anytype.core_utils.ext.withParent
|
||||||
import com.anytypeio.anytype.di.common.componentManager
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
|
@ -21,10 +22,11 @@ class AppDefaultObjectTypeFragment : BaseObjectTypeChangeFragment() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemClicked(id: Id, name: String) {
|
override fun onItemClicked(id: Id, key: Key, name: String) {
|
||||||
withParent<OnObjectTypeAction> {
|
withParent<OnObjectTypeAction> {
|
||||||
onProceedWithUpdateType(
|
onProceedWithUpdateType(
|
||||||
id = id,
|
id = id,
|
||||||
|
key = key,
|
||||||
name = name
|
name = name
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -51,6 +53,6 @@ class AppDefaultObjectTypeFragment : BaseObjectTypeChangeFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnObjectTypeAction {
|
interface OnObjectTypeAction {
|
||||||
fun onProceedWithUpdateType(id: Id, name: String)
|
fun onProceedWithUpdateType(id: Id, key: Key, name: String)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.ui.objects.types.pickers
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import com.anytypeio.anytype.R
|
import com.anytypeio.anytype.R
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
||||||
import com.anytypeio.anytype.core_utils.ext.withParent
|
import com.anytypeio.anytype.core_utils.ext.withParent
|
||||||
import com.anytypeio.anytype.di.common.componentManager
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
|
@ -23,7 +24,7 @@ class DataViewSelectSourceFragment : BaseObjectTypeChangeFragment() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemClicked(id: Id, name: String) {
|
override fun onItemClicked(id: Id, key: Key, name: String) {
|
||||||
withParent<OnDataViewSelectSourceAction> {
|
withParent<OnDataViewSelectSourceAction> {
|
||||||
onProceedWithSelectSource(id = id)
|
onProceedWithSelectSource(id = id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.ui.objects.types.pickers
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import com.anytypeio.anytype.R
|
import com.anytypeio.anytype.R
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
||||||
import com.anytypeio.anytype.core_utils.ext.withParent
|
import com.anytypeio.anytype.core_utils.ext.withParent
|
||||||
import com.anytypeio.anytype.di.common.componentManager
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
|
@ -23,9 +24,12 @@ class DraftObjectSelectTypeFragment : BaseObjectTypeChangeFragment() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemClicked(id: Id, name: String) {
|
override fun onItemClicked(id: Id, key: Key, name: String) {
|
||||||
withParent<OnObjectSelectTypeAction> {
|
withParent<OnObjectSelectTypeAction> {
|
||||||
onProceedWithDraftUpdateType(id = id)
|
onProceedWithDraftUpdateType(
|
||||||
|
id = id,
|
||||||
|
key = key
|
||||||
|
)
|
||||||
}
|
}
|
||||||
hideSoftInput()
|
hideSoftInput()
|
||||||
dismiss()
|
dismiss()
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.anytypeio.anytype.ui.objects.types.pickers
|
||||||
|
|
||||||
import com.anytypeio.anytype.R
|
import com.anytypeio.anytype.R
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
||||||
import com.anytypeio.anytype.core_utils.ext.withParent
|
import com.anytypeio.anytype.core_utils.ext.withParent
|
||||||
import com.anytypeio.anytype.di.common.componentManager
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
|
@ -22,7 +23,7 @@ class EmptyDataViewSelectSourceFragment : BaseObjectTypeChangeFragment() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemClicked(id: Id, name: String) {
|
override fun onItemClicked(id: Id, key: Key, name: String) {
|
||||||
withParent<OnDataViewSelectSourceAction> {
|
withParent<OnDataViewSelectSourceAction> {
|
||||||
onProceedWithSelectSource(id = id)
|
onProceedWithSelectSource(id = id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.ui.objects.types.pickers
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import com.anytypeio.anytype.R
|
import com.anytypeio.anytype.R
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
import com.anytypeio.anytype.core_utils.ext.hideSoftInput
|
||||||
import com.anytypeio.anytype.core_utils.ext.withParent
|
import com.anytypeio.anytype.core_utils.ext.withParent
|
||||||
import com.anytypeio.anytype.di.common.componentManager
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
|
@ -23,9 +24,9 @@ class ObjectSelectTypeFragment : BaseObjectTypeChangeFragment() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemClicked(id: Id, name: String) {
|
override fun onItemClicked(id: Id, key: Key, name: String) {
|
||||||
withParent<OnObjectSelectTypeAction> {
|
withParent<OnObjectSelectTypeAction> {
|
||||||
onProceedWithUpdateType(id = id)
|
onProceedWithUpdateType(id = id, key = key)
|
||||||
}
|
}
|
||||||
hideSoftInput()
|
hideSoftInput()
|
||||||
dismiss()
|
dismiss()
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package com.anytypeio.anytype.ui.objects.types.pickers
|
package com.anytypeio.anytype.ui.objects.types.pickers
|
||||||
|
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
|
|
||||||
interface OnObjectSelectTypeAction {
|
interface OnObjectSelectTypeAction {
|
||||||
fun onProceedWithUpdateType(id: Id)
|
fun onProceedWithUpdateType(id: Id, key: Key)
|
||||||
fun onProceedWithDraftUpdateType(id: Id)
|
fun onProceedWithDraftUpdateType(id: Id, key: Key)
|
||||||
}
|
}
|
|
@ -52,8 +52,8 @@ import com.anytypeio.anytype.core_ui.reactive.touches
|
||||||
import com.anytypeio.anytype.core_ui.tools.DefaultTextWatcher
|
import com.anytypeio.anytype.core_ui.tools.DefaultTextWatcher
|
||||||
import com.anytypeio.anytype.core_ui.views.ButtonPrimarySmallIcon
|
import com.anytypeio.anytype.core_ui.views.ButtonPrimarySmallIcon
|
||||||
import com.anytypeio.anytype.core_ui.widgets.FeaturedRelationGroupWidget
|
import com.anytypeio.anytype.core_ui.widgets.FeaturedRelationGroupWidget
|
||||||
import com.anytypeio.anytype.core_ui.widgets.TypeTemplatesWidget
|
|
||||||
import com.anytypeio.anytype.core_ui.widgets.StatusBadgeWidget
|
import com.anytypeio.anytype.core_ui.widgets.StatusBadgeWidget
|
||||||
|
import com.anytypeio.anytype.core_ui.widgets.TypeTemplatesWidget
|
||||||
import com.anytypeio.anytype.core_ui.widgets.dv.ViewerEditWidget
|
import com.anytypeio.anytype.core_ui.widgets.dv.ViewerEditWidget
|
||||||
import com.anytypeio.anytype.core_ui.widgets.dv.ViewerLayoutWidget
|
import com.anytypeio.anytype.core_ui.widgets.dv.ViewerLayoutWidget
|
||||||
import com.anytypeio.anytype.core_ui.widgets.dv.ViewersWidget
|
import com.anytypeio.anytype.core_ui.widgets.dv.ViewersWidget
|
||||||
|
@ -78,7 +78,6 @@ import com.anytypeio.anytype.databinding.FragmentObjectSetBinding
|
||||||
import com.anytypeio.anytype.di.common.componentManager
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
import com.anytypeio.anytype.presentation.editor.cover.CoverColor
|
import com.anytypeio.anytype.presentation.editor.cover.CoverColor
|
||||||
import com.anytypeio.anytype.presentation.editor.cover.CoverGradient
|
import com.anytypeio.anytype.presentation.editor.cover.CoverGradient
|
||||||
import com.anytypeio.anytype.presentation.sets.ViewersWidgetUi
|
|
||||||
import com.anytypeio.anytype.presentation.sets.DataViewViewState
|
import com.anytypeio.anytype.presentation.sets.DataViewViewState
|
||||||
import com.anytypeio.anytype.presentation.sets.ObjectSetCommand
|
import com.anytypeio.anytype.presentation.sets.ObjectSetCommand
|
||||||
import com.anytypeio.anytype.presentation.sets.ObjectSetViewModel
|
import com.anytypeio.anytype.presentation.sets.ObjectSetViewModel
|
||||||
|
@ -86,9 +85,9 @@ import com.anytypeio.anytype.presentation.sets.ObjectSetViewModelFactory
|
||||||
import com.anytypeio.anytype.presentation.sets.SetOrCollectionHeaderState
|
import com.anytypeio.anytype.presentation.sets.SetOrCollectionHeaderState
|
||||||
import com.anytypeio.anytype.presentation.sets.ViewEditAction
|
import com.anytypeio.anytype.presentation.sets.ViewEditAction
|
||||||
import com.anytypeio.anytype.presentation.sets.ViewerLayoutWidgetUi
|
import com.anytypeio.anytype.presentation.sets.ViewerLayoutWidgetUi
|
||||||
|
import com.anytypeio.anytype.presentation.sets.ViewersWidgetUi
|
||||||
import com.anytypeio.anytype.presentation.sets.isVisible
|
import com.anytypeio.anytype.presentation.sets.isVisible
|
||||||
import com.anytypeio.anytype.presentation.sets.model.Viewer
|
import com.anytypeio.anytype.presentation.sets.model.Viewer
|
||||||
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUI
|
|
||||||
import com.anytypeio.anytype.ui.base.NavigationFragment
|
import com.anytypeio.anytype.ui.base.NavigationFragment
|
||||||
import com.anytypeio.anytype.ui.editor.cover.SelectCoverObjectSetFragment
|
import com.anytypeio.anytype.ui.editor.cover.SelectCoverObjectSetFragment
|
||||||
import com.anytypeio.anytype.ui.editor.modals.IconPickerFragmentBase
|
import com.anytypeio.anytype.ui.editor.modals.IconPickerFragmentBase
|
||||||
|
@ -111,7 +110,8 @@ import com.anytypeio.anytype.ui.sets.modals.ManageViewerFragment
|
||||||
import com.anytypeio.anytype.ui.sets.modals.ObjectSetSettingsFragment
|
import com.anytypeio.anytype.ui.sets.modals.ObjectSetSettingsFragment
|
||||||
import com.anytypeio.anytype.ui.sets.modals.SetObjectCreateRecordFragmentBase
|
import com.anytypeio.anytype.ui.sets.modals.SetObjectCreateRecordFragmentBase
|
||||||
import com.anytypeio.anytype.ui.sets.modals.sort.ViewerSortFragment
|
import com.anytypeio.anytype.ui.sets.modals.sort.ViewerSortFragment
|
||||||
import com.anytypeio.anytype.ui.templates.EditorTemplateFragment.Companion.ARG_TARGET_OBJECT_TYPE
|
import com.anytypeio.anytype.ui.templates.EditorTemplateFragment.Companion.ARG_TARGET_TYPE_ID
|
||||||
|
import com.anytypeio.anytype.ui.templates.EditorTemplateFragment.Companion.ARG_TARGET_TYPE_KEY
|
||||||
import com.anytypeio.anytype.ui.templates.EditorTemplateFragment.Companion.ARG_TEMPLATE_ID
|
import com.anytypeio.anytype.ui.templates.EditorTemplateFragment.Companion.ARG_TEMPLATE_ID
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -1221,14 +1221,15 @@ open class ObjectSetFragment :
|
||||||
inflater, container, false
|
inflater, container, false
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun onProceedWithUpdateType(id: Id) {
|
override fun onProceedWithUpdateType(id: Id, key: Key) {
|
||||||
vm.onNewTypeForViewerClicked(id)
|
vm.onNewTypeForViewerClicked(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onProceedWithDraftUpdateType(id: Id) {
|
override fun onProceedWithDraftUpdateType(id: Id, key: Key) {
|
||||||
// Do nothing
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun observeSelectingTemplate() {
|
private fun observeSelectingTemplate() {
|
||||||
val navController = findNavController()
|
val navController = findNavController()
|
||||||
val navBackStackEntry = navController.getBackStackEntry(R.id.objectSetScreen)
|
val navBackStackEntry = navController.getBackStackEntry(R.id.objectSetScreen)
|
||||||
|
@ -1236,14 +1237,21 @@ open class ObjectSetFragment :
|
||||||
if (event == Lifecycle.Event.ON_RESUME
|
if (event == Lifecycle.Event.ON_RESUME
|
||||||
&& navBackStackEntry.savedStateHandle.contains(ARG_TEMPLATE_ID)) {
|
&& navBackStackEntry.savedStateHandle.contains(ARG_TEMPLATE_ID)) {
|
||||||
val resultTemplateId = navBackStackEntry.savedStateHandle.get<String>(ARG_TEMPLATE_ID)
|
val resultTemplateId = navBackStackEntry.savedStateHandle.get<String>(ARG_TEMPLATE_ID)
|
||||||
val resultObjectTypeId = navBackStackEntry.savedStateHandle.get<String>(ARG_TARGET_OBJECT_TYPE)
|
val resultTypeId = navBackStackEntry.savedStateHandle.get<String>(ARG_TARGET_TYPE_ID)
|
||||||
if (!resultTemplateId.isNullOrBlank() && !resultObjectTypeId.isNullOrBlank()) {
|
val resultTypeKey = navBackStackEntry.savedStateHandle.get<String>(ARG_TARGET_TYPE_KEY)
|
||||||
|
if (!resultTemplateId.isNullOrBlank() && !resultTypeId.isNullOrBlank() && !resultTypeKey.isNullOrBlank()) {
|
||||||
navBackStackEntry.savedStateHandle.remove<String>(ARG_TEMPLATE_ID)
|
navBackStackEntry.savedStateHandle.remove<String>(ARG_TEMPLATE_ID)
|
||||||
navBackStackEntry.savedStateHandle.remove<String>(ARG_TARGET_OBJECT_TYPE)
|
navBackStackEntry.savedStateHandle.remove<String>(ARG_TARGET_TYPE_ID)
|
||||||
vm.proceedWithSelectedTemplate(template = resultTemplateId, objectType = resultObjectTypeId)
|
navBackStackEntry.savedStateHandle.remove<String>(ARG_TARGET_TYPE_KEY)
|
||||||
|
vm.proceedWithSelectedTemplate(
|
||||||
|
template = resultTemplateId,
|
||||||
|
typeId = resultTypeId,
|
||||||
|
typeKey = resultTypeKey
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
navBackStackEntry.lifecycle.addObserver(observer)
|
navBackStackEntry.lifecycle.addObserver(observer)
|
||||||
|
|
||||||
viewLifecycleOwner.lifecycle.addObserver(LifecycleEventObserver { _, event ->
|
viewLifecycleOwner.lifecycle.addObserver(LifecycleEventObserver { _, event ->
|
||||||
|
|
|
@ -128,7 +128,12 @@ EditDataViewViewerFragment : BaseBottomSheetFragment<FragmentEditDataViewViewerB
|
||||||
isGalleryChosen.invisible()
|
isGalleryChosen.invisible()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EditDataViewViewerViewModel.ViewState.Kanban -> {}
|
EditDataViewViewerViewModel.ViewState.Kanban -> {
|
||||||
|
toast("TODO")
|
||||||
|
}
|
||||||
|
EditDataViewViewerViewModel.ViewState.Calendar -> {
|
||||||
|
toast("TODO")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_utils.ext.toast
|
import com.anytypeio.anytype.core_utils.ext.toast
|
||||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||||
import com.anytypeio.anytype.core_utils.ui.proceed
|
import com.anytypeio.anytype.core_utils.ui.proceed
|
||||||
|
@ -24,8 +25,8 @@ class OtherSettingsFragment : BaseBottomSheetFragment<FragmentUserSettingsBindin
|
||||||
|
|
||||||
private val vm by viewModels<OtherSettingsViewModel> { factory }
|
private val vm by viewModels<OtherSettingsViewModel> { factory }
|
||||||
|
|
||||||
override fun onProceedWithUpdateType(id: Id, name: String) {
|
override fun onProceedWithUpdateType(id: Id, key: Key, name: String) {
|
||||||
vm.proceedWithUpdateType(type = id, name = name)
|
vm.proceedWithUpdateType(type = id, key = key, name = name)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
|
|
@ -91,6 +91,13 @@ class ProfileFragment : BaseBottomSheetComposeFragment() {
|
||||||
setupBottomSheetBehavior(PADDING_TOP)
|
setupBottomSheetBehavior(PADDING_TOP)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
subscribe(vm.toasts) {
|
||||||
|
toast(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun proceedWithAccountDeletion() {
|
private fun proceedWithAccountDeletion() {
|
||||||
vm.proceedWithAccountDeletion()
|
vm.proceedWithAccountDeletion()
|
||||||
val dialog = DeleteAccountWarning()
|
val dialog = DeleteAccountWarning()
|
||||||
|
|
|
@ -0,0 +1,244 @@
|
||||||
|
package com.anytypeio.anytype.ui.settings.space
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
|
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||||
|
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import com.anytypeio.anytype.R
|
||||||
|
import com.anytypeio.anytype.core_ui.common.ComposeDialogView
|
||||||
|
import com.anytypeio.anytype.core_ui.extensions.throttledClick
|
||||||
|
import com.anytypeio.anytype.core_ui.foundation.Divider
|
||||||
|
import com.anytypeio.anytype.core_ui.foundation.Option
|
||||||
|
import com.anytypeio.anytype.core_ui.views.ButtonSize
|
||||||
|
import com.anytypeio.anytype.core_ui.views.ButtonWarning
|
||||||
|
import com.anytypeio.anytype.core_ui.views.PreviewTitle2Regular
|
||||||
|
import com.anytypeio.anytype.core_ui.views.Title1
|
||||||
|
import com.anytypeio.anytype.core_utils.ext.toast
|
||||||
|
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetComposeFragment
|
||||||
|
import com.anytypeio.anytype.core_utils.ui.ViewState
|
||||||
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SpaceSettingsViewModel
|
||||||
|
import com.anytypeio.anytype.ui.settings.typography
|
||||||
|
import com.anytypeio.anytype.ui.spaces.Section
|
||||||
|
import com.anytypeio.anytype.ui.spaces.TypeOfSpace
|
||||||
|
import com.anytypeio.anytype.ui_settings.main.SpaceHeader
|
||||||
|
import javax.inject.Inject
|
||||||
|
import timber.log.Timber
|
||||||
|
|
||||||
|
class SpaceSettingsFragment : BaseBottomSheetComposeFragment() {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var factory: SpaceSettingsViewModel.Factory
|
||||||
|
|
||||||
|
private val vm by viewModels<SpaceSettingsViewModel> { factory }
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
|
) = ComposeDialogView(
|
||||||
|
context = requireContext(), dialog = requireDialog()
|
||||||
|
).apply {
|
||||||
|
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||||
|
setContent {
|
||||||
|
MaterialTheme(typography = typography) {
|
||||||
|
SpaceSettingsScreen(onSpaceIconClick = {},
|
||||||
|
onNameSet = vm::onNameSet,
|
||||||
|
spaceData = vm.spaceViewState.collectAsStateWithLifecycle().value,
|
||||||
|
onDeleteSpaceClicked = {
|
||||||
|
toast("Coming soon...")
|
||||||
|
},
|
||||||
|
onFileStorageClick = {
|
||||||
|
findNavController().navigate(R.id.filesStorageScreen)
|
||||||
|
},
|
||||||
|
onPersonalizationClicked = {
|
||||||
|
findNavController().navigate(R.id.personalizationScreen)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
expand()
|
||||||
|
skipCollapsed()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun injectDependencies() {
|
||||||
|
componentManager().spaceSettingsComponent.get().inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun releaseDependencies() {
|
||||||
|
componentManager().spaceSettingsComponent.release()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SpaceSettingsScreen(
|
||||||
|
spaceData: ViewState<SpaceSettingsViewModel.SpaceData>,
|
||||||
|
onSpaceIconClick: () -> Unit,
|
||||||
|
onNameSet: (String) -> Unit,
|
||||||
|
onDeleteSpaceClicked: () -> Unit,
|
||||||
|
onFileStorageClick: () -> Unit,
|
||||||
|
onPersonalizationClicked: () -> Unit,
|
||||||
|
) {
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier
|
||||||
|
.nestedScroll(rememberNestedScrollInteropConnection())
|
||||||
|
.fillMaxSize(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
item {
|
||||||
|
SpaceHeader(
|
||||||
|
modifier = Modifier,
|
||||||
|
name = when (spaceData) {
|
||||||
|
is ViewState.Success -> spaceData.data.name.also {
|
||||||
|
Timber.d("Setting name: $it")
|
||||||
|
}
|
||||||
|
else -> null
|
||||||
|
},
|
||||||
|
icon = when (spaceData) {
|
||||||
|
is ViewState.Success -> spaceData.data.icon
|
||||||
|
else -> null
|
||||||
|
},
|
||||||
|
onSpaceIconClick = onSpaceIconClick,
|
||||||
|
onNameSet = onNameSet
|
||||||
|
)
|
||||||
|
}
|
||||||
|
item { Divider() }
|
||||||
|
item {
|
||||||
|
Section(title = "Type")
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
TypeOfSpace()
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Divider()
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Section(title = stringResource(id = R.string.settings))
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Option(image = R.drawable.ic_file_storage,
|
||||||
|
text = stringResource(R.string.remote_storage),
|
||||||
|
onClick = throttledClick(onFileStorageClick)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Option(image = R.drawable.ic_personalization,
|
||||||
|
text = stringResource(R.string.personalization),
|
||||||
|
onClick = throttledClick(onPersonalizationClicked)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Section(title = stringResource(id = R.string.space_info))
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(92.dp)
|
||||||
|
.padding(horizontal = 20.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.space_id),
|
||||||
|
style = Title1,
|
||||||
|
modifier = Modifier.padding(top = 12.dp)
|
||||||
|
)
|
||||||
|
if (spaceData is ViewState.Success) {
|
||||||
|
Text(
|
||||||
|
text = spaceData.data.spaceId ?: stringResource(id = R.string.unknown),
|
||||||
|
style = PreviewTitle2Regular,
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.BottomStart)
|
||||||
|
.padding(bottom = 12.dp, end = 50.dp),
|
||||||
|
maxLines = 2
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(72.dp)
|
||||||
|
.padding(horizontal = 20.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.created_by),
|
||||||
|
style = Title1,
|
||||||
|
modifier = Modifier.padding(top = 12.dp)
|
||||||
|
)
|
||||||
|
if (spaceData is ViewState.Success) {
|
||||||
|
Text(
|
||||||
|
text = spaceData.data.createdBy ?: stringResource(id = R.string.unknown),
|
||||||
|
style = PreviewTitle2Regular,
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.BottomStart)
|
||||||
|
.padding(bottom = 12.dp, end = 50.dp),
|
||||||
|
maxLines = 1
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(72.dp)
|
||||||
|
.padding(horizontal = 20.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.creation_date),
|
||||||
|
style = Title1,
|
||||||
|
modifier = Modifier.padding(top = 12.dp)
|
||||||
|
)
|
||||||
|
if (spaceData is ViewState.Success) {
|
||||||
|
Text(
|
||||||
|
text = spaceData.data.createdDate ?: stringResource(id = R.string.unknown),
|
||||||
|
style = PreviewTitle2Regular,
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.BottomStart)
|
||||||
|
.padding(bottom = 12.dp, end = 50.dp),
|
||||||
|
maxLines = 1
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Box(modifier = Modifier.height(78.dp)) {
|
||||||
|
ButtonWarning(
|
||||||
|
onClick = { onDeleteSpaceClicked() },
|
||||||
|
text = "Delete space",
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(start = 20.dp, end = 20.dp, bottom = 10.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.align(Alignment.BottomCenter),
|
||||||
|
size = ButtonSize.Large
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item {
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.anytypeio.anytype.ui.spaces
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.collectAsState
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import com.anytypeio.anytype.core_utils.ext.toast
|
||||||
|
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetComposeFragment
|
||||||
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.CreateSpaceViewModel
|
||||||
|
import com.anytypeio.anytype.ui.settings.typography
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class CreateSpaceFragment : BaseBottomSheetComposeFragment() {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var factory: CreateSpaceViewModel.Factory
|
||||||
|
|
||||||
|
private val vm by viewModels<CreateSpaceViewModel> { factory }
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View = ComposeView(requireContext()).apply {
|
||||||
|
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||||
|
setContent {
|
||||||
|
MaterialTheme(
|
||||||
|
typography = typography
|
||||||
|
) {
|
||||||
|
CreateSpaceScreen(
|
||||||
|
spaceIconView = vm.spaceGradient.collectAsState().value,
|
||||||
|
onCreate = vm::onCreateSpace,
|
||||||
|
onSpaceIconClicked = vm::onSpaceIconClicked,
|
||||||
|
isLoading = vm.isInProgress.collectAsState()
|
||||||
|
)
|
||||||
|
LaunchedEffect(Unit) { vm.toasts.collect() { toast(it) } }
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
vm.isDismissed.collect { isDismissed ->
|
||||||
|
if (isDismissed) dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
skipCollapsed()
|
||||||
|
expand()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun injectDependencies() {
|
||||||
|
componentManager().createSpaceComponent.get().inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun releaseDependencies() {
|
||||||
|
componentManager().createSpaceComponent.release()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,279 @@
|
||||||
|
package com.anytypeio.anytype.ui.spaces
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.wrapContentSize
|
||||||
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
|
import androidx.compose.material.ExperimentalMaterialApi
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.material.TextFieldDefaults
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.MutableState
|
||||||
|
import androidx.compose.runtime.State
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalFocusManager
|
||||||
|
import androidx.compose.ui.res.colorResource
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.input.VisualTransformation
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.anytypeio.anytype.R
|
||||||
|
import com.anytypeio.anytype.core_models.Name
|
||||||
|
import com.anytypeio.anytype.core_ui.foundation.Divider
|
||||||
|
import com.anytypeio.anytype.core_ui.foundation.Dragger
|
||||||
|
import com.anytypeio.anytype.core_ui.views.BodyRegular
|
||||||
|
import com.anytypeio.anytype.core_ui.views.ButtonPrimaryLoading
|
||||||
|
import com.anytypeio.anytype.core_ui.views.ButtonSize
|
||||||
|
import com.anytypeio.anytype.core_ui.views.Caption1Regular
|
||||||
|
import com.anytypeio.anytype.core_ui.views.HeadlineHeading
|
||||||
|
import com.anytypeio.anytype.core_ui.views.Title2
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SpaceIconView
|
||||||
|
import com.anytypeio.anytype.ui_settings.main.SpaceImageBlock
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun CreateSpaceScreen(
|
||||||
|
spaceIconView: SpaceIconView,
|
||||||
|
onCreate: (Name) -> Unit,
|
||||||
|
onSpaceIconClicked: () -> Unit,
|
||||||
|
isLoading: State<Boolean>
|
||||||
|
) {
|
||||||
|
val input = remember {
|
||||||
|
mutableStateOf("")
|
||||||
|
}
|
||||||
|
Column(modifier = Modifier.fillMaxHeight()) {
|
||||||
|
Dragger(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(vertical = 6.dp)
|
||||||
|
.align(Alignment.CenterHorizontally)
|
||||||
|
)
|
||||||
|
Header()
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
SpaceIcon(
|
||||||
|
modifier = Modifier.align(Alignment.CenterHorizontally),
|
||||||
|
spaceIconView = spaceIconView,
|
||||||
|
onSpaceIconClicked = onSpaceIconClicked
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
SpaceNameInput(input = input)
|
||||||
|
Divider()
|
||||||
|
Section(title = "Type")
|
||||||
|
TypeOfSpace()
|
||||||
|
Divider()
|
||||||
|
Section(title = "Start with")
|
||||||
|
UseCase()
|
||||||
|
Divider()
|
||||||
|
Box(modifier = Modifier.weight(1.0f)) {
|
||||||
|
CreateSpaceButton(
|
||||||
|
onCreate = onCreate,
|
||||||
|
input = input,
|
||||||
|
modifier = Modifier.align(Alignment.BottomCenter),
|
||||||
|
isLoading = isLoading
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun CreateSpaceButton(
|
||||||
|
modifier: Modifier,
|
||||||
|
onCreate: (Name) -> Unit,
|
||||||
|
input: State<String>,
|
||||||
|
isLoading: State<Boolean>
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = modifier
|
||||||
|
.height(78.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
ButtonPrimaryLoading(
|
||||||
|
onClick = { onCreate(input.value) },
|
||||||
|
text = stringResource(id = R.string.create),
|
||||||
|
size = ButtonSize.Large,
|
||||||
|
modifierButton = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 20.dp)
|
||||||
|
,
|
||||||
|
modifierBox = Modifier
|
||||||
|
.padding(bottom = 10.dp)
|
||||||
|
.align(Alignment.BottomCenter)
|
||||||
|
,
|
||||||
|
loading = isLoading.value
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Header() {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(48.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.align(Alignment.Center),
|
||||||
|
text = stringResource(id = R.string.create_space),
|
||||||
|
style = Title2,
|
||||||
|
color = colorResource(id = R.color.text_primary)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SpaceIcon(
|
||||||
|
modifier: Modifier,
|
||||||
|
spaceIconView: SpaceIconView,
|
||||||
|
onSpaceIconClicked: () -> Unit
|
||||||
|
) {
|
||||||
|
Box(modifier = modifier.wrapContentSize()) {
|
||||||
|
SpaceImageBlock(
|
||||||
|
icon = spaceIconView,
|
||||||
|
onSpaceIconClick = onSpaceIconClicked
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterialApi::class)
|
||||||
|
@Composable
|
||||||
|
fun SpaceNameInput(
|
||||||
|
input: MutableState<String>
|
||||||
|
) {
|
||||||
|
val focusManager = LocalFocusManager.current
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(72.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
BasicTextField(
|
||||||
|
value = input.value,
|
||||||
|
onValueChange = { input.value = it },
|
||||||
|
keyboardActions = KeyboardActions(
|
||||||
|
onDone = {
|
||||||
|
focusManager.clearFocus()
|
||||||
|
}
|
||||||
|
),
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(start = 20.dp, bottom = 12.dp)
|
||||||
|
.align(Alignment.BottomStart)
|
||||||
|
,
|
||||||
|
maxLines = 1,
|
||||||
|
singleLine = true,
|
||||||
|
textStyle = HeadlineHeading.copy(
|
||||||
|
color = colorResource(id = R.color.text_primary)
|
||||||
|
),
|
||||||
|
decorationBox = @Composable { innerTextField ->
|
||||||
|
TextFieldDefaults.OutlinedTextFieldDecorationBox(
|
||||||
|
value = input.value,
|
||||||
|
innerTextField = innerTextField,
|
||||||
|
singleLine = true,
|
||||||
|
enabled = true,
|
||||||
|
isError = false,
|
||||||
|
placeholder = {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.space_name),
|
||||||
|
style = HeadlineHeading
|
||||||
|
)
|
||||||
|
},
|
||||||
|
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||||
|
textColor = colorResource(id = com.anytypeio.anytype.ui_settings.R.color.text_primary),
|
||||||
|
backgroundColor = Color.Transparent,
|
||||||
|
disabledBorderColor = Color.Transparent,
|
||||||
|
errorBorderColor = Color.Transparent,
|
||||||
|
focusedBorderColor = Color.Transparent,
|
||||||
|
unfocusedBorderColor = Color.Transparent,
|
||||||
|
placeholderColor = colorResource(id = com.anytypeio.anytype.ui_settings.R.color.text_tertiary),
|
||||||
|
cursorColor = colorResource(id = com.anytypeio.anytype.ui_settings.R.color.orange)
|
||||||
|
),
|
||||||
|
contentPadding = PaddingValues(
|
||||||
|
start = 0.dp,
|
||||||
|
top = 0.dp,
|
||||||
|
end = 0.dp,
|
||||||
|
bottom = 0.dp
|
||||||
|
),
|
||||||
|
border = {},
|
||||||
|
interactionSource = remember { MutableInteractionSource() },
|
||||||
|
visualTransformation = VisualTransformation.None
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
color = colorResource(id = R.color.text_secondary),
|
||||||
|
style = Caption1Regular,
|
||||||
|
modifier = Modifier.padding(
|
||||||
|
start = 20.dp,
|
||||||
|
top = 11.dp
|
||||||
|
),
|
||||||
|
text = stringResource(id = R.string.space_name)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Section(
|
||||||
|
title: String
|
||||||
|
) {
|
||||||
|
Box(modifier = Modifier.height(52.dp).fillMaxWidth()) {
|
||||||
|
Text(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(
|
||||||
|
start = 20.dp,
|
||||||
|
bottom = 8.dp
|
||||||
|
)
|
||||||
|
.align(Alignment.BottomStart),
|
||||||
|
text = title,
|
||||||
|
color = colorResource(id = R.color.text_secondary)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TypeOfSpace() {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(52.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.CenterStart)
|
||||||
|
.padding(start = 18.dp),
|
||||||
|
painter = painterResource(id = R.drawable.ic_space_type_private),
|
||||||
|
contentDescription = "Private space icon"
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(start = 42.dp)
|
||||||
|
.align(Alignment.CenterStart),
|
||||||
|
text = "Private",
|
||||||
|
color = colorResource(id = R.color.text_primary),
|
||||||
|
style = BodyRegular
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun UseCase() {
|
||||||
|
Box(modifier = Modifier.height(52.dp)) {
|
||||||
|
Text(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(start = 20.dp)
|
||||||
|
.align(Alignment.CenterStart),
|
||||||
|
text = "Empty space",
|
||||||
|
color = colorResource(id = R.color.text_primary),
|
||||||
|
style = BodyRegular
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
package com.anytypeio.anytype.ui.spaces
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.collectAsState
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
|
import com.anytypeio.anytype.R
|
||||||
|
import com.anytypeio.anytype.core_utils.ext.toast
|
||||||
|
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetComposeFragment
|
||||||
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.Command
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SelectSpaceViewModel
|
||||||
|
import com.anytypeio.anytype.ui.settings.typography
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class SelectSpaceFragment : BaseBottomSheetComposeFragment() {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var factory: SelectSpaceViewModel.Factory
|
||||||
|
|
||||||
|
private val vm by viewModels<SelectSpaceViewModel> { factory }
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setStyle(
|
||||||
|
STYLE_NORMAL,
|
||||||
|
R.style.SelectSpaceDialogTheme
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View = ComposeView(requireContext()).apply {
|
||||||
|
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||||
|
setContent {
|
||||||
|
MaterialTheme(
|
||||||
|
typography = typography
|
||||||
|
) {
|
||||||
|
SelectSpaceScreen(
|
||||||
|
spaces = vm.views.collectAsState().value,
|
||||||
|
onSpaceClicked = vm::onSpaceClicked,
|
||||||
|
onAddClicked = vm::onCreateSpaceClicked,
|
||||||
|
onSpaceSettingsClicked = {
|
||||||
|
findNavController().navigate(
|
||||||
|
R.id.profileScreen
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onProfileClicked = {
|
||||||
|
findNavController().navigate(
|
||||||
|
R.id.profileScreen
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
vm.commands.collect { command -> proceedWithCommand(command) }
|
||||||
|
}
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
vm.toasts.collect { toast(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun proceedWithCommand(command: Command) {
|
||||||
|
when (command) {
|
||||||
|
is Command.CreateSpace -> {
|
||||||
|
findNavController().navigate(
|
||||||
|
R.id.createSpaceScreen
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is Command.Dismiss -> {
|
||||||
|
findNavController().popBackStack()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
skipCollapsed()
|
||||||
|
expand()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun injectDependencies() {
|
||||||
|
componentManager().selectSpaceComponent.get().inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun releaseDependencies() {
|
||||||
|
componentManager().selectSpaceComponent.release()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,288 @@
|
||||||
|
package com.anytypeio.anytype.ui.spaces
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.lazy.grid.GridCells
|
||||||
|
import androidx.compose.foundation.lazy.grid.GridItemSpan
|
||||||
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.graphics.Brush
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.layout.ContentScale
|
||||||
|
import androidx.compose.ui.res.colorResource
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.core.graphics.toColorInt
|
||||||
|
import coil.compose.rememberAsyncImagePainter
|
||||||
|
import com.anytypeio.anytype.R
|
||||||
|
import com.anytypeio.anytype.core_ui.foundation.Dragger
|
||||||
|
import com.anytypeio.anytype.core_ui.foundation.noRippleClickable
|
||||||
|
import com.anytypeio.anytype.core_ui.views.Caption1Medium
|
||||||
|
import com.anytypeio.anytype.core_ui.views.HeadlineHeading
|
||||||
|
import com.anytypeio.anytype.core_utils.ext.orNull
|
||||||
|
import com.anytypeio.anytype.presentation.profile.ProfileIconView
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SelectSpaceView
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.WorkspaceView
|
||||||
|
import com.anytypeio.anytype.ui_settings.main.SpaceImageBlock
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SelectSpaceScreen(
|
||||||
|
spaces: List<SelectSpaceView>,
|
||||||
|
onAddClicked: () -> Unit,
|
||||||
|
onSpaceClicked: (WorkspaceView) -> Unit,
|
||||||
|
onSpaceSettingsClicked: () -> Unit,
|
||||||
|
onProfileClicked: () -> Unit
|
||||||
|
) {
|
||||||
|
Column() {
|
||||||
|
Dragger(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(vertical = 6.dp)
|
||||||
|
.align(Alignment.CenterHorizontally)
|
||||||
|
)
|
||||||
|
LazyVerticalGrid(
|
||||||
|
columns = GridCells.Fixed(count = 3),
|
||||||
|
modifier = Modifier.padding(
|
||||||
|
bottom = 16.dp
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
spaces.forEach { item ->
|
||||||
|
when (item) {
|
||||||
|
is SelectSpaceView.Profile -> {
|
||||||
|
item(
|
||||||
|
span = {
|
||||||
|
GridItemSpan(MAX_SPAN_COUNT)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
SelectSpaceProfileHeader(
|
||||||
|
profile = item,
|
||||||
|
onSpaceSettingsClicked = onSpaceSettingsClicked,
|
||||||
|
onProfileClicked = onProfileClicked
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is SelectSpaceView.Space -> {
|
||||||
|
item(
|
||||||
|
span = {
|
||||||
|
GridItemSpan(1)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
SelectSpaceSpaceItem(item, onSpaceClicked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is SelectSpaceView.Create -> {
|
||||||
|
item(
|
||||||
|
span = {
|
||||||
|
GridItemSpan(1)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
SelectSpaceCreateButton(onAddClicked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SelectSpaceCreateButton(onAddClicked: () -> Unit) {
|
||||||
|
Column(modifier = Modifier) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(96.dp)
|
||||||
|
.align(Alignment.CenterHorizontally)
|
||||||
|
.clip(RoundedCornerShape(8.dp))
|
||||||
|
.background(Color(0x33FFFFFF))
|
||||||
|
.clickable { onAddClicked() }
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.ic_plus_32_white),
|
||||||
|
contentDescription = "Plus icon",
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.Center)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
Spacer(modifier = Modifier.height(28.dp))
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SelectSpaceSpaceItem(
|
||||||
|
item: SelectSpaceView.Space,
|
||||||
|
onSpaceClicked: (WorkspaceView) -> Unit
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(96.dp)
|
||||||
|
.align(Alignment.CenterHorizontally)
|
||||||
|
.clip(RoundedCornerShape(8.dp))
|
||||||
|
.then(
|
||||||
|
if (item.view.isSelected)
|
||||||
|
Modifier.border(
|
||||||
|
width = if (item.view.isSelected) 2.dp else 0.dp,
|
||||||
|
color = Color.White,
|
||||||
|
shape = RoundedCornerShape(8.dp)
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Modifier
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
SpaceImageBlock(
|
||||||
|
icon = item.view.icon,
|
||||||
|
onSpaceIconClick = { onSpaceClicked(item.view) },
|
||||||
|
gradientBackground = colorResource(id = R.color.default_gradient_background)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
text = item.view.name.orEmpty(),
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
style = Caption1Medium,
|
||||||
|
color = Color.White,
|
||||||
|
maxLines = 1
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SelectSpaceProfileHeader(
|
||||||
|
profile: SelectSpaceView.Profile,
|
||||||
|
onSpaceSettingsClicked: () -> Unit,
|
||||||
|
onProfileClicked: () -> Unit
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(68.dp)
|
||||||
|
.padding(bottom = 6.dp)
|
||||||
|
) {
|
||||||
|
SelectSpaceProfileIcon(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(start = 30.dp)
|
||||||
|
.align(Alignment.CenterStart),
|
||||||
|
name = profile.name,
|
||||||
|
icon = profile.icon,
|
||||||
|
onProfileIconClick = onProfileClicked
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = profile.name.orNull() ?: stringResource(id = R.string.untitled),
|
||||||
|
style = HeadlineHeading,
|
||||||
|
color = Color.White,
|
||||||
|
modifier = Modifier
|
||||||
|
.align(
|
||||||
|
Alignment.CenterStart
|
||||||
|
)
|
||||||
|
.padding(
|
||||||
|
start = 74.dp,
|
||||||
|
end = 74.dp
|
||||||
|
)
|
||||||
|
.clickable { onProfileClicked() }
|
||||||
|
)
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(end = 30.dp)
|
||||||
|
.size(32.dp)
|
||||||
|
.align(Alignment.CenterEnd)
|
||||||
|
.clickable { onSpaceSettingsClicked() }
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.ic_space_settings),
|
||||||
|
contentDescription = "Space settings icon",
|
||||||
|
modifier = Modifier.align(Alignment.Center)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SelectSpaceProfileIcon(
|
||||||
|
modifier: Modifier,
|
||||||
|
name: String,
|
||||||
|
icon: ProfileIconView,
|
||||||
|
onProfileIconClick: () -> Unit
|
||||||
|
) {
|
||||||
|
when (icon) {
|
||||||
|
is ProfileIconView.Image -> {
|
||||||
|
Image(
|
||||||
|
painter = rememberAsyncImagePainter(
|
||||||
|
model = icon.url,
|
||||||
|
error = painterResource(id = R.drawable.ic_home_widget_space)
|
||||||
|
),
|
||||||
|
contentDescription = "Custom image profile",
|
||||||
|
contentScale = ContentScale.Crop,
|
||||||
|
modifier = modifier
|
||||||
|
.size(32.dp)
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.noRippleClickable {
|
||||||
|
onProfileIconClick.invoke()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is ProfileIconView.Gradient -> {
|
||||||
|
val gradient = Brush.radialGradient(
|
||||||
|
colors = listOf(
|
||||||
|
Color(icon.from.toColorInt()),
|
||||||
|
Color(icon.to.toColorInt())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Box(modifier = modifier
|
||||||
|
.size(32.dp)
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(gradient)
|
||||||
|
.noRippleClickable {
|
||||||
|
onProfileIconClick.invoke()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
val nameFirstChar = if (name.isEmpty()) {
|
||||||
|
stringResource(id = R.string.account_default_name)
|
||||||
|
} else {
|
||||||
|
name.first().uppercaseChar().toString()
|
||||||
|
}
|
||||||
|
Box(
|
||||||
|
modifier = modifier
|
||||||
|
.size(32.dp)
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(colorResource(id = R.color.shape_primary))
|
||||||
|
.noRippleClickable {
|
||||||
|
onProfileIconClick.invoke()
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = nameFirstChar,
|
||||||
|
style = MaterialTheme.typography.h3.copy(
|
||||||
|
color = colorResource(id = R.color.text_white),
|
||||||
|
fontSize = 12.sp
|
||||||
|
),
|
||||||
|
modifier = Modifier.align(Alignment.Center)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const val MAX_SPAN_COUNT = 3
|
|
@ -14,9 +14,11 @@ import androidx.navigation.fragment.findNavController
|
||||||
import com.anytypeio.anytype.BuildConfig
|
import com.anytypeio.anytype.BuildConfig
|
||||||
import com.anytypeio.anytype.R
|
import com.anytypeio.anytype.R
|
||||||
import com.anytypeio.anytype.app.DefaultAppActionManager.Companion.ACTION_CREATE_NEW_TYPE_KEY
|
import com.anytypeio.anytype.app.DefaultAppActionManager.Companion.ACTION_CREATE_NEW_TYPE_KEY
|
||||||
|
import com.anytypeio.anytype.core_utils.ext.gone
|
||||||
import com.anytypeio.anytype.core_utils.ext.toast
|
import com.anytypeio.anytype.core_utils.ext.toast
|
||||||
import com.anytypeio.anytype.core_utils.ext.visible
|
import com.anytypeio.anytype.core_utils.ext.visible
|
||||||
import com.anytypeio.anytype.core_utils.ui.BaseFragment
|
import com.anytypeio.anytype.core_utils.ui.BaseFragment
|
||||||
|
import com.anytypeio.anytype.core_utils.ui.ViewState
|
||||||
import com.anytypeio.anytype.databinding.FragmentSplashBinding
|
import com.anytypeio.anytype.databinding.FragmentSplashBinding
|
||||||
import com.anytypeio.anytype.di.common.componentManager
|
import com.anytypeio.anytype.di.common.componentManager
|
||||||
import com.anytypeio.anytype.presentation.splash.SplashViewModel
|
import com.anytypeio.anytype.presentation.splash.SplashViewModel
|
||||||
|
@ -43,23 +45,40 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>(R.layout.fragment_spl
|
||||||
showVersion()
|
showVersion()
|
||||||
viewLifecycleOwner.lifecycleScope.launch {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
|
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||||
vm.commands.collect {
|
launch {
|
||||||
try {
|
vm.commands.collect {
|
||||||
observe(it)
|
try {
|
||||||
} catch (e: Exception) {
|
observe(it)
|
||||||
toast(e.message ?: resources.getString(R.string.unknown_error))
|
} catch (e: Exception) {
|
||||||
|
toast(e.message ?: resources.getString(R.string.unknown_error))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
launch {
|
||||||
|
vm.state.collect { state ->
|
||||||
|
when(state) {
|
||||||
|
is ViewState.Error -> {
|
||||||
|
binding.error.text = state.error
|
||||||
|
binding.error.visible()
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
binding.error.gone()
|
||||||
|
binding.error.text = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
binding.error.setOnClickListener {
|
||||||
|
vm.onErrorClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observe(command: SplashViewModel.Command) {
|
private fun observe(command: SplashViewModel.Command) {
|
||||||
when (command) {
|
when (command) {
|
||||||
is SplashViewModel.Command.Error -> {
|
|
||||||
toast(command.msg)
|
|
||||||
binding.error.visible()
|
|
||||||
}
|
|
||||||
SplashViewModel.Command.NavigateToDashboard -> {
|
SplashViewModel.Command.NavigateToDashboard -> {
|
||||||
try {
|
try {
|
||||||
findNavController().navigate(
|
findNavController().navigate(
|
||||||
|
|
|
@ -20,7 +20,8 @@ import timber.log.Timber
|
||||||
|
|
||||||
class EditorTemplateFragment : EditorFragment() {
|
class EditorTemplateFragment : EditorFragment() {
|
||||||
|
|
||||||
private val targetObjectType get() = arg<Id>(ARG_TARGET_OBJECT_TYPE)
|
private val targetTypeId get() = arg<Id>(ARG_TARGET_TYPE_ID)
|
||||||
|
private val targetTypeKey get() = arg<Id>(ARG_TARGET_TYPE_KEY)
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
@ -72,7 +73,8 @@ class EditorTemplateFragment : EditorFragment() {
|
||||||
findNavController().apply {
|
findNavController().apply {
|
||||||
previousBackStackEntry?.savedStateHandle?.apply {
|
previousBackStackEntry?.savedStateHandle?.apply {
|
||||||
set(ARG_TEMPLATE_ID, ctx)
|
set(ARG_TEMPLATE_ID, ctx)
|
||||||
set(ARG_TARGET_OBJECT_TYPE, targetObjectType)
|
set(ARG_TARGET_TYPE_ID, targetTypeId)
|
||||||
|
set(ARG_TARGET_TYPE_KEY, targetTypeKey)
|
||||||
}
|
}
|
||||||
popBackStack(R.id.editorModalScreen, true)
|
popBackStack(R.id.editorModalScreen, true)
|
||||||
}
|
}
|
||||||
|
@ -85,15 +87,17 @@ class EditorTemplateFragment : EditorFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(id: String, targetObjectType: Id): EditorTemplateFragment =
|
fun newInstance(id: String, targetTypeId: Id, targetTypeKey: Id): EditorTemplateFragment =
|
||||||
EditorTemplateFragment().apply {
|
EditorTemplateFragment().apply {
|
||||||
arguments = bundleOf(
|
arguments = bundleOf(
|
||||||
ID_KEY to id,
|
ID_KEY to id,
|
||||||
ARG_TARGET_OBJECT_TYPE to targetObjectType
|
ARG_TARGET_TYPE_ID to targetTypeId,
|
||||||
|
ARG_TARGET_TYPE_KEY to targetTypeKey
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const val ARG_TEMPLATE_ID = "template_id"
|
const val ARG_TEMPLATE_ID = "template_id"
|
||||||
const val ARG_TARGET_OBJECT_TYPE = "target_object_type"
|
const val ARG_TARGET_TYPE_ID = "target_type_id"
|
||||||
|
const val ARG_TARGET_TYPE_KEY = "target_type_key"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,7 +29,7 @@ import com.anytypeio.anytype.domain.page.CreateObject
|
||||||
import com.anytypeio.anytype.domain.search.ObjectSearchSubscriptionContainer
|
import com.anytypeio.anytype.domain.search.ObjectSearchSubscriptionContainer
|
||||||
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
import com.anytypeio.anytype.domain.search.SubscriptionEventChannel
|
||||||
import com.anytypeio.anytype.domain.templates.GetTemplates
|
import com.anytypeio.anytype.domain.templates.GetTemplates
|
||||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||||
import com.anytypeio.anytype.presentation.widgets.WidgetDispatchEvent
|
import com.anytypeio.anytype.presentation.widgets.WidgetDispatchEvent
|
||||||
import com.anytypeio.anytype.presentation.widgets.collection.CollectionViewModel
|
import com.anytypeio.anytype.presentation.widgets.collection.CollectionViewModel
|
||||||
|
@ -42,9 +42,7 @@ import kotlinx.coroutines.Dispatchers
|
||||||
|
|
||||||
@Component(
|
@Component(
|
||||||
dependencies = [CollectionDependencies::class],
|
dependencies = [CollectionDependencies::class],
|
||||||
modules = [
|
modules = [CollectionModule::class]
|
||||||
CollectionModule::class
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
@PerScreen
|
@PerScreen
|
||||||
interface CollectionComponent {
|
interface CollectionComponent {
|
||||||
|
@ -153,14 +151,14 @@ object CollectionModule {
|
||||||
@PerScreen
|
@PerScreen
|
||||||
fun getCreateObject(
|
fun getCreateObject(
|
||||||
repo: BlockRepository,
|
repo: BlockRepository,
|
||||||
getTemplates: GetTemplates,
|
|
||||||
getDefaultPageType: GetDefaultPageType,
|
getDefaultPageType: GetDefaultPageType,
|
||||||
dispatchers: AppCoroutineDispatchers
|
dispatchers: AppCoroutineDispatchers,
|
||||||
|
spaceManager: SpaceManager
|
||||||
): CreateObject = CreateObject(
|
): CreateObject = CreateObject(
|
||||||
repo = repo,
|
repo = repo,
|
||||||
getTemplates = getTemplates,
|
|
||||||
getDefaultPageType = getDefaultPageType,
|
getDefaultPageType = getDefaultPageType,
|
||||||
dispatchers = dispatchers
|
dispatchers = dispatchers,
|
||||||
|
spaceManager = spaceManager
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -169,13 +167,15 @@ object CollectionModule {
|
||||||
fun provideGetDefaultPageType(
|
fun provideGetDefaultPageType(
|
||||||
userSettingsRepository: UserSettingsRepository,
|
userSettingsRepository: UserSettingsRepository,
|
||||||
blockRepository: BlockRepository,
|
blockRepository: BlockRepository,
|
||||||
workspaceManager: WorkspaceManager,
|
dispatchers: AppCoroutineDispatchers,
|
||||||
dispatchers: AppCoroutineDispatchers
|
spaceManager: SpaceManager,
|
||||||
|
configStorage: ConfigStorage
|
||||||
): GetDefaultPageType = GetDefaultPageType(
|
): GetDefaultPageType = GetDefaultPageType(
|
||||||
userSettingsRepository = userSettingsRepository,
|
userSettingsRepository = userSettingsRepository,
|
||||||
blockRepository = blockRepository,
|
blockRepository = blockRepository,
|
||||||
workspaceManager = workspaceManager,
|
dispatchers = dispatchers,
|
||||||
dispatchers = dispatchers
|
spaceManager = spaceManager,
|
||||||
|
configStorage = configStorage
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -209,11 +209,11 @@ interface CollectionDependencies : ComponentDependencies {
|
||||||
fun urlBuilder(): UrlBuilder
|
fun urlBuilder(): UrlBuilder
|
||||||
fun objectStore(): ObjectStore
|
fun objectStore(): ObjectStore
|
||||||
fun subscriptionEventChannel(): SubscriptionEventChannel
|
fun subscriptionEventChannel(): SubscriptionEventChannel
|
||||||
fun workspaceManager(): WorkspaceManager
|
|
||||||
fun analytics(): Analytics
|
fun analytics(): Analytics
|
||||||
fun eventChannel(): EventChannel
|
fun eventChannel(): EventChannel
|
||||||
fun userSettingsRepository(): UserSettingsRepository
|
fun userSettingsRepository(): UserSettingsRepository
|
||||||
fun storeOfObjectTypes(): StoreOfObjectTypes
|
fun storeOfObjectTypes(): StoreOfObjectTypes
|
||||||
fun dispatchers(): AppCoroutineDispatchers
|
fun dispatchers(): AppCoroutineDispatchers
|
||||||
|
fun spaceManager(): SpaceManager
|
||||||
fun logger(): Logger
|
fun logger(): Logger
|
||||||
}
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.anytypeio.anytype.ui.widgets.types
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.colorResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.anytypeio.anytype.R
|
||||||
|
import com.anytypeio.anytype.core_ui.foundation.noRippleClickable
|
||||||
|
import com.anytypeio.anytype.core_ui.views.PreviewTitle2Medium
|
||||||
|
import com.anytypeio.anytype.core_ui.views.Relations3
|
||||||
|
import com.anytypeio.anytype.presentation.spaces.SpaceIconView
|
||||||
|
import com.anytypeio.anytype.ui_settings.main.SpaceImageBlock
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SpaceWidgetCard(
|
||||||
|
onClick: () -> Unit,
|
||||||
|
name: String,
|
||||||
|
icon: SpaceIconView
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(start = 20.dp, end = 20.dp, top = 12.dp, bottom = 6.dp)
|
||||||
|
.height(68.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.noRippleClickable { onClick() }
|
||||||
|
.background(
|
||||||
|
shape = RoundedCornerShape(16.dp),
|
||||||
|
color = colorResource(id = R.color.dashboard_card_background)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(start = 16.dp)
|
||||||
|
.align(Alignment.CenterStart)
|
||||||
|
) {
|
||||||
|
SpaceImageBlock(
|
||||||
|
icon = icon,
|
||||||
|
onSpaceIconClick = {},
|
||||||
|
mainSize = 40.dp,
|
||||||
|
gradientSize = 24.dp,
|
||||||
|
emojiSize = 24.dp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.align(Alignment.TopStart)
|
||||||
|
.padding(start = 71.dp, top = 16.dp, end = 32.dp)
|
||||||
|
,
|
||||||
|
text = name.trim().ifEmpty { stringResource(id = R.string.untitled) },
|
||||||
|
style = PreviewTitle2Medium,
|
||||||
|
color = colorResource(id = R.color.text_primary),
|
||||||
|
maxLines = 1
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.align(Alignment.BottomStart)
|
||||||
|
.padding(start = 71.dp, bottom = 16.dp)
|
||||||
|
,
|
||||||
|
text = stringResource(id = R.string.personal),
|
||||||
|
style = Relations3,
|
||||||
|
color = colorResource(id = R.color.text_secondary),
|
||||||
|
maxLines = 1
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,7 +30,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|center_horizontal"
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
android:layout_marginBottom="100dp"
|
android:layout_marginBottom="100dp"
|
||||||
android:text="@string/failed_to_launch_wallet"
|
android:text="@string/generic_error"
|
||||||
android:textColor="@color/palette_system_red"
|
android:textColor="@color/palette_system_red"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
tools:ignore="SmallSp"
|
tools:ignore="SmallSp"
|
||||||
|
|
|
@ -33,10 +33,11 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/doneBtn"
|
android:id="@+id/doneBtn"
|
||||||
style="@style/DefaultCellInteractionTextButtonStyle"
|
style="@style/TextView.UXStyle.Body"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="end"
|
android:gravity="center"
|
||||||
|
android:textColor="@color/glyph_active"
|
||||||
android:paddingStart="@dimen/dp_16"
|
android:paddingStart="@dimen/dp_16"
|
||||||
android:paddingEnd="16dp"
|
android:paddingEnd="16dp"
|
||||||
android:text="@string/done"
|
android:text="@string/done"
|
||||||
|
|
|
@ -145,8 +145,11 @@
|
||||||
android:label="Home screen"
|
android:label="Home screen"
|
||||||
tools:layout="@layout/fragment_home">
|
tools:layout="@layout/fragment_home">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_open_settings"
|
android:id="@+id/action_open_space_settings"
|
||||||
app:destination="@id/settingsScreen" />
|
app:destination="@id/spaceSettingsScreen" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_open_spaces"
|
||||||
|
app:destination="@id/selectSpaceScreen" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
|
@ -167,6 +170,19 @@
|
||||||
android:id="@+id/selectWidgetTypeScreen"
|
android:id="@+id/selectWidgetTypeScreen"
|
||||||
android:name="com.anytypeio.anytype.ui.widgets.SelectWidgetTypeFragment"/>
|
android:name="com.anytypeio.anytype.ui.widgets.SelectWidgetTypeFragment"/>
|
||||||
|
|
||||||
|
<dialog
|
||||||
|
android:id="@+id/selectSpaceScreen"
|
||||||
|
android:name="com.anytypeio.anytype.ui.spaces.SelectSpaceFragment"/>
|
||||||
|
|
||||||
|
<dialog
|
||||||
|
android:id="@+id/createSpaceScreen"
|
||||||
|
android:name="com.anytypeio.anytype.ui.spaces.CreateSpaceFragment"/>
|
||||||
|
|
||||||
|
<dialog
|
||||||
|
android:id="@+id/spaceSettingsScreen"
|
||||||
|
android:name="com.anytypeio.anytype.ui.settings.space.SpaceSettingsFragment"
|
||||||
|
android:label="SpaceSettingsScreen"/>
|
||||||
|
|
||||||
<dialog
|
<dialog
|
||||||
android:id="@+id/settingsScreen"
|
android:id="@+id/settingsScreen"
|
||||||
android:name="com.anytypeio.anytype.ui.settings.MainSettingFragment"
|
android:name="com.anytypeio.anytype.ui.settings.MainSettingFragment"
|
||||||
|
|
|
@ -393,4 +393,14 @@ Do the computation of an expensive paragraph of text on a background thread:
|
||||||
|
|
||||||
<string name="exiting_please_wait">Exiting... please wait</string>
|
<string name="exiting_please_wait">Exiting... please wait</string>
|
||||||
<string name="loading_please_wait">Loading... please wait</string>
|
<string name="loading_please_wait">Loading... please wait</string>
|
||||||
|
<string name="personal">Personal</string>
|
||||||
|
<string name="create_space">Create a space</string>
|
||||||
|
|
||||||
|
<string name="generic_error">Something went wrong. Please try again.</string>
|
||||||
|
<string name="type">Type\n</string>
|
||||||
|
<string name="space_info">Space info</string>
|
||||||
|
<string name="creation_date">Creation date</string>
|
||||||
|
<string name="created_by">Created by</string>
|
||||||
|
<string name="space_id">Space ID</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -296,7 +296,8 @@ data class Block(
|
||||||
GRID("Grid"),
|
GRID("Grid"),
|
||||||
LIST("List"),
|
LIST("List"),
|
||||||
GALLERY("Gallery"),
|
GALLERY("Gallery"),
|
||||||
BOARD("Board")
|
BOARD("Board"),
|
||||||
|
CALENDAR("Calendar")
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class Size { SMALL, MEDIUM, LARGE }
|
enum class Size { SMALL, MEDIUM, LARGE }
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.anytypeio.anytype.core_models
|
package com.anytypeio.anytype.core_models
|
||||||
|
|
||||||
|
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||||
|
import com.anytypeio.anytype.core_models.primitives.TypeKey
|
||||||
|
|
||||||
sealed class Command {
|
sealed class Command {
|
||||||
|
|
||||||
class UploadFile(
|
class UploadFile(
|
||||||
|
@ -165,6 +168,7 @@ sealed class Command {
|
||||||
*/
|
*/
|
||||||
data class CreateBlockLinkWithObject(
|
data class CreateBlockLinkWithObject(
|
||||||
val context: Id,
|
val context: Id,
|
||||||
|
val type: TypeKey,
|
||||||
val target: Id,
|
val target: Id,
|
||||||
val position: Position,
|
val position: Position,
|
||||||
val template: Id?,
|
val template: Id?,
|
||||||
|
@ -181,7 +185,9 @@ sealed class Command {
|
||||||
data class CreateObject(
|
data class CreateObject(
|
||||||
val prefilled: Struct,
|
val prefilled: Struct,
|
||||||
val template: Id?,
|
val template: Id?,
|
||||||
val internalFlags: List<InternalFlags>
|
val internalFlags: List<InternalFlags>,
|
||||||
|
val space: SpaceId,
|
||||||
|
val type: TypeKey
|
||||||
)
|
)
|
||||||
|
|
||||||
class Move(
|
class Move(
|
||||||
|
|
|
@ -5,13 +5,14 @@ package com.anytypeio.anytype.core_models
|
||||||
* @property home id of the home dashboard
|
* @property home id of the home dashboard
|
||||||
* @property profile id of the current profile
|
* @property profile id of the current profile
|
||||||
* @property gateway url of the gateway for fetching files.
|
* @property gateway url of the gateway for fetching files.
|
||||||
* @property workspace id of account workspace
|
* @property spaceView id of space view - UI-representation of space object
|
||||||
*/
|
*/
|
||||||
data class Config(
|
data class Config(
|
||||||
val home: Id,
|
val home: Id,
|
||||||
val profile: Id,
|
val profile: Id,
|
||||||
val gateway: Url,
|
val gateway: Url,
|
||||||
val workspace: Id,
|
val space: Id,
|
||||||
|
val spaceView: Id,
|
||||||
val widgets: Id,
|
val widgets: Id,
|
||||||
val analytics: Id,
|
val analytics: Id,
|
||||||
val device: Id
|
val device: Id
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package com.anytypeio.anytype.core_models
|
||||||
|
|
||||||
|
const val NO_VALUE = ""
|
|
@ -43,7 +43,13 @@ data class ObjectType(
|
||||||
SPACE(10),
|
SPACE(10),
|
||||||
BOOKMARK(11),
|
BOOKMARK(11),
|
||||||
DATABASE(20),
|
DATABASE(20),
|
||||||
COLLECTION(14)
|
RELATION_OPTION_LIST(12),
|
||||||
|
RELATION_OPTION(13),
|
||||||
|
COLLECTION(14),
|
||||||
|
AUDIO(15),
|
||||||
|
VIDEO(16),
|
||||||
|
DATE(17),
|
||||||
|
SPACE_VIEW(18)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.anytypeio.anytype.core_models
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keys for predefined, bundled object types.
|
* Keys for predefined, bundled object types.
|
||||||
|
* // TODO rename to ObjectTypeUniqueKeys when finished multi-spaces refactoring
|
||||||
*/
|
*/
|
||||||
object ObjectTypeIds {
|
object ObjectTypeIds {
|
||||||
const val PAGE = "ot-page"
|
const val PAGE = "ot-page"
|
||||||
|
@ -67,5 +68,10 @@ object MarketplaceObjectTypeIds {
|
||||||
}
|
}
|
||||||
|
|
||||||
object Marketplace {
|
object Marketplace {
|
||||||
const val MARKETPLACE_ID = "_anytype_marketplace"
|
const val MARKETPLACE_SPACE_ID = "_anytype_marketplace"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO Temporary typealias - remove and rename [ObjectTypeIds] when finished multi-spaces refactoring
|
||||||
|
*/
|
||||||
|
typealias ObjectTypeUniqueKeys = ObjectTypeIds
|
|
@ -54,6 +54,8 @@ sealed class ObjectWrapper {
|
||||||
|
|
||||||
val id: Id by default
|
val id: Id by default
|
||||||
|
|
||||||
|
val uniqueKey: String? by default
|
||||||
|
|
||||||
val done: Boolean? by default
|
val done: Boolean? by default
|
||||||
|
|
||||||
val snippet: String? by default
|
val snippet: String? by default
|
||||||
|
@ -154,6 +156,7 @@ sealed class ObjectWrapper {
|
||||||
data class Type(override val map: Struct) : ObjectWrapper() {
|
data class Type(override val map: Struct) : ObjectWrapper() {
|
||||||
private val default = map.withDefault { null }
|
private val default = map.withDefault { null }
|
||||||
val id: Id by default
|
val id: Id by default
|
||||||
|
val uniqueKey: String? by default
|
||||||
val name: String? by default
|
val name: String? by default
|
||||||
val sourceObject: Id? by default
|
val sourceObject: Id? by default
|
||||||
val description: String? by default
|
val description: String? by default
|
||||||
|
@ -166,9 +169,13 @@ sealed class ObjectWrapper {
|
||||||
is Double -> ObjectType.Layout.values().singleOrNull { layout ->
|
is Double -> ObjectType.Layout.values().singleOrNull { layout ->
|
||||||
layout.code == value.toInt()
|
layout.code == value.toInt()
|
||||||
}
|
}
|
||||||
else -> null
|
else -> ObjectType.Layout.BASIC
|
||||||
}
|
}
|
||||||
val defaultTemplateId: Id? by default
|
val defaultTemplateId: Id? by default
|
||||||
|
|
||||||
|
val key: String? get() = uniqueKey
|
||||||
|
|
||||||
|
val isValid get() = map.containsKey(Relations.UNIQUE_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Relation(override val map: Struct) : ObjectWrapper() {
|
data class Relation(override val map: Struct) : ObjectWrapper() {
|
||||||
|
@ -192,8 +199,9 @@ sealed class ObjectWrapper {
|
||||||
private val relationReadonlyValue: Boolean? by default
|
private val relationReadonlyValue: Boolean? by default
|
||||||
|
|
||||||
val id: Id by default
|
val id: Id by default
|
||||||
|
val uniqueKey: String? by default
|
||||||
val key: Key get() = relationKey
|
val key: Key get() = relationKey
|
||||||
val workspaceId: Id? by default
|
val spaceId: Id? by default
|
||||||
val sourceObject: Id? by default
|
val sourceObject: Id? by default
|
||||||
val format: RelationFormat get() = relationFormat
|
val format: RelationFormat get() = relationFormat
|
||||||
val name: String? by default
|
val name: String? by default
|
||||||
|
@ -230,6 +238,13 @@ sealed class ObjectWrapper {
|
||||||
val color: String = relationOptionColor.orEmpty()
|
val color: String = relationOptionColor.orEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class Workspace(override val map: Struct) : ObjectWrapper() {
|
||||||
|
private val default = map.withDefault { null }
|
||||||
|
val id: Id by default
|
||||||
|
val name: String? by default
|
||||||
|
val spaceId: String? by default
|
||||||
|
}
|
||||||
|
|
||||||
inline fun <reified T> getValue(relation: Key): T? {
|
inline fun <reified T> getValue(relation: Key): T? {
|
||||||
val value = map.getOrDefault(relation, null)
|
val value = map.getOrDefault(relation, null)
|
||||||
return if (value is T)
|
return if (value is T)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.anytypeio.anytype.core_models
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keys for predefined, bundled relations.
|
* Keys for predefined, bundled relations.
|
||||||
|
* // TODO remove outdated or deprecated relations
|
||||||
*/
|
*/
|
||||||
object Relations {
|
object Relations {
|
||||||
|
|
||||||
|
@ -29,7 +30,8 @@ object Relations {
|
||||||
const val DONE = "done"
|
const val DONE = "done"
|
||||||
const val FEATURED_RELATIONS = "featuredRelations"
|
const val FEATURED_RELATIONS = "featuredRelations"
|
||||||
const val SNIPPET = "snippet"
|
const val SNIPPET = "snippet"
|
||||||
const val WORKSPACE_ID = "workspaceId"
|
const val SPACE_ID = "spaceId"
|
||||||
|
const val TARGET_SPACE_ID = "targetSpaceId"
|
||||||
const val SET_OF = "setOf"
|
const val SET_OF = "setOf"
|
||||||
const val URL = "url"
|
const val URL = "url"
|
||||||
const val SOURCE = "source"
|
const val SOURCE = "source"
|
||||||
|
@ -48,6 +50,7 @@ object Relations {
|
||||||
const val SIZE_IN_BYTES = "sizeInBytes"
|
const val SIZE_IN_BYTES = "sizeInBytes"
|
||||||
const val FILE_SYNC_STATUS = "fileSyncStatus"
|
const val FILE_SYNC_STATUS = "fileSyncStatus"
|
||||||
const val CREATED_DATE = "createdDate"
|
const val CREATED_DATE = "createdDate"
|
||||||
|
const val CREATOR = "creator"
|
||||||
|
|
||||||
const val PAGE_COVER = "pageCover"
|
const val PAGE_COVER = "pageCover"
|
||||||
|
|
||||||
|
@ -61,6 +64,13 @@ object Relations {
|
||||||
const val RECOMMENDED_RELATIONS = "recommendedRelations"
|
const val RECOMMENDED_RELATIONS = "recommendedRelations"
|
||||||
const val DEFAULT_TEMPLATE_ID = "defaultTemplateId"
|
const val DEFAULT_TEMPLATE_ID = "defaultTemplateId"
|
||||||
|
|
||||||
|
const val UNIQUE_KEY = "uniqueKey"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transitive relation key.
|
||||||
|
*/
|
||||||
|
const val TYPE_UNIQUE_KEY = "type.uniqueKey"
|
||||||
|
|
||||||
val systemRelationKeys = listOf(
|
val systemRelationKeys = listOf(
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"name",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.anytypeio.anytype.core_models.exceptions
|
package com.anytypeio.anytype.core_models.exceptions
|
||||||
|
|
||||||
sealed class CreateAccountException : Exception() {
|
sealed class CreateAccountException : Exception() {
|
||||||
|
@Deprecated("To be delete")
|
||||||
object BadInviteCode : CreateAccountException()
|
object BadInviteCode : CreateAccountException()
|
||||||
object NetworkError: CreateAccountException()
|
object NetworkError: CreateAccountException()
|
||||||
object OfflineDevice: CreateAccountException()
|
object OfflineDevice: CreateAccountException()
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.anytypeio.anytype.core_models.primitives
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class Id(val id: String)
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class Key(val key: String)
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class SpaceId(val id: String)
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class TypeId(val id: String)
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class TypeKey(val key: String)
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class RelationId(val id: String)
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class RelationKey(val key: String)
|
|
@ -4,6 +4,7 @@ import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_ui.R
|
import com.anytypeio.anytype.core_ui.R
|
||||||
import com.anytypeio.anytype.core_ui.common.DefaultSectionViewHolder
|
import com.anytypeio.anytype.core_ui.common.DefaultSectionViewHolder
|
||||||
import com.anytypeio.anytype.core_ui.databinding.ItemDefaultListSectionBinding
|
import com.anytypeio.anytype.core_ui.databinding.ItemDefaultListSectionBinding
|
||||||
|
@ -15,7 +16,7 @@ import com.anytypeio.anytype.presentation.objects.ObjectTypeItemView
|
||||||
|
|
||||||
class ObjectTypeVerticalAdapter(
|
class ObjectTypeVerticalAdapter(
|
||||||
private var data: ArrayList<ObjectTypeItemView>,
|
private var data: ArrayList<ObjectTypeItemView>,
|
||||||
private val onItemClick: (Id, String) -> Unit
|
private val onItemClick: (Id, Key, String) -> Unit
|
||||||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||||
|
|
||||||
fun update(data: List<ObjectTypeItemView>) {
|
fun update(data: List<ObjectTypeItemView>) {
|
||||||
|
@ -36,7 +37,11 @@ class ObjectTypeVerticalAdapter(
|
||||||
itemView.setOnClickListener {
|
itemView.setOnClickListener {
|
||||||
if (bindingAdapterPosition != RecyclerView.NO_POSITION) {
|
if (bindingAdapterPosition != RecyclerView.NO_POSITION) {
|
||||||
val item = data[bindingAdapterPosition] as ObjectTypeItemView.Type
|
val item = data[bindingAdapterPosition] as ObjectTypeItemView.Type
|
||||||
onItemClick(item.view.id, item.view.name)
|
onItemClick(
|
||||||
|
item.view.id,
|
||||||
|
item.view.key,
|
||||||
|
item.view.name
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.anytypeio.anytype.core_models.Id
|
import com.anytypeio.anytype.core_models.Id
|
||||||
|
import com.anytypeio.anytype.core_models.Key
|
||||||
import com.anytypeio.anytype.core_ui.R
|
import com.anytypeio.anytype.core_ui.R
|
||||||
import com.anytypeio.anytype.core_ui.databinding.ItemObjectTypeHorizontalItemBinding
|
import com.anytypeio.anytype.core_ui.databinding.ItemObjectTypeHorizontalItemBinding
|
||||||
import com.anytypeio.anytype.core_ui.features.objects.holders.ObjectTypeHorizontalHolder
|
import com.anytypeio.anytype.core_ui.features.objects.holders.ObjectTypeHorizontalHolder
|
||||||
|
@ -12,7 +13,7 @@ import com.anytypeio.anytype.presentation.objects.ObjectTypeView
|
||||||
|
|
||||||
class ObjectTypeHorizontalListAdapter(
|
class ObjectTypeHorizontalListAdapter(
|
||||||
private var data: ArrayList<ObjectTypeView>,
|
private var data: ArrayList<ObjectTypeView>,
|
||||||
private val onItemClick: (Id, String) -> Unit,
|
private val onItemClick: (Id, Key, String) -> Unit,
|
||||||
private val onSearchClick: (() -> Unit)? = null
|
private val onSearchClick: (() -> Unit)? = null
|
||||||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ class ObjectTypeHorizontalListAdapter(
|
||||||
itemView.setOnClickListener {
|
itemView.setOnClickListener {
|
||||||
if (bindingAdapterPosition != RecyclerView.NO_POSITION) {
|
if (bindingAdapterPosition != RecyclerView.NO_POSITION) {
|
||||||
val item = data[bindingAdapterPosition - 1] as ObjectTypeView
|
val item = data[bindingAdapterPosition - 1] as ObjectTypeView
|
||||||
onItemClick(item.id, item.name)
|
onItemClick(item.id, item.key, item.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.alpha
|
||||||
import androidx.compose.ui.res.colorResource
|
import androidx.compose.ui.res.colorResource
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
@ -71,10 +72,12 @@ fun Dragger(modifier: Modifier = Modifier) {
|
||||||
@Composable
|
@Composable
|
||||||
fun Divider(
|
fun Divider(
|
||||||
paddingStart: Dp = 20.dp,
|
paddingStart: Dp = 20.dp,
|
||||||
paddingEnd: Dp = 20.dp
|
paddingEnd: Dp = 20.dp,
|
||||||
|
visible: Boolean = true
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
Modifier
|
Modifier
|
||||||
|
.alpha(if (visible) 1f else 0f)
|
||||||
.padding(start = paddingStart, end = paddingEnd)
|
.padding(start = paddingStart, end = paddingEnd)
|
||||||
.background(color = colorResource(R.color.shape_primary))
|
.background(color = colorResource(R.color.shape_primary))
|
||||||
.height(0.5.dp)
|
.height(0.5.dp)
|
||||||
|
|
|
@ -51,6 +51,7 @@ import androidx.compose.runtime.rememberUpdatedState
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.alpha
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.draw.drawBehind
|
import androidx.compose.ui.draw.drawBehind
|
||||||
import androidx.compose.ui.draw.shadow
|
import androidx.compose.ui.draw.shadow
|
||||||
|
@ -81,6 +82,8 @@ import com.anytypeio.anytype.core_models.Id
|
||||||
import com.anytypeio.anytype.core_models.ObjectType
|
import com.anytypeio.anytype.core_models.ObjectType
|
||||||
import com.anytypeio.anytype.core_models.ObjectWrapper
|
import com.anytypeio.anytype.core_models.ObjectWrapper
|
||||||
import com.anytypeio.anytype.core_models.Relations
|
import com.anytypeio.anytype.core_models.Relations
|
||||||
|
import com.anytypeio.anytype.core_models.primitives.TypeId
|
||||||
|
import com.anytypeio.anytype.core_models.primitives.TypeKey
|
||||||
import com.anytypeio.anytype.core_ui.R
|
import com.anytypeio.anytype.core_ui.R
|
||||||
import com.anytypeio.anytype.core_ui.foundation.Divider
|
import com.anytypeio.anytype.core_ui.foundation.Divider
|
||||||
import com.anytypeio.anytype.core_ui.foundation.Dragger
|
import com.anytypeio.anytype.core_ui.foundation.Dragger
|
||||||
|
@ -88,9 +91,11 @@ import com.anytypeio.anytype.core_ui.foundation.noRippleClickable
|
||||||
import com.anytypeio.anytype.core_ui.foundation.noRippleThrottledClickable
|
import com.anytypeio.anytype.core_ui.foundation.noRippleThrottledClickable
|
||||||
import com.anytypeio.anytype.core_ui.views.BodyCalloutMedium
|
import com.anytypeio.anytype.core_ui.views.BodyCalloutMedium
|
||||||
import com.anytypeio.anytype.core_ui.views.BodyCalloutRegular
|
import com.anytypeio.anytype.core_ui.views.BodyCalloutRegular
|
||||||
|
import com.anytypeio.anytype.core_ui.views.BodyRegular
|
||||||
import com.anytypeio.anytype.core_ui.views.Caption1Medium
|
import com.anytypeio.anytype.core_ui.views.Caption1Medium
|
||||||
import com.anytypeio.anytype.core_ui.views.Caption2Semibold
|
import com.anytypeio.anytype.core_ui.views.Caption2Semibold
|
||||||
import com.anytypeio.anytype.core_ui.views.ModalTitle
|
import com.anytypeio.anytype.core_ui.views.ModalTitle
|
||||||
|
import com.anytypeio.anytype.core_ui.views.Title1
|
||||||
import com.anytypeio.anytype.core_ui.views.fontInterRegular
|
import com.anytypeio.anytype.core_ui.views.fontInterRegular
|
||||||
import com.anytypeio.anytype.emojifier.Emojifier
|
import com.anytypeio.anytype.emojifier.Emojifier
|
||||||
import com.anytypeio.anytype.presentation.editor.cover.CoverGradient
|
import com.anytypeio.anytype.presentation.editor.cover.CoverGradient
|
||||||
|
@ -100,8 +105,8 @@ import com.anytypeio.anytype.presentation.templates.TemplateView
|
||||||
import com.anytypeio.anytype.presentation.templates.TemplateView.Companion.DEFAULT_TEMPLATE_ID_BLANK
|
import com.anytypeio.anytype.presentation.templates.TemplateView.Companion.DEFAULT_TEMPLATE_ID_BLANK
|
||||||
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUI
|
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUI
|
||||||
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUIAction
|
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUIAction
|
||||||
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUIAction.TypeClick
|
|
||||||
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUIAction.TemplateClick
|
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUIAction.TemplateClick
|
||||||
|
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUIAction.TypeClick
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
@ -164,7 +169,6 @@ fun TypeTemplatesWidget(
|
||||||
var currentClickedMoreButtonCoordinates: IntOffset by remember {
|
var currentClickedMoreButtonCoordinates: IntOffset by remember {
|
||||||
mutableStateOf(IntOffset(0, 0))
|
mutableStateOf(IntOffset(0, 0))
|
||||||
}
|
}
|
||||||
val showPlusButton = remember { mutableStateOf(false) }
|
|
||||||
|
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = currentState.showWidget,
|
visible = currentState.showWidget,
|
||||||
|
@ -216,9 +220,11 @@ fun TypeTemplatesWidget(
|
||||||
.padding(
|
.padding(
|
||||||
start = 15.dp, top = 12.dp, bottom = 12.dp, end = 16.dp
|
start = 15.dp, top = 12.dp, bottom = 12.dp, end = 16.dp
|
||||||
)
|
)
|
||||||
.noRippleClickable { doneClick() },
|
.noRippleClickable { doneClick() }
|
||||||
|
.alpha(if (currentState.isPossibleToChangeTemplate) 1f else 0f)
|
||||||
|
,
|
||||||
text = stringResource(id = R.string.done),
|
text = stringResource(id = R.string.done),
|
||||||
style = BodyCalloutRegular,
|
style = BodyRegular,
|
||||||
color = colorResource(id = R.color.glyph_active)
|
color = colorResource(id = R.color.glyph_active)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -230,9 +236,10 @@ fun TypeTemplatesWidget(
|
||||||
bottom = 12.dp,
|
bottom = 12.dp,
|
||||||
end = 16.dp
|
end = 16.dp
|
||||||
)
|
)
|
||||||
.noRippleClickable { editClick() },
|
.noRippleClickable { editClick() }
|
||||||
|
.alpha(if (currentState.isPossibleToChangeTemplate) 1f else 0f),
|
||||||
text = stringResource(id = R.string.edit),
|
text = stringResource(id = R.string.edit),
|
||||||
style = BodyCalloutRegular,
|
style = BodyRegular,
|
||||||
color = colorResource(id = R.color.glyph_active)
|
color = colorResource(id = R.color.glyph_active)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -241,32 +248,34 @@ fun TypeTemplatesWidget(
|
||||||
Box(modifier = Modifier.align(Alignment.Center)) {
|
Box(modifier = Modifier.align(Alignment.Center)) {
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
style = ModalTitle,
|
style = Title1,
|
||||||
color = colorResource(R.color.text_primary)
|
color = colorResource(R.color.text_primary)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (showPlusButton.value) {
|
Box(
|
||||||
Box(
|
modifier = Modifier
|
||||||
modifier = Modifier.align(Alignment.CenterEnd)
|
.align(Alignment.CenterEnd)
|
||||||
.noRippleThrottledClickable {
|
.noRippleThrottledClickable {
|
||||||
val templates = (currentState as? TypeTemplatesWidgetUI.Data)?.templates
|
val templates =
|
||||||
val newTemplate = templates?.firstOrNull { it is TemplateView.New }
|
(currentState as? TypeTemplatesWidgetUI.Data)?.templates
|
||||||
if (newTemplate != null) {
|
val newTemplate =
|
||||||
action(TemplateClick(newTemplate))
|
templates?.firstOrNull { it is TemplateView.New }
|
||||||
}
|
if (newTemplate != null) {
|
||||||
|
action(TemplateClick(newTemplate))
|
||||||
}
|
}
|
||||||
) {
|
}
|
||||||
Image(
|
.alpha(if (currentState.isPossibleToChangeTemplate) 1f else 0f)
|
||||||
modifier = Modifier.padding(
|
) {
|
||||||
start = 16.dp,
|
Image(
|
||||||
top = 12.dp,
|
modifier = Modifier.padding(
|
||||||
bottom = 12.dp,
|
start = 16.dp,
|
||||||
end = 16.dp
|
top = 12.dp,
|
||||||
),
|
bottom = 12.dp,
|
||||||
painter = painterResource(id = R.drawable.ic_default_plus),
|
end = 16.dp
|
||||||
contentDescription = null
|
),
|
||||||
)
|
painter = painterResource(id = R.drawable.ic_default_plus),
|
||||||
}
|
contentDescription = null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val itemsScroll = rememberLazyListState()
|
val itemsScroll = rememberLazyListState()
|
||||||
|
@ -301,7 +310,6 @@ fun TypeTemplatesWidget(
|
||||||
},
|
},
|
||||||
action = action,
|
action = action,
|
||||||
scrollState = itemsScroll,
|
scrollState = itemsScroll,
|
||||||
showPlusButton = { showPlusButton.value = it }
|
|
||||||
)
|
)
|
||||||
if ((currentState as TypeTemplatesWidgetUI.Data).moreMenuItem != null
|
if ((currentState as TypeTemplatesWidgetUI.Data).moreMenuItem != null
|
||||||
&& itemsScroll.isScrollInProgress
|
&& itemsScroll.isScrollInProgress
|
||||||
|
@ -432,103 +440,85 @@ private fun TemplatesList(
|
||||||
scrollState: LazyListState,
|
scrollState: LazyListState,
|
||||||
state: TypeTemplatesWidgetUI.Data,
|
state: TypeTemplatesWidgetUI.Data,
|
||||||
action: (TypeTemplatesWidgetUIAction) -> Unit,
|
action: (TypeTemplatesWidgetUIAction) -> Unit,
|
||||||
moreClick: (TemplateView, IntOffset) -> Unit,
|
moreClick: (TemplateView, IntOffset) -> Unit
|
||||||
showPlusButton: (Boolean) -> Unit
|
|
||||||
) {
|
) {
|
||||||
if (state.templates.isEmpty()) {
|
LazyRow(
|
||||||
showPlusButton.invoke(false)
|
state = scrollState,
|
||||||
Box(
|
modifier = Modifier
|
||||||
modifier = Modifier.fillMaxWidth().wrapContentHeight(),
|
.wrapContentHeight()
|
||||||
contentAlignment = Alignment.Center) {
|
.fillMaxWidth(),
|
||||||
Text(
|
contentPadding = PaddingValues(start = 20.dp, end = 20.dp),
|
||||||
modifier = Modifier
|
horizontalArrangement = Arrangement.spacedBy(5.dp)
|
||||||
.wrapContentSize()
|
)
|
||||||
.padding(top = 111.dp, bottom = 111.dp),
|
{
|
||||||
text = stringResource(id = R.string.title_templates_not_allowed),
|
itemsIndexed(
|
||||||
style = BodyCalloutRegular,
|
items = state.templates,
|
||||||
color = colorResource(id = R.color.text_secondary)
|
itemContent = { index, item ->
|
||||||
)
|
Box(
|
||||||
}
|
modifier =
|
||||||
} else {
|
Modifier
|
||||||
showPlusButton.invoke(true)
|
.height(232.dp)
|
||||||
LazyRow(
|
.width(127.dp),
|
||||||
state = scrollState,
|
contentAlignment = Alignment.BottomStart
|
||||||
modifier = Modifier
|
) {
|
||||||
.wrapContentHeight()
|
val borderWidth: Dp
|
||||||
.fillMaxWidth(),
|
val borderColor: Color
|
||||||
contentPadding = PaddingValues(start = 20.dp, end = 20.dp),
|
if (item.isDefault) {
|
||||||
horizontalArrangement = Arrangement.spacedBy(5.dp)
|
borderWidth = 2.dp
|
||||||
)
|
borderColor = colorResource(id = R.color.palette_system_amber_50)
|
||||||
{
|
} else {
|
||||||
itemsIndexed(
|
borderWidth = 1.dp
|
||||||
items = state.templates,
|
borderColor = colorResource(id = R.color.shape_primary)
|
||||||
itemContent = { index, item ->
|
}
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier = Modifier
|
||||||
Modifier
|
.border(
|
||||||
.height(232.dp)
|
width = borderWidth,
|
||||||
.width(127.dp),
|
color = borderColor,
|
||||||
contentAlignment = Alignment.BottomStart
|
shape = RoundedCornerShape(size = 16.dp)
|
||||||
) {
|
|
||||||
val borderWidth: Dp
|
|
||||||
val borderColor: Color
|
|
||||||
if (item.isDefault) {
|
|
||||||
borderWidth = 2.dp
|
|
||||||
borderColor = colorResource(id = R.color.palette_system_amber_50)
|
|
||||||
} else {
|
|
||||||
borderWidth = 1.dp
|
|
||||||
borderColor = colorResource(id = R.color.shape_primary)
|
|
||||||
}
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.border(
|
|
||||||
width = borderWidth,
|
|
||||||
color = borderColor,
|
|
||||||
shape = RoundedCornerShape(size = 16.dp)
|
|
||||||
)
|
|
||||||
.height(224.dp)
|
|
||||||
.width(120.dp)
|
|
||||||
.clickable {
|
|
||||||
action(TemplateClick(item))
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
TemplateItemContent(item)
|
|
||||||
}
|
|
||||||
|
|
||||||
val showMoreButton = (item is TemplateView.Template && state.isEditing)
|
|
||||||
AnimatedVisibility(
|
|
||||||
visible = showMoreButton,
|
|
||||||
enter = fadeIn(),
|
|
||||||
exit = fadeOut(),
|
|
||||||
modifier = Modifier
|
|
||||||
.align(Alignment.TopEnd)
|
|
||||||
.padding(1.dp)
|
|
||||||
) {
|
|
||||||
var currentCoordinates: IntOffset by remember {
|
|
||||||
mutableStateOf(IntOffset(0, 0))
|
|
||||||
}
|
|
||||||
Image(
|
|
||||||
modifier = Modifier
|
|
||||||
.width(28.dp)
|
|
||||||
.height(28.dp)
|
|
||||||
.clickable { moreClick(item, currentCoordinates) }
|
|
||||||
.onGloballyPositioned { coordinates ->
|
|
||||||
if (coordinates.isAttached) {
|
|
||||||
with(coordinates.positionInRoot()) {
|
|
||||||
currentCoordinates = IntOffset(x.toInt(), y.toInt())
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
currentCoordinates = IntOffset(0, 0)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
painter = painterResource(id = R.drawable.ic_edit_temlate),
|
|
||||||
contentDescription = "Edit template button"
|
|
||||||
)
|
)
|
||||||
|
.height(224.dp)
|
||||||
|
.width(120.dp)
|
||||||
|
.clickable {
|
||||||
|
action(TemplateClick(item))
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
TemplateItemContent(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
val showMoreButton = (item is TemplateView.Template && state.isEditing)
|
||||||
|
AnimatedVisibility(
|
||||||
|
visible = showMoreButton,
|
||||||
|
enter = fadeIn(),
|
||||||
|
exit = fadeOut(),
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.TopEnd)
|
||||||
|
.padding(1.dp)
|
||||||
|
) {
|
||||||
|
var currentCoordinates: IntOffset by remember {
|
||||||
|
mutableStateOf(IntOffset(0, 0))
|
||||||
}
|
}
|
||||||
|
Image(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(28.dp)
|
||||||
|
.height(28.dp)
|
||||||
|
.clickable { moreClick(item, currentCoordinates) }
|
||||||
|
.onGloballyPositioned { coordinates ->
|
||||||
|
if (coordinates.isAttached) {
|
||||||
|
with(coordinates.positionInRoot()) {
|
||||||
|
currentCoordinates = IntOffset(x.toInt(), y.toInt())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
currentCoordinates = IntOffset(0, 0)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
painter = painterResource(id = R.drawable.ic_edit_temlate),
|
||||||
|
contentDescription = "Edit template button"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,7 +811,7 @@ val TemplateTitleStyle = TextStyle(
|
||||||
fontWeight = FontWeight.W600,
|
fontWeight = FontWeight.W600,
|
||||||
fontSize = 11.sp,
|
fontSize = 11.sp,
|
||||||
lineHeight = 14.sp,
|
lineHeight = 14.sp,
|
||||||
letterSpacing = (-0.006).em
|
letterSpacing = (-0.00636363).em
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -934,47 +924,48 @@ fun ObjectTypesList(
|
||||||
borderWidth = 1.dp
|
borderWidth = 1.dp
|
||||||
borderColor = colorResource(id = R.color.shape_primary)
|
borderColor = colorResource(id = R.color.shape_primary)
|
||||||
}
|
}
|
||||||
Box(modifier = Modifier
|
Box(
|
||||||
.border(
|
modifier = Modifier
|
||||||
width = borderWidth,
|
.height(48.dp)
|
||||||
color = borderColor,
|
.wrapContentWidth()
|
||||||
shape = RoundedCornerShape(size = 10.dp)
|
.border(
|
||||||
)
|
width = borderWidth,
|
||||||
.wrapContentSize()
|
color = borderColor,
|
||||||
.noRippleThrottledClickable {
|
shape = RoundedCornerShape(size = 10.dp)
|
||||||
action(TypeClick.Item(item.type))
|
)
|
||||||
}) {
|
.noRippleThrottledClickable {
|
||||||
|
action(TypeClick.Item(item.type))
|
||||||
|
},
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
val typeIcon = item.type.iconEmoji
|
||||||
|
val (rowPaddingStart, textPaddingStart) = if (typeIcon != null) {
|
||||||
|
14.dp to 8.dp
|
||||||
|
} else {
|
||||||
|
16.dp to 0.dp
|
||||||
|
}
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
start = 14.dp,
|
start = rowPaddingStart,
|
||||||
end = 16.dp,
|
end = 16.dp
|
||||||
top = 13.dp,
|
),
|
||||||
bottom = 13.dp
|
verticalAlignment = Alignment.CenterVertically
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
item.type.iconEmoji?.let {
|
if (typeIcon != null) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier.wrapContentSize()
|
||||||
.clip(RoundedCornerShape(8.dp))
|
|
||||||
.background(
|
|
||||||
color = colorResource(id = R.color.shape_tertiary)
|
|
||||||
)
|
|
||||||
.border(
|
|
||||||
width = 2.dp,
|
|
||||||
color = colorResource(id = R.color.background_primary),
|
|
||||||
shape = RoundedCornerShape(8.dp)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = rememberAsyncImagePainter(
|
painter = rememberAsyncImagePainter(
|
||||||
model = Emojifier.safeUri(it),
|
Emojifier.safeUri(
|
||||||
error = painterResource(id = R.drawable.ic_home_widget_space)
|
typeIcon
|
||||||
|
)
|
||||||
),
|
),
|
||||||
contentDescription = "Emoji template's icon",
|
contentDescription = "Type's icon",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(20.dp)
|
.size(18.dp)
|
||||||
.align(Alignment.Center),
|
.align(Alignment.Center),
|
||||||
contentScale = ContentScale.Crop
|
alignment = Alignment.Center
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -984,7 +975,7 @@ fun ObjectTypesList(
|
||||||
color = colorResource(id = R.color.text_primary)
|
color = colorResource(id = R.color.text_primary)
|
||||||
),
|
),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(start = 8.dp)
|
.padding(start = textPaddingStart)
|
||||||
.widthIn(max = 100.dp),
|
.widthIn(max = 100.dp),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
|
@ -1031,14 +1022,16 @@ fun ComposablePreview() {
|
||||||
val items = listOf(
|
val items = listOf(
|
||||||
TemplateView.Blank(
|
TemplateView.Blank(
|
||||||
id = DEFAULT_TEMPLATE_ID_BLANK,
|
id = DEFAULT_TEMPLATE_ID_BLANK,
|
||||||
typeId = "page",
|
targetTypeId = TypeId("page"),
|
||||||
|
targetTypeKey = TypeKey("ot-page"),
|
||||||
typeName = "Page",
|
typeName = "Page",
|
||||||
layout = ObjectType.Layout.BASIC.code
|
layout = ObjectType.Layout.BASIC.code
|
||||||
),
|
),
|
||||||
TemplateView.Template(
|
TemplateView.Template(
|
||||||
id = "1",
|
id = "1",
|
||||||
name = "Template 1",
|
name = "Template 1",
|
||||||
typeId = "page",
|
targetTypeId = TypeId("page"),
|
||||||
|
targetTypeKey = TypeKey("ot-page"),
|
||||||
layout = ObjectType.Layout.BASIC,
|
layout = ObjectType.Layout.BASIC,
|
||||||
image = null,
|
image = null,
|
||||||
emoji = null,
|
emoji = null,
|
||||||
|
@ -1051,7 +1044,12 @@ fun ComposablePreview() {
|
||||||
templates = items,
|
templates = items,
|
||||||
showWidget = true,
|
showWidget = true,
|
||||||
isEditing = true,
|
isEditing = true,
|
||||||
moreMenuItem = TemplateView.Template(id = "123", name = "Template 1", typeId = "page"),
|
moreMenuItem = TemplateView.Template(
|
||||||
|
id = "123",
|
||||||
|
name = "Template 1",
|
||||||
|
targetTypeId = TypeId("page"),
|
||||||
|
targetTypeKey = TypeKey("ot-page"),
|
||||||
|
),
|
||||||
objectTypes = listOf(
|
objectTypes = listOf(
|
||||||
TemplateObjectTypeView.Search,
|
TemplateObjectTypeView.Search,
|
||||||
TemplateObjectTypeView.Item(
|
TemplateObjectTypeView.Item(
|
||||||
|
@ -1061,7 +1059,8 @@ fun ComposablePreview() {
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
viewerId = "",
|
viewerId = "",
|
||||||
isPossibleToChangeType = true
|
isPossibleToChangeType = true,
|
||||||
|
isPossibleToChangeTemplate = false
|
||||||
)
|
)
|
||||||
TypeTemplatesWidget(
|
TypeTemplatesWidget(
|
||||||
state = state,
|
state = state,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user