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.versionMinor=26
|
||||
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.search.ObjectTypesSubscriptionManager
|
||||
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.presentation.auth.account.SetupSelectedAccountViewModel
|
||||
import com.anytypeio.anytype.presentation.auth.account.SetupSelectedAccountViewModelFactory
|
||||
|
@ -72,9 +71,6 @@ class SetupSelectedAccountTest {
|
|||
@Mock
|
||||
lateinit var configStorage: ConfigStorage
|
||||
|
||||
@Mock
|
||||
lateinit var workspaceManager: WorkspaceManager
|
||||
|
||||
@Mock
|
||||
private lateinit var relationsSubscriptionManager: RelationsSubscriptionManager
|
||||
|
||||
|
@ -87,9 +83,6 @@ class SetupSelectedAccountTest {
|
|||
@Mock
|
||||
private lateinit var metricsProvider: MetricsProvider
|
||||
|
||||
@Mock
|
||||
private lateinit var config: ConfigStorage
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
MockitoAnnotations.openMocks(this)
|
||||
|
@ -97,7 +90,6 @@ class SetupSelectedAccountTest {
|
|||
repository = authRepository,
|
||||
featuresConfigProvider = featuresConfigProvider,
|
||||
configStorage = configStorage,
|
||||
workspaceManager = workspaceManager,
|
||||
metricsProvider = metricsProvider
|
||||
)
|
||||
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.Copy
|
||||
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.UserSettingsRepository
|
||||
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.workspace.FileLimitsEventChannel
|
||||
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.presentation.common.Delegator
|
||||
import com.anytypeio.anytype.presentation.editor.DocumentExternalEventReducer
|
||||
|
@ -273,6 +275,12 @@ open class EditorTestSetup {
|
|||
@Mock
|
||||
lateinit var setObjectInternalFlags: SetObjectInternalFlags
|
||||
|
||||
@Mock
|
||||
lateinit var spaceManager: SpaceManager
|
||||
|
||||
@Mock
|
||||
lateinit var configStorage: ConfigStorage
|
||||
|
||||
lateinit var interceptFileLimitEvents: InterceptFileLimitEvents
|
||||
|
||||
lateinit var addRelationToObject: AddRelationToObject
|
||||
|
@ -319,8 +327,13 @@ open class EditorTestSetup {
|
|||
turnIntoDocument = TurnIntoDocument(repo)
|
||||
updateFields = UpdateFields(repo)
|
||||
setObjectType = SetObjectType(repo)
|
||||
createObjectAsMentionOrLink =
|
||||
CreateObjectAsMentionOrLink(repo, getDefaultPageType, getTemplates, dispatchers)
|
||||
createObjectAsMentionOrLink = CreateObjectAsMentionOrLink(
|
||||
repo = repo,
|
||||
getDefaultPageType = getDefaultPageType,
|
||||
getTemplates = getTemplates,
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
getSearchObjects = SearchObjects(repo)
|
||||
interceptThreadStatus = InterceptThreadStatus(channel = threadStatusChannel)
|
||||
downloadUnsplashImage = DownloadUnsplashImage(unsplashRepository)
|
||||
|
@ -351,10 +364,11 @@ open class EditorTestSetup {
|
|||
turnIntoStyle = TurnIntoStyle(repo)
|
||||
updateDetail = UpdateDetail(repo)
|
||||
getDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository,
|
||||
repo,
|
||||
workspaceManager,
|
||||
dispatchers
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
blockRepository = repo,
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager,
|
||||
configStorage = configStorage
|
||||
)
|
||||
createObjectSet = CreateObjectSet(repo)
|
||||
findObjectSetForType = FindObjectSetForType(repo)
|
||||
|
@ -466,12 +480,12 @@ open class EditorTestSetup {
|
|||
storeOfObjectTypes = storeOfObjectTypes,
|
||||
featureToggles = featureToggles,
|
||||
tableDelegate = tableDelegate,
|
||||
workspaceManager = workspaceManager,
|
||||
getObjectTypes = getObjectTypes,
|
||||
objectToCollection = objectToCollection,
|
||||
interceptFileLimitEvents = interceptFileLimitEvents,
|
||||
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.options.GetOptions
|
||||
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.add.AddOptionsRelationDVViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvider
|
||||
|
@ -81,6 +82,9 @@ class AddRelationStatusValueTest {
|
|||
@Mock
|
||||
lateinit var objectDetailProvider: ObjectDetailProvider
|
||||
|
||||
@Mock
|
||||
lateinit var spaceManager: SpaceManager
|
||||
|
||||
private lateinit var createRelationOption: CreateRelationOption
|
||||
private lateinit var updateDetail: UpdateDetail
|
||||
private lateinit var getOptions: GetOptions
|
||||
|
@ -120,7 +124,8 @@ class AddRelationStatusValueTest {
|
|||
analytics = analytics,
|
||||
createRelationOption = createRelationOption,
|
||||
detailsProvider = objectDetailProvider,
|
||||
getOptions = getOptions
|
||||
getOptions = getOptions,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -541,7 +546,8 @@ class AddRelationStatusValueTest {
|
|||
createRelationOption(
|
||||
relation = any(),
|
||||
color = any(),
|
||||
name = any()
|
||||
name = any(),
|
||||
space = any()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -557,7 +563,8 @@ class AddRelationStatusValueTest {
|
|||
createRelationOption(
|
||||
relation = relation,
|
||||
color = color,
|
||||
name = name
|
||||
name = name,
|
||||
space = any()
|
||||
)
|
||||
} doReturn StubRelationOptionObject(
|
||||
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.options.GetOptions
|
||||
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.add.AddOptionsRelationDVViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationProvider
|
||||
|
@ -79,6 +80,9 @@ class AddRelationTagValueTest {
|
|||
@Mock
|
||||
lateinit var objectDetailProvider: ObjectDetailProvider
|
||||
|
||||
@Mock
|
||||
lateinit var spaceManager: SpaceManager
|
||||
|
||||
private lateinit var createRelationOption: CreateRelationOption
|
||||
private lateinit var updateDetail: UpdateDetail
|
||||
private lateinit var getOptions: GetOptions
|
||||
|
@ -115,7 +119,8 @@ class AddRelationTagValueTest {
|
|||
analytics = analytics,
|
||||
setObjectDetail = updateDetail,
|
||||
detailsProvider = objectDetailProvider,
|
||||
getOptions = getOptions
|
||||
getOptions = getOptions,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -491,7 +496,8 @@ class AddRelationTagValueTest {
|
|||
createRelationOption(
|
||||
relation = any(),
|
||||
color = any(),
|
||||
name = any()
|
||||
name = any(),
|
||||
space = any()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -506,7 +512,8 @@ class AddRelationTagValueTest {
|
|||
createRelationOption(
|
||||
relation = any(),
|
||||
color = any(),
|
||||
name = any()
|
||||
name = any(),
|
||||
space = any()
|
||||
)
|
||||
} doReturn StubRelationOptionObject(
|
||||
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.repo.BlockRepository
|
||||
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.UserSettingsRepository
|
||||
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.unsplash.DownloadUnsplashImage
|
||||
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.emojifier.data.DefaultDocumentEmojiIconProvider
|
||||
import com.anytypeio.anytype.presentation.common.Action
|
||||
|
@ -144,6 +146,12 @@ abstract class TestObjectSetSetup {
|
|||
@Mock
|
||||
lateinit var viewerDelegate: ViewerDelegate
|
||||
|
||||
@Mock
|
||||
lateinit var spaceManager: SpaceManager
|
||||
|
||||
@Mock
|
||||
lateinit var configStorage: ConfigStorage
|
||||
|
||||
@Mock
|
||||
lateinit var createTemplate: CreateTemplate
|
||||
|
||||
|
@ -155,7 +163,6 @@ abstract class TestObjectSetSetup {
|
|||
private val paginator = ObjectSetPaginator()
|
||||
private val store: ObjectStore = DefaultObjectStore()
|
||||
private val storeOfRelations: StoreOfRelations = DefaultStoreOfRelations()
|
||||
private val workspaceManager: WorkspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
||||
|
||||
private lateinit var database: ObjectSetDatabase
|
||||
private lateinit var dataViewSubscriptionContainer: DataViewSubscriptionContainer
|
||||
|
@ -199,19 +206,18 @@ abstract class TestObjectSetSetup {
|
|||
setDataViewQuery = SetDataViewQuery(repo)
|
||||
updateText = UpdateText(repo)
|
||||
openObjectSet = OpenObjectSet(repo, auth)
|
||||
runBlocking {
|
||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
||||
}
|
||||
getDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
blockRepository = repo,
|
||||
workspaceManager = workspaceManager,
|
||||
dispatchers = dispatchers
|
||||
spaceManager = spaceManager,
|
||||
dispatchers = dispatchers,
|
||||
configStorage = configStorage
|
||||
)
|
||||
createDataViewObject = CreateDataViewObject(
|
||||
repo = repo,
|
||||
storeOfRelations = storeOfRelations,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
setObjectDetails = UpdateDetail(repo)
|
||||
updateDataViewViewer = UpdateDataViewViewer(repo, dispatchers)
|
||||
|
@ -255,7 +261,6 @@ abstract class TestObjectSetSetup {
|
|||
storeOfRelations = storeOfRelations,
|
||||
objectStateReducer = DefaultObjectStateReducer(),
|
||||
dataViewSubscription = DefaultDataViewSubscription(dataViewSubscriptionContainer),
|
||||
workspaceManager = workspaceManager,
|
||||
objectToCollection = convertObjectToCollection,
|
||||
setQueryToObjectSet = setQueryToObjectSet,
|
||||
objectStore = objectStore,
|
||||
|
@ -267,6 +272,7 @@ abstract class TestObjectSetSetup {
|
|||
setObjectListIsArchived = setObjectListIsArchived,
|
||||
duplicateObjects = duplicateObjects,
|
||||
viewerDelegate = viewerDelegate,
|
||||
spaceManager = spaceManager,
|
||||
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.options.GetOptions
|
||||
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.filter.FilterViewModel
|
||||
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.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
@ -68,6 +67,9 @@ class CreateSelectedFilterTest {
|
|||
@Mock
|
||||
lateinit var analytics: Analytics
|
||||
|
||||
@Mock
|
||||
lateinit var spaceManager: SpaceManager
|
||||
|
||||
@Mock
|
||||
lateinit var dispatchers: AppCoroutineDispatchers
|
||||
|
||||
|
@ -84,9 +86,6 @@ class CreateSelectedFilterTest {
|
|||
private val objectStore: ObjectStore = DefaultObjectStore()
|
||||
private val db = ObjectSetDatabase(store = objectStore)
|
||||
|
||||
lateinit var workspaceManager: WorkspaceManager
|
||||
val workspaceId = MockDataFactory.randomString()
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
MockitoAnnotations.openMocks(this)
|
||||
|
@ -94,10 +93,6 @@ class CreateSelectedFilterTest {
|
|||
searchObjects = SearchObjects(repo)
|
||||
getOptions = GetOptions(repo)
|
||||
urlBuilder = UrlBuilder(gateway)
|
||||
workspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
||||
runBlocking {
|
||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
||||
}
|
||||
TestCreateSelectedFilterFragment.testVmFactory = FilterViewModel.Factory(
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
dispatcher = dispatcher,
|
||||
|
@ -109,7 +104,7 @@ class CreateSelectedFilterTest {
|
|||
storeOfRelations = storeOfRelations,
|
||||
objectSetDatabase = db,
|
||||
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.options.GetOptions
|
||||
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.filter.FilterViewModel
|
||||
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.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
@ -76,6 +75,9 @@ class ModifyInputValueFilterTest {
|
|||
@Mock
|
||||
lateinit var dispatchers: AppCoroutineDispatchers
|
||||
|
||||
@Mock
|
||||
lateinit var spaceManager: SpaceManager
|
||||
|
||||
private lateinit var updateDataViewViewer: UpdateDataViewViewer
|
||||
private lateinit var searchObjects: SearchObjects
|
||||
private lateinit var getOptions: GetOptions
|
||||
|
@ -89,19 +91,12 @@ class ModifyInputValueFilterTest {
|
|||
private val objectStore: ObjectStore = DefaultObjectStore()
|
||||
private val db = ObjectSetDatabase(store = objectStore)
|
||||
|
||||
lateinit var workspaceManager: WorkspaceManager
|
||||
val workspaceId = MockDataFactory.randomString()
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
MockitoAnnotations.openMocks(this)
|
||||
updateDataViewViewer = UpdateDataViewViewer(repo, dispatchers)
|
||||
searchObjects = SearchObjects(repo)
|
||||
urlBuilder = UrlBuilder(gateway)
|
||||
workspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
||||
runBlocking {
|
||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
||||
}
|
||||
TestModifyFilterFromInputFieldValueFragment.testVmFactory = FilterViewModel.Factory(
|
||||
objectState = state,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
|
@ -113,7 +108,7 @@ class ModifyInputValueFilterTest {
|
|||
storeOfRelations = storeOfRelations,
|
||||
objectSetDatabase = db,
|
||||
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.options.GetOptions
|
||||
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.filter.FilterViewModel
|
||||
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.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.hamcrest.CoreMatchers.not
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
|
@ -75,6 +74,9 @@ class ModifyStatusFilterTest {
|
|||
@Mock
|
||||
lateinit var analytics: Analytics
|
||||
|
||||
@Mock
|
||||
lateinit var spaceManager: SpaceManager
|
||||
|
||||
private lateinit var updateDataViewViewer: UpdateDataViewViewer
|
||||
private lateinit var searchObjects: SearchObjects
|
||||
private lateinit var getOptions: GetOptions
|
||||
|
@ -88,9 +90,6 @@ class ModifyStatusFilterTest {
|
|||
private val objectStore: ObjectStore = DefaultObjectStore()
|
||||
private val db = ObjectSetDatabase(store = objectStore)
|
||||
|
||||
lateinit var workspaceManager: WorkspaceManager
|
||||
val workspaceId = MockDataFactory.randomString()
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
MockitoAnnotations.openMocks(this)
|
||||
|
@ -98,10 +97,6 @@ class ModifyStatusFilterTest {
|
|||
searchObjects = SearchObjects(repo)
|
||||
getOptions = GetOptions(repo)
|
||||
urlBuilder = UrlBuilder(gateway)
|
||||
workspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
||||
runBlocking {
|
||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
||||
}
|
||||
TestModifyFilterFromSelectedValueFragment.testVmFactory = FilterViewModel.Factory(
|
||||
objectState = state,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
|
@ -113,7 +108,7 @@ class ModifyStatusFilterTest {
|
|||
analytics = analytics,
|
||||
storeOfRelations = storeOfRelations,
|
||||
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.options.GetOptions
|
||||
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.filter.FilterViewModel
|
||||
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.bartoszlipinski.disableanimationsrule.DisableAnimationsRule
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.hamcrest.CoreMatchers.not
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
|
@ -74,6 +73,9 @@ class ModifyTagFilterTest {
|
|||
@Mock
|
||||
lateinit var analytics: Analytics
|
||||
|
||||
@Mock
|
||||
lateinit var spaceManager: SpaceManager
|
||||
|
||||
private lateinit var updateDataViewViewer: UpdateDataViewViewer
|
||||
private lateinit var searchObjects: SearchObjects
|
||||
private lateinit var getOptions: GetOptions
|
||||
|
@ -87,9 +89,6 @@ class ModifyTagFilterTest {
|
|||
private val objectStore: ObjectStore = DefaultObjectStore()
|
||||
private val db = ObjectSetDatabase(store = objectStore)
|
||||
|
||||
lateinit var workspaceManager: WorkspaceManager
|
||||
val workspaceId = MockDataFactory.randomString()
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
MockitoAnnotations.openMocks(this)
|
||||
|
@ -97,10 +96,6 @@ class ModifyTagFilterTest {
|
|||
searchObjects = SearchObjects(repo)
|
||||
getOptions = GetOptions(repo)
|
||||
urlBuilder = UrlBuilder(gateway)
|
||||
workspaceManager = WorkspaceManager.DefaultWorkspaceManager()
|
||||
runBlocking {
|
||||
workspaceManager.setCurrentWorkspace(workspaceId)
|
||||
}
|
||||
TestModifyFilterFromSelectedValueFragment.testVmFactory = FilterViewModel.Factory(
|
||||
objectState = state,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
|
@ -112,7 +107,7 @@ class ModifyTagFilterTest {
|
|||
storeOfRelations = storeOfRelations,
|
||||
objectSetDatabase = db,
|
||||
getOptions = getOptions,
|
||||
workspaceManager = workspaceManager
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,10 @@ class DefaultAppActionManager(val context: Context) : AppActionManager {
|
|||
try {
|
||||
when (action) {
|
||||
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)
|
||||
.setShortLabel(label)
|
||||
.setLongLabel(label)
|
||||
|
@ -28,7 +31,7 @@ class DefaultAppActionManager(val context: Context) : AppActionManager {
|
|||
.setIntent(
|
||||
Intent(Intent.ACTION_VIEW, null).apply {
|
||||
setClass(context, MainActivity::class.java)
|
||||
putExtra(ACTION_CREATE_NEW_TYPE_KEY, action.type)
|
||||
putExtra(ACTION_CREATE_NEW_TYPE_KEY, action.type.key)
|
||||
}
|
||||
)
|
||||
.build()
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.anytypeio.anytype.app
|
|||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import com.anytypeio.anytype.BuildConfig
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_utils.tools.FeatureToggles
|
||||
import com.anytypeio.anytype.device.BuildProvider
|
||||
import javax.inject.Inject
|
||||
|
@ -33,4 +32,6 @@ class DefaultFeatureToggles @Inject constructor(
|
|||
override val isAutoUpdateEnabled: Boolean = false
|
||||
|
||||
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.MainSettingsModule
|
||||
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.DaggerTemplateSelectComponent
|
||||
import com.anytypeio.anytype.di.feature.types.DaggerTypeCreationComponent
|
||||
|
@ -961,6 +964,24 @@ class ComponentManager(
|
|||
.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) {
|
||||
|
||||
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.objects.StoreOfObjectTypes
|
||||
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.providers.ObjectRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.providers.ObjectValueProvider
|
||||
|
@ -39,8 +39,13 @@ object AddObjectRelationModule {
|
|||
storeOfObjectTypes: StoreOfObjectTypes,
|
||||
searchObjects: SearchObjects,
|
||||
urlBuilder: UrlBuilder,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): 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.objects.options.GetOptions
|
||||
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.AddOptionsRelationProvider
|
||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationViewModel
|
||||
|
@ -49,7 +50,8 @@ object AddObjectRelationValueModule {
|
|||
analytics: Analytics,
|
||||
setObjectDetail: UpdateDetail,
|
||||
detailsProvider: ObjectDetailProvider,
|
||||
getOptions: GetOptions
|
||||
getOptions: GetOptions,
|
||||
spaceManager: SpaceManager
|
||||
): AddOptionsRelationDVViewModel.Factory = AddOptionsRelationDVViewModel.Factory(
|
||||
relations = relations,
|
||||
values = values,
|
||||
|
@ -59,7 +61,8 @@ object AddObjectRelationValueModule {
|
|||
analytics = analytics,
|
||||
setObjectDetail = setObjectDetail,
|
||||
detailsProvider = detailsProvider,
|
||||
getOptions = getOptions
|
||||
getOptions = getOptions,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -73,7 +76,8 @@ object AddObjectRelationValueModule {
|
|||
updateDetail: UpdateDetail,
|
||||
analytics: Analytics,
|
||||
detailsProvider: ObjectDetailProvider,
|
||||
getOptions: GetOptions
|
||||
getOptions: GetOptions,
|
||||
spaceManager: SpaceManager
|
||||
): AddOptionsRelationViewModel.Factory = AddOptionsRelationViewModel.Factory(
|
||||
relations = relations,
|
||||
values = values,
|
||||
|
@ -83,7 +87,8 @@ object AddObjectRelationValueModule {
|
|||
analytics = analytics,
|
||||
optionsProvider = AddOptionsRelationProvider(),
|
||||
detailProvider = detailsProvider,
|
||||
getOptions = getOptions
|
||||
getOptions = getOptions,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.anytypeio.anytype.domain.`object`.SetupMobileUseCaseSkip
|
|||
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
||||
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
||||
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.SelectAccountViewModelFactory
|
||||
import com.anytypeio.anytype.presentation.auth.account.SetupNewAccountViewModelFactory
|
||||
|
@ -244,12 +243,10 @@ object SetupNewAccountModule {
|
|||
fun provideCreateAccountUseCase(
|
||||
repository: AuthRepository,
|
||||
configStorage: ConfigStorage,
|
||||
workspaceManager: WorkspaceManager,
|
||||
metricsProvider: MetricsProvider
|
||||
): CreateAccount = CreateAccount(
|
||||
repository = repository,
|
||||
configStorage = configStorage,
|
||||
workspaceManager = workspaceManager,
|
||||
metricsProvider = metricsProvider
|
||||
)
|
||||
|
||||
|
@ -299,14 +296,12 @@ object SetupSelectedAccountModule {
|
|||
repository: AuthRepository,
|
||||
configStorage: ConfigStorage,
|
||||
featuresConfigProvider: FeaturesConfigProvider,
|
||||
workspaceManager: WorkspaceManager,
|
||||
metricsProvider: MetricsProvider
|
||||
): SelectAccount {
|
||||
return SelectAccount(
|
||||
repository = repository,
|
||||
configStorage = configStorage,
|
||||
featuresConfigProvider = featuresConfigProvider,
|
||||
workspaceManager = workspaceManager,
|
||||
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.misc.UrlBuilder
|
||||
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.presentation.linking.BackLinkOrAddToObjectViewModelFactory
|
||||
import com.anytypeio.anytype.ui.linking.BacklinkOrAddToObjectFragment
|
||||
|
@ -77,4 +78,5 @@ interface BacklinkOrAddToObjectDependencies : ComponentDependencies {
|
|||
fun urlBuilder(): UrlBuilder
|
||||
fun dispatchers(): AppCoroutineDispatchers
|
||||
fun analytics(): Analytics
|
||||
fun spaceManager(): SpaceManager
|
||||
}
|
|
@ -1,14 +1,14 @@
|
|||
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.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.launch.GetDefaultPageType
|
||||
import com.anytypeio.anytype.domain.page.CreateObject
|
||||
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.ui.editor.CreateObjectFragment
|
||||
import dagger.Module
|
||||
|
@ -36,14 +36,14 @@ object CreateObjectModule {
|
|||
@PerScreen
|
||||
fun getCreateObject(
|
||||
repo: BlockRepository,
|
||||
getTemplates: GetTemplates,
|
||||
getDefaultPageType: GetDefaultPageType,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): CreateObject = CreateObject(
|
||||
repo = repo,
|
||||
getTemplates = getTemplates,
|
||||
getDefaultPageType = getDefaultPageType,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -52,13 +52,15 @@ object CreateObjectModule {
|
|||
fun provideGetDefaultPageType(
|
||||
blockRepository: BlockRepository,
|
||||
userSettingsRepository: UserSettingsRepository,
|
||||
workspaceManager: WorkspaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
configStorage: ConfigStorage
|
||||
): GetDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository,
|
||||
blockRepository,
|
||||
workspaceManager,
|
||||
dispatchers
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
blockRepository = blockRepository,
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager,
|
||||
configStorage = configStorage
|
||||
)
|
||||
|
||||
@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.Copy
|
||||
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.cover.SetDocCoverImage
|
||||
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.workspace.FileLimitsEventChannel
|
||||
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.Delegator
|
||||
import com.anytypeio.anytype.presentation.editor.DocumentExternalEventReducer
|
||||
|
@ -276,7 +277,7 @@ object EditorSessionModule {
|
|||
objectToSet: ConvertObjectToSet,
|
||||
featureToggles: FeatureToggles,
|
||||
tableDelegate: EditorTableDelegate,
|
||||
workspaceManager: WorkspaceManager,
|
||||
spaceManager: SpaceManager,
|
||||
getObjectTypes: GetObjectTypes,
|
||||
objectToCollection: ConvertObjectToCollection,
|
||||
interceptFileLimitEvents: InterceptFileLimitEvents,
|
||||
|
@ -314,7 +315,7 @@ object EditorSessionModule {
|
|||
objectToSet = objectToSet,
|
||||
featureToggles = featureToggles,
|
||||
tableDelegate = tableDelegate,
|
||||
workspaceManager = workspaceManager,
|
||||
spaceManager = spaceManager,
|
||||
getObjectTypes = getObjectTypes,
|
||||
objectToCollection = objectToCollection,
|
||||
interceptFileLimitEvents = interceptFileLimitEvents,
|
||||
|
@ -730,12 +731,14 @@ object EditorUseCaseModule {
|
|||
repo: BlockRepository,
|
||||
getDefaultPageType: GetDefaultPageType,
|
||||
getTemplates: GetTemplates,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): CreateObjectAsMentionOrLink = CreateObjectAsMentionOrLink(
|
||||
repo = repo,
|
||||
getDefaultPageType = getDefaultPageType,
|
||||
getTemplates = getTemplates,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -983,13 +986,15 @@ object EditorUseCaseModule {
|
|||
fun provideGetDefaultPageType(
|
||||
repo: UserSettingsRepository,
|
||||
blockRepository: BlockRepository,
|
||||
workspaceManager: WorkspaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
configStorage: ConfigStorage
|
||||
): GetDefaultPageType = GetDefaultPageType(
|
||||
repo,
|
||||
blockRepository,
|
||||
workspaceManager,
|
||||
dispatchers
|
||||
userSettingsRepository = repo,
|
||||
blockRepository = blockRepository,
|
||||
spaceManager = spaceManager,
|
||||
dispatchers = dispatchers,
|
||||
configStorage = configStorage
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -1181,14 +1186,14 @@ object EditorUseCaseModule {
|
|||
@PerScreen
|
||||
fun getCreateObject(
|
||||
repo: BlockRepository,
|
||||
getTemplates: GetTemplates,
|
||||
getDefaultPageType: GetDefaultPageType,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): CreateObject = CreateObject(
|
||||
repo = repo,
|
||||
getTemplates = getTemplates,
|
||||
getDefaultPageType = getDefaultPageType,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@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.block.interactor.sets.GetObjectTypes
|
||||
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.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.ui.linking.LinkToObjectFragment
|
||||
import dagger.Module
|
||||
|
@ -39,14 +39,14 @@ object LinkToObjectModule {
|
|||
urlBuilder: UrlBuilder,
|
||||
getObjectTypes: GetObjectTypes,
|
||||
searchObjects: SearchObjects,
|
||||
workspaceManager: WorkspaceManager,
|
||||
analytics: Analytics
|
||||
analytics: Analytics,
|
||||
spaceManager: SpaceManager
|
||||
): LinkToObjectViewModelFactory = LinkToObjectViewModelFactory(
|
||||
urlBuilder = urlBuilder,
|
||||
getObjectTypes = getObjectTypes,
|
||||
searchObjects = searchObjects,
|
||||
workspaceManager = workspaceManager,
|
||||
analytics = analytics
|
||||
analytics = analytics,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@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.objects.StoreOfObjectTypes
|
||||
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.linking.LinkToObjectOrWebViewModelFactory
|
||||
import com.anytypeio.anytype.ui.linking.LinkToObjectOrWebPagesFragment
|
||||
|
@ -42,7 +42,7 @@ object LinkToObjectOrWebModule {
|
|||
analytics: Analytics,
|
||||
stores: Editor.Storage,
|
||||
urlValidator: UrlValidator,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): LinkToObjectOrWebViewModelFactory = LinkToObjectOrWebViewModelFactory(
|
||||
urlBuilder = urlBuilder,
|
||||
storeOfObjectTypes = storeOfObjectTypes,
|
||||
|
@ -50,6 +50,6 @@ object LinkToObjectOrWebModule {
|
|||
analytics = analytics,
|
||||
stores = stores,
|
||||
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.wallpaper.ObserveWallpaper
|
||||
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.ui.main.MainActivity
|
||||
import com.anytypeio.anytype.ui_settings.appearance.ThemeApplicator
|
||||
|
@ -79,14 +80,12 @@ object MainEntryModule {
|
|||
pathProvider: PathProvider,
|
||||
configStorage: ConfigStorage,
|
||||
featuresConfigProvider: FeaturesConfigProvider,
|
||||
workspaceManager: WorkspaceManager,
|
||||
metricsProvider: MetricsProvider
|
||||
): ResumeAccount = ResumeAccount(
|
||||
repository = authRepository,
|
||||
pathProvider = pathProvider,
|
||||
configStorage = configStorage,
|
||||
featuresConfigProvider = featuresConfigProvider,
|
||||
workspaceManager = workspaceManager,
|
||||
metricsProvider = metricsProvider
|
||||
)
|
||||
|
||||
|
@ -99,8 +98,15 @@ object MainEntryModule {
|
|||
@PerScreen
|
||||
@Provides
|
||||
fun provideRestoreWallpaperUseCase(
|
||||
repo: UserSettingsRepository
|
||||
): RestoreWallpaper = RestoreWallpaper(repo)
|
||||
repo: UserSettingsRepository,
|
||||
spaceManager: SpaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): RestoreWallpaper = RestoreWallpaper(
|
||||
repo = repo,
|
||||
spaceManager = spaceManager,
|
||||
store = WallpaperStore.Default,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@PerScreen
|
||||
|
@ -132,12 +138,14 @@ object MainEntryModule {
|
|||
repo: AuthRepository,
|
||||
provider: ConfigStorage,
|
||||
user: UserSettingsRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): Logout = Logout(
|
||||
repo = repo,
|
||||
user = user,
|
||||
config = provider,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@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.block.interactor.sets.GetObjectTypes
|
||||
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.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.ui.moving.MoveToFragment
|
||||
import dagger.Module
|
||||
|
@ -53,12 +53,12 @@ object MoveToModule {
|
|||
getObjectTypes: GetObjectTypes,
|
||||
searchObjects: SearchObjects,
|
||||
analytics: Analytics,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): MoveToViewModelFactory = MoveToViewModelFactory(
|
||||
urlBuilder = urlBuilder,
|
||||
getObjectTypes = getObjectTypes,
|
||||
searchObjects = searchObjects,
|
||||
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.domain.block.repo.BlockRepository
|
||||
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.ui.sets.modals.SetObjectCreateBookmarkRecordFragment
|
||||
import dagger.Module
|
||||
|
@ -30,10 +31,12 @@ object ObjectSetCreateBookmarkRecordModule {
|
|||
@PerDialog
|
||||
fun provideObjectSetRecordViewModelFactory(
|
||||
createBookmarkObject: CreateBookmarkObject,
|
||||
urlValidator: UrlValidator
|
||||
): ObjectSetCreateBookmarkRecordViewModel.Factory = ObjectSetCreateBookmarkRecordViewModel.Factory(
|
||||
createBookmarkObject = createBookmarkObject,
|
||||
urlValidator = urlValidator
|
||||
urlValidator: UrlValidator,
|
||||
spaceManager: SpaceManager
|
||||
) = ObjectSetCreateBookmarkRecordViewModel.Factory(
|
||||
createBookmarkObject = createBookmarkObject,
|
||||
urlValidator = urlValidator,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@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.repo.BlockRepository
|
||||
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.cover.SetDocCoverImage
|
||||
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.unsplash.DownloadUnsplashImage
|
||||
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.Delegator
|
||||
import com.anytypeio.anytype.presentation.editor.cover.CoverImageHashProvider
|
||||
|
@ -213,7 +214,6 @@ object ObjectSetModule {
|
|||
storeOfRelations: StoreOfRelations,
|
||||
objectStateReducer: ObjectStateReducer,
|
||||
dataViewSubscription: DataViewSubscription,
|
||||
workspaceManager: WorkspaceManager,
|
||||
@Named("object-set-store") objectStore: ObjectStore,
|
||||
addObjectToCollection: AddObjectToCollection,
|
||||
convertObjectToCollection: ConvertObjectToCollection,
|
||||
|
@ -223,8 +223,9 @@ object ObjectSetModule {
|
|||
duplicateObjects: DuplicateObjects,
|
||||
templatesContainer: ObjectTypeTemplatesContainer,
|
||||
setObjectListIsArchived: SetObjectListIsArchived,
|
||||
createTemplate: CreateTemplate,
|
||||
viewerDelegate: ViewerDelegate,
|
||||
createTemplate: CreateTemplate
|
||||
spaceManager: SpaceManager
|
||||
): ObjectSetViewModelFactory = ObjectSetViewModelFactory(
|
||||
openObjectSet = openObjectSet,
|
||||
closeBlock = closeBlock,
|
||||
|
@ -250,7 +251,6 @@ object ObjectSetModule {
|
|||
storeOfRelations = storeOfRelations,
|
||||
objectStateReducer = objectStateReducer,
|
||||
dataViewSubscription = dataViewSubscription,
|
||||
workspaceManager = workspaceManager,
|
||||
objectStore = objectStore,
|
||||
addObjectToCollection = addObjectToCollection,
|
||||
objectToCollection = convertObjectToCollection,
|
||||
|
@ -261,6 +261,7 @@ object ObjectSetModule {
|
|||
templatesContainer = templatesContainer,
|
||||
setObjectListIsArchived = setObjectListIsArchived,
|
||||
viewerDelegate = viewerDelegate,
|
||||
spaceManager = spaceManager,
|
||||
createTemplate = createTemplate
|
||||
)
|
||||
|
||||
|
@ -280,14 +281,14 @@ object ObjectSetModule {
|
|||
@PerScreen
|
||||
fun getCreateObject(
|
||||
repo: BlockRepository,
|
||||
getTemplates: GetTemplates,
|
||||
getDefaultPageType: GetDefaultPageType,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): CreateObject = CreateObject(
|
||||
repo = repo,
|
||||
getTemplates = getTemplates,
|
||||
getDefaultPageType = getDefaultPageType,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -304,13 +305,15 @@ object ObjectSetModule {
|
|||
fun provideGetDefaultPageType(
|
||||
userSettingsRepository: UserSettingsRepository,
|
||||
blockRepository: BlockRepository,
|
||||
workspaceManager: WorkspaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
configStorage: ConfigStorage
|
||||
): GetDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
blockRepository = blockRepository,
|
||||
workspaceManager = workspaceManager,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager,
|
||||
configStorage = configStorage
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -327,11 +330,15 @@ object ObjectSetModule {
|
|||
fun provideCreateDataViewRecordUseCase(
|
||||
repo: BlockRepository,
|
||||
storeOfRelations: StoreOfRelations,
|
||||
getDefaultPageType: GetDefaultPageType,
|
||||
getTemplates: GetTemplates,
|
||||
spaceManager: SpaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): CreateDataViewObject = CreateDataViewObject(
|
||||
repo = repo,
|
||||
storeOfRelations = storeOfRelations,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@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.block.interactor.sets.GetObjectTypes
|
||||
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.launch.GetDefaultPageType
|
||||
import com.anytypeio.anytype.domain.workspace.AddObjectToWorkspace
|
||||
import com.anytypeio.anytype.domain.workspace.WorkspaceManager
|
||||
import com.anytypeio.anytype.domain.spaces.AddObjectTypeToSpace
|
||||
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||
import com.anytypeio.anytype.presentation.objects.ObjectTypeChangeViewModelFactory
|
||||
import com.anytypeio.anytype.ui.objects.types.pickers.AppDefaultObjectTypeFragment
|
||||
import com.anytypeio.anytype.ui.objects.types.pickers.DataViewSelectSourceFragment
|
||||
|
@ -43,16 +44,16 @@ object ObjectTypeChangeModule {
|
|||
@PerScreen
|
||||
fun provideObjectTypeViewModelFactory(
|
||||
getObjectTypes: GetObjectTypes,
|
||||
addObjectToWorkspace: AddObjectToWorkspace,
|
||||
addObjectTypeToSpace: AddObjectTypeToSpace,
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
workspaceManager: WorkspaceManager,
|
||||
spaceManager: SpaceManager,
|
||||
getDefaultPageType: GetDefaultPageType
|
||||
): ObjectTypeChangeViewModelFactory {
|
||||
return ObjectTypeChangeViewModelFactory(
|
||||
getObjectTypes = getObjectTypes,
|
||||
addObjectToWorkspace = addObjectToWorkspace,
|
||||
addObjectTypeToSpace = addObjectTypeToSpace,
|
||||
dispatchers = dispatchers,
|
||||
workspaceManager = workspaceManager,
|
||||
spaceManager = spaceManager,
|
||||
getDefaultPageType = getDefaultPageType
|
||||
)
|
||||
}
|
||||
|
@ -68,10 +69,10 @@ object ObjectTypeChangeModule {
|
|||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
fun addObjectToWorkspace(
|
||||
fun provideAddObjectTypeToSpace(
|
||||
repo: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
) : AddObjectToWorkspace = AddObjectToWorkspace(
|
||||
) : AddObjectTypeToSpace = AddObjectTypeToSpace(
|
||||
repo = repo,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
|
@ -82,13 +83,15 @@ object ObjectTypeChangeModule {
|
|||
fun provideGetDefaultPageType(
|
||||
userSettingsRepository: UserSettingsRepository,
|
||||
blockRepository: BlockRepository,
|
||||
workspaceManager: WorkspaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
configStorage: ConfigStorage
|
||||
): GetDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
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.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.device.ClearFileCache
|
||||
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.workspace.WorkspaceManager
|
||||
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||
import com.anytypeio.anytype.presentation.settings.OtherSettingsViewModel
|
||||
import com.anytypeio.anytype.ui.settings.OtherSettingsFragment
|
||||
import dagger.Module
|
||||
|
@ -38,20 +39,27 @@ object OtherSettingsModule {
|
|||
fun provideGetDefaultPageType(
|
||||
userSettingsRepository: UserSettingsRepository,
|
||||
blockRepository: BlockRepository,
|
||||
workspaceManager: WorkspaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
configStorage: ConfigStorage
|
||||
): GetDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
blockRepository = blockRepository,
|
||||
workspaceManager = workspaceManager,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager,
|
||||
configStorage = configStorage
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@PerScreen
|
||||
@Provides
|
||||
fun provideSetDefaultPageType(repo: UserSettingsRepository): SetDefaultEditorType =
|
||||
SetDefaultEditorType(repo)
|
||||
fun provideSetDefaultPageType(
|
||||
repo: UserSettingsRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): SetDefaultObjectType = SetDefaultObjectType(
|
||||
repo = repo,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@PerScreen
|
||||
|
@ -63,15 +71,17 @@ object OtherSettingsModule {
|
|||
@PerScreen
|
||||
fun provideOtherSettingsFactory(
|
||||
getDefaultPageType: GetDefaultPageType,
|
||||
setDefaultEditorType: SetDefaultEditorType,
|
||||
setDefaultObjectType: SetDefaultObjectType,
|
||||
clearFileCache: ClearFileCache,
|
||||
appActionManager: AppActionManager,
|
||||
analytics: Analytics
|
||||
analytics: Analytics,
|
||||
spaceManager: SpaceManager
|
||||
): OtherSettingsViewModel.Factory = OtherSettingsViewModel.Factory(
|
||||
getDefaultPageType = getDefaultPageType,
|
||||
setDefaultEditorType = setDefaultEditorType,
|
||||
setDefaultObjectType = setDefaultObjectType,
|
||||
clearFileCache = clearFileCache,
|
||||
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.block.interactor.sets.GetObjectTypes
|
||||
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.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.ui.search.ObjectSearchFragment
|
||||
import dagger.Module
|
||||
|
@ -51,12 +51,12 @@ object ObjectSearchModule {
|
|||
getObjectTypes: GetObjectTypes,
|
||||
searchObjects: SearchObjects,
|
||||
analytics: Analytics,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): ObjectSearchViewModelFactory = ObjectSearchViewModelFactory(
|
||||
urlBuilder = urlBuilder,
|
||||
searchObjects = searchObjects,
|
||||
getObjectTypes = getObjectTypes,
|
||||
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.device.PathProvider
|
||||
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.page.CreateObject
|
||||
import com.anytypeio.anytype.domain.platform.MetricsProvider
|
||||
import com.anytypeio.anytype.domain.search.ObjectTypesSubscriptionManager
|
||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||
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.presentation.splash.SplashViewModelFactory
|
||||
import com.anytypeio.anytype.ui.splash.SplashFragment
|
||||
|
@ -71,15 +72,17 @@ object SplashModule {
|
|||
pathProvider: PathProvider,
|
||||
featuresConfigProvider: FeaturesConfigProvider,
|
||||
configStorage: ConfigStorage,
|
||||
workspaceManager: WorkspaceManager,
|
||||
metricsProvider: MetricsProvider
|
||||
spaceManager: SpaceManager,
|
||||
metricsProvider: MetricsProvider,
|
||||
userSettings: UserSettingsRepository
|
||||
): LaunchAccount = LaunchAccount(
|
||||
repository = authRepository,
|
||||
pathProvider = pathProvider,
|
||||
featuresConfigProvider = featuresConfigProvider,
|
||||
configStorage = configStorage,
|
||||
workspaceManager = workspaceManager,
|
||||
metricsProvider = metricsProvider
|
||||
spaceManager = spaceManager,
|
||||
metricsProvider = metricsProvider,
|
||||
settings = userSettings
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -111,34 +114,41 @@ object SplashModule {
|
|||
fun provideGetDefaultPageType(
|
||||
userSettingsRepository: UserSettingsRepository,
|
||||
blockRepository: BlockRepository,
|
||||
workspaceManager: WorkspaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
configStorage: ConfigStorage
|
||||
): GetDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository,
|
||||
blockRepository,
|
||||
workspaceManager,
|
||||
dispatchers
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
blockRepository = blockRepository,
|
||||
spaceManager = spaceManager,
|
||||
dispatchers = dispatchers,
|
||||
configStorage = configStorage
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@PerScreen
|
||||
@Provides
|
||||
fun provideSetDefaultPageType(repo: UserSettingsRepository): SetDefaultEditorType =
|
||||
SetDefaultEditorType(repo)
|
||||
fun provideSetDefaultPageType(
|
||||
repo: UserSettingsRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): SetDefaultObjectType = SetDefaultObjectType(
|
||||
repo = repo,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@PerScreen
|
||||
fun getCreateObject(
|
||||
repo: BlockRepository,
|
||||
getTemplates: GetTemplates,
|
||||
getDefaultPageType: GetDefaultPageType,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): CreateObject = CreateObject(
|
||||
repo = repo,
|
||||
getTemplates = getTemplates,
|
||||
getDefaultPageType = getDefaultPageType,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -177,4 +187,5 @@ interface SplashDependencies : ComponentDependencies {
|
|||
fun dispatchers(): AppCoroutineDispatchers
|
||||
fun crashReporter(): CrashReporter
|
||||
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.misc.AppActionManager
|
||||
import com.anytypeio.anytype.domain.search.RelationsSubscriptionManager
|
||||
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||
import com.anytypeio.anytype.ext.DefaultDateHelper
|
||||
import com.anytypeio.anytype.presentation.auth.account.DeletedAccountViewModel
|
||||
import com.anytypeio.anytype.ui.auth.account.DeletedAccountFragment
|
||||
|
@ -60,12 +61,14 @@ object DeletedAccountModule {
|
|||
repo: AuthRepository,
|
||||
provider: ConfigStorage,
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
user: UserSettingsRepository
|
||||
user: UserSettingsRepository,
|
||||
spaceManager: SpaceManager
|
||||
): Logout = Logout(
|
||||
repo = repo,
|
||||
config = provider,
|
||||
user = user,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -93,4 +96,5 @@ interface DeletedAccountDependencies : ComponentDependencies {
|
|||
fun configStorage(): ConfigStorage
|
||||
fun authRepository(): AuthRepository
|
||||
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.search.SubscriptionEventChannel
|
||||
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.presentation.home.HomeScreenViewModel
|
||||
import com.anytypeio.anytype.presentation.home.Unsubscriber
|
||||
|
@ -124,11 +125,11 @@ object HomeScreenModule {
|
|||
fun emptyBin(
|
||||
repo: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
) : EmptyBin = EmptyBin(
|
||||
repo = repo,
|
||||
dispatchers = dispatchers,
|
||||
workspaceManager = workspaceManager
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -149,12 +150,12 @@ object HomeScreenModule {
|
|||
repo: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
getDefaultEditorType: GetDefaultPageType,
|
||||
getTemplates: GetTemplates
|
||||
spaceManager: SpaceManager
|
||||
): CreateObject = CreateObject(
|
||||
repo = repo,
|
||||
dispatchers = dispatchers,
|
||||
getTemplates = getTemplates,
|
||||
getDefaultPageType = getDefaultEditorType
|
||||
getDefaultPageType = getDefaultEditorType,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -163,13 +164,15 @@ object HomeScreenModule {
|
|||
fun getDefaultPageType(
|
||||
userSettingsRepository: UserSettingsRepository,
|
||||
blockRepository: BlockRepository,
|
||||
workspaceManager: WorkspaceManager,
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
configStorage: ConfigStorage
|
||||
) : GetDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
blockRepository = blockRepository,
|
||||
workspaceManager = workspaceManager,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager,
|
||||
configStorage = configStorage
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -259,4 +262,5 @@ interface HomeScreenDependencies : ComponentDependencies {
|
|||
fun appActionManager(): AppActionManager
|
||||
fun storeOfObjectTypes(): StoreOfObjectTypes
|
||||
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.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.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.workspace.AddObjectToWorkspace
|
||||
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.presentation.library.LibraryListDelegate
|
||||
import com.anytypeio.anytype.presentation.library.LibraryResourceManager
|
||||
|
@ -64,11 +66,16 @@ object LibraryModule {
|
|||
@JvmStatic
|
||||
fun provideMyTypesDelegate(
|
||||
container: StorelessSubscriptionContainer,
|
||||
workspaceManager: WorkspaceManager,
|
||||
spaceManager: SpaceManager,
|
||||
urlBuilder: UrlBuilder,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): LibraryListDelegate {
|
||||
return MyTypesDelegate(container, workspaceManager, urlBuilder, dispatchers)
|
||||
return MyTypesDelegate(
|
||||
container = container,
|
||||
spaceManager = spaceManager,
|
||||
urlBuilder = urlBuilder,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
}
|
||||
|
||||
@PerScreen
|
||||
|
@ -87,11 +94,16 @@ object LibraryModule {
|
|||
@JvmStatic
|
||||
fun provideMyRelationsDelegate(
|
||||
container: StorelessSubscriptionContainer,
|
||||
workspaceManager: WorkspaceManager,
|
||||
spaceManager: SpaceManager,
|
||||
urlBuilder: UrlBuilder,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): LibraryListDelegate {
|
||||
return MyRelationsDelegate(container, workspaceManager, urlBuilder, dispatchers)
|
||||
return MyRelationsDelegate(
|
||||
container = container,
|
||||
spaceManager = spaceManager,
|
||||
urlBuilder = urlBuilder,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
}
|
||||
|
||||
@PerScreen
|
||||
|
@ -129,14 +141,14 @@ object LibraryModule {
|
|||
@PerScreen
|
||||
fun getCreateObject(
|
||||
repo: BlockRepository,
|
||||
getTemplates: GetTemplates,
|
||||
getDefaultPageType: GetDefaultPageType,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
): CreateObject = CreateObject(
|
||||
repo = repo,
|
||||
getTemplates = getTemplates,
|
||||
getDefaultPageType = getDefaultPageType,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -145,13 +157,15 @@ object LibraryModule {
|
|||
fun provideGetDefaultPageType(
|
||||
userSettingsRepository: UserSettingsRepository,
|
||||
blockRepository: BlockRepository,
|
||||
workspaceManager: WorkspaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
configStorage: ConfigStorage
|
||||
): GetDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
blockRepository = blockRepository,
|
||||
workspaceManager = workspaceManager,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager,
|
||||
configStorage = configStorage
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -199,7 +213,8 @@ interface LibraryDependencies : ComponentDependencies {
|
|||
fun channel(): SubscriptionEventChannel
|
||||
fun dispatchers(): AppCoroutineDispatchers
|
||||
fun userSettingsRepository(): UserSettingsRepository
|
||||
|
||||
fun analytics(): Analytics
|
||||
fun spaceManager(): SpaceManager
|
||||
fun config(): ConfigStorage
|
||||
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.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||
import com.anytypeio.anytype.domain.`object`.SetObjectDetails
|
||||
import com.anytypeio.anytype.presentation.onboarding.signup.OnboardingSoulCreationViewModel
|
||||
import dagger.Binds
|
||||
import dagger.Component
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import javax.inject.Scope
|
||||
|
||||
@Component(
|
||||
|
@ -34,26 +32,11 @@ interface OnboardingSoulCreationComponent {
|
|||
|
||||
@Module
|
||||
object OnboardingSoulCreationModule {
|
||||
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@SoulCreationScreenScope
|
||||
fun provideSetObjectDetailsUseCase(
|
||||
repository: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): SetObjectDetails = SetObjectDetails(
|
||||
repo = repository,
|
||||
dispatchers = dispatchers
|
||||
)
|
||||
|
||||
@Module
|
||||
interface Declarations {
|
||||
|
||||
@Binds
|
||||
@SoulCreationScreenScope
|
||||
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.search.ObjectTypesSubscriptionManager
|
||||
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.presentation.onboarding.signup.OnboardingVoidViewModel
|
||||
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
|
||||
|
@ -57,12 +58,10 @@ object OnboardingVoidModule {
|
|||
fun provideCreateAccountUseCase(
|
||||
authRepository: AuthRepository,
|
||||
configStorage: ConfigStorage,
|
||||
workspaceManager: WorkspaceManager,
|
||||
metricsProvider: MetricsProvider
|
||||
): CreateAccount = CreateAccount(
|
||||
repository = authRepository,
|
||||
configStorage = configStorage,
|
||||
workspaceManager = workspaceManager,
|
||||
metricsProvider = metricsProvider
|
||||
)
|
||||
|
||||
|
@ -107,4 +106,5 @@ interface OnboardingVoidDependencies : ComponentDependencies {
|
|||
fun dispatchers(): AppCoroutineDispatchers
|
||||
fun analytics(): Analytics
|
||||
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.GetRelations
|
||||
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.RelationAddToObjectViewModel
|
||||
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.sets.state.ObjectState
|
||||
import com.anytypeio.anytype.presentation.util.Dispatcher
|
||||
|
@ -55,7 +56,7 @@ object RelationAddToObjectModule {
|
|||
getRelations: GetRelations,
|
||||
appCoroutineDispatchers: AppCoroutineDispatchers,
|
||||
addObjectToWorkspace: AddObjectToWorkspace,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): RelationAddToObjectViewModel.Factory = RelationAddToObjectViewModel.Factory(
|
||||
storeOfRelations = storeOfRelations,
|
||||
addRelationToObject = addRelationToObject,
|
||||
|
@ -65,7 +66,7 @@ object RelationAddToObjectModule {
|
|||
getRelations = getRelations,
|
||||
appCoroutineDispatchers = appCoroutineDispatchers,
|
||||
addObjectToWorkspace = addObjectToWorkspace,
|
||||
workspaceManager = workspaceManager
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -110,11 +111,11 @@ object RelationAddToDataViewModule {
|
|||
state: MutableStateFlow<ObjectState>,
|
||||
updateDataViewViewer: UpdateDataViewViewer,
|
||||
analytics: Analytics,
|
||||
@Named(INTRINSIC_PROVIDER_TYPE) relationsProvider: ObjectRelationProvider,
|
||||
@Named(DATA_VIEW_PROVIDER_TYPE) relationsProvider: ObjectRelationProvider,
|
||||
appCoroutineDispatchers: AppCoroutineDispatchers,
|
||||
getRelations: GetRelations,
|
||||
addObjectToWorkspace: AddObjectToWorkspace,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): RelationAddToDataViewViewModel.Factory = RelationAddToDataViewViewModel.Factory(
|
||||
addRelationToDataView = addRelationToDataView,
|
||||
dispatcher = dispatcher,
|
||||
|
@ -125,7 +126,7 @@ object RelationAddToDataViewModule {
|
|||
appCoroutineDispatchers = appCoroutineDispatchers,
|
||||
getRelations = getRelations,
|
||||
addObjectToWorkspace = addObjectToWorkspace,
|
||||
workspaceManager = workspaceManager
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations
|
|||
import com.anytypeio.anytype.domain.objects.StoreOfRelations
|
||||
import com.anytypeio.anytype.domain.relations.CreateRelation
|
||||
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.model.CreateFromScratchState
|
||||
import com.anytypeio.anytype.presentation.relations.model.StateHolder
|
||||
|
@ -91,4 +92,5 @@ object RelationCreateFromLibraryModule {
|
|||
interface RelationCreateFromLibraryDependencies : ComponentDependencies {
|
||||
fun blockRepository(): BlockRepository
|
||||
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.relations.AddRelationToObject
|
||||
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.RelationCreateFromScratchForObjectBlockViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForObjectViewModel
|
||||
|
@ -39,7 +40,7 @@ interface RelationCreateFromScratchForObjectSubComponent {
|
|||
fun inject(fragment: RelationCreateFromScratchForObjectFragment)
|
||||
|
||||
fun relationFormatPickerComponent(): RelationFormatPickerSubcomponent.Builder
|
||||
fun limitObjectTypeComponent() : LimitObjectTypeSubComponent.Builder
|
||||
fun limitObjectTypeComponent(): LimitObjectTypeSubComponent.Builder
|
||||
}
|
||||
|
||||
@Module
|
||||
|
@ -53,13 +54,15 @@ object RelationCreateFromScratchForObjectModule {
|
|||
dispatcher: Dispatcher<Payload>,
|
||||
analytics: Analytics,
|
||||
createFromScratchState: StateHolder<CreateFromScratchState>,
|
||||
createRelation: CreateRelation
|
||||
createRelation: CreateRelation,
|
||||
spaceManager: SpaceManager
|
||||
) = RelationCreateFromScratchForObjectViewModel.Factory(
|
||||
addRelationToObject = addRelationToObject,
|
||||
createRelation = createRelation,
|
||||
dispatcher = dispatcher,
|
||||
analytics = analytics,
|
||||
createFromScratchState = createFromScratchState
|
||||
addRelationToObject = addRelationToObject,
|
||||
createRelation = createRelation,
|
||||
dispatcher = dispatcher,
|
||||
analytics = analytics,
|
||||
createFromScratchState = createFromScratchState,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -96,7 +99,7 @@ interface RelationCreateFromScratchForDataViewSubComponent {
|
|||
fun inject(fragment: RelationCreateFromScratchForDataViewFragment)
|
||||
|
||||
fun relationFormatPickerComponent(): RelationFormatPickerSubcomponent.Builder
|
||||
fun limitObjectTypeComponent() : LimitObjectTypeSubComponent.Builder
|
||||
fun limitObjectTypeComponent(): LimitObjectTypeSubComponent.Builder
|
||||
}
|
||||
|
||||
@Module
|
||||
|
@ -112,15 +115,17 @@ object RelationCreateFromScratchForDataViewModule {
|
|||
analytics: Analytics,
|
||||
createFromScratchState: StateHolder<CreateFromScratchState>,
|
||||
createRelation: CreateRelation,
|
||||
addRelationToDataView: AddRelationToDataView
|
||||
addRelationToDataView: AddRelationToDataView,
|
||||
spaceManager: SpaceManager
|
||||
) = RelationCreateFromScratchForDataViewViewModel.Factory(
|
||||
addRelationToDataView = addRelationToDataView,
|
||||
dispatcher = dispatcher,
|
||||
objectState = state,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
analytics = analytics,
|
||||
createFromScratchState = createFromScratchState,
|
||||
createRelation = createRelation
|
||||
addRelationToDataView = addRelationToDataView,
|
||||
dispatcher = dispatcher,
|
||||
objectState = state,
|
||||
updateDataViewViewer = updateDataViewViewer,
|
||||
analytics = analytics,
|
||||
createFromScratchState = createFromScratchState,
|
||||
createRelation = createRelation,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -162,7 +167,7 @@ interface RelationCreateFromScratchForObjectBlockSubComponent {
|
|||
fun inject(fragment: RelationCreateFromScratchForObjectBlockFragment)
|
||||
|
||||
fun relationFormatPickerComponent(): RelationFormatPickerSubcomponent.Builder
|
||||
fun limitObjectTypeComponent() : LimitObjectTypeSubComponent.Builder
|
||||
fun limitObjectTypeComponent(): LimitObjectTypeSubComponent.Builder
|
||||
}
|
||||
|
||||
@Module
|
||||
|
@ -176,13 +181,15 @@ object RelationCreateFromScratchForObjectBlockModule {
|
|||
createRelation: CreateRelation,
|
||||
dispatcher: Dispatcher<Payload>,
|
||||
analytics: Analytics,
|
||||
createFromScratchState: StateHolder<CreateFromScratchState>
|
||||
createFromScratchState: StateHolder<CreateFromScratchState>,
|
||||
spaceManager: SpaceManager
|
||||
) = RelationCreateFromScratchForObjectBlockViewModel.Factory(
|
||||
addRelationToObject = addRelationToObject,
|
||||
createRelation = createRelation,
|
||||
dispatcher = dispatcher,
|
||||
analytics = analytics,
|
||||
createFromScratchState = createFromScratchState
|
||||
addRelationToObject = addRelationToObject,
|
||||
createRelation = createRelation,
|
||||
dispatcher = dispatcher,
|
||||
analytics = analytics,
|
||||
createFromScratchState = createFromScratchState,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@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.options.GetOptions
|
||||
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.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
|
@ -52,7 +52,7 @@ object CreateFilterModule {
|
|||
objectSetDatabase: ObjectSetDatabase,
|
||||
analytics: Analytics,
|
||||
getOptions: GetOptions,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): FilterViewModel.Factory = FilterViewModel.Factory(
|
||||
objectState = state,
|
||||
dispatcher = dispatcher,
|
||||
|
@ -64,6 +64,6 @@ object CreateFilterModule {
|
|||
objectSetDatabase = objectSetDatabase,
|
||||
analytics = analytics,
|
||||
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.options.GetOptions
|
||||
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.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.state.ObjectState
|
||||
|
@ -52,7 +52,7 @@ object ModifyFilterModule {
|
|||
objectSetDatabase: ObjectSetDatabase,
|
||||
getOptions: GetOptions,
|
||||
storeOfRelations: StoreOfRelations,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): FilterViewModel.Factory = FilterViewModel.Factory(
|
||||
objectState = state,
|
||||
dispatcher = dispatcher,
|
||||
|
@ -64,6 +64,6 @@ object ModifyFilterModule {
|
|||
storeOfRelations = storeOfRelations,
|
||||
analytics = analytics,
|
||||
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.FileSpaceUsage
|
||||
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.spaces.SpaceGradientProvider
|
||||
import com.anytypeio.anytype.ui.settings.FilesStorageFragment
|
||||
|
@ -79,8 +80,9 @@ object FilesStorageModule {
|
|||
@PerScreen
|
||||
fun provideSpaceUsage(
|
||||
repo: BlockRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
): FileSpaceUsage = FileSpaceUsage(repo, dispatchers)
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): FileSpaceUsage = FileSpaceUsage(repo, spaceManager, dispatchers)
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
|
@ -118,4 +120,5 @@ interface FilesStorageDependencies : ComponentDependencies {
|
|||
fun buildProvider(): BuildProvider
|
||||
fun authRepo(): AuthRepository
|
||||
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.misc.AppActionManager
|
||||
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.account.LogoutWarningViewModel
|
||||
import dagger.Module
|
||||
|
@ -53,11 +54,13 @@ object LogoutWarningModule {
|
|||
repo: AuthRepository,
|
||||
provider: ConfigStorage,
|
||||
user: UserSettingsRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): Logout = Logout(
|
||||
repo = repo,
|
||||
config = provider,
|
||||
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.domain.base.AppCoroutineDispatchers
|
||||
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.DebugSpaceShareDownloader
|
||||
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||
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.spaces.SpaceGradientProvider
|
||||
import com.anytypeio.anytype.presentation.util.downloader.UriFileProvider
|
||||
|
@ -64,19 +65,19 @@ object MainSettingsModule {
|
|||
fun provideViewModelFactory(
|
||||
analytics: Analytics,
|
||||
storelessSubscriptionContainer: StorelessSubscriptionContainer,
|
||||
configStorage: ConfigStorage,
|
||||
urlBuilder: UrlBuilder,
|
||||
setObjectDetails: SetObjectDetails,
|
||||
spaceGradientProvider: SpaceGradientProvider,
|
||||
debugSpaceShareDownloader: DebugSpaceShareDownloader
|
||||
debugSpaceShareDownloader: DebugSpaceShareDownloader,
|
||||
spaceManager: SpaceManager,
|
||||
setSpaceDetails: SetSpaceDetails
|
||||
): MainSettingsViewModel.Factory = MainSettingsViewModel.Factory(
|
||||
analytics = analytics,
|
||||
storelessSubscriptionContainer = storelessSubscriptionContainer,
|
||||
configStorage = configStorage,
|
||||
urlBuilder = urlBuilder,
|
||||
setObjectDetails = setObjectDetails,
|
||||
setSpaceDetails = setSpaceDetails,
|
||||
spaceGradientProvider = spaceGradientProvider,
|
||||
debugSpaceShareDownloader = debugSpaceShareDownloader
|
||||
debugSpaceShareDownloader = debugSpaceShareDownloader,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@Module
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.anytypeio.anytype.domain.icon.SetDocumentImageIcon
|
|||
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
|
||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||
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.ui.settings.ProfileFragment
|
||||
import com.anytypeio.anytype.ui_settings.account.ProfileViewModel
|
||||
|
@ -78,12 +79,14 @@ object ProfileModule {
|
|||
repo: AuthRepository,
|
||||
provider: ConfigStorage,
|
||||
user: UserSettingsRepository,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): Logout = Logout(
|
||||
repo = repo,
|
||||
config = provider,
|
||||
user = user,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@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.misc.UrlBuilder
|
||||
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.EmojiProvider
|
||||
import com.anytypeio.anytype.presentation.types.TypeCreationViewModel
|
||||
|
@ -67,4 +68,5 @@ interface TypeCreationDependencies : ComponentDependencies {
|
|||
fun dispatchers(): AppCoroutineDispatchers
|
||||
fun urlBuilder(): UrlBuilder
|
||||
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.cover.GetCoverGradientCollection
|
||||
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.ui.dashboard.WallpaperSelectFragment
|
||||
import dagger.Module
|
||||
|
@ -35,11 +36,13 @@ object WallpaperSelectModule {
|
|||
@PerScreen
|
||||
fun provideViewModelFactory(
|
||||
setWallpaper: SetWallpaper,
|
||||
analytics: Analytics
|
||||
analytics: Analytics,
|
||||
spaceManager: SpaceManager
|
||||
): WallpaperSelectViewModel.Factory = WallpaperSelectViewModel.Factory(
|
||||
setWallpaper = setWallpaper,
|
||||
analytics = analytics,
|
||||
getGradients = GetCoverGradientCollection(DefaultGradientCollectionProvider)
|
||||
getGradients = GetCoverGradientCollection(DefaultGradientCollectionProvider),
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -2,13 +2,12 @@ package com.anytypeio.anytype.di.feature.widgets
|
|||
|
||||
import com.anytypeio.anytype.analytics.base.Analytics
|
||||
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.block.interactor.sets.GetObjectTypes
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||
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.widgets.SelectWidgetSourceViewModel
|
||||
import com.anytypeio.anytype.presentation.widgets.WidgetDispatchEvent
|
||||
|
@ -41,17 +40,17 @@ object SelectWidgetSourceModule {
|
|||
fun factory(
|
||||
urlBuilder: UrlBuilder,
|
||||
analytics: Analytics,
|
||||
workspaceManager: WorkspaceManager,
|
||||
searchObjects: SearchObjects,
|
||||
getObjectTypes: GetObjectTypes,
|
||||
dispatcher: Dispatcher<WidgetDispatchEvent>
|
||||
dispatcher: Dispatcher<WidgetDispatchEvent>,
|
||||
spaceManager: SpaceManager
|
||||
): SelectWidgetSourceViewModel.Factory = SelectWidgetSourceViewModel.Factory(
|
||||
urlBuilder = urlBuilder,
|
||||
searchObjects = searchObjects,
|
||||
analytics = analytics,
|
||||
workspaceManager = workspaceManager,
|
||||
getObjectTypes = getObjectTypes,
|
||||
dispatcher = dispatcher
|
||||
dispatcher = dispatcher,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
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.domain.base.AppCoroutineDispatchers
|
||||
import com.anytypeio.anytype.domain.config.ConfigStorage
|
||||
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.Provides
|
||||
import javax.inject.Singleton
|
||||
|
@ -17,8 +18,12 @@ object ConfigModule {
|
|||
@Provides
|
||||
@Singleton
|
||||
fun provideGateway(
|
||||
provider: ConfigStorage
|
||||
): Gateway = GatewayProvider(provider)
|
||||
spaceManager: SpaceManager,
|
||||
logger: Logger
|
||||
): Gateway = GatewayProvider(
|
||||
spaceManager = spaceManager,
|
||||
logger = logger
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
@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.MainSettingsSubComponent
|
||||
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.TemplateSelectDependencies
|
||||
import com.anytypeio.anytype.di.feature.templates.TemplateSubComponent
|
||||
|
@ -97,7 +100,10 @@ interface MainComponent :
|
|||
AboutAppDependencies,
|
||||
OnboardingSoulCreationAnimDependencies,
|
||||
TemplateBlankDependencies,
|
||||
TemplateSelectDependencies {
|
||||
TemplateSelectDependencies,
|
||||
SelectSpaceDependencies,
|
||||
CreateSpaceDependencies,
|
||||
SpaceSettingsDependencies {
|
||||
|
||||
fun inject(app: AndroidApplication)
|
||||
|
||||
|
@ -257,4 +263,19 @@ private abstract class ComponentDependenciesModule private constructor() {
|
|||
@IntoMap
|
||||
@ComponentDependenciesKey(TemplateSelectDependencies::class)
|
||||
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.RelationsSubscriptionManager
|
||||
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.Provides
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
|
@ -65,10 +64,10 @@ object SubscriptionsModule {
|
|||
@Singleton
|
||||
fun relationsSubscriptionManager(
|
||||
subscription: RelationsSubscriptionContainer,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): RelationsSubscriptionManager = RelationsSubscriptionManager(
|
||||
subscription = subscription,
|
||||
workspaceManager = workspaceManager
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -76,9 +75,9 @@ object SubscriptionsModule {
|
|||
@Singleton
|
||||
fun objectTypesSubscriptionManager(
|
||||
subscription: ObjectTypesSubscriptionContainer,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): ObjectTypesSubscriptionManager = ObjectTypesSubscriptionManager(
|
||||
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.debugging.Logger
|
||||
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.workspace.WorkspaceManager
|
||||
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||
import com.anytypeio.anytype.presentation.templates.DefaultObjectTypeTemplatesContainer
|
||||
import com.anytypeio.anytype.presentation.templates.ObjectTypeTemplatesContainer
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import javax.inject.Named
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
|
@ -33,10 +31,10 @@ object TemplatesModule {
|
|||
@Singleton
|
||||
fun provideTemplatesContainer(
|
||||
storage: StorelessSubscriptionContainer,
|
||||
workspaceManager: WorkspaceManager
|
||||
spaceManager: SpaceManager
|
||||
): ObjectTypeTemplatesContainer =
|
||||
DefaultObjectTypeTemplatesContainer(
|
||||
storage = storage,
|
||||
workspaceManager = workspaceManager
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
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 dagger.Module
|
||||
import dagger.Provides
|
||||
|
@ -10,4 +15,18 @@ object WorkspaceModule {
|
|||
@Provides
|
||||
@Singleton
|
||||
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 openSettings() {
|
||||
override fun openSpaceSettings() {
|
||||
try {
|
||||
navController?.navigate(R.id.action_open_settings)
|
||||
navController?.navigate(R.id.action_open_space_settings)
|
||||
} catch (e: Exception) {
|
||||
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(
|
||||
R.id.nav_editor_modal,
|
||||
bundleOf(
|
||||
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)
|
||||
}
|
||||
|
||||
override fun logException(e: Exception) {
|
||||
override fun logException(e: Throwable) {
|
||||
Timber.e(e)
|
||||
}
|
||||
}
|
|
@ -30,10 +30,12 @@ class NavigationRouter(
|
|||
)
|
||||
|
||||
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.OpenModalEditor -> navigation.openModalEditor(
|
||||
id = command.id, targetObjectType = command.targetObjectType
|
||||
id = command.id,
|
||||
targetTypeId = command.targetTypeId,
|
||||
targetTypeKey = command.targetTypeKey
|
||||
)
|
||||
is AppNavigation.Command.OpenSetOrCollection -> navigation.openObjectSet(
|
||||
command.target,
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.lifecycle.lifecycleScope
|
|||
import androidx.navigation.NavOptions
|
||||
import androidx.navigation.fragment.findNavController
|
||||
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.subscribe
|
||||
import com.anytypeio.anytype.core_utils.ext.toast
|
||||
|
@ -23,7 +24,7 @@ class CreateObjectFragment : BaseFragment<FragmentCreateObjectBinding>(R.layout.
|
|||
lateinit var factory: 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() {
|
||||
jobs += lifecycleScope.subscribe(vm.createObjectStatus) { state ->
|
||||
|
|
|
@ -2071,12 +2071,20 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
vm.proceedToCreateObjectAndAddToTextAsLink(name)
|
||||
}
|
||||
|
||||
override fun onProceedWithUpdateType(id: Id) {
|
||||
vm.onObjectTypeChanged(type = id, applyTemplate = false)
|
||||
override fun onProceedWithUpdateType(id: Id, key: Key) {
|
||||
vm.onObjectTypeChanged(
|
||||
type = id,
|
||||
key = key,
|
||||
applyTemplate = false
|
||||
)
|
||||
}
|
||||
|
||||
override fun onProceedWithDraftUpdateType(id: Id) {
|
||||
vm.onObjectTypeChanged(type = id, applyTemplate = true)
|
||||
override fun onProceedWithDraftUpdateType(id: Id, key: Key) {
|
||||
vm.onObjectTypeChanged(
|
||||
type = id,
|
||||
key = key,
|
||||
applyTemplate = true
|
||||
)
|
||||
}
|
||||
|
||||
override fun onAddRelationToTarget(target: Id, relationKey: Key) {
|
||||
|
|
|
@ -14,14 +14,16 @@ import com.anytypeio.anytype.ui.templates.EditorTemplateFragment
|
|||
class EditorModalFragment : BaseBottomSheetFragment<MyFragmentContainerBinding>() {
|
||||
|
||||
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?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setStyle(STYLE_NORMAL, R.style.AppBottomSecondarySheetDialogTheme)
|
||||
val editorFragment = EditorTemplateFragment.newInstance(
|
||||
id = ctx,
|
||||
targetObjectType = targetObjectType
|
||||
targetTypeId = targetTypeId,
|
||||
targetTypeKey = targetTypeKey
|
||||
)
|
||||
childFragmentManager.beginTransaction()
|
||||
.add(R.id.fragment_container_view, editorFragment)
|
||||
|
@ -52,6 +54,7 @@ class EditorModalFragment : BaseBottomSheetFragment<MyFragmentContainerBinding>(
|
|||
|
||||
companion object {
|
||||
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.LinkWidgetCard
|
||||
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 org.burnoutcrew.reorderable.ReorderableItem
|
||||
import org.burnoutcrew.reorderable.detectReorderAfterLongPress
|
||||
|
@ -92,10 +93,12 @@ fun HomeScreen(
|
|||
onExitEditMode: () -> Unit,
|
||||
onSearchClicked: () -> Unit,
|
||||
onLibraryClicked: () -> Unit,
|
||||
onOpenSpacesClicked: () -> Unit,
|
||||
onCreateNewObjectClicked: () -> 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()) {
|
||||
|
@ -111,6 +114,8 @@ fun HomeScreen(
|
|||
onChangeWidgetView = onChangeWidgetView,
|
||||
onEditWidgets = onEditWidgets,
|
||||
onLibraryClicked = onLibraryClicked,
|
||||
onOpenSpacesClicked = onOpenSpacesClicked,
|
||||
onSpaceWidgetClicked = onSpaceWidgetClicked,
|
||||
onMove = onMove,
|
||||
onObjectCheckboxClicked = onObjectCheckboxClicked
|
||||
)
|
||||
|
@ -176,7 +181,9 @@ private fun WidgetList(
|
|||
onEditWidgets: () -> Unit,
|
||||
onLibraryClicked: () -> Unit,
|
||||
onMove: (List<WidgetView>, FromIndex, ToIndex) -> Unit,
|
||||
onObjectCheckboxClicked: (Id, Boolean) -> Unit
|
||||
onObjectCheckboxClicked: (Id, Boolean) -> Unit,
|
||||
onOpenSpacesClicked: () -> Unit,
|
||||
onSpaceWidgetClicked: () -> Unit
|
||||
) {
|
||||
val views = remember { mutableStateOf(widgets) }
|
||||
views.value = widgets
|
||||
|
@ -208,6 +215,13 @@ private fun WidgetList(
|
|||
key = { _, item -> item.id }
|
||||
) { index, item ->
|
||||
when (item) {
|
||||
is WidgetView.SpaceWidget.View -> {
|
||||
SpaceWidgetCard(
|
||||
onClick = onSpaceWidgetClicked,
|
||||
name = item.space.name.orEmpty(),
|
||||
icon = item.icon
|
||||
)
|
||||
}
|
||||
is WidgetView.Tree -> {
|
||||
ReorderableItem(lazyListState, key = item.id) { isDragged ->
|
||||
val alpha = animateFloatAsState(if (isDragged) 0.8f else 1.0f)
|
||||
|
@ -435,6 +449,25 @@ private fun WidgetList(
|
|||
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 -> {
|
||||
LibraryWidgetCard(
|
||||
onDropDownMenuAction = { action ->
|
||||
|
|
|
@ -84,7 +84,13 @@ class HomeScreenFragment : BaseComposeFragment() {
|
|||
vm.onCreateNewObjectClicked()
|
||||
},
|
||||
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,
|
||||
onMove = vm::onMove,
|
||||
|
|
|
@ -10,6 +10,7 @@ import androidx.lifecycle.lifecycleScope
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.anytypeio.anytype.R
|
||||
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.reactive.textChanges
|
||||
import com.anytypeio.anytype.core_utils.ext.argOrNull
|
||||
|
@ -27,7 +28,7 @@ abstract class BaseObjectTypeChangeFragment :
|
|||
|
||||
abstract fun setTitle()
|
||||
abstract fun startWithParams()
|
||||
abstract fun onItemClicked(id: Id, name: String)
|
||||
abstract fun onItemClicked(id: Id, key: Key, name: String)
|
||||
|
||||
@Inject
|
||||
lateinit var factory: ObjectTypeChangeViewModelFactory
|
||||
|
@ -66,11 +67,13 @@ abstract class BaseObjectTypeChangeFragment :
|
|||
jobs += subscribe(binding.searchObjectTypeInput.textChanges()) {
|
||||
vm.onQueryChanged(it.toString())
|
||||
}
|
||||
jobs += subscribe(vm.toasts) { toast -> toast(toast) }
|
||||
jobs += subscribe(vm.commands) { command ->
|
||||
when (command) {
|
||||
is Command.DispatchType -> {
|
||||
onItemClicked(
|
||||
id = command.id,
|
||||
key = command.key,
|
||||
name = command.name
|
||||
)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.ui.objects.types.pickers
|
|||
import androidx.core.os.bundleOf
|
||||
import com.anytypeio.anytype.R
|
||||
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.withParent
|
||||
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> {
|
||||
onProceedWithUpdateType(
|
||||
id = id,
|
||||
key = key,
|
||||
name = name
|
||||
)
|
||||
}
|
||||
|
@ -51,6 +53,6 @@ class AppDefaultObjectTypeFragment : BaseObjectTypeChangeFragment() {
|
|||
}
|
||||
|
||||
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 com.anytypeio.anytype.R
|
||||
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.withParent
|
||||
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> {
|
||||
onProceedWithSelectSource(id = id)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.ui.objects.types.pickers
|
|||
import androidx.core.os.bundleOf
|
||||
import com.anytypeio.anytype.R
|
||||
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.withParent
|
||||
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> {
|
||||
onProceedWithDraftUpdateType(id = id)
|
||||
onProceedWithDraftUpdateType(
|
||||
id = id,
|
||||
key = key
|
||||
)
|
||||
}
|
||||
hideSoftInput()
|
||||
dismiss()
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.anytypeio.anytype.ui.objects.types.pickers
|
|||
|
||||
import com.anytypeio.anytype.R
|
||||
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.withParent
|
||||
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> {
|
||||
onProceedWithSelectSource(id = id)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.ui.objects.types.pickers
|
|||
import androidx.core.os.bundleOf
|
||||
import com.anytypeio.anytype.R
|
||||
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.withParent
|
||||
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> {
|
||||
onProceedWithUpdateType(id = id)
|
||||
onProceedWithUpdateType(id = id, key = key)
|
||||
}
|
||||
hideSoftInput()
|
||||
dismiss()
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.anytypeio.anytype.ui.objects.types.pickers
|
||||
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
|
||||
interface OnObjectSelectTypeAction {
|
||||
fun onProceedWithUpdateType(id: Id)
|
||||
fun onProceedWithDraftUpdateType(id: Id)
|
||||
fun onProceedWithUpdateType(id: Id, key: Key)
|
||||
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.views.ButtonPrimarySmallIcon
|
||||
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.TypeTemplatesWidget
|
||||
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.ViewersWidget
|
||||
|
@ -78,7 +78,6 @@ import com.anytypeio.anytype.databinding.FragmentObjectSetBinding
|
|||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.presentation.editor.cover.CoverColor
|
||||
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.ObjectSetCommand
|
||||
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.ViewEditAction
|
||||
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.model.Viewer
|
||||
import com.anytypeio.anytype.presentation.widgets.TypeTemplatesWidgetUI
|
||||
import com.anytypeio.anytype.ui.base.NavigationFragment
|
||||
import com.anytypeio.anytype.ui.editor.cover.SelectCoverObjectSetFragment
|
||||
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.SetObjectCreateRecordFragmentBase
|
||||
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.bumptech.glide.Glide
|
||||
import javax.inject.Inject
|
||||
|
@ -1221,14 +1221,15 @@ open class ObjectSetFragment :
|
|||
inflater, container, false
|
||||
)
|
||||
|
||||
override fun onProceedWithUpdateType(id: Id) {
|
||||
override fun onProceedWithUpdateType(id: Id, key: Key) {
|
||||
vm.onNewTypeForViewerClicked(id)
|
||||
}
|
||||
|
||||
override fun onProceedWithDraftUpdateType(id: Id) {
|
||||
// Do nothing
|
||||
override fun onProceedWithDraftUpdateType(id: Id, key: Key) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
||||
private fun observeSelectingTemplate() {
|
||||
val navController = findNavController()
|
||||
val navBackStackEntry = navController.getBackStackEntry(R.id.objectSetScreen)
|
||||
|
@ -1236,14 +1237,21 @@ open class ObjectSetFragment :
|
|||
if (event == Lifecycle.Event.ON_RESUME
|
||||
&& navBackStackEntry.savedStateHandle.contains(ARG_TEMPLATE_ID)) {
|
||||
val resultTemplateId = navBackStackEntry.savedStateHandle.get<String>(ARG_TEMPLATE_ID)
|
||||
val resultObjectTypeId = navBackStackEntry.savedStateHandle.get<String>(ARG_TARGET_OBJECT_TYPE)
|
||||
if (!resultTemplateId.isNullOrBlank() && !resultObjectTypeId.isNullOrBlank()) {
|
||||
val resultTypeId = navBackStackEntry.savedStateHandle.get<String>(ARG_TARGET_TYPE_ID)
|
||||
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_TARGET_OBJECT_TYPE)
|
||||
vm.proceedWithSelectedTemplate(template = resultTemplateId, objectType = resultObjectTypeId)
|
||||
navBackStackEntry.savedStateHandle.remove<String>(ARG_TARGET_TYPE_ID)
|
||||
navBackStackEntry.savedStateHandle.remove<String>(ARG_TARGET_TYPE_KEY)
|
||||
vm.proceedWithSelectedTemplate(
|
||||
template = resultTemplateId,
|
||||
typeId = resultTypeId,
|
||||
typeKey = resultTypeKey
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
navBackStackEntry.lifecycle.addObserver(observer)
|
||||
|
||||
viewLifecycleOwner.lifecycle.addObserver(LifecycleEventObserver { _, event ->
|
||||
|
|
|
@ -128,7 +128,12 @@ EditDataViewViewerFragment : BaseBottomSheetFragment<FragmentEditDataViewViewerB
|
|||
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 androidx.fragment.app.viewModels
|
||||
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.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.core_utils.ui.proceed
|
||||
|
@ -24,8 +25,8 @@ class OtherSettingsFragment : BaseBottomSheetFragment<FragmentUserSettingsBindin
|
|||
|
||||
private val vm by viewModels<OtherSettingsViewModel> { factory }
|
||||
|
||||
override fun onProceedWithUpdateType(id: Id, name: String) {
|
||||
vm.proceedWithUpdateType(type = id, name = name)
|
||||
override fun onProceedWithUpdateType(id: Id, key: Key, name: String) {
|
||||
vm.proceedWithUpdateType(type = id, key = key, name = name)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
|
|
@ -91,6 +91,13 @@ class ProfileFragment : BaseBottomSheetComposeFragment() {
|
|||
setupBottomSheetBehavior(PADDING_TOP)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
subscribe(vm.toasts) {
|
||||
toast(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun proceedWithAccountDeletion() {
|
||||
vm.proceedWithAccountDeletion()
|
||||
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.R
|
||||
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.visible
|
||||
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.di.common.componentManager
|
||||
import com.anytypeio.anytype.presentation.splash.SplashViewModel
|
||||
|
@ -43,23 +45,40 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>(R.layout.fragment_spl
|
|||
showVersion()
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||
vm.commands.collect {
|
||||
try {
|
||||
observe(it)
|
||||
} catch (e: Exception) {
|
||||
toast(e.message ?: resources.getString(R.string.unknown_error))
|
||||
launch {
|
||||
vm.commands.collect {
|
||||
try {
|
||||
observe(it)
|
||||
} 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) {
|
||||
when (command) {
|
||||
is SplashViewModel.Command.Error -> {
|
||||
toast(command.msg)
|
||||
binding.error.visible()
|
||||
}
|
||||
SplashViewModel.Command.NavigateToDashboard -> {
|
||||
try {
|
||||
findNavController().navigate(
|
||||
|
|
|
@ -20,7 +20,8 @@ import timber.log.Timber
|
|||
|
||||
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?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
@ -72,7 +73,8 @@ class EditorTemplateFragment : EditorFragment() {
|
|||
findNavController().apply {
|
||||
previousBackStackEntry?.savedStateHandle?.apply {
|
||||
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)
|
||||
}
|
||||
|
@ -85,15 +87,17 @@ class EditorTemplateFragment : EditorFragment() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(id: String, targetObjectType: Id): EditorTemplateFragment =
|
||||
fun newInstance(id: String, targetTypeId: Id, targetTypeKey: Id): EditorTemplateFragment =
|
||||
EditorTemplateFragment().apply {
|
||||
arguments = bundleOf(
|
||||
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_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.SubscriptionEventChannel
|
||||
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.widgets.WidgetDispatchEvent
|
||||
import com.anytypeio.anytype.presentation.widgets.collection.CollectionViewModel
|
||||
|
@ -42,9 +42,7 @@ import kotlinx.coroutines.Dispatchers
|
|||
|
||||
@Component(
|
||||
dependencies = [CollectionDependencies::class],
|
||||
modules = [
|
||||
CollectionModule::class
|
||||
]
|
||||
modules = [CollectionModule::class]
|
||||
)
|
||||
@PerScreen
|
||||
interface CollectionComponent {
|
||||
|
@ -153,14 +151,14 @@ object CollectionModule {
|
|||
@PerScreen
|
||||
fun getCreateObject(
|
||||
repo: BlockRepository,
|
||||
getTemplates: GetTemplates,
|
||||
getDefaultPageType: GetDefaultPageType,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager
|
||||
): CreateObject = CreateObject(
|
||||
repo = repo,
|
||||
getTemplates = getTemplates,
|
||||
getDefaultPageType = getDefaultPageType,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -169,13 +167,15 @@ object CollectionModule {
|
|||
fun provideGetDefaultPageType(
|
||||
userSettingsRepository: UserSettingsRepository,
|
||||
blockRepository: BlockRepository,
|
||||
workspaceManager: WorkspaceManager,
|
||||
dispatchers: AppCoroutineDispatchers
|
||||
dispatchers: AppCoroutineDispatchers,
|
||||
spaceManager: SpaceManager,
|
||||
configStorage: ConfigStorage
|
||||
): GetDefaultPageType = GetDefaultPageType(
|
||||
userSettingsRepository = userSettingsRepository,
|
||||
blockRepository = blockRepository,
|
||||
workspaceManager = workspaceManager,
|
||||
dispatchers = dispatchers
|
||||
dispatchers = dispatchers,
|
||||
spaceManager = spaceManager,
|
||||
configStorage = configStorage
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
@ -209,11 +209,11 @@ interface CollectionDependencies : ComponentDependencies {
|
|||
fun urlBuilder(): UrlBuilder
|
||||
fun objectStore(): ObjectStore
|
||||
fun subscriptionEventChannel(): SubscriptionEventChannel
|
||||
fun workspaceManager(): WorkspaceManager
|
||||
fun analytics(): Analytics
|
||||
fun eventChannel(): EventChannel
|
||||
fun userSettingsRepository(): UserSettingsRepository
|
||||
fun storeOfObjectTypes(): StoreOfObjectTypes
|
||||
fun dispatchers(): AppCoroutineDispatchers
|
||||
fun spaceManager(): SpaceManager
|
||||
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_gravity="bottom|center_horizontal"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:text="@string/failed_to_launch_wallet"
|
||||
android:text="@string/generic_error"
|
||||
android:textColor="@color/palette_system_red"
|
||||
android:visibility="invisible"
|
||||
tools:ignore="SmallSp"
|
||||
|
|
|
@ -33,10 +33,11 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/doneBtn"
|
||||
style="@style/DefaultCellInteractionTextButtonStyle"
|
||||
style="@style/TextView.UXStyle.Body"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/glyph_active"
|
||||
android:paddingStart="@dimen/dp_16"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="@string/done"
|
||||
|
|
|
@ -145,8 +145,11 @@
|
|||
android:label="Home screen"
|
||||
tools:layout="@layout/fragment_home">
|
||||
<action
|
||||
android:id="@+id/action_open_settings"
|
||||
app:destination="@id/settingsScreen" />
|
||||
android:id="@+id/action_open_space_settings"
|
||||
app:destination="@id/spaceSettingsScreen" />
|
||||
<action
|
||||
android:id="@+id/action_open_spaces"
|
||||
app:destination="@id/selectSpaceScreen" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
|
@ -167,6 +170,19 @@
|
|||
android:id="@+id/selectWidgetTypeScreen"
|
||||
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
|
||||
android:id="@+id/settingsScreen"
|
||||
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="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>
|
||||
|
|
|
@ -296,7 +296,8 @@ data class Block(
|
|||
GRID("Grid"),
|
||||
LIST("List"),
|
||||
GALLERY("Gallery"),
|
||||
BOARD("Board")
|
||||
BOARD("Board"),
|
||||
CALENDAR("Calendar")
|
||||
}
|
||||
|
||||
enum class Size { SMALL, MEDIUM, LARGE }
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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 {
|
||||
|
||||
class UploadFile(
|
||||
|
@ -165,6 +168,7 @@ sealed class Command {
|
|||
*/
|
||||
data class CreateBlockLinkWithObject(
|
||||
val context: Id,
|
||||
val type: TypeKey,
|
||||
val target: Id,
|
||||
val position: Position,
|
||||
val template: Id?,
|
||||
|
@ -181,7 +185,9 @@ sealed class Command {
|
|||
data class CreateObject(
|
||||
val prefilled: Struct,
|
||||
val template: Id?,
|
||||
val internalFlags: List<InternalFlags>
|
||||
val internalFlags: List<InternalFlags>,
|
||||
val space: SpaceId,
|
||||
val type: TypeKey
|
||||
)
|
||||
|
||||
class Move(
|
||||
|
|
|
@ -5,13 +5,14 @@ package com.anytypeio.anytype.core_models
|
|||
* @property home id of the home dashboard
|
||||
* @property profile id of the current profile
|
||||
* @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(
|
||||
val home: Id,
|
||||
val profile: Id,
|
||||
val gateway: Url,
|
||||
val workspace: Id,
|
||||
val space: Id,
|
||||
val spaceView: Id,
|
||||
val widgets: Id,
|
||||
val analytics: 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),
|
||||
BOOKMARK(11),
|
||||
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.
|
||||
* // TODO rename to ObjectTypeUniqueKeys when finished multi-spaces refactoring
|
||||
*/
|
||||
object ObjectTypeIds {
|
||||
const val PAGE = "ot-page"
|
||||
|
@ -67,5 +68,10 @@ object MarketplaceObjectTypeIds {
|
|||
}
|
||||
|
||||
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 uniqueKey: String? by default
|
||||
|
||||
val done: Boolean? by default
|
||||
|
||||
val snippet: String? by default
|
||||
|
@ -154,6 +156,7 @@ sealed class ObjectWrapper {
|
|||
data class Type(override val map: Struct) : ObjectWrapper() {
|
||||
private val default = map.withDefault { null }
|
||||
val id: Id by default
|
||||
val uniqueKey: String? by default
|
||||
val name: String? by default
|
||||
val sourceObject: Id? by default
|
||||
val description: String? by default
|
||||
|
@ -166,9 +169,13 @@ sealed class ObjectWrapper {
|
|||
is Double -> ObjectType.Layout.values().singleOrNull { layout ->
|
||||
layout.code == value.toInt()
|
||||
}
|
||||
else -> null
|
||||
else -> ObjectType.Layout.BASIC
|
||||
}
|
||||
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() {
|
||||
|
@ -192,8 +199,9 @@ sealed class ObjectWrapper {
|
|||
private val relationReadonlyValue: Boolean? by default
|
||||
|
||||
val id: Id by default
|
||||
val uniqueKey: String? by default
|
||||
val key: Key get() = relationKey
|
||||
val workspaceId: Id? by default
|
||||
val spaceId: Id? by default
|
||||
val sourceObject: Id? by default
|
||||
val format: RelationFormat get() = relationFormat
|
||||
val name: String? by default
|
||||
|
@ -230,6 +238,13 @@ sealed class ObjectWrapper {
|
|||
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? {
|
||||
val value = map.getOrDefault(relation, null)
|
||||
return if (value is T)
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.anytypeio.anytype.core_models
|
|||
|
||||
/**
|
||||
* Keys for predefined, bundled relations.
|
||||
* // TODO remove outdated or deprecated relations
|
||||
*/
|
||||
object Relations {
|
||||
|
||||
|
@ -29,7 +30,8 @@ object Relations {
|
|||
const val DONE = "done"
|
||||
const val FEATURED_RELATIONS = "featuredRelations"
|
||||
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 URL = "url"
|
||||
const val SOURCE = "source"
|
||||
|
@ -48,6 +50,7 @@ object Relations {
|
|||
const val SIZE_IN_BYTES = "sizeInBytes"
|
||||
const val FILE_SYNC_STATUS = "fileSyncStatus"
|
||||
const val CREATED_DATE = "createdDate"
|
||||
const val CREATOR = "creator"
|
||||
|
||||
const val PAGE_COVER = "pageCover"
|
||||
|
||||
|
@ -61,6 +64,13 @@ object Relations {
|
|||
const val RECOMMENDED_RELATIONS = "recommendedRelations"
|
||||
const val DEFAULT_TEMPLATE_ID = "defaultTemplateId"
|
||||
|
||||
const val UNIQUE_KEY = "uniqueKey"
|
||||
|
||||
/**
|
||||
* Transitive relation key.
|
||||
*/
|
||||
const val TYPE_UNIQUE_KEY = "type.uniqueKey"
|
||||
|
||||
val systemRelationKeys = listOf(
|
||||
"id",
|
||||
"name",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.anytypeio.anytype.core_models.exceptions
|
||||
|
||||
sealed class CreateAccountException : Exception() {
|
||||
@Deprecated("To be delete")
|
||||
object BadInviteCode : CreateAccountException()
|
||||
object NetworkError: 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 androidx.recyclerview.widget.RecyclerView
|
||||
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.common.DefaultSectionViewHolder
|
||||
import com.anytypeio.anytype.core_ui.databinding.ItemDefaultListSectionBinding
|
||||
|
@ -15,7 +16,7 @@ import com.anytypeio.anytype.presentation.objects.ObjectTypeItemView
|
|||
|
||||
class ObjectTypeVerticalAdapter(
|
||||
private var data: ArrayList<ObjectTypeItemView>,
|
||||
private val onItemClick: (Id, String) -> Unit
|
||||
private val onItemClick: (Id, Key, String) -> Unit
|
||||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
fun update(data: List<ObjectTypeItemView>) {
|
||||
|
@ -36,7 +37,11 @@ class ObjectTypeVerticalAdapter(
|
|||
itemView.setOnClickListener {
|
||||
if (bindingAdapterPosition != RecyclerView.NO_POSITION) {
|
||||
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 androidx.recyclerview.widget.RecyclerView
|
||||
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.databinding.ItemObjectTypeHorizontalItemBinding
|
||||
import com.anytypeio.anytype.core_ui.features.objects.holders.ObjectTypeHorizontalHolder
|
||||
|
@ -12,7 +13,7 @@ import com.anytypeio.anytype.presentation.objects.ObjectTypeView
|
|||
|
||||
class ObjectTypeHorizontalListAdapter(
|
||||
private var data: ArrayList<ObjectTypeView>,
|
||||
private val onItemClick: (Id, String) -> Unit,
|
||||
private val onItemClick: (Id, Key, String) -> Unit,
|
||||
private val onSearchClick: (() -> Unit)? = null
|
||||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
|
@ -34,7 +35,7 @@ class ObjectTypeHorizontalListAdapter(
|
|||
itemView.setOnClickListener {
|
||||
if (bindingAdapterPosition != RecyclerView.NO_POSITION) {
|
||||
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.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
|
@ -71,10 +72,12 @@ fun Dragger(modifier: Modifier = Modifier) {
|
|||
@Composable
|
||||
fun Divider(
|
||||
paddingStart: Dp = 20.dp,
|
||||
paddingEnd: Dp = 20.dp
|
||||
paddingEnd: Dp = 20.dp,
|
||||
visible: Boolean = true
|
||||
) {
|
||||
Box(
|
||||
Modifier
|
||||
.alpha(if (visible) 1f else 0f)
|
||||
.padding(start = paddingStart, end = paddingEnd)
|
||||
.background(color = colorResource(R.color.shape_primary))
|
||||
.height(0.5.dp)
|
||||
|
|
|
@ -51,6 +51,7 @@ import androidx.compose.runtime.rememberUpdatedState
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
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.ObjectWrapper
|
||||
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.foundation.Divider
|
||||
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.views.BodyCalloutMedium
|
||||
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.Caption2Semibold
|
||||
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.emojifier.Emojifier
|
||||
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.widgets.TypeTemplatesWidgetUI
|
||||
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.TypeClick
|
||||
import kotlin.math.roundToInt
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -164,7 +169,6 @@ fun TypeTemplatesWidget(
|
|||
var currentClickedMoreButtonCoordinates: IntOffset by remember {
|
||||
mutableStateOf(IntOffset(0, 0))
|
||||
}
|
||||
val showPlusButton = remember { mutableStateOf(false) }
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = currentState.showWidget,
|
||||
|
@ -216,9 +220,11 @@ fun TypeTemplatesWidget(
|
|||
.padding(
|
||||
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),
|
||||
style = BodyCalloutRegular,
|
||||
style = BodyRegular,
|
||||
color = colorResource(id = R.color.glyph_active)
|
||||
)
|
||||
} else {
|
||||
|
@ -230,9 +236,10 @@ fun TypeTemplatesWidget(
|
|||
bottom = 12.dp,
|
||||
end = 16.dp
|
||||
)
|
||||
.noRippleClickable { editClick() },
|
||||
.noRippleClickable { editClick() }
|
||||
.alpha(if (currentState.isPossibleToChangeTemplate) 1f else 0f),
|
||||
text = stringResource(id = R.string.edit),
|
||||
style = BodyCalloutRegular,
|
||||
style = BodyRegular,
|
||||
color = colorResource(id = R.color.glyph_active)
|
||||
)
|
||||
}
|
||||
|
@ -241,32 +248,34 @@ fun TypeTemplatesWidget(
|
|||
Box(modifier = Modifier.align(Alignment.Center)) {
|
||||
Text(
|
||||
text = title,
|
||||
style = ModalTitle,
|
||||
style = Title1,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
if (showPlusButton.value) {
|
||||
Box(
|
||||
modifier = Modifier.align(Alignment.CenterEnd)
|
||||
.noRippleThrottledClickable {
|
||||
val templates = (currentState as? TypeTemplatesWidgetUI.Data)?.templates
|
||||
val newTemplate = templates?.firstOrNull { it is TemplateView.New }
|
||||
if (newTemplate != null) {
|
||||
action(TemplateClick(newTemplate))
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterEnd)
|
||||
.noRippleThrottledClickable {
|
||||
val templates =
|
||||
(currentState as? TypeTemplatesWidgetUI.Data)?.templates
|
||||
val newTemplate =
|
||||
templates?.firstOrNull { it is TemplateView.New }
|
||||
if (newTemplate != null) {
|
||||
action(TemplateClick(newTemplate))
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
modifier = Modifier.padding(
|
||||
start = 16.dp,
|
||||
top = 12.dp,
|
||||
bottom = 12.dp,
|
||||
end = 16.dp
|
||||
),
|
||||
painter = painterResource(id = R.drawable.ic_default_plus),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
}
|
||||
.alpha(if (currentState.isPossibleToChangeTemplate) 1f else 0f)
|
||||
) {
|
||||
Image(
|
||||
modifier = Modifier.padding(
|
||||
start = 16.dp,
|
||||
top = 12.dp,
|
||||
bottom = 12.dp,
|
||||
end = 16.dp
|
||||
),
|
||||
painter = painterResource(id = R.drawable.ic_default_plus),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
}
|
||||
val itemsScroll = rememberLazyListState()
|
||||
|
@ -301,7 +310,6 @@ fun TypeTemplatesWidget(
|
|||
},
|
||||
action = action,
|
||||
scrollState = itemsScroll,
|
||||
showPlusButton = { showPlusButton.value = it }
|
||||
)
|
||||
if ((currentState as TypeTemplatesWidgetUI.Data).moreMenuItem != null
|
||||
&& itemsScroll.isScrollInProgress
|
||||
|
@ -432,103 +440,85 @@ private fun TemplatesList(
|
|||
scrollState: LazyListState,
|
||||
state: TypeTemplatesWidgetUI.Data,
|
||||
action: (TypeTemplatesWidgetUIAction) -> Unit,
|
||||
moreClick: (TemplateView, IntOffset) -> Unit,
|
||||
showPlusButton: (Boolean) -> Unit
|
||||
moreClick: (TemplateView, IntOffset) -> Unit
|
||||
) {
|
||||
if (state.templates.isEmpty()) {
|
||||
showPlusButton.invoke(false)
|
||||
Box(
|
||||
modifier = Modifier.fillMaxWidth().wrapContentHeight(),
|
||||
contentAlignment = Alignment.Center) {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.wrapContentSize()
|
||||
.padding(top = 111.dp, bottom = 111.dp),
|
||||
text = stringResource(id = R.string.title_templates_not_allowed),
|
||||
style = BodyCalloutRegular,
|
||||
color = colorResource(id = R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
showPlusButton.invoke(true)
|
||||
LazyRow(
|
||||
state = scrollState,
|
||||
modifier = Modifier
|
||||
.wrapContentHeight()
|
||||
.fillMaxWidth(),
|
||||
contentPadding = PaddingValues(start = 20.dp, end = 20.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(5.dp)
|
||||
)
|
||||
{
|
||||
itemsIndexed(
|
||||
items = state.templates,
|
||||
itemContent = { index, item ->
|
||||
LazyRow(
|
||||
state = scrollState,
|
||||
modifier = Modifier
|
||||
.wrapContentHeight()
|
||||
.fillMaxWidth(),
|
||||
contentPadding = PaddingValues(start = 20.dp, end = 20.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(5.dp)
|
||||
)
|
||||
{
|
||||
itemsIndexed(
|
||||
items = state.templates,
|
||||
itemContent = { index, item ->
|
||||
Box(
|
||||
modifier =
|
||||
Modifier
|
||||
.height(232.dp)
|
||||
.width(127.dp),
|
||||
contentAlignment = Alignment.BottomStart
|
||||
) {
|
||||
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
|
||||
.height(232.dp)
|
||||
.width(127.dp),
|
||||
contentAlignment = Alignment.BottomStart
|
||||
) {
|
||||
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"
|
||||
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"
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -821,7 +811,7 @@ val TemplateTitleStyle = TextStyle(
|
|||
fontWeight = FontWeight.W600,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 14.sp,
|
||||
letterSpacing = (-0.006).em
|
||||
letterSpacing = (-0.00636363).em
|
||||
)
|
||||
|
||||
@Composable
|
||||
|
@ -934,47 +924,48 @@ fun ObjectTypesList(
|
|||
borderWidth = 1.dp
|
||||
borderColor = colorResource(id = R.color.shape_primary)
|
||||
}
|
||||
Box(modifier = Modifier
|
||||
.border(
|
||||
width = borderWidth,
|
||||
color = borderColor,
|
||||
shape = RoundedCornerShape(size = 10.dp)
|
||||
)
|
||||
.wrapContentSize()
|
||||
.noRippleThrottledClickable {
|
||||
action(TypeClick.Item(item.type))
|
||||
}) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(48.dp)
|
||||
.wrapContentWidth()
|
||||
.border(
|
||||
width = borderWidth,
|
||||
color = borderColor,
|
||||
shape = RoundedCornerShape(size = 10.dp)
|
||||
)
|
||||
.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(
|
||||
modifier = Modifier.padding(
|
||||
start = 14.dp,
|
||||
end = 16.dp,
|
||||
top = 13.dp,
|
||||
bottom = 13.dp
|
||||
)
|
||||
start = rowPaddingStart,
|
||||
end = 16.dp
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
item.type.iconEmoji?.let {
|
||||
if (typeIcon != null) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.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)
|
||||
)
|
||||
modifier = Modifier.wrapContentSize()
|
||||
) {
|
||||
Image(
|
||||
painter = rememberAsyncImagePainter(
|
||||
model = Emojifier.safeUri(it),
|
||||
error = painterResource(id = R.drawable.ic_home_widget_space)
|
||||
Emojifier.safeUri(
|
||||
typeIcon
|
||||
)
|
||||
),
|
||||
contentDescription = "Emoji template's icon",
|
||||
contentDescription = "Type's icon",
|
||||
modifier = Modifier
|
||||
.size(20.dp)
|
||||
.size(18.dp)
|
||||
.align(Alignment.Center),
|
||||
contentScale = ContentScale.Crop
|
||||
alignment = Alignment.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -984,7 +975,7 @@ fun ObjectTypesList(
|
|||
color = colorResource(id = R.color.text_primary)
|
||||
),
|
||||
modifier = Modifier
|
||||
.padding(start = 8.dp)
|
||||
.padding(start = textPaddingStart)
|
||||
.widthIn(max = 100.dp),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
|
@ -1031,14 +1022,16 @@ fun ComposablePreview() {
|
|||
val items = listOf(
|
||||
TemplateView.Blank(
|
||||
id = DEFAULT_TEMPLATE_ID_BLANK,
|
||||
typeId = "page",
|
||||
targetTypeId = TypeId("page"),
|
||||
targetTypeKey = TypeKey("ot-page"),
|
||||
typeName = "Page",
|
||||
layout = ObjectType.Layout.BASIC.code
|
||||
),
|
||||
TemplateView.Template(
|
||||
id = "1",
|
||||
name = "Template 1",
|
||||
typeId = "page",
|
||||
targetTypeId = TypeId("page"),
|
||||
targetTypeKey = TypeKey("ot-page"),
|
||||
layout = ObjectType.Layout.BASIC,
|
||||
image = null,
|
||||
emoji = null,
|
||||
|
@ -1051,7 +1044,12 @@ fun ComposablePreview() {
|
|||
templates = items,
|
||||
showWidget = 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(
|
||||
TemplateObjectTypeView.Search,
|
||||
TemplateObjectTypeView.Item(
|
||||
|
@ -1061,7 +1059,8 @@ fun ComposablePreview() {
|
|||
)
|
||||
),
|
||||
viewerId = "",
|
||||
isPossibleToChangeType = true
|
||||
isPossibleToChangeType = true,
|
||||
isPossibleToChangeTemplate = false
|
||||
)
|
||||
TypeTemplatesWidget(
|
||||
state = state,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue