mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2341 Multiplayer | Tech | Propagate spaceId as required parameter for components (#1034)
This commit is contained in:
parent
91503a5eae
commit
120efe64e5
97 changed files with 1738 additions and 533 deletions
|
@ -17,6 +17,7 @@ import com.anytypeio.anytype.di.feature.DaggerBacklinkOrAddToObjectComponent
|
|||
import com.anytypeio.anytype.di.feature.DaggerSplashComponent
|
||||
import com.anytypeio.anytype.di.feature.DataViewRelationValueModule
|
||||
import com.anytypeio.anytype.di.feature.DebugSettingsModule
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.di.feature.EditDataViewViewerModule
|
||||
import com.anytypeio.anytype.di.feature.EditorSessionModule
|
||||
import com.anytypeio.anytype.di.feature.EditorUseCaseModule
|
||||
|
@ -201,7 +202,7 @@ class ComponentManager(
|
|||
DaggerTemplateSelectComponent.factory().create(findComponentDependencies())
|
||||
}
|
||||
|
||||
val editorComponent = ComponentMap {
|
||||
val editorComponent = ComponentMapWithParam { param: DefaultComponentParam ->
|
||||
main
|
||||
.editorComponentBuilder()
|
||||
.session(EditorSessionModule)
|
||||
|
@ -209,74 +210,74 @@ class ComponentManager(
|
|||
.build()
|
||||
}
|
||||
|
||||
val objectIconPickerComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectIconPickerComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectIconPickerComponent()
|
||||
.base(ObjectIconPickerBaseModule)
|
||||
.module(ObjectIconPickerModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val textBlockIconPickerComponent = ComponentWithParams { ctx: Id ->
|
||||
val textBlockIconPickerComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.textBlockIconPickerComponent()
|
||||
.module(TextBlockIconPickerModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectSetIconPickerComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectSetIconPickerComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectSetIconPickerComponent()
|
||||
.base(ObjectIconPickerBaseModule)
|
||||
.module(ObjectSetIconPickerModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectLayoutComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectLayoutComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectLayoutComponent()
|
||||
.module(ObjectLayoutModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectAppearanceSettingComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectAppearanceSettingComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectAppearanceSettingComponent()
|
||||
.module(ObjectAppearanceSettingModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectAppearanceIconComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectAppearanceIconComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectAppearanceIconComponent()
|
||||
.module(ObjectAppearanceIconModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectAppearancePreviewLayoutComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectAppearancePreviewLayoutComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectAppearancePreviewLayoutComponent()
|
||||
.module(ObjectAppearancePreviewLayoutModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectAppearanceChooseDescriptionComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectAppearanceChooseDescriptionComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectAppearanceChooseDescription()
|
||||
.build()
|
||||
}
|
||||
|
||||
val setTextBlockValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val setTextBlockValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.setBlockTextValueComponent()
|
||||
.build()
|
||||
}
|
||||
|
@ -300,8 +301,9 @@ class ComponentManager(
|
|||
.build()
|
||||
}
|
||||
|
||||
val linkToObjectOrWebComponent = ComponentWithParams { id: Id ->
|
||||
editorComponent.get(id)
|
||||
val linkToObjectOrWebComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(key = param.ctx, param = param)
|
||||
.linkToObjectOrWebBuilder()
|
||||
.module(LinkToObjectOrWebModule)
|
||||
.build()
|
||||
|
@ -320,409 +322,409 @@ class ComponentManager(
|
|||
.build()
|
||||
}
|
||||
|
||||
val objectSetComponent = ComponentMap {
|
||||
val objectSetComponent = ComponentMapWithParam { param: DefaultComponentParam ->
|
||||
main.objectSetComponentBuilder()
|
||||
.module(ObjectSetModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectRelationListComponent = ComponentWithParams { id: Id ->
|
||||
val objectRelationListComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(id)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectRelationListComponent()
|
||||
.module(ObjectRelationListModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectSetRelationListComponent = ComponentWithParams { id: Id ->
|
||||
val objectSetRelationListComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(id)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectRelationListComponent()
|
||||
.module(ObjectRelationListModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val setOrCollectionRelationTextValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val setOrCollectionRelationTextValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationTextValueComponent()
|
||||
.module(RelationTextValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val dataViewRelationTextValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val dataViewRelationTextValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationDataViewTextValueComponent()
|
||||
.module(RelationDataViewTextValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationTextValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationTextValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationTextValueComponent()
|
||||
.module(RelationTextValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val dataViewRelationDateValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val dataViewRelationDateValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.dataViewRelationDateValueComponent()
|
||||
.module(RelationDataViewDateValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val setOrCollectionRelationDateValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val setOrCollectionRelationDateValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationDateValueComponent()
|
||||
.module(RelationDateValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectRelationDateValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectRelationDateValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.editRelationDateComponent()
|
||||
.module(RelationDateValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val viewerFilterComponent = ComponentWithParams { ctx: Id ->
|
||||
val viewerFilterComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.viewerFilterBySubComponent()
|
||||
.module(ViewerFilterModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectSetRecordComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectSetRecordComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectSetRecordComponent()
|
||||
.module(ObjectSetRecordModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectSetCreateBookmarkRecordComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectSetCreateBookmarkRecordComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectSetCreateBookmarkRecordComponent()
|
||||
.module(ObjectSetCreateBookmarkRecordModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val createDataViewViewerComponent = ComponentWithParams { ctx: Id ->
|
||||
val createDataViewViewerComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.createDataViewViewerSubComponent()
|
||||
.module(CreateDataViewViewerModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val editDataViewViewerComponent = ComponentWithParams { ctx: Id ->
|
||||
val editDataViewViewerComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.editDataViewViewerComponent()
|
||||
.module(EditDataViewViewerModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val dataViewRelationValueComponent = DependentComponentMap { ctx ->
|
||||
val dataViewRelationValueComponent = DependentComponentMap { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.dataViewObjectRelationValueComponent()
|
||||
.module(DataViewRelationValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val setOrCollectionRelationValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val setOrCollectionRelationValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.setOrCollectionRelationValueComponent()
|
||||
.module(SetOrCollectionRelationValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val addObjectSetObjectRelationValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val addObjectSetObjectRelationValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
dataViewRelationValueComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.addObjectRelationValueComponent()
|
||||
.module(AddObjectRelationValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val addDataViewObjectRelationValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val addDataViewObjectRelationValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
dataViewRelationValueComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.addDataViewRelationOptionValueComponent()
|
||||
.module(AddDataViewRelationOptionValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectObjectRelationValueComponent = DependentComponentMap { ctx ->
|
||||
val objectObjectRelationValueComponent = DependentComponentMap { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.editDocRelationComponent()
|
||||
.module(ObjectObjectRelationValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val addObjectObjectRelationValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val addObjectObjectRelationValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectObjectRelationValueComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.addObjectRelationValueComponent()
|
||||
.module(AddObjectRelationValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val addObjectSetObjectRelationObjectValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val addObjectSetObjectRelationObjectValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
dataViewRelationValueComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.addObjectRelationObjectValueComponent()
|
||||
.module(AddObjectRelationModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val addDataViewRelationObjectValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val addDataViewRelationObjectValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
dataViewRelationValueComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.addDataViewRelationObjectValueComponent()
|
||||
.module(AddDataViewRelationObjectValueModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val addObjectRelationObjectValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val addObjectRelationObjectValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectObjectRelationValueComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.addObjectRelationObjectValueComponent()
|
||||
.module(AddObjectRelationModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationFileValueComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationFileValueComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectObjectRelationValueComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.addRelationFileValueAddComponent()
|
||||
.module(AddFileRelationModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationFileValueDVComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationFileValueDVComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
dataViewRelationValueComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.addRelationFileValueAddComponent()
|
||||
.module(AddFileRelationModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val manageViewerComponent = ComponentWithParams { ctx: Id ->
|
||||
val manageViewerComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.manageViewerComponent()
|
||||
.module(ManageViewerModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectsSetSettingsComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectsSetSettingsComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectSetSettingsComponent()
|
||||
.module(ObjectSetSettingsModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val viewerCardSizeSelectComponent = ComponentWithParams { ctx: Id ->
|
||||
val viewerCardSizeSelectComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.viewerCardSizeSelectComponent()
|
||||
.module(ViewerCardSizeSelectModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val viewerImagePreviewSelectComponent = ComponentWithParams { ctx: Id ->
|
||||
val viewerImagePreviewSelectComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.viewerImagePreviewSelectComponent()
|
||||
.module(ViewerImagePreviewSelectModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val selectSortRelationComponent = ComponentWithParams { ctx: Id ->
|
||||
val selectSortRelationComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.selectSortRelationComponent()
|
||||
.module(SelectSortRelationModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val selectFilterRelationComponent = ComponentWithParams { ctx: Id ->
|
||||
val selectFilterRelationComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.selectFilterRelationComponent()
|
||||
.module(SelectFilterRelationModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val createFilterComponent = DependentComponentMap { ctx ->
|
||||
val createFilterComponent = DependentComponentMap { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.createFilterComponent()
|
||||
.module(CreateFilterModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val pickFilterConditionComponentCreate = ComponentWithParams { ctx: Id ->
|
||||
val pickFilterConditionComponentCreate = ComponentWithParams { param: DefaultComponentParam ->
|
||||
createFilterComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.createPickConditionComponent()
|
||||
.module(PickConditionModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val pickFilterConditionComponentModify = ComponentWithParams { ctx: Id ->
|
||||
val pickFilterConditionComponentModify = ComponentWithParams { param: DefaultComponentParam ->
|
||||
modifyFilterComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.createPickConditionComponent()
|
||||
.module(PickConditionModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val modifyFilterComponent = DependentComponentMap { ctx ->
|
||||
val modifyFilterComponent = DependentComponentMap { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.modifyFilterComponent()
|
||||
.module(ModifyFilterModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val viewerSortComponent = ComponentWithParams { ctx: Id ->
|
||||
val viewerSortComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.viewerSortComponent()
|
||||
.module(ViewerSortModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val modifyViewerSortComponent = ComponentWithParams { ctx: Id ->
|
||||
val modifyViewerSortComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.modifyViewerSortComponent()
|
||||
.module(ModifyViewerSortModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectCoverComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectCoverComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectCoverComponent()
|
||||
.module(SelectCoverObjectModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectUnsplashComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectUnsplashComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectUnsplashComponent()
|
||||
.module(UnsplashModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectSetUnsplashComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectSetUnsplashComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectUnsplashComponent()
|
||||
.module(UnsplashModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectSetCoverComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectSetCoverComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectSetCoverComponent()
|
||||
.module(SelectCoverObjectSetModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectMenuComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectMenuComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectMenuComponent()
|
||||
.base(ObjectMenuModuleBase)
|
||||
.module(ObjectMenuModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectSetMenuComponent = ComponentWithParams { ctx: Id ->
|
||||
val objectSetMenuComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.objectSetMenuComponent()
|
||||
.base(ObjectMenuModuleBase)
|
||||
.module(ObjectSetMenuModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationAddToObjectComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationAddToObjectComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationAddToObjectComponent()
|
||||
.module(RelationAddToObjectModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationAddToObjectSetComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationAddToObjectSetComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationAddToObjectComponent()
|
||||
.module(RelationAddToObjectModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationAddToDataViewComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationAddToDataViewComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationAddToDataViewComponent()
|
||||
.module(RelationAddToDataViewModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationCreateFromScratchForObjectComponent = DependentComponentMap { ctx ->
|
||||
val relationCreateFromScratchForObjectComponent = DependentComponentMap { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationCreateFromScratchForObjectComponent()
|
||||
.module(RelationCreateFromScratchForObjectModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationCreateFromScratchForObjectSetComponent = DependentComponentMap { ctx ->
|
||||
val relationCreateFromScratchForObjectSetComponent = DependentComponentMap { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationCreateFromScratchForObjectComponent()
|
||||
.module(RelationCreateFromScratchForObjectModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationCreateFromScratchForObjectBlockComponent = DependentComponentMap { ctx ->
|
||||
val relationCreateFromScratchForObjectBlockComponent = DependentComponentMap { param: DefaultComponentParam ->
|
||||
editorComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationCreateFromScratchForObjectBlockComponent()
|
||||
.module(RelationCreateFromScratchForObjectBlockModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationCreateFromScratchForDataViewComponent = DependentComponentMap { ctx ->
|
||||
val relationCreateFromScratchForDataViewComponent = DependentComponentMap { param: DefaultComponentParam ->
|
||||
objectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationCreateFromScratchForDataViewComponent()
|
||||
.module(RelationCreateFromScratchForDataViewModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationFormatPickerObjectComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationFormatPickerObjectComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
relationCreateFromScratchForObjectComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationFormatPickerComponent()
|
||||
.build()
|
||||
}
|
||||
|
@ -734,50 +736,54 @@ class ComponentManager(
|
|||
.build()
|
||||
}
|
||||
|
||||
val relationFormatPickerBlockComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationFormatPickerBlockComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
relationCreateFromScratchForObjectBlockComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationFormatPickerComponent()
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationFormatPickerDataViewComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationFormatPickerDataViewComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
relationCreateFromScratchForDataViewComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationFormatPickerComponent()
|
||||
.build()
|
||||
}
|
||||
|
||||
val relationFormatPickerSetOrCollectionComponent = ComponentWithParams { ctx: Id ->
|
||||
val relationFormatPickerSetOrCollectionComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
relationCreateFromScratchForObjectSetComponent
|
||||
.get(ctx)
|
||||
.get(key = param.ctx, param = param)
|
||||
.relationFormatPickerComponent()
|
||||
.build()
|
||||
}
|
||||
|
||||
val limitObjectTypeObjectComponent = ComponentWithParams { ctx: Id ->
|
||||
relationCreateFromScratchForObjectComponent.get(ctx)
|
||||
val limitObjectTypeObjectComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
relationCreateFromScratchForObjectComponent
|
||||
.get(key = param.ctx, param = param)
|
||||
.limitObjectTypeComponent()
|
||||
.module(LimitObjectTypeModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val limitObjectTypeBlockComponent = ComponentWithParams { ctx: Id ->
|
||||
relationCreateFromScratchForObjectBlockComponent.get(ctx)
|
||||
val limitObjectTypeBlockComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
relationCreateFromScratchForObjectBlockComponent
|
||||
.get(key = param.ctx, param = param)
|
||||
.limitObjectTypeComponent()
|
||||
.module(LimitObjectTypeModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val limitObjectTypeDataViewComponent = ComponentWithParams { ctx: Id ->
|
||||
relationCreateFromScratchForDataViewComponent.get(ctx)
|
||||
val limitObjectTypeDataViewComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
relationCreateFromScratchForDataViewComponent
|
||||
.get(key = param.ctx, param = param)
|
||||
.limitObjectTypeComponent()
|
||||
.module(LimitObjectTypeModule)
|
||||
.build()
|
||||
}
|
||||
|
||||
val limitObjectTypeSetOrCollectionComponent = ComponentWithParams { ctx: Id ->
|
||||
relationCreateFromScratchForObjectSetComponent.get(ctx)
|
||||
val limitObjectTypeSetOrCollectionComponent = ComponentWithParams { param: DefaultComponentParam ->
|
||||
relationCreateFromScratchForObjectSetComponent
|
||||
.get(key = param.ctx, param = param)
|
||||
.limitObjectTypeComponent()
|
||||
.module(LimitObjectTypeModule)
|
||||
.build()
|
||||
|
@ -968,84 +974,168 @@ class ComponentManager(
|
|||
}
|
||||
|
||||
val tagStatusObjectComponent = ComponentWithParams { params: TagOrStatusValueViewModel.ViewModelParams ->
|
||||
editorComponent.get(params.ctx)
|
||||
editorComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.tagStatusObjectComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val tagStatusSetComponent = ComponentWithParams { params: TagOrStatusValueViewModel.ViewModelParams ->
|
||||
objectSetComponent.get(params.ctx)
|
||||
objectSetComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.tagStatusSetComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val tagStatusDataViewComponent = ComponentWithParams { params: TagOrStatusValueViewModel.ViewModelParams ->
|
||||
objectSetComponent.get(params.ctx)
|
||||
objectSetComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.tagStatusDataViewComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val optionObjectComponent = ComponentWithParams { params: CreateOrEditOptionViewModel.ViewModelParams ->
|
||||
editorComponent.get(params.ctx)
|
||||
editorComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.optionObjectComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val optionSetComponent = ComponentWithParams { params: CreateOrEditOptionViewModel.ViewModelParams ->
|
||||
objectSetComponent.get(params.ctx)
|
||||
objectSetComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.optionSetComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val optionDataViewComponent = ComponentWithParams { params: CreateOrEditOptionViewModel.ViewModelParams ->
|
||||
objectSetComponent.get(params.ctx)
|
||||
objectSetComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.optionDataViewComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectValueObjectComponent = ComponentWithParams { params: ObjectValueViewModel.ViewModelParams ->
|
||||
editorComponent.get(params.ctx)
|
||||
editorComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.objectValueComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectValueSetComponent = ComponentWithParams { params: ObjectValueViewModel.ViewModelParams ->
|
||||
objectSetComponent.get(params.ctx)
|
||||
objectSetComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.objectValueSetComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val objectValueDataViewComponent = ComponentWithParams { params: ObjectValueViewModel.ViewModelParams ->
|
||||
objectSetComponent.get(params.ctx)
|
||||
objectSetComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.objectValueDataViewComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val attachmentObjectComponent = ComponentWithParams { params: AttachmentValueViewModel.ViewModelParams ->
|
||||
editorComponent.get(params.ctx)
|
||||
editorComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.attachmentValueObjectComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val attachmentSetComponent = ComponentWithParams { params: AttachmentValueViewModel.ViewModelParams ->
|
||||
objectSetComponent.get(params.ctx)
|
||||
objectSetComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.attachmentSetComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
}
|
||||
|
||||
val attachmentDataViewComponent = ComponentWithParams { params: AttachmentValueViewModel.ViewModelParams ->
|
||||
objectSetComponent.get(params.ctx)
|
||||
objectSetComponent
|
||||
.get(
|
||||
key = params.ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = params.ctx,
|
||||
space = params.space
|
||||
)
|
||||
)
|
||||
.attachmentDataViewComponent()
|
||||
.params(params)
|
||||
.build()
|
||||
|
@ -1133,13 +1223,36 @@ class ComponentManager(
|
|||
}
|
||||
}
|
||||
|
||||
class DependentComponentMap<T>(private val builder: (Id) -> T) {
|
||||
class ComponentMapWithParam<out T, in PARAMETER>(private val builder: (PARAMETER) -> T) {
|
||||
|
||||
private val map = mutableMapOf<String, T>()
|
||||
|
||||
fun get(id: Id) = map[id] ?: builder(id).also { map[id] = it }
|
||||
fun get(key: String, param: PARAMETER) = map[key] ?: builder(param).also { map[key] = it }
|
||||
|
||||
fun new(id: Id) = builder(id).also { map[id] = it }
|
||||
fun new(id: String, param: PARAMETER) = builder(param).also { map[id] = it }
|
||||
|
||||
fun release(id: String) {
|
||||
map.remove(id)
|
||||
}
|
||||
|
||||
fun isInitialized() = map.isNotEmpty()
|
||||
|
||||
override fun toString(): String {
|
||||
return if (BuildConfig.DEBUG) {
|
||||
map.toString()
|
||||
} else {
|
||||
super.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DependentComponentMap<out T, in PARAMETER>(private val builder: (PARAMETER) -> T) {
|
||||
|
||||
private val map = mutableMapOf<String, T>()
|
||||
|
||||
fun get(key: String, param: PARAMETER) = map[key] ?: builder(param).also { map[key] = it }
|
||||
|
||||
fun new(key: String, param: PARAMETER) = builder(param).also { map[key] = it }
|
||||
|
||||
fun release(id: Id) {
|
||||
map.remove(id)
|
||||
|
@ -1187,7 +1300,7 @@ class ComponentManager(
|
|||
Timber.d("Unreleased component: $component")
|
||||
}
|
||||
}
|
||||
is DependentComponentMap<*> -> {
|
||||
is DependentComponentMap<*, *> -> {
|
||||
if (component.isInitialized()) {
|
||||
Timber.d("Unreleased component: $component")
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import com.anytypeio.anytype.analytics.base.Analytics
|
|||
import com.anytypeio.anytype.core_models.Block
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.primitives.Space
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.di.scope.PerScreen
|
||||
import com.anytypeio.anytype.di.feature.cover.UnsplashSubComponent
|
||||
import com.anytypeio.anytype.di.feature.relations.RelationAddToDataViewSubComponent
|
||||
|
@ -723,4 +725,10 @@ object ObjectSetModule {
|
|||
analytics = analytics,
|
||||
dispatcher = dispatcher
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
data class DefaultComponentParam(
|
||||
val ctx: Id,
|
||||
val space: Space
|
||||
)
|
||||
|
||||
|
|
|
@ -45,7 +45,8 @@ class Navigator : AppNavigation {
|
|||
override fun openModalTemplateSelect(
|
||||
template: Id,
|
||||
templateTypeId: Id,
|
||||
templateTypeKey: Key
|
||||
templateTypeKey: Key,
|
||||
space: Id,
|
||||
) {
|
||||
navController?.navigate(
|
||||
R.id.nav_editor_modal,
|
||||
|
@ -53,7 +54,8 @@ class Navigator : AppNavigation {
|
|||
EditorModalFragment.ARG_TEMPLATE_ID to template,
|
||||
EditorModalFragment.ARG_TEMPLATE_TYPE_ID to templateTypeId,
|
||||
EditorModalFragment.ARG_TEMPLATE_TYPE_KEY to templateTypeKey,
|
||||
EditorModalFragment.ARG_SCREEN_TYPE to TYPE_TEMPLATE_SELECT
|
||||
EditorModalFragment.ARG_SCREEN_TYPE to TYPE_TEMPLATE_SELECT,
|
||||
EditorModalFragment.ARG_SPACE_ID to space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -61,7 +63,8 @@ class Navigator : AppNavigation {
|
|||
override fun openModalTemplateEdit(
|
||||
template: Id,
|
||||
templateTypeId: Id,
|
||||
templateTypeKey: Key
|
||||
templateTypeKey: Key,
|
||||
space: Id,
|
||||
) {
|
||||
navController?.navigate(
|
||||
R.id.nav_editor_modal,
|
||||
|
@ -69,7 +72,8 @@ class Navigator : AppNavigation {
|
|||
EditorModalFragment.ARG_TEMPLATE_ID to template,
|
||||
EditorModalFragment.ARG_TEMPLATE_TYPE_ID to templateTypeId,
|
||||
EditorModalFragment.ARG_TEMPLATE_TYPE_KEY to templateTypeKey,
|
||||
EditorModalFragment.ARG_SCREEN_TYPE to TYPE_TEMPLATE_EDIT
|
||||
EditorModalFragment.ARG_SCREEN_TYPE to TYPE_TEMPLATE_EDIT,
|
||||
EditorModalFragment.ARG_SPACE_ID to space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -142,16 +146,6 @@ class Navigator : AppNavigation {
|
|||
navController?.navigate(R.id.pageSearchFragment)
|
||||
}
|
||||
|
||||
override fun exitToDesktopAndOpenPage(pageId: String) {
|
||||
navController?.navigate(
|
||||
R.id.homeScreen,
|
||||
bundleOf(EditorFragment.CTX_KEY to pageId),
|
||||
navOptions {
|
||||
launchSingleTop = true
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun openObjectSet(
|
||||
target: Id,
|
||||
space: Id,
|
||||
|
|
|
@ -20,7 +20,8 @@ class NavigationRouter(
|
|||
is AppNavigation.Command.OpenModalTemplateSelect -> navigation.openModalTemplateSelect(
|
||||
template = command.template,
|
||||
templateTypeId = command.templateTypeId,
|
||||
templateTypeKey = command.templateTypeKey
|
||||
templateTypeKey = command.templateTypeKey,
|
||||
space = command.space
|
||||
)
|
||||
is AppNavigation.Command.OpenSetOrCollection -> navigation.openObjectSet(
|
||||
target = command.target,
|
||||
|
@ -39,26 +40,19 @@ class NavigationRouter(
|
|||
is AppNavigation.Command.Exit -> navigation.exit()
|
||||
is AppNavigation.Command.ExitToDesktop -> navigation.exitToDesktop()
|
||||
is AppNavigation.Command.OpenDebugSettingsScreen -> navigation.openDebugSettings()
|
||||
is AppNavigation.Command.ExitToDesktopAndOpenPage -> navigation.exitToDesktopAndOpenPage(
|
||||
command.pageId
|
||||
)
|
||||
|
||||
is AppNavigation.Command.OpenPageSearch -> navigation.openPageSearch()
|
||||
is AppNavigation.Command.OpenUpdateAppScreen -> navigation.openUpdateAppScreen()
|
||||
is AppNavigation.Command.DeletedAccountScreen -> navigation.deletedAccountScreen(
|
||||
command.deadline
|
||||
)
|
||||
|
||||
is AppNavigation.Command.OpenTemplates -> navigation.openTemplatesModal(
|
||||
typeId = command.typeId
|
||||
)
|
||||
|
||||
is AppNavigation.Command.OpenLibrary -> navigation.openLibrary(command.space)
|
||||
is AppNavigation.Command.MigrationErrorScreen -> navigation.migrationErrorScreen()
|
||||
is AppNavigation.Command.OpenRemoteFilesManageScreen -> navigation.openRemoteFilesManageScreen(
|
||||
command.subscription
|
||||
)
|
||||
|
||||
else -> Timber.d("Nav command ignored: $command")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -42,13 +42,19 @@ class CreateObjectFragment : BaseFragment<FragmentCreateObjectBinding>(R.layout.
|
|||
if (layout == ObjectType.Layout.COLLECTION || layout == ObjectType.Layout.SET) {
|
||||
findNavController().navigate(
|
||||
R.id.dataViewNavigation,
|
||||
bundleOf(ObjectSetFragment.CONTEXT_ID_KEY to state.id),
|
||||
ObjectSetFragment.args(
|
||||
ctx = state.id,
|
||||
space = state.space
|
||||
),
|
||||
navOptions
|
||||
)
|
||||
} else {
|
||||
findNavController().navigate(
|
||||
R.id.objectNavigation,
|
||||
bundleOf(EditorFragment.CTX_KEY to state.id),
|
||||
EditorFragment.args(
|
||||
ctx = state.id,
|
||||
space = state.space
|
||||
),
|
||||
navOptions
|
||||
)
|
||||
}
|
||||
|
|
|
@ -107,6 +107,7 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.showActionableSnackBar
|
||||
import com.anytypeio.anytype.databinding.FragmentEditorBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.ext.extractMarks
|
||||
import com.anytypeio.anytype.presentation.editor.Editor
|
||||
import com.anytypeio.anytype.presentation.editor.EditorViewModel
|
||||
|
@ -958,11 +959,17 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
findNavController().safeNavigate(
|
||||
R.id.pageScreen,
|
||||
R.id.action_pageScreen_to_objectCoverScreen,
|
||||
bundleOf(SelectCoverObjectFragment.CTX_KEY to command.ctx)
|
||||
SelectCoverObjectFragment.args(
|
||||
ctx = command.ctx,
|
||||
space = space
|
||||
)
|
||||
)
|
||||
}
|
||||
is Command.OpenObjectLayout -> {
|
||||
val fr = ObjectLayoutFragment.new(command.ctx).apply {
|
||||
val fr = ObjectLayoutFragment.new(
|
||||
ctx = command.ctx,
|
||||
space = space
|
||||
).apply {
|
||||
onDismissListener = { vm.onLayoutDialogDismissed() }
|
||||
}
|
||||
fr.showChildFragment()
|
||||
|
@ -999,8 +1006,9 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
ObjectRelationListFragment
|
||||
.new(
|
||||
ctx = command.ctx,
|
||||
space = space,
|
||||
target = command.target,
|
||||
mode = ObjectRelationListFragment.MODE_ADD
|
||||
mode = ObjectRelationListFragment.MODE_ADD,
|
||||
)
|
||||
.showChildFragment()
|
||||
}
|
||||
|
@ -1011,6 +1019,7 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
R.id.objectRelationListScreen,
|
||||
bundleOf(
|
||||
ObjectRelationListFragment.ARG_CTX to command.ctx,
|
||||
ObjectRelationListFragment.ARG_SPACE to space,
|
||||
ObjectRelationListFragment.ARG_TARGET to command.target,
|
||||
ObjectRelationListFragment.ARG_LOCKED to command.isLocked,
|
||||
ObjectRelationListFragment.ARG_MODE to ObjectRelationListFragment.MODE_LIST,
|
||||
|
@ -1024,7 +1033,8 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
target = command.target,
|
||||
relationKey = command.relationKey,
|
||||
targetObjectTypes = command.targetObjectTypes,
|
||||
isLocked = command.isReadOnlyValue
|
||||
isLocked = command.isReadOnlyValue,
|
||||
space = command.space
|
||||
)
|
||||
fr.showChildFragment()
|
||||
}
|
||||
|
@ -1034,7 +1044,8 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
ctx = command.ctx,
|
||||
relationKey = command.relationKey,
|
||||
objectId = command.target,
|
||||
isLocked = command.isReadOnlyValue
|
||||
isLocked = command.isReadOnlyValue,
|
||||
space = command.space
|
||||
)
|
||||
fr.showChildFragment()
|
||||
}
|
||||
|
@ -1042,6 +1053,7 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
hideKeyboard()
|
||||
val fr = RelationDateValueFragment.new(
|
||||
ctx = command.ctx,
|
||||
space = command.space,
|
||||
objectId = command.target,
|
||||
relationKey = command.relationKey,
|
||||
isLocked = command.isReadOnlyValue
|
||||
|
@ -1111,7 +1123,8 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
hideSoftInput()
|
||||
val fr = RelationAddToObjectBlockFragment.newInstance(
|
||||
ctx = command.ctx,
|
||||
target = command.target
|
||||
target = command.target,
|
||||
space = space
|
||||
)
|
||||
fr.showChildFragment()
|
||||
}
|
||||
|
@ -1122,7 +1135,8 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
blockId = command.target,
|
||||
rangeStart = command.range.first,
|
||||
rangeEnd = command.range.last,
|
||||
isWholeBlockMarkup = command.isWholeBlockMarkup
|
||||
isWholeBlockMarkup = command.isWholeBlockMarkup,
|
||||
space = space
|
||||
)
|
||||
fr.showChildFragment()
|
||||
}
|
||||
|
@ -1141,7 +1155,8 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
is Command.OpenObjectAppearanceSettingScreen -> {
|
||||
val fr = ObjectAppearanceSettingFragment.new(
|
||||
ctx = command.ctx,
|
||||
block = command.block
|
||||
block = command.block,
|
||||
space = space
|
||||
)
|
||||
fr.showChildFragment()
|
||||
}
|
||||
|
@ -1154,7 +1169,8 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
val fr = SetBlockTextValueFragment.new(
|
||||
ctx = command.ctx,
|
||||
block = command.block,
|
||||
table = command.table
|
||||
table = command.table,
|
||||
space = space
|
||||
).apply {
|
||||
onDismissListener = {
|
||||
vm.onSetBlockTextValueScreenDismiss()
|
||||
|
@ -1168,12 +1184,13 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
findNavController().safeNavigate(
|
||||
R.id.pageScreen,
|
||||
R.id.nav_relations,
|
||||
bundleOf(
|
||||
TagOrStatusValueFragment.CTX_KEY to command.ctx,
|
||||
TagOrStatusValueFragment.OBJECT_ID_KEY to command.target,
|
||||
TagOrStatusValueFragment.RELATION_KEY to command.relationKey,
|
||||
TagOrStatusValueFragment.IS_LOCKED_KEY to command.isReadOnlyValue,
|
||||
TagOrStatusValueFragment.RELATION_CONTEXT_KEY to RelationContext.OBJECT
|
||||
TagOrStatusValueFragment.args(
|
||||
ctx = command.ctx,
|
||||
space = command.space,
|
||||
obj = command.target,
|
||||
relation = command.relationKey,
|
||||
isLocked = command.isReadOnlyValue,
|
||||
context = RelationContext.OBJECT
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -1181,12 +1198,13 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
findNavController().safeNavigate(
|
||||
R.id.pageScreen,
|
||||
R.id.objectValueScreen,
|
||||
bundleOf(
|
||||
ObjectValueFragment.CTX_KEY to command.ctx,
|
||||
ObjectValueFragment.OBJECT_ID_KEY to command.target,
|
||||
ObjectValueFragment.RELATION_KEY to command.relationKey,
|
||||
ObjectValueFragment.IS_LOCKED_KEY to command.isReadOnlyValue,
|
||||
ObjectValueFragment.RELATION_CONTEXT_KEY to RelationContext.OBJECT
|
||||
ObjectValueFragment.args(
|
||||
ctx = command.ctx,
|
||||
space = command.space,
|
||||
obj = command.target,
|
||||
relation = command.relationKey,
|
||||
isLocked = command.isReadOnlyValue,
|
||||
relationContext = RelationContext.OBJECT
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -1979,14 +1997,6 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
}
|
||||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().editorComponent.get(extractDocumentId()).inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
componentManager().editorComponent.release(extractDocumentId())
|
||||
}
|
||||
|
||||
private fun getEditorSettings() {
|
||||
}
|
||||
|
||||
|
@ -2176,6 +2186,22 @@ open class EditorFragment : NavigationFragment<FragmentEditorBinding>(R.layout.f
|
|||
inflater, container, false
|
||||
)
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().editorComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
componentManager().editorComponent.release(ctx)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun args(ctx: Id, space: Id) = bundleOf(CTX_KEY to ctx, SPACE_ID_KEY to space)
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.anytypeio.anytype.ui.templates.EditorTemplateFragment
|
|||
|
||||
class EditorModalFragment : BaseBottomSheetFragment<MyFragmentContainerBinding>() {
|
||||
|
||||
private val space get() = arg<Id>(ARG_SPACE_ID)
|
||||
private val template get() = arg<Id>(ARG_TEMPLATE_ID)
|
||||
private val templateTypeId get() = arg<Id>(ARG_TEMPLATE_TYPE_ID)
|
||||
private val templateTypeKey get() = arg<Id>(ARG_TEMPLATE_TYPE_KEY)
|
||||
|
@ -24,6 +25,7 @@ class EditorModalFragment : BaseBottomSheetFragment<MyFragmentContainerBinding>(
|
|||
setStyle(STYLE_NORMAL, R.style.AppBottomSecondarySheetDialogTheme)
|
||||
val editorFragment = EditorTemplateFragment.newInstance(
|
||||
id = template,
|
||||
space = space,
|
||||
targetTypeId = templateTypeId,
|
||||
targetTypeKey = templateTypeKey,
|
||||
type = screenType
|
||||
|
@ -57,6 +59,7 @@ class EditorModalFragment : BaseBottomSheetFragment<MyFragmentContainerBinding>(
|
|||
|
||||
companion object {
|
||||
const val ARG_TEMPLATE_ID = "arg_template_id"
|
||||
const val ARG_SPACE_ID = "arg_space_id"
|
||||
const val ARG_TEMPLATE_TYPE_ID = "arg_template_object_type"
|
||||
const val ARG_TEMPLATE_TYPE_KEY = "arg_template_object_type_key"
|
||||
const val ARG_SCREEN_TYPE = "arg_screen_type"
|
||||
|
|
|
@ -14,6 +14,7 @@ import androidx.recyclerview.widget.GridLayoutManager
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.editor.modal.DocCoverGalleryAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
import com.anytypeio.anytype.core_utils.ext.GetImageContract
|
||||
|
@ -26,6 +27,7 @@ import com.anytypeio.anytype.core_utils.ext.toast
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentDocCoverGalleryBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.other.MediaPermissionHelper
|
||||
import com.anytypeio.anytype.presentation.editor.cover.SelectCoverObjectSetViewModel
|
||||
import com.anytypeio.anytype.presentation.editor.cover.SelectCoverObjectViewModel
|
||||
|
@ -39,6 +41,7 @@ abstract class SelectCoverGalleryFragment :
|
|||
BaseBottomSheetFragment<FragmentDocCoverGalleryBinding>() {
|
||||
|
||||
abstract val ctx: String
|
||||
abstract val space: Id
|
||||
abstract val vm: SelectCoverViewModel
|
||||
|
||||
private val docCoverGalleryAdapter by lazy {
|
||||
|
@ -89,8 +92,9 @@ abstract class SelectCoverGalleryFragment :
|
|||
.onEach {
|
||||
findNavController().navigate(
|
||||
R.id.objectCoverUnsplashScreen,
|
||||
bundleOf(
|
||||
UnsplashBaseFragment.CTX_KEY to ctx
|
||||
UnsplashBaseFragment.args(
|
||||
ctx = ctx,
|
||||
space = space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -177,6 +181,7 @@ abstract class SelectCoverGalleryFragment :
|
|||
class SelectCoverObjectFragment : SelectCoverGalleryFragment() {
|
||||
|
||||
override val ctx get() = arg<String>(CTX_KEY)
|
||||
override val space get() = arg<String>(SPACE_KEY)
|
||||
|
||||
@Inject
|
||||
lateinit var factory: SelectCoverObjectViewModel.Factory
|
||||
|
@ -185,14 +190,23 @@ class SelectCoverObjectFragment : SelectCoverGalleryFragment() {
|
|||
override fun onUnsplashClicked() {
|
||||
findNavController().navigate(
|
||||
R.id.objectCoverUnsplashScreen,
|
||||
bundleOf(
|
||||
UnsplashBaseFragment.CTX_KEY to ctx
|
||||
UnsplashBaseFragment.args(
|
||||
ctx = ctx,
|
||||
space = space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectCoverComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectCoverComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -200,24 +214,38 @@ class SelectCoverObjectFragment : SelectCoverGalleryFragment() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id) = SelectCoverObjectFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx)
|
||||
fun new(ctx: Id, space: Id) = SelectCoverObjectFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, SPACE_KEY to space)
|
||||
}
|
||||
|
||||
const val CTX_KEY = "arg.object-cover-gallery.ctx"
|
||||
fun args(ctx: Id, space: Id) = bundleOf(
|
||||
CTX_KEY to ctx, SPACE_KEY to space
|
||||
)
|
||||
|
||||
protected const val CTX_KEY = "arg.object-cover-gallery.ctx"
|
||||
protected const val SPACE_KEY = "arg.object-cover-gallery.space"
|
||||
}
|
||||
}
|
||||
|
||||
class SelectCoverObjectSetFragment : SelectCoverGalleryFragment() {
|
||||
|
||||
override val ctx get() = arg<String>(CTX_KEY)
|
||||
override val space: Id get() = arg(SPACE_KEY)
|
||||
|
||||
@Inject
|
||||
lateinit var factory: SelectCoverObjectSetViewModel.Factory
|
||||
override val vm by viewModels<SelectCoverObjectSetViewModel> { factory }
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectSetCoverComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectSetCoverComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -227,17 +255,19 @@ class SelectCoverObjectSetFragment : SelectCoverGalleryFragment() {
|
|||
override fun onUnsplashClicked() {
|
||||
findNavController().navigate(
|
||||
R.id.objectCoverUnsplashScreen,
|
||||
bundleOf(
|
||||
UnsplashBaseFragment.CTX_KEY to ctx
|
||||
UnsplashBaseFragment.args(
|
||||
ctx = ctx,
|
||||
space = space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id) = SelectCoverObjectSetFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx)
|
||||
fun new(ctx: Id, space: Id) = SelectCoverObjectSetFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, SPACE_KEY to space)
|
||||
}
|
||||
|
||||
const val CTX_KEY = "arg.object-set-cover-gallery.ctx"
|
||||
const val SPACE_KEY = "arg.object-set-cover-gallery.space"
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.Lifecycle
|
||||
|
@ -15,6 +16,8 @@ import androidx.navigation.fragment.findNavController
|
|||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.cover.UnsplashImageAdapter
|
||||
import com.anytypeio.anytype.core_ui.features.editor.modal.DocCoverGalleryAdapter
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
|
@ -25,6 +28,7 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetTextInputFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentUnsplashBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.editor.cover.UnsplashViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
@ -32,6 +36,7 @@ import javax.inject.Inject
|
|||
abstract class UnsplashBaseFragment : BaseBottomSheetTextInputFragment<FragmentUnsplashBinding>() {
|
||||
|
||||
val ctx get() = arg<String>(CTX_KEY)
|
||||
val space get() = arg<String>(SPACE_KEY)
|
||||
|
||||
override val textInput: EditText get() = binding.searchToolbar.binding.filterInputField
|
||||
|
||||
|
@ -114,13 +119,30 @@ abstract class UnsplashBaseFragment : BaseBottomSheetTextInputFragment<FragmentU
|
|||
)
|
||||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.object.cover.unsplash.ctx"
|
||||
private const val CTX_KEY = "arg.object.cover.unsplash.ctx"
|
||||
private const val SPACE_KEY = "arg.object.cover.unsplash.space"
|
||||
|
||||
fun args(
|
||||
ctx: Id,
|
||||
space: Id
|
||||
) = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class ObjectUnsplashFragment : UnsplashBaseFragment() {
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectUnsplashComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectUnsplashComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -145,7 +167,15 @@ class ObjectSetUnsplashFragment : UnsplashBaseFragment() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectSetUnsplashComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectSetUnsplashComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
|
|
@ -12,6 +12,7 @@ import androidx.recyclerview.widget.DividerItemDecoration
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.objects.ObjectLayoutAdapter
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
import com.anytypeio.anytype.core_utils.ext.drawable
|
||||
|
@ -19,6 +20,7 @@ import com.anytypeio.anytype.core_utils.ext.subscribe
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentObjectLayoutBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.editor.layout.ObjectLayoutViewModel
|
||||
import com.anytypeio.anytype.presentation.objects.ObjectLayoutView
|
||||
import javax.inject.Inject
|
||||
|
@ -26,6 +28,7 @@ import javax.inject.Inject
|
|||
class ObjectLayoutFragment : BaseBottomSheetFragment<FragmentObjectLayoutBinding>() {
|
||||
|
||||
private val ctx: String get() = argString(CONTEXT_ID_KEY)
|
||||
private val space: String get() = argString(SPACE_KEY)
|
||||
|
||||
@Inject
|
||||
lateinit var factory: ObjectLayoutViewModel.Factory
|
||||
|
@ -70,7 +73,15 @@ class ObjectLayoutFragment : BaseBottomSheetFragment<FragmentObjectLayoutBinding
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectLayoutComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectLayoutComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -85,12 +96,14 @@ class ObjectLayoutFragment : BaseBottomSheetFragment<FragmentObjectLayoutBinding
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id): ObjectLayoutFragment = ObjectLayoutFragment().apply {
|
||||
fun new(ctx: Id, space: Id): ObjectLayoutFragment = ObjectLayoutFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CONTEXT_ID_KEY to ctx
|
||||
CONTEXT_ID_KEY to ctx,
|
||||
SPACE_KEY to space
|
||||
)
|
||||
}
|
||||
|
||||
const val CONTEXT_ID_KEY = "arg.object-layout.ctx"
|
||||
const val SPACE_KEY = "arg.object-layout.ctx"
|
||||
}
|
||||
}
|
|
@ -3,7 +3,9 @@ package com.anytypeio.anytype.ui.editor.modals
|
|||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.editor.picker.ObjectIconPickerViewModelFactory
|
||||
import com.anytypeio.anytype.presentation.picker.IconPickerViewModel
|
||||
import javax.inject.Inject
|
||||
|
@ -18,7 +20,15 @@ open class ObjectIconPickerFragment : IconPickerFragmentBase<Id>() {
|
|||
get() = context
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectIconPickerComponent.get(context).inject(this)
|
||||
componentManager()
|
||||
.objectIconPickerComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = target,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
|
|
@ -14,6 +14,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Url
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.editor.BlockAdapter
|
||||
import com.anytypeio.anytype.core_ui.features.editor.DragAndDropAdapterDelegate
|
||||
import com.anytypeio.anytype.core_ui.tools.ClipboardInterceptor
|
||||
|
@ -27,6 +28,7 @@ import com.anytypeio.anytype.core_utils.ext.withParent
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetImeOffsetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentSetBlockTextValueBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.objects.block.SetBlockTextValueViewModel
|
||||
import com.anytypeio.anytype.ui.editor.OnFragmentInteractionListener
|
||||
import java.util.*
|
||||
|
@ -140,7 +142,15 @@ class SetBlockTextValueFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().setTextBlockValueComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.setTextBlockValueComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -174,18 +184,26 @@ class SetBlockTextValueFragment :
|
|||
override fun onDrag(v: View?, event: DragEvent?) = false
|
||||
|
||||
private val ctx: String get() = argString(CTX_KEY)
|
||||
private val space: String get() = argString(SPACE_KEY)
|
||||
private val block: String get() = argString(BLOCK_ID_KEY)
|
||||
private val table: String get() = argString(TABLE_ID_KEY)
|
||||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.editor.block.text.value.ctx"
|
||||
const val SPACE_KEY = "arg.editor.block.text.value.space"
|
||||
const val TABLE_ID_KEY = "arg.editor.block.text.value.table.id"
|
||||
const val BLOCK_ID_KEY = "arg.editor.block.text.value.block.id"
|
||||
const val DEFAULT_IME_ACTION = EditorInfo.IME_ACTION_DONE
|
||||
|
||||
fun new(ctx: Id, table: Id, block: Id) = SetBlockTextValueFragment().apply {
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
table: Id,
|
||||
block: Id
|
||||
) = SetBlockTextValueFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
TABLE_ID_KEY to table,
|
||||
BLOCK_ID_KEY to block
|
||||
)
|
||||
|
|
|
@ -3,8 +3,10 @@ package com.anytypeio.anytype.ui.editor.modals
|
|||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.domain.icon.TextBlockTarget
|
||||
import com.anytypeio.anytype.presentation.picker.IconPickerViewModel
|
||||
import com.anytypeio.anytype.presentation.editor.picker.TextBlockIconPickerViewModelFactory
|
||||
|
@ -24,7 +26,15 @@ class TextBlockIconPickerFragment : IconPickerFragmentBase<TextBlockTarget>() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().textBlockIconPickerComponent.get(context).inject(this)
|
||||
componentManager()
|
||||
.textBlockIconPickerComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = context,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
|
|
@ -165,14 +165,18 @@ abstract class ObjectMenuBaseFragment :
|
|||
navigation().openModalTemplateEdit(
|
||||
template = command.templateId,
|
||||
templateTypeId = command.typeId,
|
||||
templateTypeKey = command.typeKey
|
||||
templateTypeKey = command.typeKey,
|
||||
space = command.space
|
||||
)
|
||||
}
|
||||
|
||||
private fun openObjectCover() {
|
||||
findNavController().navigate(
|
||||
R.id.objectCoverScreen,
|
||||
bundleOf(SelectCoverObjectFragment.CTX_KEY to ctx)
|
||||
SelectCoverObjectFragment.args(
|
||||
ctx = ctx,
|
||||
space = space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -187,7 +191,7 @@ abstract class ObjectMenuBaseFragment :
|
|||
}
|
||||
|
||||
private fun openObjectLayout() {
|
||||
val fr = ObjectLayoutFragment.new(ctx)
|
||||
val fr = ObjectLayoutFragment.new(ctx = ctx, space = space)
|
||||
fr.showChildFragment()
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,11 @@ import androidx.core.os.bundleOf
|
|||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.subscribe
|
||||
import com.anytypeio.anytype.core_utils.ext.withParent
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.objects.menu.ObjectMenuViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -28,7 +30,15 @@ class ObjectMenuFragment : ObjectMenuBaseFragment() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectMenuComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectMenuComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
|
|
@ -17,6 +17,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.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.reactive.textChanges
|
||||
import com.anytypeio.anytype.core_ui.widgets.toolbar.adapter.ObjectLinksAdapter
|
||||
import com.anytypeio.anytype.core_utils.clipboard.parseUrlFromClipboard
|
||||
|
@ -24,6 +25,7 @@ import com.anytypeio.anytype.core_utils.ext.*
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentLinkToObjectOrWebBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.linking.LinkToObjectOrWebViewModel
|
||||
import com.anytypeio.anytype.presentation.linking.LinkToObjectOrWebViewModelFactory
|
||||
import com.anytypeio.anytype.ui.editor.OnFragmentInteractionListener
|
||||
|
@ -45,6 +47,7 @@ class LinkToObjectOrWebPagesFragment :
|
|||
private val filterInputField: EditText get() = binding.searchView.root.findViewById(R.id.filterInputField)
|
||||
|
||||
private val ctx get() = arg<Id>(CTX_KEY)
|
||||
private val space get() = arg<Id>(SPACE_KEY)
|
||||
private val blockId get() = arg<String>(BLOCK_KEY)
|
||||
private val rangeStart get() = arg<Int>(RANGE_START_KEY)
|
||||
private val rangeEnd get() = arg<Int>(RANGE_END_KEY)
|
||||
|
@ -242,7 +245,13 @@ class LinkToObjectOrWebPagesFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().linkToObjectOrWebComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.linkToObjectOrWebComponent
|
||||
.get(params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
))
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -258,6 +267,7 @@ class LinkToObjectOrWebPagesFragment :
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.link-to.ctx"
|
||||
const val SPACE_KEY = "arg.link-to.space"
|
||||
const val BLOCK_KEY = "arg.link-to.block.id"
|
||||
const val RANGE_START_KEY = "arg.link-to.start"
|
||||
const val RANGE_END_KEY = "arg.link-to.end"
|
||||
|
@ -265,6 +275,7 @@ class LinkToObjectOrWebPagesFragment :
|
|||
|
||||
fun newInstance(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
blockId: Id,
|
||||
rangeStart: Int,
|
||||
rangeEnd: Int,
|
||||
|
@ -273,6 +284,7 @@ class LinkToObjectOrWebPagesFragment :
|
|||
LinkToObjectOrWebPagesFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
BLOCK_KEY to blockId,
|
||||
RANGE_START_KEY to rangeStart,
|
||||
RANGE_END_KEY to rangeEnd,
|
||||
|
|
|
@ -11,6 +11,7 @@ import androidx.recyclerview.widget.DividerItemDecoration
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.objects.appearance.ObjectAppearanceSettingAdapter
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
import com.anytypeio.anytype.core_utils.ext.drawable
|
||||
|
@ -19,6 +20,7 @@ import com.anytypeio.anytype.core_utils.ext.toast
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentObjectAppearanceSettingBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.objects.appearance.ObjectAppearanceSettingViewModel
|
||||
import com.anytypeio.anytype.ui.objects.appearance.choose.ObjectAppearanceChooseDescriptionFragment
|
||||
import com.anytypeio.anytype.ui.objects.appearance.choose.ObjectAppearanceChooseIconFragment
|
||||
|
@ -33,6 +35,7 @@ class ObjectAppearanceSettingFragment :
|
|||
private val vm by viewModels<ObjectAppearanceSettingViewModel> { factory }
|
||||
|
||||
private val ctx: String get() = argString(CONTEXT_ID_KEY)
|
||||
private val space: String get() = argString(SPACE_KEY)
|
||||
private val block: String get() = argString(BLOCK_ID_KEY)
|
||||
private val adapterAppearance by lazy {
|
||||
ObjectAppearanceSettingAdapter(
|
||||
|
@ -90,10 +93,18 @@ class ObjectAppearanceSettingFragment :
|
|||
private fun observeCommands(command: ObjectAppearanceSettingViewModel.Command) {
|
||||
val fr = when (command) {
|
||||
ObjectAppearanceSettingViewModel.Command.IconScreen -> {
|
||||
ObjectAppearanceChooseIconFragment.new(block = block, ctx = ctx)
|
||||
ObjectAppearanceChooseIconFragment.new(
|
||||
block = block,
|
||||
ctx = ctx,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ObjectAppearanceSettingViewModel.Command.PreviewLayoutScreen -> {
|
||||
ObjectAppearanceChoosePreviewLayoutFragment.new(block = block, ctx = ctx)
|
||||
ObjectAppearanceChoosePreviewLayoutFragment.new(
|
||||
block = block,
|
||||
ctx = ctx,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ObjectAppearanceSettingViewModel.Command.DescriptionScreen -> {
|
||||
ObjectAppearanceChooseDescriptionFragment.new(block = block, ctx = ctx)
|
||||
|
@ -103,7 +114,15 @@ class ObjectAppearanceSettingFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectAppearanceSettingComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectAppearanceSettingComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -118,14 +137,15 @@ class ObjectAppearanceSettingFragment :
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, block: Id) = ObjectAppearanceSettingFragment().apply {
|
||||
fun new(ctx: Id, space: Id, block: Id) = ObjectAppearanceSettingFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CONTEXT_ID_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
BLOCK_ID_KEY to block
|
||||
)
|
||||
}
|
||||
|
||||
const val CONTEXT_ID_KEY = "arg.object-appearance-setting.ctx"
|
||||
const val SPACE_KEY = "arg.object-appearance-setting.space"
|
||||
const val BLOCK_ID_KEY = "arg.object-appearance-setting.block"
|
||||
}
|
||||
}
|
|
@ -4,7 +4,9 @@ import androidx.core.os.bundleOf
|
|||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.objects.appearance.choose.ObjectAppearanceChooseDescriptionViewModel
|
||||
import com.anytypeio.anytype.presentation.objects.appearance.choose.ObjectAppearanceChooseSettingsView
|
||||
import javax.inject.Inject
|
||||
|
@ -18,7 +20,10 @@ class ObjectAppearanceChooseDescriptionFragment :
|
|||
override val title: Int = R.string.description
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectAppearanceChooseDescriptionComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectAppearanceChooseDescriptionComponent
|
||||
.get(params = DefaultComponentParam(ctx = ctx, space = SpaceId(space)))
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
|
|
@ -25,6 +25,7 @@ abstract class ObjectAppearanceChooseFragmentBase
|
|||
BaseBottomSheetFragment<FragmentObjAppearanceBaseBinding>() {
|
||||
|
||||
protected val ctx: String get() = argString(CONTEXT_ID_KEY)
|
||||
protected val space: String get() = argString(SPACE_KEY)
|
||||
protected val block: String get() = argString(BLOCK_ID_KEY)
|
||||
|
||||
protected abstract val vm: T
|
||||
|
@ -86,6 +87,7 @@ abstract class ObjectAppearanceChooseFragmentBase
|
|||
|
||||
companion object {
|
||||
const val CONTEXT_ID_KEY = "arg.object.ctx"
|
||||
const val SPACE_KEY = "arg.object.space"
|
||||
const val BLOCK_ID_KEY = "arg.object.block"
|
||||
}
|
||||
}
|
|
@ -4,7 +4,9 @@ import androidx.core.os.bundleOf
|
|||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.objects.appearance.choose.ObjectAppearanceChooseIconViewModel
|
||||
import com.anytypeio.anytype.presentation.objects.appearance.choose.ObjectAppearanceChooseSettingsView
|
||||
import javax.inject.Inject
|
||||
|
@ -19,7 +21,15 @@ class ObjectAppearanceChooseIconFragment :
|
|||
override val title: Int = R.string.icon
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectAppearanceIconComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectAppearanceIconComponent
|
||||
.get(
|
||||
DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -27,8 +37,12 @@ class ObjectAppearanceChooseIconFragment :
|
|||
}
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, block: Id) = ObjectAppearanceChooseIconFragment().apply {
|
||||
arguments = bundleOf(CONTEXT_ID_KEY to ctx, BLOCK_ID_KEY to block)
|
||||
fun new(ctx: Id, space: Id, block: Id) = ObjectAppearanceChooseIconFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CONTEXT_ID_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
BLOCK_ID_KEY to block
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,9 @@ import androidx.core.os.bundleOf
|
|||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.objects.appearance.choose.ObjectAppearanceChoosePreviewLayoutViewModel
|
||||
import com.anytypeio.anytype.presentation.objects.appearance.choose.ObjectAppearanceChooseSettingsView
|
||||
import javax.inject.Inject
|
||||
|
@ -18,7 +20,14 @@ class ObjectAppearanceChoosePreviewLayoutFragment :
|
|||
override val title: Int = R.string.preview_layout
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectAppearancePreviewLayoutComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectAppearancePreviewLayoutComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx, space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -26,8 +35,12 @@ class ObjectAppearanceChoosePreviewLayoutFragment :
|
|||
}
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, block: Id) = ObjectAppearanceChoosePreviewLayoutFragment().apply {
|
||||
arguments = bundleOf(CONTEXT_ID_KEY to ctx, BLOCK_ID_KEY to block)
|
||||
fun new(ctx: Id, space: Id, block: Id) = ObjectAppearanceChoosePreviewLayoutFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CONTEXT_ID_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
BLOCK_ID_KEY to block
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -160,8 +160,9 @@ class SelectObjectTypeFragment : BaseBottomSheetComposeFragment() {
|
|||
dismiss()
|
||||
findNavController().navigate(
|
||||
R.id.objectNavigation,
|
||||
bundleOf(
|
||||
EditorFragment.CTX_KEY to nav.target
|
||||
EditorFragment.args(
|
||||
ctx = nav.target,
|
||||
space = nav.space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -4,12 +4,14 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.relations.ObjectTypeAddAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.textChanges
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
|
@ -17,6 +19,7 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentObjectTypeChangeBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.LimitObjectTypeViewModel
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
|
@ -25,6 +28,7 @@ import kotlinx.coroutines.launch
|
|||
class LimitObjectTypeFragment : BaseBottomSheetFragment<FragmentObjectTypeChangeBinding>() {
|
||||
|
||||
private val ctx get() = arg<Id>(CTX_KEY)
|
||||
private val space get() = arg<Id>(SPACE_KEY)
|
||||
private val flow get() = arg<Id>(FLOW_TYPE)
|
||||
|
||||
private val objectTypeAdapter = ObjectTypeAddAdapter {
|
||||
|
@ -77,21 +81,25 @@ class LimitObjectTypeFragment : BaseBottomSheetFragment<FragmentObjectTypeChange
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
when(flow) {
|
||||
FLOW_OBJECT -> {
|
||||
componentManager().limitObjectTypeObjectComponent.get(ctx).inject(this)
|
||||
componentManager().limitObjectTypeObjectComponent.get(param).inject(this)
|
||||
}
|
||||
FLOW_DV -> {
|
||||
componentManager().limitObjectTypeDataViewComponent.get(ctx).inject(this)
|
||||
componentManager().limitObjectTypeDataViewComponent.get(param).inject(this)
|
||||
}
|
||||
FLOW_BLOCK -> {
|
||||
componentManager().limitObjectTypeBlockComponent.get(ctx).inject(this)
|
||||
componentManager().limitObjectTypeBlockComponent.get(param).inject(this)
|
||||
}
|
||||
FLOW_LIBRARY -> {
|
||||
componentManager().limitObjectTypeLibraryComponent.get(ctx).inject(this)
|
||||
}
|
||||
FLOW_SET_OR_COLLECTION -> {
|
||||
componentManager().limitObjectTypeSetOrCollectionComponent.get(ctx).inject(this)
|
||||
componentManager().limitObjectTypeSetOrCollectionComponent.get(param).inject(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,12 +132,23 @@ class LimitObjectTypeFragment : BaseBottomSheetFragment<FragmentObjectTypeChange
|
|||
)
|
||||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.limit-object-type.ctx"
|
||||
const val FLOW_TYPE = "arg.limit-object-type.flow"
|
||||
private const val CTX_KEY = "arg.limit-object-type.ctx"
|
||||
private const val SPACE_KEY = "arg.limit-object-type.space"
|
||||
private const val FLOW_TYPE = "arg.limit-object-type.flow"
|
||||
const val FLOW_OBJECT = "arg.limit-object-type.flow-object"
|
||||
const val FLOW_SET_OR_COLLECTION = "arg.limit-object-type.flow-set-or-collection"
|
||||
const val FLOW_LIBRARY = "arg.limit-object-type.flow-library"
|
||||
const val FLOW_DV = "arg.limit-object-type.flow-dv"
|
||||
const val FLOW_BLOCK = "arg.limit-object-type.flow-block"
|
||||
|
||||
fun args(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
flow: String
|
||||
) = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
FLOW_TYPE to flow
|
||||
)
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ 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_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.relations.DocumentRelationAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.textChanges
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
|
@ -29,6 +30,7 @@ import com.anytypeio.anytype.core_utils.ext.withParent
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationListBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectRelationListViewModelFactory
|
||||
import com.anytypeio.anytype.presentation.relations.RelationListViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.RelationListViewModel.Command
|
||||
|
@ -53,6 +55,7 @@ open class ObjectRelationListFragment : BaseBottomSheetFragment<FragmentRelation
|
|||
private lateinit var clearSearchText: View
|
||||
|
||||
private val ctx: String get() = argString(ARG_CTX)
|
||||
private val space: String get() = argString(ARG_SPACE)
|
||||
private val target: String? get() = argStringOrNull(ARG_TARGET)
|
||||
private val mode: Int get() = argInt(ARG_MODE)
|
||||
private val isLocked: Boolean get() = arg(ARG_LOCKED)
|
||||
|
@ -102,6 +105,7 @@ open class ObjectRelationListFragment : BaseBottomSheetFragment<FragmentRelation
|
|||
if (!isLocked) {
|
||||
RelationAddToObjectFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
isSetOrCollection = isSetFlow
|
||||
).showChildFragment()
|
||||
} else {
|
||||
|
@ -122,13 +126,15 @@ open class ObjectRelationListFragment : BaseBottomSheetFragment<FragmentRelation
|
|||
flow = if (isSetFlow)
|
||||
RelationTextValueFragment.FLOW_DATAVIEW
|
||||
else
|
||||
RelationTextValueFragment.FLOW_DEFAULT
|
||||
RelationTextValueFragment.FLOW_DEFAULT,
|
||||
space = space
|
||||
)
|
||||
fr.showChildFragment()
|
||||
}
|
||||
is Command.EditDateRelationValue -> {
|
||||
val fr = RelationDateValueFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
relationKey = command.relationKey,
|
||||
objectId = command.target,
|
||||
flow = if (isSetFlow) {
|
||||
|
@ -145,12 +151,13 @@ open class ObjectRelationListFragment : BaseBottomSheetFragment<FragmentRelation
|
|||
findNavController().safeNavigate(
|
||||
R.id.objectRelationListScreen,
|
||||
R.id.objectValueScreen,
|
||||
bundleOf(
|
||||
ObjectValueFragment.CTX_KEY to command.ctx,
|
||||
ObjectValueFragment.OBJECT_ID_KEY to command.target,
|
||||
ObjectValueFragment.RELATION_KEY to command.relationKey,
|
||||
ObjectValueFragment.IS_LOCKED_KEY to command.isLocked,
|
||||
ObjectValueFragment.RELATION_CONTEXT_KEY to relationContext
|
||||
ObjectValueFragment.args(
|
||||
ctx = command.ctx,
|
||||
space = space,
|
||||
obj = command.target,
|
||||
relation = command.relationKey,
|
||||
isLocked = command.isLocked,
|
||||
relationContext = relationContext
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -165,12 +172,13 @@ open class ObjectRelationListFragment : BaseBottomSheetFragment<FragmentRelation
|
|||
}
|
||||
is Command.EditTagOrStatusRelationValue -> {
|
||||
val relationContext = if (isSetFlow) RelationContext.OBJECT_SET else RelationContext.OBJECT
|
||||
val bundle = bundleOf(
|
||||
TagOrStatusValueFragment.CTX_KEY to command.ctx,
|
||||
TagOrStatusValueFragment.OBJECT_ID_KEY to command.target,
|
||||
TagOrStatusValueFragment.RELATION_KEY to command.relationKey,
|
||||
TagOrStatusValueFragment.IS_LOCKED_KEY to command.isLocked,
|
||||
TagOrStatusValueFragment.RELATION_CONTEXT_KEY to relationContext
|
||||
val bundle = TagOrStatusValueFragment.args(
|
||||
ctx = command.ctx,
|
||||
space = space,
|
||||
obj = command.target,
|
||||
relation = command.relationKey,
|
||||
isLocked = command.isLocked,
|
||||
context = relationContext
|
||||
)
|
||||
findNavController().safeNavigate(R.id.objectRelationListScreen, R.id.nav_relations, bundle)
|
||||
}
|
||||
|
@ -257,10 +265,14 @@ open class ObjectRelationListFragment : BaseBottomSheetFragment<FragmentRelation
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
if (isSetFlow) {
|
||||
componentManager().objectSetRelationListComponent.get(ctx).inject(this)
|
||||
componentManager().objectSetRelationListComponent.get(param).inject(this)
|
||||
} else {
|
||||
componentManager().objectRelationListComponent.get(ctx).inject(this)
|
||||
componentManager().objectRelationListComponent.get(param).inject(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,7 +298,8 @@ open class ObjectRelationListFragment : BaseBottomSheetFragment<FragmentRelation
|
|||
*/
|
||||
companion object {
|
||||
fun new(
|
||||
ctx: String,
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
target: String?,
|
||||
mode: Int,
|
||||
locked: Boolean = false,
|
||||
|
@ -294,6 +307,7 @@ open class ObjectRelationListFragment : BaseBottomSheetFragment<FragmentRelation
|
|||
) = ObjectRelationListFragment().apply {
|
||||
arguments = bundleOf(
|
||||
ARG_CTX to ctx,
|
||||
ARG_SPACE to space,
|
||||
ARG_TARGET to target,
|
||||
ARG_MODE to mode,
|
||||
ARG_LOCKED to locked,
|
||||
|
@ -302,6 +316,7 @@ open class ObjectRelationListFragment : BaseBottomSheetFragment<FragmentRelation
|
|||
}
|
||||
|
||||
const val ARG_CTX = "arg.document-relation.ctx"
|
||||
const val ARG_SPACE = "arg.document-relation.space"
|
||||
const val ARG_MODE = "arg.document-relation.mode"
|
||||
const val ARG_TARGET = "arg.document-relation.target"
|
||||
const val ARG_LOCKED = "arg.document-relation.locked"
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.anytypeio.anytype.analytics.base.EventsDictionary
|
|||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.RelationFormat
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.relations.RelationAddAdapter
|
||||
import com.anytypeio.anytype.core_ui.features.relations.RelationAddHeaderAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.focusChanges
|
||||
|
@ -33,6 +34,7 @@ import com.anytypeio.anytype.core_utils.ext.withParent
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetTextInputFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationAddBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.RelationAddToDataViewViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.RelationAddToObjectViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.RelationAddViewModelBase
|
||||
|
@ -49,7 +51,8 @@ abstract class RelationAddBaseFragment :
|
|||
|
||||
override val textInput: EditText get() = binding.searchBar.root.findViewById(R.id.filterInputField)
|
||||
|
||||
abstract val ctx: String
|
||||
abstract val ctx: Id
|
||||
abstract val space: Id
|
||||
|
||||
private lateinit var searchRelationInput: EditText
|
||||
lateinit var clearSearchText: View
|
||||
|
@ -137,12 +140,14 @@ abstract class RelationAddBaseFragment :
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.relation-add.ctx"
|
||||
const val SPACE_KEY = "arg.relation-add.space"
|
||||
}
|
||||
}
|
||||
|
||||
class RelationAddToObjectFragment : RelationAddBaseFragment() {
|
||||
|
||||
override val ctx get() = arg<Id>(CTX_KEY)
|
||||
override val space get() = arg<Id>(SPACE_KEY)
|
||||
private val isSetOrCollection get() = arg<Boolean>(IS_SET_OR_COLLECTION_KEY)
|
||||
|
||||
@Inject
|
||||
|
@ -168,10 +173,14 @@ class RelationAddToObjectFragment : RelationAddBaseFragment() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
if (isSetOrCollection) {
|
||||
componentManager().relationAddToObjectSetComponent.get(ctx).inject(this)
|
||||
componentManager().relationAddToObjectSetComponent.get(param).inject(this)
|
||||
} else {
|
||||
componentManager().relationAddToObjectComponent.get(ctx).inject(this)
|
||||
componentManager().relationAddToObjectComponent.get(param).inject(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,6 +198,7 @@ class RelationAddToObjectFragment : RelationAddBaseFragment() {
|
|||
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
isSetOrCollection: Boolean = true
|
||||
) = RelationAddToObjectFragment().apply {
|
||||
arguments = bundleOf(
|
||||
|
@ -203,6 +213,7 @@ class RelationAddToDataViewFragment : RelationAddBaseFragment() {
|
|||
|
||||
private val dv get() = arg<Id>(DV_KEY)
|
||||
override val ctx get() = arg<Id>(CTX_KEY)
|
||||
override val space get() = arg<Id>(SPACE_KEY)
|
||||
private val viewer get() = arg<Id>(VIEWER_KEY)
|
||||
|
||||
@Inject
|
||||
|
@ -231,7 +242,15 @@ class RelationAddToDataViewFragment : RelationAddBaseFragment() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().relationAddToDataViewComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.relationAddToDataViewComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -239,10 +258,11 @@ class RelationAddToDataViewFragment : RelationAddBaseFragment() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, dv: Id, viewer: Id): RelationAddToDataViewFragment =
|
||||
fun new(ctx: Id, space: Id, dv: Id, viewer: Id): RelationAddToDataViewFragment =
|
||||
RelationAddToDataViewFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
DV_KEY to dv,
|
||||
VIEWER_KEY to viewer
|
||||
)
|
||||
|
@ -257,6 +277,7 @@ class RelationAddToObjectBlockFragment : RelationAddBaseFragment(),
|
|||
OnCreateFromScratchRelationListener {
|
||||
|
||||
override val ctx get() = arg<Id>(CTX_KEY)
|
||||
override val space get() = arg<Id>(SPACE_KEY)
|
||||
private val target get() = arg<Id>(TARGET_KEY)
|
||||
|
||||
@Inject
|
||||
|
@ -313,7 +334,15 @@ class RelationAddToObjectBlockFragment : RelationAddBaseFragment(),
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().relationAddToObjectComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.relationAddToObjectComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -325,9 +354,14 @@ class RelationAddToObjectBlockFragment : RelationAddBaseFragment(),
|
|||
|
||||
fun newInstance(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
target: Id
|
||||
): RelationAddToObjectBlockFragment = RelationAddToObjectBlockFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, TARGET_KEY to target)
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
TARGET_KEY to target
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,9 +41,10 @@ class RelationCreateFromLibraryFragment : RelationCreateFromScratchBaseFragment(
|
|||
override fun onLimitObjectTypeClicked() {
|
||||
findNavController().navigate(
|
||||
R.id.limitObjectTypeScreen,
|
||||
bundleOf(
|
||||
LimitObjectTypeFragment.CTX_KEY to ctx,
|
||||
LimitObjectTypeFragment.FLOW_TYPE to LimitObjectTypeFragment.FLOW_LIBRARY
|
||||
LimitObjectTypeFragment.args(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
flow = LimitObjectTypeFragment.FLOW_LIBRARY
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ 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_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.relations.LimitObjectTypeAdapter
|
||||
import com.anytypeio.anytype.core_ui.features.relations.RelationConnectWithAdapter
|
||||
import com.anytypeio.anytype.core_ui.features.relations.RelationFormatAdapter
|
||||
|
@ -27,6 +28,7 @@ import com.anytypeio.anytype.core_utils.ext.withParent
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationCreateFromScratchBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchBaseViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForDataViewViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.RelationCreateFromScratchForObjectBlockViewModel
|
||||
|
@ -40,6 +42,7 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
|
|||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import java.io.Serializable
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.flow.flow
|
||||
|
||||
abstract class RelationCreateFromScratchBaseFragment :
|
||||
BaseBottomSheetFragment<FragmentRelationCreateFromScratchBinding>() {
|
||||
|
@ -47,6 +50,7 @@ abstract class RelationCreateFromScratchBaseFragment :
|
|||
abstract val vm: RelationCreateFromScratchBaseViewModel
|
||||
|
||||
protected val ctx get() = arg<Id>(CTX_KEY)
|
||||
protected val space get() = arg<Id>(SPACE_KEY)
|
||||
private val query get() = arg<Id>(QUERY_KEY)
|
||||
|
||||
private val nameInputAdapter = RelationNameInputAdapter {
|
||||
|
@ -140,6 +144,7 @@ abstract class RelationCreateFromScratchBaseFragment :
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.relation-create-from-scratch.ctx"
|
||||
const val SPACE_KEY = "arg.relation-create-from-scratch.space"
|
||||
const val QUERY_KEY = "arg.relation-create-from-scratch.query"
|
||||
}
|
||||
|
||||
|
@ -158,16 +163,22 @@ class RelationCreateFromScratchForObjectFragment : RelationCreateFromScratchBase
|
|||
}
|
||||
|
||||
override fun onLimitObjectTypeClicked() {
|
||||
val bundle: Bundle
|
||||
if (isSetOrCollection)
|
||||
bundle = LimitObjectTypeFragment.args(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
flow = LimitObjectTypeFragment.FLOW_SET_OR_COLLECTION
|
||||
)
|
||||
else
|
||||
bundle = LimitObjectTypeFragment.args(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
flow = LimitObjectTypeFragment.FLOW_OBJECT
|
||||
)
|
||||
findNavController().navigate(
|
||||
R.id.limitObjectTypeScreen,
|
||||
bundleOf(
|
||||
LimitObjectTypeFragment.CTX_KEY to ctx,
|
||||
if (isSetOrCollection) {
|
||||
LimitObjectTypeFragment.FLOW_TYPE to LimitObjectTypeFragment.FLOW_SET_OR_COLLECTION
|
||||
} else {
|
||||
LimitObjectTypeFragment.FLOW_TYPE to LimitObjectTypeFragment.FLOW_OBJECT
|
||||
}
|
||||
)
|
||||
bundle
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -186,10 +197,26 @@ class RelationCreateFromScratchForObjectFragment : RelationCreateFromScratchBase
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
if (isSetOrCollection) {
|
||||
componentManager().relationCreateFromScratchForObjectSetComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.relationCreateFromScratchForObjectSetComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = params
|
||||
)
|
||||
.inject(this)
|
||||
} else {
|
||||
componentManager().relationCreateFromScratchForObjectComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.relationCreateFromScratchForObjectComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = params
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,9 +264,10 @@ class RelationCreateFromScratchForDataViewFragment : RelationCreateFromScratchBa
|
|||
override fun onLimitObjectTypeClicked() {
|
||||
findNavController().navigate(
|
||||
R.id.limitObjectTypeScreen,
|
||||
bundleOf(
|
||||
LimitObjectTypeFragment.CTX_KEY to ctx,
|
||||
LimitObjectTypeFragment.FLOW_TYPE to LimitObjectTypeFragment.FLOW_DV
|
||||
LimitObjectTypeFragment.args(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
flow = LimitObjectTypeFragment.FLOW_DV
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -255,7 +283,16 @@ class RelationCreateFromScratchForDataViewFragment : RelationCreateFromScratchBa
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().relationCreateFromScratchForDataViewComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.relationCreateFromScratchForDataViewComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -309,9 +346,10 @@ class RelationCreateFromScratchForObjectBlockFragment : RelationCreateFromScratc
|
|||
override fun onLimitObjectTypeClicked() {
|
||||
findNavController().navigate(
|
||||
R.id.limitObjectTypeScreen,
|
||||
bundleOf(
|
||||
LimitObjectTypeFragment.CTX_KEY to ctx,
|
||||
LimitObjectTypeFragment.FLOW_TYPE to LimitObjectTypeFragment.FLOW_BLOCK
|
||||
LimitObjectTypeFragment.args(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
flow = LimitObjectTypeFragment.FLOW_BLOCK
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -327,7 +365,16 @@ class RelationCreateFromScratchForObjectBlockFragment : RelationCreateFromScratc
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().relationCreateFromScratchForObjectBlockComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.relationCreateFromScratchForObjectBlockComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
|
|
@ -9,12 +9,14 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.relations.RelationFormatAdapter
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
import com.anytypeio.anytype.core_utils.ext.drawable
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationCreateFromScratchFormatPickerBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.model.CreateFromScratchState
|
||||
import com.anytypeio.anytype.presentation.relations.model.RelationView
|
||||
import com.anytypeio.anytype.presentation.relations.model.StateHolder
|
||||
|
@ -24,6 +26,7 @@ class RelationCreateFromScratchFormatPickerFragment :
|
|||
BaseBottomSheetFragment<FragmentRelationCreateFromScratchFormatPickerBinding>() {
|
||||
|
||||
private val ctx get() = arg<Id>(CTX_KEY)
|
||||
private val space get() = arg<Id>(SPACE_KEY)
|
||||
private val flow get() = arg<Id>(FLOW_TYPE)
|
||||
|
||||
@Inject
|
||||
|
@ -63,21 +66,25 @@ class RelationCreateFromScratchFormatPickerFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
when (flow) {
|
||||
FLOW_OBJECT -> {
|
||||
componentManager().relationFormatPickerObjectComponent.get(ctx).inject(this)
|
||||
componentManager().relationFormatPickerObjectComponent.get(param).inject(this)
|
||||
}
|
||||
FLOW_BLOCK -> {
|
||||
componentManager().relationFormatPickerBlockComponent.get(ctx).inject(this)
|
||||
componentManager().relationFormatPickerBlockComponent.get(param).inject(this)
|
||||
}
|
||||
FLOW_DV -> {
|
||||
componentManager().relationFormatPickerDataViewComponent.get(ctx).inject(this)
|
||||
componentManager().relationFormatPickerDataViewComponent.get(param).inject(this)
|
||||
}
|
||||
FLOW_LIBRARY -> {
|
||||
componentManager().relationFormatPickerLibraryComponent.get(ctx).inject(this)
|
||||
}
|
||||
FLOW_SET_OR_COLLECTION -> {
|
||||
componentManager().relationFormatPickerSetOrCollectionComponent.get(ctx).inject(this)
|
||||
componentManager().relationFormatPickerSetOrCollectionComponent.get(param).inject(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +119,7 @@ class RelationCreateFromScratchFormatPickerFragment :
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.relation-format-picker.ctx"
|
||||
const val SPACE_KEY = "arg.relation-format-picker.space"
|
||||
const val FLOW_TYPE = "arg.relation-format-picker.flow"
|
||||
val excludedFormats = listOf(
|
||||
Relation.Format.SHORT_TEXT,
|
||||
|
|
|
@ -13,6 +13,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.relations.DatePickerContent
|
||||
import com.anytypeio.anytype.core_ui.views.Title3
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
|
@ -22,6 +23,7 @@ import com.anytypeio.anytype.core_utils.ext.subscribe
|
|||
import com.anytypeio.anytype.core_utils.ext.withParent
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetComposeFragment
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.DateValueCommand
|
||||
import com.anytypeio.anytype.presentation.sets.RelationDateValueViewModel
|
||||
import com.anytypeio.anytype.ui.sets.modals.DatePickerFragment
|
||||
|
@ -34,6 +36,7 @@ open class RelationDateValueFragment : BaseBottomSheetComposeFragment() {
|
|||
val vm: RelationDateValueViewModel by viewModels { factory }
|
||||
|
||||
private val ctx get() = argString(CONTEXT_ID)
|
||||
private val space get() = argString(SPACE_KEY)
|
||||
private val objectId get() = argString(OBJECT_ID)
|
||||
private val relationKey get() = argString(RELATION_KEY)
|
||||
private val flow get() = arg<Int>(FLOW_KEY)
|
||||
|
@ -96,15 +99,19 @@ open class RelationDateValueFragment : BaseBottomSheetComposeFragment() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
when (flow) {
|
||||
FLOW_DV -> {
|
||||
componentManager().dataViewRelationDateValueComponent.get(ctx).inject(this)
|
||||
componentManager().dataViewRelationDateValueComponent.get(param).inject(this)
|
||||
}
|
||||
FLOW_SET_OR_COLLECTION -> {
|
||||
componentManager().setOrCollectionRelationDateValueComponent.get(ctx).inject(this)
|
||||
componentManager().setOrCollectionRelationDateValueComponent.get(param).inject(this)
|
||||
}
|
||||
else -> {
|
||||
componentManager().objectRelationDateValueComponent.get(ctx).inject(this)
|
||||
componentManager().objectRelationDateValueComponent.get(param).inject(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,6 +134,7 @@ open class RelationDateValueFragment : BaseBottomSheetComposeFragment() {
|
|||
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
relationKey: Key,
|
||||
objectId: Id,
|
||||
flow: Int = FLOW_DEFAULT,
|
||||
|
@ -134,6 +142,7 @@ open class RelationDateValueFragment : BaseBottomSheetComposeFragment() {
|
|||
) = RelationDateValueFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CONTEXT_ID to ctx,
|
||||
SPACE_KEY to space,
|
||||
RELATION_KEY to relationKey,
|
||||
OBJECT_ID to objectId,
|
||||
FLOW_KEY to flow,
|
||||
|
@ -142,6 +151,7 @@ open class RelationDateValueFragment : BaseBottomSheetComposeFragment() {
|
|||
}
|
||||
|
||||
const val CONTEXT_ID = "arg.relation.date.context"
|
||||
const val SPACE_KEY = "arg.relation.date.space"
|
||||
const val RELATION_KEY = "arg.relation.date.relation.key"
|
||||
const val OBJECT_ID = "arg.relation.date.object.id"
|
||||
const val LOCKED_KEY = "arg.relation.date.object.locked"
|
||||
|
|
|
@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
import com.anytypeio.anytype.core_ui.tools.DefaultDividerItemDecoration
|
||||
import com.anytypeio.anytype.core_utils.ext.drawable
|
||||
|
@ -22,6 +23,7 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.proceed
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationStatusValueBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.RelationValueView
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueBaseViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueViewModel
|
||||
|
@ -115,6 +117,7 @@ class RelationStatusValueFragment :
|
|||
private fun showAddStatusOrTagScreen() {
|
||||
val fr = AddOptionsRelationFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
objectId = target,
|
||||
relationKey = relationKey
|
||||
)
|
||||
|
@ -131,7 +134,16 @@ class RelationStatusValueFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectObjectRelationValueComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectObjectRelationValueComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -141,6 +153,7 @@ class RelationStatusValueFragment :
|
|||
companion object {
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
target: Id,
|
||||
relationKey: Key,
|
||||
targetObjectTypes: List<Id>,
|
||||
|
|
|
@ -15,6 +15,7 @@ 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_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.relations.RelationActionAdapter
|
||||
import com.anytypeio.anytype.core_ui.features.relations.RelationTextValueAdapter
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
|
@ -28,9 +29,11 @@ import com.anytypeio.anytype.core_utils.intents.proceedWithAction
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetImeOffsetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationTextValueBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.RelationTextValueView
|
||||
import com.anytypeio.anytype.presentation.sets.RelationTextValueViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueAction
|
||||
import com.google.android.material.R.id.spacer
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import javax.inject.Inject
|
||||
import timber.log.Timber
|
||||
|
@ -45,6 +48,7 @@ open class RelationTextValueFragment :
|
|||
private val vm: RelationTextValueViewModel by viewModels { factory }
|
||||
|
||||
private val ctx get() = arg<String>(CONTEXT_ID)
|
||||
private val space get() = arg<String>(SPACE_KEY)
|
||||
private val relationKey get() = arg<Key>(RELATION_KEY)
|
||||
private val objectId get() = arg<String>(OBJECT_ID)
|
||||
private val flow get() = arg<Int>(FLOW_KEY)
|
||||
|
@ -194,20 +198,24 @@ open class RelationTextValueFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
when (flow) {
|
||||
FLOW_DATAVIEW, FLOW_CHANGE_DATE -> {
|
||||
componentManager().dataViewRelationTextValueComponent
|
||||
.get(ctx)
|
||||
.get(param)
|
||||
.inject(this)
|
||||
}
|
||||
FLOW_SET_OR_COLLECTION -> {
|
||||
componentManager().setOrCollectionRelationTextValueComponent
|
||||
.get(ctx)
|
||||
.get(param)
|
||||
.inject(this)
|
||||
}
|
||||
else -> {
|
||||
componentManager().relationTextValueComponent
|
||||
.get(ctx)
|
||||
.get(param)
|
||||
.inject(this)
|
||||
}
|
||||
}
|
||||
|
@ -236,6 +244,7 @@ open class RelationTextValueFragment :
|
|||
companion object {
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
relationKey: Key,
|
||||
objectId: Id,
|
||||
flow: Int = FLOW_DEFAULT,
|
||||
|
@ -243,6 +252,7 @@ open class RelationTextValueFragment :
|
|||
) = RelationTextValueFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CONTEXT_ID to ctx,
|
||||
SPACE_KEY to space,
|
||||
RELATION_KEY to relationKey,
|
||||
OBJECT_ID to objectId,
|
||||
FLOW_KEY to flow,
|
||||
|
@ -251,8 +261,17 @@ open class RelationTextValueFragment :
|
|||
}
|
||||
|
||||
fun new(
|
||||
ctx: Id, name: String = "", value: Long? = null
|
||||
) = new(ctx = ctx, relationKey = "", objectId = "", flow = FLOW_CHANGE_DATE).apply {
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
name: String = "",
|
||||
value: Long? = null
|
||||
) = new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
relationKey = "",
|
||||
objectId = "",
|
||||
flow = FLOW_CHANGE_DATE
|
||||
).apply {
|
||||
arguments?.apply {
|
||||
putString(KEY_NAME, name)
|
||||
value?.let { putLong(KEY_VALUE, it) }
|
||||
|
@ -260,6 +279,7 @@ open class RelationTextValueFragment :
|
|||
}
|
||||
|
||||
const val CONTEXT_ID = "arg.edit-relation-value.context"
|
||||
const val SPACE_KEY = "arg.edit-relation-value.space"
|
||||
const val RELATION_KEY = "arg.edit-relation-value.relation.key"
|
||||
const val OBJECT_ID = "arg.edit-relation-value.object.id"
|
||||
const val FLOW_KEY = "arg.edit-relation-value.flow"
|
||||
|
|
|
@ -41,6 +41,7 @@ abstract class RelationValueBaseFragment<T: ViewBinding> : BaseBottomSheetFragm
|
|||
AddObjectRelationFragment.ObjectValueAddReceiver {
|
||||
|
||||
protected val ctx get() = argString(CTX_KEY)
|
||||
protected val space get() = argString(SPACE_KEY)
|
||||
protected val relationKey get() = argString(RELATION_KEY)
|
||||
protected val target get() = argString(TARGET_KEY)
|
||||
protected val dv get() = argString(DV_KEY)
|
||||
|
@ -317,6 +318,7 @@ abstract class RelationValueBaseFragment<T: ViewBinding> : BaseBottomSheetFragm
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.edit-cell-tag.ctx"
|
||||
const val SPACE_KEY = "arg.edit-cell-tag.space"
|
||||
const val IS_LOCKED_KEY = "arg.edit-cell-tag.locked"
|
||||
const val RELATION_KEY = "arg.edit-cell-tag.relation.key"
|
||||
const val TARGET_KEY = "arg.edit-cell-tag.target"
|
||||
|
|
|
@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
import com.anytypeio.anytype.core_ui.tools.DefaultDividerItemDecoration
|
||||
import com.anytypeio.anytype.core_utils.ext.argOrNull
|
||||
|
@ -22,6 +23,7 @@ import com.anytypeio.anytype.core_utils.ext.drawable
|
|||
import com.anytypeio.anytype.core_utils.ext.subscribe
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationValueBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.RelationValueView
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueBaseViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueDVViewModel
|
||||
|
@ -132,6 +134,7 @@ open class RelationValueDVFragment : RelationValueBaseFragment<FragmentRelationV
|
|||
}
|
||||
val fr = AddObjectRelationFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
relationKey = relationKey,
|
||||
objectId = target,
|
||||
types = types,
|
||||
|
@ -143,6 +146,7 @@ open class RelationValueDVFragment : RelationValueBaseFragment<FragmentRelationV
|
|||
private fun showAddStatusOrTagScreen() {
|
||||
val fr = AddOptionsRelationDVFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
target = target,
|
||||
relationKey = relationKey,
|
||||
isIntrinsic = isIntrinsic
|
||||
|
@ -155,7 +159,8 @@ open class RelationValueDVFragment : RelationValueBaseFragment<FragmentRelationV
|
|||
ctx = ctx,
|
||||
objectId = target,
|
||||
flow = AddFileRelationFragment.FLOW_DATAVIEW,
|
||||
relationKey = relationKey
|
||||
relationKey = relationKey,
|
||||
space = space
|
||||
)
|
||||
fr.show(childFragmentManager, null)
|
||||
}
|
||||
|
@ -180,10 +185,20 @@ open class RelationValueDVFragment : RelationValueBaseFragment<FragmentRelationV
|
|||
)
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
if (isIntrinsic) {
|
||||
componentManager().setOrCollectionRelationValueComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.setOrCollectionRelationValueComponent
|
||||
.get(param)
|
||||
.inject(this)
|
||||
} else {
|
||||
componentManager().dataViewRelationValueComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.dataViewRelationValueComponent
|
||||
.get(key = ctx, param = param)
|
||||
.inject(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,14 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
import com.anytypeio.anytype.core_ui.tools.DefaultDividerItemDecoration
|
||||
import com.anytypeio.anytype.core_utils.ext.drawable
|
||||
import com.anytypeio.anytype.core_utils.ext.subscribe
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationValueBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.RelationValueView
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueBaseViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.RelationValueViewModel
|
||||
|
@ -127,7 +129,8 @@ class RelationValueFragment : RelationValueBaseFragment<FragmentRelationValueBin
|
|||
ctx = ctx,
|
||||
relationKey = relationKey,
|
||||
objectId = target,
|
||||
flow = AddFileRelationFragment.FLOW_DEFAULT
|
||||
flow = AddFileRelationFragment.FLOW_DEFAULT,
|
||||
space = space
|
||||
)
|
||||
fr.show(childFragmentManager, null)
|
||||
}
|
||||
|
@ -135,6 +138,7 @@ class RelationValueFragment : RelationValueBaseFragment<FragmentRelationValueBin
|
|||
private fun showAddStatusOrTagScreen() {
|
||||
val fr = AddOptionsRelationFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
objectId = target,
|
||||
relationKey = relationKey
|
||||
)
|
||||
|
@ -144,6 +148,7 @@ class RelationValueFragment : RelationValueBaseFragment<FragmentRelationValueBin
|
|||
private fun showAddObjectScreen() {
|
||||
val fr = AddObjectRelationFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
relationKey = relationKey,
|
||||
objectId = target,
|
||||
types = types,
|
||||
|
@ -172,7 +177,16 @@ class RelationValueFragment : RelationValueBaseFragment<FragmentRelationValueBin
|
|||
)
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectObjectRelationValueComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectObjectRelationValueComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -182,6 +196,7 @@ class RelationValueFragment : RelationValueBaseFragment<FragmentRelationValueBin
|
|||
companion object {
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
target: Id,
|
||||
relationKey: Key,
|
||||
targetObjectTypes: List<Id>,
|
||||
|
@ -189,6 +204,7 @@ class RelationValueFragment : RelationValueBaseFragment<FragmentRelationValueBin
|
|||
) = RelationValueFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
TARGET_KEY to target,
|
||||
RELATION_KEY to relationKey,
|
||||
TARGET_TYPES_KEY to targetObjectTypes,
|
||||
|
|
|
@ -12,6 +12,7 @@ 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_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.relations.RelationFileValueAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.textChanges
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
|
@ -23,6 +24,7 @@ import com.anytypeio.anytype.core_utils.ext.withParent
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationValueFileAddBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.add.AddFileRelationViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.add.FileValueAddCommand
|
||||
import com.anytypeio.anytype.presentation.relations.add.FileValueAddView
|
||||
|
@ -36,6 +38,7 @@ class AddFileRelationFragment :
|
|||
val vm: AddFileRelationViewModel by viewModels { factory }
|
||||
|
||||
private val ctx get() = argString(CONTEXT_ID)
|
||||
private val space get() = argString(SPACE_ID_KEY)
|
||||
private val objectId get() = argString(OBJECT_ID)
|
||||
private val relationKey get() = argString(RELATION_KEY)
|
||||
private val flow get() = arg<Int>(FLOW_KEY)
|
||||
|
@ -124,10 +127,14 @@ class AddFileRelationFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
space = SpaceId(space),
|
||||
ctx = ctx
|
||||
)
|
||||
if (flow == FLOW_DEFAULT) {
|
||||
componentManager().relationFileValueComponent.get(ctx).inject(this)
|
||||
componentManager().relationFileValueComponent.get(param).inject(this)
|
||||
} else {
|
||||
componentManager().relationFileValueDVComponent.get(ctx).inject(this)
|
||||
componentManager().relationFileValueDVComponent.get(param).inject(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,12 +157,14 @@ class AddFileRelationFragment :
|
|||
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
objectId: Id,
|
||||
relationKey: Key,
|
||||
flow: Int = FLOW_DEFAULT
|
||||
) = AddFileRelationFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CONTEXT_ID to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
OBJECT_ID to objectId,
|
||||
RELATION_KEY to relationKey,
|
||||
FLOW_KEY to flow
|
||||
|
@ -163,6 +172,7 @@ class AddFileRelationFragment :
|
|||
}
|
||||
|
||||
const val CONTEXT_ID = "arg.relation.add.file.context"
|
||||
const val SPACE_ID_KEY = "arg.relation.add.file.space-id"
|
||||
const val RELATION_KEY = "arg.relation.add.file.relation.key"
|
||||
const val OBJECT_ID = "arg.relation.add.file.object.id"
|
||||
const val FLOW_KEY = "arg.relation.add.file.flow"
|
||||
|
|
|
@ -14,12 +14,14 @@ 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_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.relations.RelationObjectValueAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
import com.anytypeio.anytype.core_ui.reactive.textChanges
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
import com.anytypeio.anytype.core_utils.ext.gone
|
||||
import com.anytypeio.anytype.core_utils.ext.hasSpan
|
||||
import com.anytypeio.anytype.core_utils.ext.invisible
|
||||
import com.anytypeio.anytype.core_utils.ext.subscribe
|
||||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
|
@ -27,6 +29,7 @@ import com.anytypeio.anytype.core_utils.ext.withParent
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseDialogFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentRelationObjectValueAddBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.add.AddObjectRelationViewModel
|
||||
import com.anytypeio.anytype.presentation.relations.add.ObjectValueAddCommand
|
||||
import com.anytypeio.anytype.presentation.relations.add.ObjectValueAddView
|
||||
|
@ -42,6 +45,7 @@ class AddObjectRelationFragment : BaseDialogFragment<FragmentRelationObjectValue
|
|||
val vm: AddObjectRelationViewModel by viewModels { factory }
|
||||
|
||||
private val ctx get() = argString(CONTEXT_ID)
|
||||
private val space get() = argString(SPACE_ID_KEY)
|
||||
private val objectId get() = argString(OBJECT_ID)
|
||||
private val relationKey get() = argString(RELATION_KEY)
|
||||
private val types get() = arg<List<String>>(TARGET_TYPES)
|
||||
|
@ -164,16 +168,28 @@ class AddObjectRelationFragment : BaseDialogFragment<FragmentRelationObjectValue
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
when (flow) {
|
||||
FLOW_OBJECT -> {
|
||||
componentManager().addObjectRelationObjectValueComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.addObjectRelationObjectValueComponent
|
||||
.get(param)
|
||||
.inject(this)
|
||||
}
|
||||
FLOW_OBJECT_SET -> {
|
||||
componentManager().addObjectSetObjectRelationObjectValueComponent.get(ctx)
|
||||
componentManager()
|
||||
.addObjectSetObjectRelationObjectValueComponent
|
||||
.get(param)
|
||||
.inject(this)
|
||||
}
|
||||
FLOW_DATAVIEW -> {
|
||||
componentManager().addDataViewRelationObjectValueComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.addDataViewRelationObjectValueComponent
|
||||
.get(param)
|
||||
.inject(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,6 +219,7 @@ class AddObjectRelationFragment : BaseDialogFragment<FragmentRelationObjectValue
|
|||
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
objectId: Id,
|
||||
relationKey: Key,
|
||||
types: List<Id>,
|
||||
|
@ -210,6 +227,7 @@ class AddObjectRelationFragment : BaseDialogFragment<FragmentRelationObjectValue
|
|||
) = AddObjectRelationFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CONTEXT_ID to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
OBJECT_ID to objectId,
|
||||
RELATION_KEY to relationKey,
|
||||
TARGET_TYPES to types,
|
||||
|
@ -218,6 +236,7 @@ class AddObjectRelationFragment : BaseDialogFragment<FragmentRelationObjectValue
|
|||
}
|
||||
|
||||
const val CONTEXT_ID = "arg.relation.add.object.context"
|
||||
const val SPACE_ID_KEY = "arg.relation.add.object.space-id"
|
||||
const val RELATION_KEY = "arg.relation.add.object.relation.key"
|
||||
const val OBJECT_ID = "arg.relation.add.object.object.id"
|
||||
const val TARGET_TYPES = "arg.relation.add.object.target_types"
|
||||
|
|
|
@ -4,8 +4,10 @@ import androidx.core.os.bundleOf
|
|||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.argOrNull
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.RelationValueView
|
||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationDVViewModel
|
||||
import javax.inject.Inject
|
||||
|
@ -44,10 +46,14 @@ open class AddOptionsRelationDVFragment : BaseAddOptionsRelationFragment() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
if (isIntrinsic) {
|
||||
componentManager().addObjectSetObjectRelationValueComponent.get(ctx).inject(this)
|
||||
componentManager().addObjectSetObjectRelationValueComponent.get(param).inject(this)
|
||||
} else {
|
||||
componentManager().addDataViewObjectRelationValueComponent.get(ctx).inject(this)
|
||||
componentManager().addDataViewObjectRelationValueComponent.get(param).inject(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,12 +68,14 @@ open class AddOptionsRelationDVFragment : BaseAddOptionsRelationFragment() {
|
|||
companion object {
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
target: Id,
|
||||
relationKey: Key,
|
||||
isIntrinsic: Boolean
|
||||
) = AddOptionsRelationDVFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
TARGET_KEY to target,
|
||||
RELATION_KEY to relationKey,
|
||||
IS_INTRINSIC_KEY to isIntrinsic
|
||||
|
|
|
@ -4,7 +4,9 @@ import androidx.core.os.bundleOf
|
|||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.RelationValueView
|
||||
import com.anytypeio.anytype.presentation.relations.add.AddOptionsRelationViewModel
|
||||
import javax.inject.Inject
|
||||
|
@ -41,7 +43,15 @@ class AddOptionsRelationFragment : BaseAddOptionsRelationFragment() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().addObjectObjectRelationValueComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.addObjectObjectRelationValueComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -51,11 +61,13 @@ class AddOptionsRelationFragment : BaseAddOptionsRelationFragment() {
|
|||
companion object {
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
objectId: Id,
|
||||
relationKey: Key
|
||||
) = AddOptionsRelationFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
TARGET_KEY to objectId,
|
||||
RELATION_KEY to relationKey
|
||||
)
|
||||
|
|
|
@ -38,6 +38,7 @@ abstract class BaseAddOptionsRelationFragment : BaseBottomSheetFragment<AddOptio
|
|||
}
|
||||
|
||||
val ctx get() = argString(CTX_KEY)
|
||||
val space get() = argString(SPACE_ID_KEY)
|
||||
val relationKey get() = argString(RELATION_KEY)
|
||||
val target get() = argString(TARGET_KEY)
|
||||
val flow get() = arg<Int>(FLOW_KEY)
|
||||
|
@ -195,6 +196,7 @@ abstract class BaseAddOptionsRelationFragment : BaseBottomSheetFragment<AddOptio
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.add-object-relation-value.ctx"
|
||||
const val SPACE_ID_KEY = "arg.add-object-relation-value.space-id"
|
||||
const val RELATION_KEY = "arg.add-object-relation-value.relation.key"
|
||||
const val TARGET_KEY = "arg.add-object-relation-value.target"
|
||||
const val FLOW_KEY = "arg.add-object-relation-value.flow"
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.anytypeio.anytype.ui.relations.value
|
||||
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.core_models.primitives.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
import com.anytypeio.anytype.core_utils.ext.argBoolean
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetComposeFragment
|
||||
|
@ -13,6 +17,7 @@ import javax.inject.Inject
|
|||
class AttachmentValueFragment : BaseBottomSheetComposeFragment() {
|
||||
|
||||
private val ctx get() = argString(CTX_KEY)
|
||||
private val space get() = arg<String>(SPACE_ID_KEY)
|
||||
private val relationKey get() = argString(RELATION_KEY)
|
||||
private val objectId get() = argString(OBJECT_ID_KEY)
|
||||
private val isLocked get() = argBoolean(IS_LOCKED_KEY)
|
||||
|
@ -28,7 +33,8 @@ class AttachmentValueFragment : BaseBottomSheetComposeFragment() {
|
|||
objectId = objectId,
|
||||
relationKey = relationKey,
|
||||
isLocked = isLocked,
|
||||
relationContext = relationContext
|
||||
relationContext = relationContext,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
inject(params)
|
||||
}
|
||||
|
@ -53,9 +59,21 @@ class AttachmentValueFragment : BaseBottomSheetComposeFragment() {
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.relation.attachment.ctx"
|
||||
const val SPACE_ID_KEY = "arg.relation.attachment.space"
|
||||
const val RELATION_KEY = "arg.relation.attachment.relation.key"
|
||||
const val OBJECT_ID_KEY = "arg.relation.attachment.object"
|
||||
const val IS_LOCKED_KEY = "arg.relation.attachment.is-locked"
|
||||
const val RELATION_CONTEXT_KEY = "arg.relation.attachment.relation-context"
|
||||
|
||||
fun args(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
relation: Key,
|
||||
obj: Id,
|
||||
isLocked: Boolean,
|
||||
relationContext: RelationContext
|
||||
) {
|
||||
// TODO provide args
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,9 @@ import androidx.fragment.app.viewModels
|
|||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.relations.CreateOrEditOptionScreen
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
import com.anytypeio.anytype.core_utils.ext.argStringOrNull
|
||||
|
@ -35,6 +37,7 @@ class CreateOrEditOptionFragment : BaseBottomSheetComposeFragment() {
|
|||
private val vm by viewModels<CreateOrEditOptionViewModel> { factory }
|
||||
|
||||
private val ctx get() = argString(CTX_KEY)
|
||||
private val space get() = argString(SPACE_KEY)
|
||||
private val objectId get() = argString(OBJECT_ID_KEY)
|
||||
private val relationKey get() = argString(RELATION_KEY)
|
||||
private val optionId get() = argStringOrNull(OPTION_ID_KEY)
|
||||
|
@ -92,7 +95,8 @@ class CreateOrEditOptionFragment : BaseBottomSheetComposeFragment() {
|
|||
optionId = optionId,
|
||||
color = color,
|
||||
name = text,
|
||||
objectId = objectId
|
||||
objectId = objectId,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
inject(params)
|
||||
}
|
||||
|
@ -121,6 +125,7 @@ class CreateOrEditOptionFragment : BaseBottomSheetComposeFragment() {
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.option.ctx"
|
||||
const val SPACE_KEY = "arg.option.space"
|
||||
const val OBJECT_ID_KEY = "arg.option.object_id"
|
||||
const val RELATION_KEY = "arg.option.relation_key"
|
||||
const val OPTION_ID_KEY = "arg.option.option_id"
|
||||
|
@ -130,6 +135,7 @@ class CreateOrEditOptionFragment : BaseBottomSheetComposeFragment() {
|
|||
|
||||
fun args(
|
||||
ctx: String,
|
||||
space: Id,
|
||||
objectId: String,
|
||||
relationKey: Key,
|
||||
optionId: String?,
|
||||
|
@ -138,6 +144,7 @@ class CreateOrEditOptionFragment : BaseBottomSheetComposeFragment() {
|
|||
relationContext: RelationContext
|
||||
) = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
OBJECT_ID_KEY to objectId,
|
||||
RELATION_KEY to relationKey,
|
||||
OPTION_ID_KEY to optionId,
|
||||
|
|
|
@ -16,6 +16,9 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.relations.RelationObjectValueScreen
|
||||
import com.anytypeio.anytype.core_utils.ext.argBoolean
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
|
@ -38,6 +41,7 @@ class ObjectValueFragment : BaseBottomSheetComposeFragment() {
|
|||
private val vm by viewModels<ObjectValueViewModel> { factory }
|
||||
|
||||
private val ctx get() = argString(CTX_KEY)
|
||||
private val space get() = argString(SPACE_KEY)
|
||||
private val relationKey get() = argString(RELATION_KEY)
|
||||
private val objectId get() = argString(OBJECT_ID_KEY)
|
||||
private val isLocked get() = argBoolean(IS_LOCKED_KEY)
|
||||
|
@ -117,7 +121,8 @@ class ObjectValueFragment : BaseBottomSheetComposeFragment() {
|
|||
objectId = objectId,
|
||||
relationKey = relationKey,
|
||||
isLocked = isLocked,
|
||||
relationContext = relationContext
|
||||
relationContext = relationContext,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
inject(params)
|
||||
}
|
||||
|
@ -146,10 +151,28 @@ class ObjectValueFragment : BaseBottomSheetComposeFragment() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.relation.object.ctx"
|
||||
const val RELATION_KEY = "arg.relation.object.relation.key"
|
||||
const val OBJECT_ID_KEY = "arg.relation.object.object"
|
||||
const val IS_LOCKED_KEY = "arg.relation.object.is-locked"
|
||||
const val RELATION_CONTEXT_KEY = "arg.relation.object.relation-context"
|
||||
|
||||
private const val CTX_KEY = "arg.relation.object.ctx"
|
||||
private const val SPACE_KEY = "arg.relation.object.space"
|
||||
private const val RELATION_KEY = "arg.relation.object.relation.key"
|
||||
private const val OBJECT_ID_KEY = "arg.relation.object.object"
|
||||
private const val IS_LOCKED_KEY = "arg.relation.object.is-locked"
|
||||
private const val RELATION_CONTEXT_KEY = "arg.relation.object.relation-context"
|
||||
|
||||
fun args(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
obj: Id,
|
||||
relation: Key,
|
||||
isLocked: Boolean,
|
||||
relationContext: RelationContext
|
||||
) = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
OBJECT_ID_KEY to obj,
|
||||
RELATION_KEY to relation,
|
||||
IS_LOCKED_KEY to isLocked,
|
||||
RELATION_CONTEXT_KEY to relationContext
|
||||
)
|
||||
}
|
||||
}
|
|
@ -10,11 +10,15 @@ import androidx.compose.ui.platform.ComposeView
|
|||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.relations.TagOrStatusValueScreen
|
||||
import com.anytypeio.anytype.core_utils.ext.argBoolean
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
|
@ -36,6 +40,7 @@ class TagOrStatusValueFragment : BaseBottomSheetComposeFragment() {
|
|||
private val vm by viewModels<TagOrStatusValueViewModel> { factory }
|
||||
|
||||
private val ctx get() = argString(CTX_KEY)
|
||||
private val space get() = argString(SPACE_KEY)
|
||||
private val relationKey get() = argString(RELATION_KEY)
|
||||
private val objectId get() = argString(OBJECT_ID_KEY)
|
||||
private val isLocked get() = argBoolean(IS_LOCKED_KEY)
|
||||
|
@ -84,7 +89,8 @@ class TagOrStatusValueFragment : BaseBottomSheetComposeFragment() {
|
|||
optionId = command.optionId,
|
||||
color = command.color,
|
||||
text = command.text,
|
||||
relationContext = relationContext
|
||||
relationContext = relationContext,
|
||||
space = space
|
||||
)
|
||||
findNavController().navigate(R.id.optionScreen, arg)
|
||||
}
|
||||
|
@ -112,7 +118,8 @@ class TagOrStatusValueFragment : BaseBottomSheetComposeFragment() {
|
|||
objectId = objectId,
|
||||
relationKey = relationKey,
|
||||
isLocked = isLocked,
|
||||
relationContext = relationContext
|
||||
relationContext = relationContext,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
inject(params)
|
||||
}
|
||||
|
@ -145,10 +152,27 @@ class TagOrStatusValueFragment : BaseBottomSheetComposeFragment() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.tag-status.ctx"
|
||||
const val RELATION_KEY = "arg.tag-status.relation.key"
|
||||
const val OBJECT_ID_KEY = "arg.tag-status.object"
|
||||
const val IS_LOCKED_KEY = "arg.tag-status.is-locked"
|
||||
const val RELATION_CONTEXT_KEY = "arg.tag-status.relation-context"
|
||||
private const val CTX_KEY = "arg.tag-status.ctx"
|
||||
private const val SPACE_KEY = "arg.tag-status.space"
|
||||
private const val RELATION_KEY = "arg.tag-status.relation.key"
|
||||
private const val OBJECT_ID_KEY = "arg.tag-status.object"
|
||||
private const val IS_LOCKED_KEY = "arg.tag-status.is-locked"
|
||||
private const val RELATION_CONTEXT_KEY = "arg.tag-status.relation-context"
|
||||
|
||||
fun args(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
obj: Id,
|
||||
relation: Key,
|
||||
isLocked: Boolean,
|
||||
context: RelationContext
|
||||
) = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
RELATION_KEY to relation,
|
||||
OBJECT_ID_KEY to obj,
|
||||
IS_LOCKED_KEY to isLocked,
|
||||
RELATION_CONTEXT_KEY to context
|
||||
)
|
||||
}
|
||||
}
|
|
@ -44,6 +44,7 @@ import com.anytypeio.anytype.R
|
|||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.ObjectWrapper
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.getLabelText
|
||||
import com.anytypeio.anytype.core_ui.extensions.getToastMsg
|
||||
import com.anytypeio.anytype.core_ui.extensions.setEmojiOrNull
|
||||
|
@ -84,6 +85,7 @@ import com.anytypeio.anytype.core_utils.ext.toast
|
|||
import com.anytypeio.anytype.core_utils.ext.visible
|
||||
import com.anytypeio.anytype.databinding.FragmentObjectSetBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.editor.cover.CoverColor
|
||||
import com.anytypeio.anytype.presentation.editor.cover.CoverGradient
|
||||
import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType
|
||||
|
@ -948,7 +950,8 @@ open class ObjectSetFragment :
|
|||
ctx = ctx,
|
||||
objectId = command.recordId,
|
||||
flow = RelationTextValueFragment.FLOW_DATAVIEW,
|
||||
relationKey = command.relationKey
|
||||
relationKey = command.relationKey,
|
||||
space = command.space
|
||||
)
|
||||
fr.showChildFragment(EMPTY_TAG)
|
||||
}
|
||||
|
@ -957,7 +960,8 @@ open class ObjectSetFragment :
|
|||
ctx = ctx,
|
||||
objectId = ctx,
|
||||
flow = RelationTextValueFragment.FLOW_SET_OR_COLLECTION,
|
||||
relationKey = command.relation
|
||||
relationKey = command.relation,
|
||||
space = command.space
|
||||
)
|
||||
fr.showChildFragment(EMPTY_TAG)
|
||||
}
|
||||
|
@ -965,28 +969,31 @@ open class ObjectSetFragment :
|
|||
findNavController().safeNavigate(
|
||||
R.id.objectSetScreen,
|
||||
R.id.objectValueScreen,
|
||||
bundleOf(
|
||||
ObjectValueFragment.CTX_KEY to command.ctx,
|
||||
ObjectValueFragment.OBJECT_ID_KEY to command.ctx,
|
||||
ObjectValueFragment.RELATION_KEY to command.relation,
|
||||
ObjectValueFragment.IS_LOCKED_KEY to false,
|
||||
ObjectValueFragment.RELATION_CONTEXT_KEY to RelationContext.OBJECT_SET
|
||||
ObjectValueFragment.args(
|
||||
ctx = command.ctx,
|
||||
obj = command.ctx,
|
||||
relation = command.relation,
|
||||
space = command.space,
|
||||
isLocked = false,
|
||||
relationContext = RelationContext.OBJECT_SET
|
||||
)
|
||||
)
|
||||
}
|
||||
is ObjectSetCommand.Modal.EditTagOrStatusRelationValue -> {
|
||||
val bundle = bundleOf(
|
||||
TagOrStatusValueFragment.CTX_KEY to command.ctx,
|
||||
TagOrStatusValueFragment.OBJECT_ID_KEY to command.ctx,
|
||||
TagOrStatusValueFragment.RELATION_KEY to command.relation,
|
||||
TagOrStatusValueFragment.IS_LOCKED_KEY to false,
|
||||
TagOrStatusValueFragment.RELATION_CONTEXT_KEY to RelationContext.OBJECT_SET
|
||||
val bundle = TagOrStatusValueFragment.args(
|
||||
ctx = command.ctx,
|
||||
obj = command.ctx,
|
||||
relation = command.relation,
|
||||
space = command.space,
|
||||
isLocked = false,
|
||||
context = RelationContext.OBJECT_SET
|
||||
)
|
||||
findNavController().safeNavigate(R.id.objectSetScreen, R.id.nav_relations, bundle)
|
||||
}
|
||||
is ObjectSetCommand.Modal.EditGridDateCell -> {
|
||||
val fr = RelationDateValueFragment.new(
|
||||
ctx = ctx,
|
||||
space = command.space,
|
||||
objectId = command.objectId,
|
||||
flow = RelationDateValueFragment.FLOW_DV,
|
||||
relationKey = command.relationKey
|
||||
|
@ -997,22 +1004,24 @@ open class ObjectSetFragment :
|
|||
findNavController().safeNavigate(
|
||||
R.id.objectSetScreen,
|
||||
R.id.objectValueScreen,
|
||||
bundleOf(
|
||||
ObjectValueFragment.CTX_KEY to command.ctx,
|
||||
ObjectValueFragment.OBJECT_ID_KEY to command.target,
|
||||
ObjectValueFragment.RELATION_KEY to command.relationKey,
|
||||
ObjectValueFragment.IS_LOCKED_KEY to false,
|
||||
ObjectValueFragment.RELATION_CONTEXT_KEY to RelationContext.DATA_VIEW
|
||||
ObjectValueFragment.args(
|
||||
ctx = command.ctx,
|
||||
space = command.space,
|
||||
obj = command.target,
|
||||
relation = command.relationKey,
|
||||
isLocked = false,
|
||||
relationContext = RelationContext.DATA_VIEW
|
||||
)
|
||||
)
|
||||
}
|
||||
is ObjectSetCommand.Modal.EditTagOrStatusCell -> {
|
||||
val bundle = bundleOf(
|
||||
TagOrStatusValueFragment.CTX_KEY to command.ctx,
|
||||
TagOrStatusValueFragment.OBJECT_ID_KEY to command.target,
|
||||
TagOrStatusValueFragment.RELATION_KEY to command.relationKey,
|
||||
TagOrStatusValueFragment.IS_LOCKED_KEY to false,
|
||||
TagOrStatusValueFragment.RELATION_CONTEXT_KEY to RelationContext.DATA_VIEW
|
||||
val bundle = TagOrStatusValueFragment.args(
|
||||
ctx = command.ctx,
|
||||
space = command.space,
|
||||
obj = command.target,
|
||||
relation = command.relationKey,
|
||||
isLocked = false,
|
||||
context = RelationContext.DATA_VIEW
|
||||
)
|
||||
findNavController().safeNavigate(R.id.objectSetScreen, R.id.nav_relations, bundle)
|
||||
}
|
||||
|
@ -1020,7 +1029,8 @@ open class ObjectSetFragment :
|
|||
val fr = ObjectSetSettingsFragment.new(
|
||||
ctx = command.ctx,
|
||||
dv = command.dv,
|
||||
viewer = command.viewer
|
||||
viewer = command.viewer,
|
||||
space = space
|
||||
)
|
||||
fr.showChildFragment(EMPTY_TAG)
|
||||
}
|
||||
|
@ -1028,9 +1038,10 @@ open class ObjectSetFragment :
|
|||
findNavController().safeNavigate(
|
||||
R.id.objectSetScreen,
|
||||
R.id.setNameForNewRecordScreen,
|
||||
bundleOf(
|
||||
SetObjectCreateRecordFragmentBase.CONTEXT_KEY to command.ctx,
|
||||
SetObjectCreateRecordFragmentBase.TARGET_KEY to command.target
|
||||
SetObjectCreateRecordFragmentBase.args(
|
||||
ctx = command.ctx,
|
||||
target = command.target,
|
||||
space = command.space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -1081,11 +1092,12 @@ open class ObjectSetFragment :
|
|||
val fr = ViewerFilterFragment.new(
|
||||
ctx = command.ctx,
|
||||
viewer = command.viewer,
|
||||
space = space
|
||||
)
|
||||
fr.showChildFragment(EMPTY_TAG)
|
||||
}
|
||||
is ObjectSetCommand.Modal.ModifyViewerSorts -> {
|
||||
val fr = ViewerSortFragment.new(ctx = ctx, viewer = command.viewer)
|
||||
val fr = ViewerSortFragment.new(ctx = ctx, space = space, viewer = command.viewer)
|
||||
fr.showChildFragment(EMPTY_TAG)
|
||||
}
|
||||
is ObjectSetCommand.Modal.OpenCoverActionMenu -> {
|
||||
|
@ -1099,7 +1111,11 @@ open class ObjectSetFragment :
|
|||
findNavController().safeNavigate(
|
||||
R.id.objectSetScreen,
|
||||
R.id.setUrlForNewBookmark,
|
||||
bundleOf(SetObjectCreateRecordFragmentBase.CONTEXT_KEY to command.ctx))
|
||||
SetObjectCreateRecordFragmentBase.args(
|
||||
ctx = command.ctx,
|
||||
space = command.space
|
||||
)
|
||||
)
|
||||
}
|
||||
is ObjectSetCommand.Modal.OpenDataViewSelectQueryScreen -> {
|
||||
val fr = DataViewSelectSourceFragment.newInstance(
|
||||
|
@ -1114,19 +1130,25 @@ open class ObjectSetFragment :
|
|||
is ObjectSetCommand.Modal.CreateViewer -> {
|
||||
val fr = CreateDataViewViewerFragment.new(
|
||||
ctx = command.ctx,
|
||||
target = command.target
|
||||
target = command.target,
|
||||
space = space
|
||||
)
|
||||
fr.showChildFragment(EMPTY_TAG)
|
||||
}
|
||||
is ObjectSetCommand.Modal.EditDataViewViewer -> {
|
||||
val fr = EditDataViewViewerFragment.new(
|
||||
ctx = command.ctx,
|
||||
viewer = command.viewer
|
||||
viewer = command.viewer,
|
||||
space = space
|
||||
)
|
||||
fr.showChildFragment(EMPTY_TAG)
|
||||
}
|
||||
is ObjectSetCommand.Modal.ManageViewer -> {
|
||||
val fr = ManageViewerFragment.new(ctx = command.ctx, dv = command.dataview)
|
||||
val fr = ManageViewerFragment.new(
|
||||
ctx = command.ctx,
|
||||
space = space,
|
||||
dv = command.dataview
|
||||
)
|
||||
fr.showChildFragment(EMPTY_TAG)
|
||||
}
|
||||
|
||||
|
@ -1341,14 +1363,6 @@ open class ObjectSetFragment :
|
|||
vm.onObjectSetQueryPicked(query = id)
|
||||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectSetComponent.get(ctx).inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
componentManager().objectSetComponent.release(ctx)
|
||||
}
|
||||
|
||||
override fun inflateBinding(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?
|
||||
|
@ -1391,6 +1405,23 @@ open class ObjectSetFragment :
|
|||
})
|
||||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectSetComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
componentManager().objectSetComponent.release(ctx)
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
const val CONTEXT_ID_KEY = "arg.object_set.context"
|
||||
const val SPACE_ID_KEY = "arg.object_set.space-id"
|
||||
|
|
|
@ -4,9 +4,11 @@ import android.os.Bundle
|
|||
import android.view.View
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.argBoolean
|
||||
import com.anytypeio.anytype.core_utils.ext.setVisible
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.picker.IconPickerViewModel
|
||||
import com.anytypeio.anytype.presentation.editor.picker.ObjectSetIconPickerViewModelFactory
|
||||
import com.anytypeio.anytype.ui.editor.modals.IconPickerFragmentBase
|
||||
|
@ -30,7 +32,15 @@ class ObjectSetIconPickerFragment : IconPickerFragmentBase<Id>() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectSetIconPickerComponent.get(context).inject(this)
|
||||
componentManager()
|
||||
.objectSetIconPickerComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = context,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
|
|
@ -4,8 +4,10 @@ import androidx.fragment.app.viewModels
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.subscribe
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.objects.menu.ObjectSetMenuViewModel
|
||||
import com.anytypeio.anytype.ui.editor.sheets.ObjectMenuBaseFragment
|
||||
import javax.inject.Inject
|
||||
|
@ -28,7 +30,15 @@ class ObjectSetMenuFragment : ObjectMenuBaseFragment() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectSetMenuComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectSetMenuComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
|
|
@ -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.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.drawable
|
||||
import com.anytypeio.anytype.core_ui.features.dataview.modals.FilterByAdapter
|
||||
import com.anytypeio.anytype.core_ui.layout.DividerVerticalItemDecoration
|
||||
|
@ -22,6 +23,7 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentFilterBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.filter.ViewerFilterCommand
|
||||
import com.anytypeio.anytype.presentation.sets.filter.ViewerFilterViewModel
|
||||
import com.anytypeio.anytype.ui.sets.modals.filter.CreateFilterFlowRootFragment
|
||||
|
@ -32,6 +34,7 @@ import javax.inject.Inject
|
|||
open class ViewerFilterFragment : BaseBottomSheetFragment<FragmentFilterBinding>() {
|
||||
|
||||
private val ctx get() = argString(CONTEXT_ID_KEY)
|
||||
private val space get() = argString(SPACE_ID_KEY)
|
||||
private val viewer get() = argString(VIEWER_ID_KEY)
|
||||
|
||||
private val filterAdapter by lazy {
|
||||
|
@ -121,12 +124,17 @@ open class ViewerFilterFragment : BaseBottomSheetFragment<FragmentFilterBinding>
|
|||
private fun observeCommands(command: ViewerFilterCommand) {
|
||||
when (command) {
|
||||
is ViewerFilterCommand.Modal.ShowRelationList -> {
|
||||
val fr = CreateFilterFlowRootFragment.new(ctx = ctx, viewer = viewer)
|
||||
val fr = CreateFilterFlowRootFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
viewer = viewer
|
||||
)
|
||||
fr.show(parentFragmentManager, null)
|
||||
}
|
||||
is ViewerFilterCommand.Modal.UpdateInputValueFilter -> {
|
||||
val fr = ModifyFilterFromInputFieldValueFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
relation = command.relation,
|
||||
index = command.filterIndex,
|
||||
viewer = viewer
|
||||
|
@ -136,6 +144,7 @@ open class ViewerFilterFragment : BaseBottomSheetFragment<FragmentFilterBinding>
|
|||
is ViewerFilterCommand.Modal.UpdateSelectValueFilter -> {
|
||||
val fr = ModifyFilterFromSelectedValueFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
relation = command.relation,
|
||||
index = command.filterIndex,
|
||||
viewer = viewer
|
||||
|
@ -146,7 +155,15 @@ open class ViewerFilterFragment : BaseBottomSheetFragment<FragmentFilterBinding>
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().viewerFilterComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.viewerFilterComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -162,10 +179,19 @@ open class ViewerFilterFragment : BaseBottomSheetFragment<FragmentFilterBinding>
|
|||
|
||||
companion object {
|
||||
const val CONTEXT_ID_KEY = "arg.viewer.filters.context"
|
||||
const val SPACE_ID_KEY = "arg.viewer.filters.space-id"
|
||||
const val VIEWER_ID_KEY = "arg.viewer.filters.viewer"
|
||||
|
||||
fun new(ctx: Id, viewer: Id) = ViewerFilterFragment().apply {
|
||||
arguments = bundleOf(CONTEXT_ID_KEY to ctx, VIEWER_ID_KEY to viewer)
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
viewer: Id
|
||||
) = ViewerFilterFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CONTEXT_ID_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
VIEWER_ID_KEY to viewer
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,17 +7,21 @@ import android.view.ViewGroup
|
|||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
import com.anytypeio.anytype.core_utils.ext.*
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentCreateDataViewViewerBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.CreateDataViewViewerViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
class CreateDataViewViewerFragment : BaseBottomSheetFragment<FragmentCreateDataViewViewerBinding>() {
|
||||
|
||||
val ctx get() = arg<String>(CTX_KEY)
|
||||
val space get() = arg<String>(SPACE_ID_KEY)
|
||||
val target get() = arg<String>(TARGET_KEY)
|
||||
|
||||
@Inject
|
||||
|
@ -80,7 +84,15 @@ class CreateDataViewViewerFragment : BaseBottomSheetFragment<FragmentCreateDataV
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().createDataViewViewerComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.createDataViewViewerComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -95,13 +107,20 @@ class CreateDataViewViewerFragment : BaseBottomSheetFragment<FragmentCreateDataV
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: String, target: String) = CreateDataViewViewerFragment().apply {
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
target: Id
|
||||
) = CreateDataViewViewerFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx, TARGET_KEY to target
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
TARGET_KEY to target
|
||||
)
|
||||
}
|
||||
|
||||
private const val CTX_KEY = "arg.create-data-view-viewer.context"
|
||||
private const val SPACE_ID_KEY = "arg.create-data-view-viewer.space"
|
||||
private const val TARGET_KEY = "arg.create-data-view-viewer.target"
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import androidx.fragment.app.viewModels
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.menu.DataViewEditViewPopupMenu
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
import com.anytypeio.anytype.core_ui.reactive.textChanges
|
||||
|
@ -22,6 +23,7 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentEditDataViewViewerBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.EditDataViewViewerViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -29,6 +31,7 @@ class
|
|||
EditDataViewViewerFragment : BaseBottomSheetFragment<FragmentEditDataViewViewerBinding>() {
|
||||
|
||||
private val ctx: Id get() = arg(CTX_KEY)
|
||||
private val space: Id get() = arg(SPACE_ID_KEY)
|
||||
private val viewer: Id get() = arg(VIEWER_KEY)
|
||||
|
||||
@Inject
|
||||
|
@ -141,7 +144,15 @@ EditDataViewViewerFragment : BaseBottomSheetFragment<FragmentEditDataViewViewerB
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().editDataViewViewerComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.editDataViewViewerComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -157,14 +168,17 @@ EditDataViewViewerFragment : BaseBottomSheetFragment<FragmentEditDataViewViewerB
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.edit-data-view-viewer.ctx"
|
||||
const val SPACE_ID_KEY = "arg.edit-data-view-viewer.space-id"
|
||||
const val VIEWER_KEY = "arg.edit-data-view-viewer.viewer"
|
||||
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
viewer: Id
|
||||
): EditDataViewViewerFragment = EditDataViewViewerFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
VIEWER_KEY to viewer
|
||||
)
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.sets.ManageViewerDoneAdapter
|
||||
import com.anytypeio.anytype.core_ui.features.sets.ManageViewerEditAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
|
@ -21,6 +22,7 @@ import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
|||
import com.anytypeio.anytype.core_utils.ui.OnStartDragListener
|
||||
import com.anytypeio.anytype.databinding.FragmentManageViewerBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.ManageViewerViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
@ -50,6 +52,7 @@ class ManageViewerFragment : BaseBottomSheetFragment<FragmentManageViewerBinding
|
|||
}
|
||||
|
||||
private val ctx: Id get() = arg(CTX_KEY)
|
||||
private val space: Id get() = arg(SPACE_ID_KEY)
|
||||
private val dv: Id get() = arg(DATA_VIEW_KEY)
|
||||
|
||||
@Inject
|
||||
|
@ -128,6 +131,7 @@ class ManageViewerFragment : BaseBottomSheetFragment<FragmentManageViewerBinding
|
|||
is ManageViewerViewModel.Command.OpenEditScreen -> {
|
||||
val dialog = EditDataViewViewerFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
viewer = command.id
|
||||
)
|
||||
dialog.show(parentFragmentManager, null)
|
||||
|
@ -135,7 +139,8 @@ class ManageViewerFragment : BaseBottomSheetFragment<FragmentManageViewerBinding
|
|||
ManageViewerViewModel.Command.OpenCreateScreen -> {
|
||||
val dialog = CreateDataViewViewerFragment.new(
|
||||
ctx = ctx,
|
||||
target = dv
|
||||
target = dv,
|
||||
space = space
|
||||
)
|
||||
dialog.show(parentFragmentManager, null)
|
||||
}
|
||||
|
@ -143,7 +148,15 @@ class ManageViewerFragment : BaseBottomSheetFragment<FragmentManageViewerBinding
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().manageViewerComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.manageViewerComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -158,11 +171,20 @@ class ManageViewerFragment : BaseBottomSheetFragment<FragmentManageViewerBinding
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, dv: Id): ManageViewerFragment = ManageViewerFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, DATA_VIEW_KEY to dv)
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
dv: Id
|
||||
): ManageViewerFragment = ManageViewerFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
DATA_VIEW_KEY to dv
|
||||
)
|
||||
}
|
||||
|
||||
const val CTX_KEY = "arg.manage-data-view-viewer.ctx"
|
||||
const val SPACE_ID_KEY = "arg.manage-data-view-viewer.space-id"
|
||||
const val DATA_VIEW_KEY = "arg.manage-data-view-viewer.dataview"
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.drawable
|
||||
import com.anytypeio.anytype.core_ui.features.dataview.ViewerModifyOrderAdapter
|
||||
import com.anytypeio.anytype.core_ui.features.dataview.ViewerRelationsAdapter
|
||||
|
@ -27,6 +28,7 @@ import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
|||
import com.anytypeio.anytype.core_utils.ui.OnStartDragListener
|
||||
import com.anytypeio.anytype.databinding.FragmentViewerRelationsListBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.relations.ObjectSetSettingsViewModel
|
||||
import com.anytypeio.anytype.ui.relations.RelationAddToDataViewFragment
|
||||
import javax.inject.Inject
|
||||
|
@ -39,6 +41,7 @@ class ObjectSetSettingsFragment : BaseBottomSheetFragment<FragmentViewerRelation
|
|||
private val vm: ObjectSetSettingsViewModel by viewModels { factory }
|
||||
|
||||
private val ctx get() = arg<String>(CTX_KEY)
|
||||
private val space get() = arg<String>(SPACE_KEY)
|
||||
private val viewer get() = arg<String>(VIEWER_KEY)
|
||||
private val dv get() = arg<String>(DV_KEY)
|
||||
|
||||
|
@ -106,7 +109,8 @@ class ObjectSetSettingsFragment : BaseBottomSheetFragment<FragmentViewerRelation
|
|||
RelationAddToDataViewFragment.new(
|
||||
ctx = ctx,
|
||||
dv = dv,
|
||||
viewer = viewer
|
||||
viewer = viewer,
|
||||
space = space
|
||||
).showChildFragment()
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +173,15 @@ class ObjectSetSettingsFragment : BaseBottomSheetFragment<FragmentViewerRelation
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectsSetSettingsComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.objectsSetSettingsComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -184,11 +196,22 @@ class ObjectSetSettingsFragment : BaseBottomSheetFragment<FragmentViewerRelation
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, dv: Id, viewer: Id) = ObjectSetSettingsFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, DV_KEY to dv, VIEWER_KEY to viewer)
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
dv: Id,
|
||||
viewer: Id
|
||||
) = ObjectSetSettingsFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space,
|
||||
DV_KEY to dv,
|
||||
VIEWER_KEY to viewer
|
||||
)
|
||||
}
|
||||
|
||||
private const val CTX_KEY = "arg.viewer-relation-list.ctx"
|
||||
private const val SPACE_KEY = "arg.viewer-relation-list.space"
|
||||
private const val DV_KEY = "arg.viewer-relation-list.dv"
|
||||
private const val VIEWER_KEY = "arg.viewer-relation-list.viewer"
|
||||
}
|
||||
|
|
|
@ -7,16 +7,19 @@ import androidx.fragment.app.viewModels
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.drawable
|
||||
import com.anytypeio.anytype.core_ui.features.sets.PickFilterConditionAdapter
|
||||
import com.anytypeio.anytype.core_ui.layout.DividerVerticalItemDecoration
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
import com.anytypeio.anytype.core_utils.ext.argInt
|
||||
import com.anytypeio.anytype.core_utils.ext.hasSpan
|
||||
import com.anytypeio.anytype.core_utils.ext.subscribe
|
||||
import com.anytypeio.anytype.core_utils.ext.withParent
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentSelectFilterConditionBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.filter.PickFilterConditionViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.model.Viewer
|
||||
import com.anytypeio.anytype.ui.sets.modals.filter.UpdateConditionActionReceiver
|
||||
|
@ -28,6 +31,7 @@ class PickFilterConditionFragment :
|
|||
BaseBottomSheetFragment<FragmentSelectFilterConditionBinding>() {
|
||||
|
||||
private val ctx: String get() = arg(CTX_KEY)
|
||||
private val space: String get() = arg(SPACE_ID_KEY)
|
||||
private val mode: Int get() = argInt(ARG_MODE)
|
||||
private val type: Viewer.Filter.Type get() = requireArguments().getParcelable(TYPE_KEY)!!
|
||||
private val index: Int get() = argInt(INDEX_KEY)
|
||||
|
@ -65,10 +69,14 @@ class PickFilterConditionFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
val param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
when (mode) {
|
||||
MODE_CREATE -> componentManager().pickFilterConditionComponentCreate.get(ctx)
|
||||
MODE_CREATE -> componentManager().pickFilterConditionComponentCreate.get(param)
|
||||
.inject(this)
|
||||
MODE_MODIFY -> componentManager().pickFilterConditionComponentModify.get(ctx)
|
||||
MODE_MODIFY -> componentManager().pickFilterConditionComponentModify.get(param)
|
||||
.inject(this)
|
||||
else -> throw RuntimeException("Wrong mode")
|
||||
}
|
||||
|
@ -95,18 +103,21 @@ class PickFilterConditionFragment :
|
|||
const val MODE_MODIFY = 2
|
||||
|
||||
private const val CTX_KEY = "arg.create-filter-relation.ctx"
|
||||
private const val SPACE_ID_KEY = "arg.create-filter-relation.space-id"
|
||||
private const val ARG_MODE = "arg.create-filter-relation.mode"
|
||||
private const val TYPE_KEY = "arg.create-filter-relation.type"
|
||||
private const val INDEX_KEY = "arg.create-filter-relation.index"
|
||||
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
mode: Int,
|
||||
type: Viewer.Filter.Type,
|
||||
index: Int
|
||||
) = PickFilterConditionFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
ARG_MODE to mode,
|
||||
TYPE_KEY to type,
|
||||
INDEX_KEY to index
|
||||
|
|
|
@ -9,9 +9,11 @@ import android.view.inputmethod.InputMethodManager
|
|||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.imm
|
||||
import com.anytypeio.anytype.databinding.FragmentSetObjectCreateBookmarkRecordBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetCreateBookmarkRecordViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -28,15 +30,6 @@ class SetObjectCreateBookmarkRecordFragment :
|
|||
lateinit var factory: ObjectSetCreateBookmarkRecordViewModel.Factory
|
||||
override val vm: ObjectSetCreateBookmarkRecordViewModel by viewModels { factory }
|
||||
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectSetCreateBookmarkRecordComponent.get(ctx).inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
componentManager().objectSetCreateBookmarkRecordComponent.release()
|
||||
}
|
||||
|
||||
override fun onButtonClicked() {
|
||||
vm.onButtonClicked(input = textInputField.text.toString())
|
||||
}
|
||||
|
@ -65,4 +58,20 @@ class SetObjectCreateBookmarkRecordFragment :
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager()
|
||||
.objectSetCreateBookmarkRecordComponent
|
||||
.get(
|
||||
DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
componentManager().objectSetCreateBookmarkRecordComponent.release()
|
||||
}
|
||||
}
|
|
@ -5,10 +5,12 @@ import android.view.View
|
|||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.EditText
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_ui.reactive.editorActionEvents
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
import com.anytypeio.anytype.core_utils.ext.hideKeyboard
|
||||
|
@ -30,7 +32,8 @@ abstract class SetObjectCreateRecordFragmentBase<T: ViewBinding> :
|
|||
abstract fun onButtonClicked()
|
||||
abstract fun onKeyboardActionDone()
|
||||
|
||||
protected val ctx: String get() = argString(CONTEXT_KEY)
|
||||
protected val ctx: String get() = argString(CTX_KEY)
|
||||
protected val space: String get() = argString(SPACE_KEY)
|
||||
|
||||
private val handler: (Int) -> Boolean = { action ->
|
||||
action == EditorInfo.IME_ACTION_DONE
|
||||
|
@ -73,7 +76,26 @@ abstract class SetObjectCreateRecordFragmentBase<T: ViewBinding> :
|
|||
}
|
||||
|
||||
companion object {
|
||||
const val CONTEXT_KEY = "arg.object-set-record.context"
|
||||
private const val CTX_KEY = "arg.object-set-record.context"
|
||||
private const val SPACE_KEY = "arg.object-set-record.space"
|
||||
const val TARGET_KEY = "arg.object-set-record.target"
|
||||
|
||||
fun args(
|
||||
ctx: Id,
|
||||
target: Id,
|
||||
space: Id,
|
||||
) = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
TARGET_KEY to target,
|
||||
SPACE_KEY to space
|
||||
)
|
||||
|
||||
fun args(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
) = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_KEY to space
|
||||
)
|
||||
}
|
||||
}
|
|
@ -11,9 +11,12 @@ import androidx.core.os.bundleOf
|
|||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.argString
|
||||
import com.anytypeio.anytype.databinding.FragmentSetObjectSetRecordNameBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetRecordViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.ObjectSetRecordViewModel.Command
|
||||
import com.anytypeio.anytype.ui.editor.EditorFragment
|
||||
|
@ -46,7 +49,10 @@ class SetObjectSetRecordNameFragment : SetObjectCreateRecordFragmentBase<Fragmen
|
|||
is Command.OpenObject -> {
|
||||
findNavController().navigate(
|
||||
R.id.objectNavigation,
|
||||
bundleOf(EditorFragment.CTX_KEY to command.ctx)
|
||||
EditorFragment.args(
|
||||
ctx = command.ctx,
|
||||
space = command.space
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -56,29 +62,51 @@ class SetObjectSetRecordNameFragment : SetObjectCreateRecordFragmentBase<Fragmen
|
|||
override fun onButtonClicked() {
|
||||
vm.onButtonClicked(
|
||||
target = target,
|
||||
input = textInputField.text.toString()
|
||||
input = textInputField.text.toString(),
|
||||
space = space
|
||||
)
|
||||
}
|
||||
|
||||
override fun onKeyboardActionDone() {
|
||||
vm.onActionDone(
|
||||
target = target,
|
||||
input = textInputField.text.toString()
|
||||
input = textInputField.text.toString(),
|
||||
space = space
|
||||
)
|
||||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().objectSetRecordComponent.get(ctx).inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
componentManager().objectSetRecordComponent.release()
|
||||
}
|
||||
|
||||
override fun inflateBinding(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?
|
||||
): FragmentSetObjectSetRecordNameBinding = FragmentSetObjectSetRecordNameBinding.inflate(
|
||||
inflater, container, false
|
||||
)
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager()
|
||||
.objectSetRecordComponent.get(
|
||||
DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
componentManager().objectSetRecordComponent.release()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val ARG_CTX_KEY = "arg.set-object-record-name.ctx"
|
||||
private const val ARG_SPACE_KEY = "arg.set-object-record-name.space"
|
||||
|
||||
fun args(
|
||||
ctx: Id,
|
||||
space: Id
|
||||
) = bundleOf(
|
||||
ARG_CTX_KEY to ctx,
|
||||
ARG_SPACE_KEY to space
|
||||
)
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ class CreateFilterFlowRootFragment :
|
|||
BaseBottomSheetFragment<FragmentViewerBottomSheetRootBinding>(), CreateFilterFlow {
|
||||
|
||||
private val ctx: String get() = arg(CTX_KEY)
|
||||
private val space: String get() = arg(SPACE_ID_KEY)
|
||||
private val viewer: String get() = arg(VIEWER_KEY)
|
||||
|
||||
val vm by lazy { CreateFilterFlowViewModel() }
|
||||
|
@ -47,14 +48,16 @@ class CreateFilterFlowRootFragment :
|
|||
CreateFilterFromInputFieldValueFragment.new(
|
||||
ctx = step.ctx,
|
||||
viewer = viewer,
|
||||
relation = step.relation
|
||||
relation = step.relation,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
CreateFilterFromSelectedValueFragment.new(
|
||||
ctx = step.ctx,
|
||||
viewer = viewer,
|
||||
relation = step.relation
|
||||
relation = step.relation,
|
||||
space = space,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +70,7 @@ class CreateFilterFlowRootFragment :
|
|||
}
|
||||
|
||||
private fun transitToSelection() {
|
||||
val fr = SelectFilterRelationFragment.new(ctx = ctx, viewerId = viewer)
|
||||
val fr = SelectFilterRelationFragment.new(ctx = ctx, space = space, viewerId = viewer)
|
||||
childFragmentManager
|
||||
.beginTransaction()
|
||||
.add(R.id.container, fr)
|
||||
|
@ -86,12 +89,17 @@ class CreateFilterFlowRootFragment :
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, viewer: Id): CreateFilterFlowRootFragment = CreateFilterFlowRootFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, VIEWER_KEY to viewer)
|
||||
fun new(ctx: Id, space: Id, viewer: Id): CreateFilterFlowRootFragment = CreateFilterFlowRootFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
VIEWER_KEY to viewer
|
||||
)
|
||||
}
|
||||
|
||||
const val TAG_ROOT = "tag.root"
|
||||
private const val CTX_KEY = "arg.create-filter-flow-root.ctx"
|
||||
private const val SPACE_ID_KEY = "arg.create-filter-flow-root.space-id"
|
||||
private const val VIEWER_KEY = "arg.create-filter-flow-root.viewer"
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import androidx.fragment.app.viewModels
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.relationIcon
|
||||
import com.anytypeio.anytype.core_ui.extensions.setInputTypeBaseOnFormat
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
|
@ -16,6 +17,7 @@ import com.anytypeio.anytype.core_utils.ext.*
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentCreateOrUpdateFilterInputFieldValueBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.model.Viewer
|
||||
import com.anytypeio.anytype.ui.sets.modals.PickFilterConditionFragment
|
||||
|
@ -27,6 +29,7 @@ class CreateFilterFromInputFieldValueFragment :
|
|||
UpdateConditionActionReceiver {
|
||||
|
||||
private val ctx: String get() = arg(CTX_KEY)
|
||||
private val space: String get() = arg(SPACE_ID_KEY)
|
||||
private val relation: String get() = arg(RELATION_KEY)
|
||||
private val viewer: String get() = arg(VIEWER_KEY)
|
||||
|
||||
|
@ -59,7 +62,8 @@ class CreateFilterFromInputFieldValueFragment :
|
|||
ctx = ctx,
|
||||
mode = PickFilterConditionFragment.MODE_CREATE,
|
||||
type = commands.type,
|
||||
index = commands.index
|
||||
index = commands.index,
|
||||
space = space
|
||||
).showChildFragment()
|
||||
}
|
||||
FilterViewModel.Commands.HideInput -> {
|
||||
|
@ -110,7 +114,16 @@ class CreateFilterFromInputFieldValueFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().createFilterComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.createFilterComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -125,11 +138,22 @@ class CreateFilterFromInputFieldValueFragment :
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, relation: Id, viewer: Id) = CreateFilterFromInputFieldValueFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, RELATION_KEY to relation, VIEWER_KEY to viewer)
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
relation: Id,
|
||||
viewer: Id
|
||||
) = CreateFilterFromInputFieldValueFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
RELATION_KEY to relation,
|
||||
VIEWER_KEY to viewer
|
||||
)
|
||||
}
|
||||
|
||||
private const val CTX_KEY = "arg.create-filter-relation.ctx"
|
||||
private const val SPACE_ID_KEY = "arg.create-filter-relation.space-id"
|
||||
private const val RELATION_KEY = "arg.create-filter-relation.relation"
|
||||
private const val VIEWER_KEY = "arg.create-filter-relation.viewer"
|
||||
val FILTER_INDEX_EMPTY: Int? = null
|
||||
|
|
|
@ -13,6 +13,7 @@ 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_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.relationIcon
|
||||
import com.anytypeio.anytype.core_ui.features.sets.CreateFilterAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
|
@ -28,6 +29,7 @@ import com.anytypeio.anytype.core_utils.ext.withParent
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentCreateOrUpdateFilterBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.model.Viewer
|
||||
import com.anytypeio.anytype.ui.relations.RelationTextValueFragment
|
||||
|
@ -47,6 +49,7 @@ open class CreateFilterFromSelectedValueFragment :
|
|||
RelationTextValueFragment.TextValueEditReceiver {
|
||||
|
||||
private val ctx: String get() = arg(CTX_KEY)
|
||||
private val space: String get() = arg(SPACE_ID_KEY)
|
||||
private val relation: String get() = arg(RELATION_KEY)
|
||||
private val viewer: String get() = arg(VIEWER_KEY)
|
||||
|
||||
|
@ -161,7 +164,8 @@ open class CreateFilterFromSelectedValueFragment :
|
|||
ctx = ctx,
|
||||
mode = PickFilterConditionFragment.MODE_CREATE,
|
||||
type = commands.type,
|
||||
index = commands.index
|
||||
index = commands.index,
|
||||
space = space
|
||||
).showChildFragment()
|
||||
}
|
||||
FilterViewModel.Commands.ShowCount -> binding.btnBottomAction.showNumber()
|
||||
|
@ -177,7 +181,8 @@ open class CreateFilterFromSelectedValueFragment :
|
|||
helper.handleOpenNumberPicker(
|
||||
fragment = this,
|
||||
command = commands,
|
||||
ctx = ctx
|
||||
ctx = ctx,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
is FilterViewModel.Commands.Toast -> {
|
||||
|
@ -205,7 +210,16 @@ open class CreateFilterFromSelectedValueFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().createFilterComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.createFilterComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -220,11 +234,17 @@ open class CreateFilterFromSelectedValueFragment :
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, relation: Id, viewer: Id): CreateFilterFromSelectedValueFragment = CreateFilterFromSelectedValueFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, RELATION_KEY to relation, VIEWER_KEY to viewer)
|
||||
fun new(ctx: Id, space: Id, relation: Id, viewer: Id): CreateFilterFromSelectedValueFragment = CreateFilterFromSelectedValueFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
RELATION_KEY to relation,
|
||||
VIEWER_KEY to viewer
|
||||
)
|
||||
}
|
||||
|
||||
const val CTX_KEY = "arg.create-filter-relation.ctx"
|
||||
const val SPACE_ID_KEY = "arg.create-filter-relation.space-id"
|
||||
const val RELATION_KEY = "arg.create-filter-relation.relation"
|
||||
private const val VIEWER_KEY = "arg.create-filter-relation.viewer"
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.anytypeio.anytype.ui.sets.modals.filter
|
|||
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.anytypeio.anytype.core_models.DVFilterQuickOption
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_utils.ext.hasSpan
|
||||
import com.anytypeio.anytype.presentation.relations.toName
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.ui.relations.RelationTextValueFragment
|
||||
|
@ -10,7 +12,8 @@ class FilterHelper {
|
|||
fun handleOpenNumberPicker(
|
||||
fragment: Fragment,
|
||||
command: FilterViewModel.Commands.OpenNumberPicker,
|
||||
ctx: String,
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
) {
|
||||
fragment.arguments?.apply {
|
||||
putSerializable(KEY_OPTION, command.option)
|
||||
|
@ -18,6 +21,7 @@ class FilterHelper {
|
|||
|
||||
RelationTextValueFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
name = command.option.toName(),
|
||||
value = command.value
|
||||
).show(fragment.childFragmentManager, null)
|
||||
|
|
|
@ -9,6 +9,7 @@ import androidx.fragment.app.viewModels
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.relationIcon
|
||||
import com.anytypeio.anytype.core_ui.extensions.setInputTypeBaseOnFormat
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
|
@ -19,6 +20,7 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentCreateOrUpdateFilterInputFieldValueBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.extension.getTextValue
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.model.Viewer
|
||||
|
@ -31,6 +33,7 @@ open class ModifyFilterFromInputFieldValueFragment :
|
|||
UpdateConditionActionReceiver {
|
||||
|
||||
private val ctx: String get() = arg(CTX_KEY)
|
||||
private val space: String get() = arg(SPACE_ID_KEY)
|
||||
private val relation: String get() = arg(RELATION_KEY)
|
||||
private val index: Int get() = arg(IDX_KEY)
|
||||
private val viewer: String get() = arg(VIEWER_KEY)
|
||||
|
@ -80,6 +83,7 @@ open class ModifyFilterFromInputFieldValueFragment :
|
|||
is FilterViewModel.Commands.OpenConditionPicker -> {
|
||||
PickFilterConditionFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
mode = PickFilterConditionFragment.MODE_MODIFY,
|
||||
type = commands.type,
|
||||
index = commands.index
|
||||
|
@ -115,7 +119,16 @@ open class ModifyFilterFromInputFieldValueFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().modifyFilterComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.modifyFilterComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -130,10 +143,11 @@ open class ModifyFilterFromInputFieldValueFragment :
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, relation: Id, index: Int, viewer: Id) =
|
||||
fun new(ctx: Id, space: Id, relation: Id, index: Int, viewer: Id) =
|
||||
ModifyFilterFromInputFieldValueFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
RELATION_KEY to relation,
|
||||
IDX_KEY to index,
|
||||
VIEWER_KEY to viewer
|
||||
|
@ -141,6 +155,7 @@ open class ModifyFilterFromInputFieldValueFragment :
|
|||
}
|
||||
|
||||
const val CTX_KEY = "arg.modify-filter-relation.ctx"
|
||||
const val SPACE_ID_KEY = "arg.modify-filter-relation.space-id"
|
||||
const val RELATION_KEY = "arg.modify-filter-relation.relation"
|
||||
const val IDX_KEY = "arg.modify-filter-relation.index"
|
||||
private const val VIEWER_KEY = "arg.modify-filter-relation.viewer"
|
||||
|
|
|
@ -13,6 +13,7 @@ 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_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.relationIcon
|
||||
import com.anytypeio.anytype.core_ui.features.sets.CreateFilterAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
|
@ -21,6 +22,7 @@ import com.anytypeio.anytype.core_utils.ext.*
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentCreateOrUpdateFilterBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.filter.FilterViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.model.ColumnView
|
||||
import com.anytypeio.anytype.presentation.sets.model.Viewer
|
||||
|
@ -39,6 +41,7 @@ open class ModifyFilterFromSelectedValueFragment :
|
|||
RelationTextValueFragment.TextValueEditReceiver {
|
||||
|
||||
private val ctx: String get() = arg(CTX_KEY)
|
||||
private val space: String get() = arg(SPACE_ID_KEY)
|
||||
private val relation: String get() = arg(RELATION_KEY)
|
||||
private val index: Int get() = arg(IDX_KEY)
|
||||
private val viewer: String get() = arg(VIEWER_KEY)
|
||||
|
@ -128,6 +131,7 @@ open class ModifyFilterFromSelectedValueFragment :
|
|||
is FilterViewModel.Commands.OpenConditionPicker -> {
|
||||
PickFilterConditionFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
mode = PickFilterConditionFragment.MODE_MODIFY,
|
||||
type = commands.type,
|
||||
index = commands.index
|
||||
|
@ -146,6 +150,7 @@ open class ModifyFilterFromSelectedValueFragment :
|
|||
fragment = this,
|
||||
command = commands,
|
||||
ctx = ctx,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
is FilterViewModel.Commands.Toast -> {
|
||||
|
@ -191,7 +196,16 @@ open class ModifyFilterFromSelectedValueFragment :
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().modifyFilterComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.modifyFilterComponent
|
||||
.get(
|
||||
key = ctx,
|
||||
param = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -208,6 +222,7 @@ open class ModifyFilterFromSelectedValueFragment :
|
|||
companion object {
|
||||
fun new(
|
||||
ctx: Id,
|
||||
space: Id,
|
||||
relation: Id,
|
||||
index: Int,
|
||||
viewer: Id
|
||||
|
@ -215,6 +230,7 @@ open class ModifyFilterFromSelectedValueFragment :
|
|||
ModifyFilterFromSelectedValueFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
RELATION_KEY to relation,
|
||||
IDX_KEY to index,
|
||||
VIEWER_KEY to viewer
|
||||
|
@ -222,6 +238,7 @@ open class ModifyFilterFromSelectedValueFragment :
|
|||
}
|
||||
|
||||
const val CTX_KEY = "arg.modify-filter-relation.ctx"
|
||||
const val SPACE_ID_KEY = "arg.modify-filter-relation.space-id"
|
||||
const val RELATION_KEY = "arg.modify-filter-relation.relation"
|
||||
const val IDX_KEY = "arg.modify-filter-relation.index"
|
||||
private const val VIEWER_KEY = "arg.modify-filter-relation.viewer"
|
||||
|
|
|
@ -3,9 +3,11 @@ package com.anytypeio.anytype.ui.sets.modals.filter
|
|||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
import com.anytypeio.anytype.core_utils.ext.withParent
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.SearchRelationViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.SelectFilterRelationViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.model.SimpleRelationView
|
||||
|
@ -15,6 +17,7 @@ import javax.inject.Inject
|
|||
class SelectFilterRelationFragment : SearchRelationFragment() {
|
||||
|
||||
override val ctx: String get() = arg(CTX_KEY)
|
||||
val space: String get() = arg(SPACE_ID_KEY)
|
||||
override val viewer: String get() = arg(VIEWER_ID_KEY)
|
||||
|
||||
@Inject
|
||||
|
@ -27,7 +30,15 @@ class SelectFilterRelationFragment : SearchRelationFragment() {
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().selectFilterRelationComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.selectFilterRelationComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -35,11 +46,12 @@ class SelectFilterRelationFragment : SearchRelationFragment() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, viewerId: Id): SelectFilterRelationFragment = SelectFilterRelationFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, VIEWER_ID_KEY to viewerId)
|
||||
fun new(ctx: Id, space: Id, viewerId: Id): SelectFilterRelationFragment = SelectFilterRelationFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, SPACE_ID_KEY to space, VIEWER_ID_KEY to viewerId)
|
||||
}
|
||||
|
||||
const val CTX_KEY = "arg.select-filter-relation.ctx"
|
||||
const val SPACE_ID_KEY = "arg.select-filter-relation.space-id"
|
||||
const val VIEWER_ID_KEY = "arg.select-filter-relation.viewer"
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ import com.anytypeio.anytype.core_models.Block
|
|||
import com.anytypeio.anytype.core_models.DVSortType
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.text
|
||||
import com.anytypeio.anytype.core_ui.reactive.clicks
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
|
@ -20,6 +21,7 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentModifyViewerSortBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.sort.ModifyViewerSortViewModel
|
||||
import kotlinx.coroutines.flow.filterNotNull
|
||||
import javax.inject.Inject
|
||||
|
@ -27,6 +29,7 @@ import javax.inject.Inject
|
|||
class ModifyViewerSortFragment : BaseBottomSheetFragment<FragmentModifyViewerSortBinding>() {
|
||||
|
||||
private val ctx: Id get() = arg(CTX_KEY)
|
||||
private val space: Id get() = arg(SPACE_ID_KEY)
|
||||
private val sortId: Id get() = arg(SORT_ID_KEY)
|
||||
private val relationKey: Key get() = arg(RELATION_KEY)
|
||||
private val viewer: Id get() = arg(VIEWER_ID_KEY)
|
||||
|
@ -80,7 +83,15 @@ class ModifyViewerSortFragment : BaseBottomSheetFragment<FragmentModifyViewerSor
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().modifyViewerSortComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.modifyViewerSortComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -95,13 +106,14 @@ class ModifyViewerSortFragment : BaseBottomSheetFragment<FragmentModifyViewerSor
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, viewer: Id, sortId: Id, relation: Key): ModifyViewerSortFragment =
|
||||
fun new(ctx: Id, space: Id, viewer: Id, sortId: Id, relation: Key): ModifyViewerSortFragment =
|
||||
ModifyViewerSortFragment().apply {
|
||||
arguments =
|
||||
bundleOf(CTX_KEY to ctx, SORT_ID_KEY to sortId, RELATION_KEY to relation, VIEWER_ID_KEY to viewer)
|
||||
bundleOf(CTX_KEY to ctx, SPACE_ID_KEY to space, SORT_ID_KEY to sortId, RELATION_KEY to relation, VIEWER_ID_KEY to viewer)
|
||||
}
|
||||
|
||||
private const val CTX_KEY = "arg.modify-viewer-sort.ctx"
|
||||
private const val SPACE_ID_KEY = "arg.modify-viewer-sort.space-id"
|
||||
private const val SORT_ID_KEY = "arg.modify-viewer-sort.sort-id"
|
||||
private const val RELATION_KEY = "arg.modify-viewer-sort.relation"
|
||||
private const val VIEWER_ID_KEY = "arg.modify-viewer-sort.viewer-id"
|
||||
|
|
|
@ -12,6 +12,7 @@ import androidx.recyclerview.widget.DividerItemDecoration
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.sets.SearchRelationAdapter
|
||||
import com.anytypeio.anytype.core_ui.reactive.textChanges
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
|
@ -22,12 +23,14 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetTextInputFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentSelectSortOrFilterRelationBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.SelectSortRelationViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
class SelectSortRelationFragment : BaseBottomSheetTextInputFragment<FragmentSelectSortOrFilterRelationBinding>() {
|
||||
|
||||
private val ctx: String get() = arg(CTX_KEY)
|
||||
private val space: String get() = arg(SPACE_ID_KEY)
|
||||
private val viewer: String get() = arg(VIEWER_ID_KEY)
|
||||
|
||||
private val searchRelationAdapter by lazy {
|
||||
|
@ -98,7 +101,15 @@ class SelectSortRelationFragment : BaseBottomSheetTextInputFragment<FragmentSele
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().selectSortRelationComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.selectSortRelationComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -115,11 +126,12 @@ class SelectSortRelationFragment : BaseBottomSheetTextInputFragment<FragmentSele
|
|||
|
||||
companion object {
|
||||
|
||||
fun new(ctx: Id, viewerId: Id): SelectSortRelationFragment = SelectSortRelationFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, VIEWER_ID_KEY to viewerId)
|
||||
fun new(ctx: Id, space: Id, viewerId: Id): SelectSortRelationFragment = SelectSortRelationFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, SPACE_ID_KEY to space, VIEWER_ID_KEY to viewerId)
|
||||
}
|
||||
|
||||
const val CTX_KEY = "arg.select-sort-relation.ctx"
|
||||
const val SPACE_ID_KEY = "arg.select-sort-relation.space-id"
|
||||
const val VIEWER_ID_KEY = "arg.select-sort-relation.viewer"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.extensions.drawable
|
||||
import com.anytypeio.anytype.core_ui.features.sets.ViewerSortAdapter
|
||||
import com.anytypeio.anytype.core_ui.layout.DividerVerticalItemDecoration
|
||||
|
@ -24,6 +25,7 @@ import com.anytypeio.anytype.core_utils.ext.visible
|
|||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentViewerSortBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.sort.ViewerSortViewModel
|
||||
import com.anytypeio.anytype.presentation.sets.sort.ViewerSortViewModel.ScreenState
|
||||
import javax.inject.Inject
|
||||
|
@ -31,6 +33,7 @@ import javax.inject.Inject
|
|||
open class ViewerSortFragment : BaseBottomSheetFragment<FragmentViewerSortBinding>() {
|
||||
|
||||
private val ctx: String get() = arg(CTX_KEY)
|
||||
private val space: String get() = arg(SPACE_ID_KEY)
|
||||
private val viewer: String get() = arg(VIEWER_ID_KEY)
|
||||
|
||||
@Inject
|
||||
|
@ -58,12 +61,18 @@ open class ViewerSortFragment : BaseBottomSheetFragment<FragmentViewerSortBindin
|
|||
private lateinit var dividerItemEdit: RecyclerView.ItemDecoration
|
||||
|
||||
private fun navigateToSelectSort() {
|
||||
val fr = SelectSortRelationFragment.new(ctx = ctx, viewerId = viewer)
|
||||
val fr = SelectSortRelationFragment.new(ctx = ctx, space = space, viewerId = viewer)
|
||||
fr.show(parentFragmentManager, null)
|
||||
}
|
||||
|
||||
private fun navigateToChangeSort(sortId: Id, relation: Key) {
|
||||
val fr = ModifyViewerSortFragment.new(ctx = ctx, viewer = viewer, sortId = sortId, relation = relation)
|
||||
val fr = ModifyViewerSortFragment.new(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
viewer = viewer,
|
||||
sortId = sortId,
|
||||
relation = relation
|
||||
)
|
||||
fr.show(parentFragmentManager, null)
|
||||
}
|
||||
|
||||
|
@ -142,7 +151,15 @@ open class ViewerSortFragment : BaseBottomSheetFragment<FragmentViewerSortBindin
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().viewerSortComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.viewerSortComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -157,11 +174,16 @@ open class ViewerSortFragment : BaseBottomSheetFragment<FragmentViewerSortBindin
|
|||
)
|
||||
|
||||
companion object {
|
||||
fun new(ctx: Id, viewer: Id): ViewerSortFragment = ViewerSortFragment().apply {
|
||||
arguments = bundleOf(CTX_KEY to ctx, VIEWER_ID_KEY to viewer)
|
||||
fun new(ctx: Id, space: Id, viewer: Id): ViewerSortFragment = ViewerSortFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to ctx,
|
||||
SPACE_ID_KEY to space,
|
||||
VIEWER_ID_KEY to viewer
|
||||
)
|
||||
}
|
||||
|
||||
const val CTX_KEY = "arg.viewer-sort.ctx"
|
||||
const val SPACE_ID_KEY = "arg.viewer-sort.space"
|
||||
const val VIEWER_ID_KEY = "arg.viewer-sort.viewer"
|
||||
}
|
||||
}
|
|
@ -6,10 +6,12 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.*
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentViewerCardSizeSelectBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.viewer.ViewerCardSizeSelectViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -20,6 +22,7 @@ class ViewerCardSizeSelectFragment : BaseBottomSheetFragment<FragmentViewerCardS
|
|||
private val vm: ViewerCardSizeSelectViewModel by viewModels { factory }
|
||||
|
||||
private val ctx get() = arg<String>(CTX_KEY)
|
||||
private val space get() = arg<String>(SPACE_ID_KEY)
|
||||
private val viewer get() = arg<String>(VIEWER_KEY)
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
@ -65,7 +68,15 @@ class ViewerCardSizeSelectFragment : BaseBottomSheetFragment<FragmentViewerCardS
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().viewerCardSizeSelectComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.viewerCardSizeSelectComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -81,6 +92,7 @@ class ViewerCardSizeSelectFragment : BaseBottomSheetFragment<FragmentViewerCardS
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.viewer-card-size-select.ctx"
|
||||
const val SPACE_ID_KEY = "arg.viewer-card-size-select.space-id"
|
||||
const val VIEWER_KEY = "arg.viewer-card-size-select.viewer"
|
||||
}
|
||||
}
|
|
@ -7,12 +7,14 @@ import android.view.ViewGroup
|
|||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_ui.features.sets.viewer.ViewerCoverAdapter
|
||||
import com.anytypeio.anytype.core_utils.ext.arg
|
||||
import com.anytypeio.anytype.core_utils.ext.subscribe
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetFragment
|
||||
import com.anytypeio.anytype.databinding.FragmentViewerImagePreviewSelectBinding
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.di.feature.DefaultComponentParam
|
||||
import com.anytypeio.anytype.presentation.sets.viewer.ViewerImagePreviewSelectViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -23,6 +25,7 @@ class ViewerImagePreviewSelectFragment : BaseBottomSheetFragment<FragmentViewerI
|
|||
private val vm: ViewerImagePreviewSelectViewModel by viewModels { factory }
|
||||
|
||||
private val ctx get() = arg<String>(CTX_KEY)
|
||||
private val space get() = arg<String>(SPACE_ID_KEY)
|
||||
private val viewer get() = arg<String>(VIEWER_KEY)
|
||||
|
||||
private val viewerCoverAdapter by lazy {
|
||||
|
@ -54,7 +57,15 @@ class ViewerImagePreviewSelectFragment : BaseBottomSheetFragment<FragmentViewerI
|
|||
}
|
||||
|
||||
override fun injectDependencies() {
|
||||
componentManager().viewerImagePreviewSelectComponent.get(ctx).inject(this)
|
||||
componentManager()
|
||||
.viewerImagePreviewSelectComponent
|
||||
.get(
|
||||
params = DefaultComponentParam(
|
||||
ctx = ctx,
|
||||
space = SpaceId(space)
|
||||
)
|
||||
)
|
||||
.inject(this)
|
||||
}
|
||||
|
||||
override fun releaseDependencies() {
|
||||
|
@ -70,6 +81,7 @@ class ViewerImagePreviewSelectFragment : BaseBottomSheetFragment<FragmentViewerI
|
|||
|
||||
companion object {
|
||||
const val CTX_KEY = "arg.viewer-cover-select.ctx"
|
||||
const val SPACE_ID_KEY = "arg.viewer-cover-select.space"
|
||||
const val VIEWER_KEY = "arg.viewer-cover-select.viewer"
|
||||
}
|
||||
}
|
|
@ -118,8 +118,9 @@ class SharingFragment : BaseBottomSheetComposeFragment() {
|
|||
dismiss()
|
||||
findNavController().navigate(
|
||||
R.id.objectNavigation,
|
||||
bundleOf(
|
||||
EditorFragment.CTX_KEY to nav.target
|
||||
EditorFragment.args(
|
||||
ctx = nav.target,
|
||||
space = nav.space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -120,6 +120,7 @@ class EditorTemplateFragment : EditorFragment() {
|
|||
companion object {
|
||||
fun newInstance(
|
||||
id: String,
|
||||
space: Id,
|
||||
targetTypeId: Id,
|
||||
targetTypeKey: Id,
|
||||
type: Int
|
||||
|
@ -127,6 +128,7 @@ class EditorTemplateFragment : EditorFragment() {
|
|||
EditorTemplateFragment().apply {
|
||||
arguments = bundleOf(
|
||||
CTX_KEY to id,
|
||||
SPACE_ID_KEY to space,
|
||||
ARG_TARGET_TYPE_ID to targetTypeId,
|
||||
ARG_TARGET_TYPE_KEY to targetTypeKey,
|
||||
ARG_TEMPLATE_TYPE to type
|
||||
|
|
|
@ -27,7 +27,8 @@ class TemplateSelectAdapter(
|
|||
id = templateView.id,
|
||||
targetTypeId = templateView.typeId,
|
||||
targetTypeKey = templateView.typeKey,
|
||||
type = EditorTemplateFragment.TYPE_TEMPLATE_MULTIPLE
|
||||
type = EditorTemplateFragment.TYPE_TEMPLATE_MULTIPLE,
|
||||
space = templateView.space
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,3 +20,5 @@ value class RelationId(val id: String)
|
|||
|
||||
@JvmInline
|
||||
value class RelationKey(val key: String)
|
||||
|
||||
typealias Space = SpaceId
|
||||
|
|
|
@ -16,6 +16,7 @@ class CellViewDiffUtilTest {
|
|||
id = MockDataFactory.randomString(),
|
||||
relationKey = MockDataFactory.randomString(),
|
||||
number = MockDataFactory.randomString(),
|
||||
space = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
val newCell = oldCell.copy(
|
||||
|
@ -39,6 +40,7 @@ class CellViewDiffUtilTest {
|
|||
id = MockDataFactory.randomString(),
|
||||
relationKey = MockDataFactory.randomString(),
|
||||
number = MockDataFactory.randomString(),
|
||||
space = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
val newCell = oldCell.copy()
|
||||
|
@ -59,7 +61,8 @@ class CellViewDiffUtilTest {
|
|||
val oldCell = CellView.Description(
|
||||
id = MockDataFactory.randomString(),
|
||||
relationKey = MockDataFactory.randomString(),
|
||||
text = MockDataFactory.randomString()
|
||||
text = MockDataFactory.randomString(),
|
||||
space = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
val newCell = oldCell.copy(
|
||||
|
@ -82,7 +85,8 @@ class CellViewDiffUtilTest {
|
|||
val oldCell = CellView.Description(
|
||||
id = MockDataFactory.randomString(),
|
||||
relationKey = MockDataFactory.randomString(),
|
||||
text = MockDataFactory.randomString()
|
||||
text = MockDataFactory.randomString(),
|
||||
space = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
val newCell = oldCell.copy()
|
||||
|
@ -104,7 +108,8 @@ class CellViewDiffUtilTest {
|
|||
id = MockDataFactory.randomString(),
|
||||
relationKey = MockDataFactory.randomString(),
|
||||
timeInSecs = MockDataFactory.randomLong(),
|
||||
dateFormat = MockDataFactory.randomString()
|
||||
dateFormat = MockDataFactory.randomString(),
|
||||
space = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
val newCell = oldCell.copy(
|
||||
|
@ -127,7 +132,8 @@ class CellViewDiffUtilTest {
|
|||
val oldCell = CellView.Date(
|
||||
id = MockDataFactory.randomString(),
|
||||
relationKey = MockDataFactory.randomString(),
|
||||
dateFormat = MockDataFactory.randomString()
|
||||
dateFormat = MockDataFactory.randomString(),
|
||||
space = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
val newCell = oldCell.copy()
|
||||
|
|
|
@ -66,6 +66,7 @@ class GetTemplates(
|
|||
),
|
||||
keys = listOf(
|
||||
Relations.ID,
|
||||
Relations.SPACE_ID,
|
||||
Relations.NAME,
|
||||
Relations.LAYOUT,
|
||||
Relations.ICON_EMOJI,
|
||||
|
|
|
@ -7157,7 +7157,8 @@ class EditorViewModel(
|
|||
ctx = context,
|
||||
target = context,
|
||||
relationKey = relation.key,
|
||||
isReadOnlyValue = isReadOnlyValue(restrictions)
|
||||
isReadOnlyValue = isReadOnlyValue(restrictions),
|
||||
space = requireNotNull(relation.spaceId)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -7180,7 +7181,8 @@ class EditorViewModel(
|
|||
ctx = context,
|
||||
target = context,
|
||||
relationKey = relation.key,
|
||||
isReadOnlyValue = isReadOnlyValue(restrictions)
|
||||
isReadOnlyValue = isReadOnlyValue(restrictions),
|
||||
space = requireNotNull(relation.spaceId)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -7190,7 +7192,8 @@ class EditorViewModel(
|
|||
ctx = context,
|
||||
target = context,
|
||||
relationKey = relation.key,
|
||||
isReadOnlyValue = isReadOnlyValue(restrictions)
|
||||
isReadOnlyValue = isReadOnlyValue(restrictions),
|
||||
space = requireNotNull(relation.spaceId)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -7200,7 +7203,8 @@ class EditorViewModel(
|
|||
ctx = context,
|
||||
target = context,
|
||||
relationKey = relation.key,
|
||||
isReadOnlyValue = isReadOnlyValue(restrictions)
|
||||
isReadOnlyValue = isReadOnlyValue(restrictions),
|
||||
space = requireNotNull(relation.spaceId)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ sealed class Command {
|
|||
abstract val isReadOnlyValue: Boolean
|
||||
data class Default(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val target: Id,
|
||||
val relationKey: Key,
|
||||
val targetObjectTypes: List<Id>,
|
||||
|
@ -101,6 +102,7 @@ sealed class Command {
|
|||
|
||||
data class Text(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val target: Id,
|
||||
val relationKey: Key,
|
||||
override val isReadOnlyValue: Boolean = false
|
||||
|
@ -108,6 +110,7 @@ sealed class Command {
|
|||
|
||||
data class Date(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val target: Id,
|
||||
val relationKey: Key,
|
||||
override val isReadOnlyValue: Boolean = false
|
||||
|
@ -115,6 +118,7 @@ sealed class Command {
|
|||
|
||||
data class TagOrStatus(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val target: Id,
|
||||
val relationKey: Key,
|
||||
override val isReadOnlyValue: Boolean = false
|
||||
|
@ -122,6 +126,7 @@ sealed class Command {
|
|||
|
||||
data class ObjectValue(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val target: Id,
|
||||
val relationKey: Key,
|
||||
override val isReadOnlyValue: Boolean = false
|
||||
|
|
|
@ -19,12 +19,14 @@ interface AppNavigation {
|
|||
fun openModalTemplateSelect(
|
||||
template: Id,
|
||||
templateTypeId: Id,
|
||||
templateTypeKey: Key
|
||||
templateTypeKey: Key,
|
||||
space: Id
|
||||
)
|
||||
fun openModalTemplateEdit(
|
||||
template: Id,
|
||||
templateTypeId: Id,
|
||||
templateTypeKey: Key
|
||||
templateTypeKey: Key,
|
||||
space: Id
|
||||
)
|
||||
|
||||
fun launchDocument(target: String, space: Id)
|
||||
|
@ -38,7 +40,6 @@ interface AppNavigation {
|
|||
fun exitToDesktop()
|
||||
fun openDebugSettings()
|
||||
fun openPageSearch()
|
||||
fun exitToDesktopAndOpenPage(pageId: String)
|
||||
fun openUpdateAppScreen()
|
||||
fun openRemoteFilesManageScreen(subscription: Id)
|
||||
|
||||
|
@ -64,7 +65,8 @@ interface AppNavigation {
|
|||
data class OpenModalTemplateSelect(
|
||||
val template: Id,
|
||||
val templateTypeId: Id,
|
||||
val templateTypeKey: Key
|
||||
val templateTypeKey: Key,
|
||||
val space: Id
|
||||
) : Command()
|
||||
|
||||
object OpenSettings : Command()
|
||||
|
@ -72,7 +74,6 @@ interface AppNavigation {
|
|||
object MigrationErrorScreen: Command()
|
||||
object OpenDebugSettingsScreen : Command()
|
||||
|
||||
data class ExitToDesktopAndOpenPage(val pageId: String) : Command()
|
||||
object OpenPageSearch : Command()
|
||||
|
||||
data class OpenSetOrCollection(
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.anytypeio.anytype.presentation.objects
|
|||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.ObjectType
|
||||
import com.anytypeio.anytype.core_models.primitives.TypeKey
|
||||
|
@ -33,7 +34,8 @@ class CreateObjectViewModel(private val createObject: CreateObject) : ViewModel(
|
|||
createObjectStatus.emit(
|
||||
State.Success(
|
||||
id = result.objectId,
|
||||
layout = result.obj.layout
|
||||
layout = result.obj.layout,
|
||||
space = requireNotNull(result.obj.spaceId)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -51,7 +53,7 @@ class CreateObjectViewModel(private val createObject: CreateObject) : ViewModel(
|
|||
}
|
||||
|
||||
sealed class State {
|
||||
data class Success(val id: String, val layout: ObjectType.Layout?) : State()
|
||||
data class Success(val id: String, val layout: ObjectType.Layout?, val space: Id) : State()
|
||||
data class Error(val msg: String) : State()
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,10 @@ class ObjectMenuViewModel(
|
|||
isDismissed.value = true
|
||||
}
|
||||
ObjectAction.USE_AS_TEMPLATE -> {
|
||||
proceedWithCreatingTemplateFromObject(ctx)
|
||||
proceedWithCreatingTemplateFromObject(
|
||||
ctx = ctx,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ObjectAction.SET_AS_DEFAULT -> {
|
||||
proceedWithSettingAsDefaultTemplate(ctx = ctx)
|
||||
|
@ -323,7 +326,7 @@ class ObjectMenuViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
private fun proceedWithCreatingTemplateFromObject(ctx: Id) {
|
||||
private fun proceedWithCreatingTemplateFromObject(ctx: Id, space: Id) {
|
||||
val startTime = System.currentTimeMillis()
|
||||
viewModelScope.launch {
|
||||
val params = CreateTemplateFromObject.Params(obj = ctx)
|
||||
|
@ -335,7 +338,11 @@ class ObjectMenuViewModel(
|
|||
ctx = ctx,
|
||||
startTime = startTime
|
||||
)
|
||||
buildOpenTemplateCommand(ctx, template)
|
||||
buildOpenTemplateCommand(
|
||||
ctx = ctx,
|
||||
space = space,
|
||||
template = template
|
||||
)
|
||||
isDismissed.value = true
|
||||
},
|
||||
onFailure = {
|
||||
|
@ -346,7 +353,7 @@ class ObjectMenuViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun buildOpenTemplateCommand(ctx: Id, template: Id) {
|
||||
private suspend fun buildOpenTemplateCommand(ctx: Id, space: Id, template: Id) {
|
||||
val details = storage.details.current().details
|
||||
val type = details[ctx]?.type?.firstOrNull()
|
||||
val typeStruct = details[type]?.map
|
||||
|
@ -357,7 +364,8 @@ class ObjectMenuViewModel(
|
|||
templateId = template,
|
||||
typeId = objType.id,
|
||||
typeKey = objTypeKey,
|
||||
typeName = objType.name.orEmpty()
|
||||
typeName = objType.name.orEmpty(),
|
||||
space = space
|
||||
)
|
||||
commands.emit(command)
|
||||
} else {
|
||||
|
|
|
@ -438,6 +438,7 @@ abstract class ObjectMenuViewModelBase(
|
|||
) : Command()
|
||||
data class OpenTemplate(
|
||||
val templateId: Id,
|
||||
val space: Id,
|
||||
val typeId: Id,
|
||||
val typeKey: Key,
|
||||
val typeName: String
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.anytypeio.anytype.core_models.Relation
|
|||
import com.anytypeio.anytype.core_models.ThemeColor
|
||||
import com.anytypeio.anytype.core_models.Relations
|
||||
import com.anytypeio.anytype.core_models.Struct
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.typeOf
|
||||
import com.anytypeio.anytype.domain.base.fold
|
||||
import com.anytypeio.anytype.domain.`object`.SetObjectDetails
|
||||
|
@ -185,6 +186,7 @@ class CreateOrEditOptionViewModel(
|
|||
|
||||
data class ViewModelParams(
|
||||
val ctx: Id,
|
||||
val space: SpaceId,
|
||||
val relationKey: Key,
|
||||
val objectId: Id,
|
||||
val optionId: Id?,
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.anytypeio.anytype.analytics.base.Analytics
|
|||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.domain.`object`.UpdateDetail
|
||||
import com.anytypeio.anytype.domain.workspace.SpaceManager
|
||||
import com.anytypeio.anytype.presentation.common.BaseViewModel
|
||||
|
@ -34,6 +35,7 @@ class AttachmentValueViewModel(
|
|||
|
||||
data class ViewModelParams(
|
||||
val ctx: Id,
|
||||
val space: SpaceId,
|
||||
val objectId: Id,
|
||||
val relationKey: Key,
|
||||
val isLocked: Boolean,
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.anytypeio.anytype.core_models.Key
|
|||
import com.anytypeio.anytype.core_models.ObjectWrapper
|
||||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.isDataView
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_models.restrictions.ObjectRestriction
|
||||
import com.anytypeio.anytype.core_utils.ext.typeOf
|
||||
import com.anytypeio.anytype.domain.base.fold
|
||||
|
@ -388,6 +389,7 @@ class ObjectValueViewModel(
|
|||
|
||||
data class ViewModelParams(
|
||||
val ctx: Id,
|
||||
val space: SpaceId,
|
||||
val objectId: Id,
|
||||
val relationKey: Key,
|
||||
val isLocked: Boolean,
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.anytypeio.anytype.core_models.ObjectWrapper
|
|||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.Relation
|
||||
import com.anytypeio.anytype.core_models.ThemeColor
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_utils.ext.typeOf
|
||||
import com.anytypeio.anytype.domain.base.fold
|
||||
import com.anytypeio.anytype.domain.library.StoreSearchParams
|
||||
|
@ -446,6 +447,7 @@ class TagOrStatusValueViewModel(
|
|||
|
||||
data class ViewModelParams(
|
||||
val ctx: Id,
|
||||
val space: SpaceId,
|
||||
val objectId: Id,
|
||||
val relationKey: Key,
|
||||
val isLocked: Boolean,
|
||||
|
|
|
@ -44,31 +44,35 @@ sealed class ObjectSetCommand {
|
|||
|
||||
data class EditGridTextCell(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val relationKey: Id,
|
||||
val recordId: Id
|
||||
) : Modal()
|
||||
|
||||
data class EditGridDateCell(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val relationKey: Key,
|
||||
val objectId: Id
|
||||
) : Modal()
|
||||
|
||||
data class EditObjectCell(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val target: Id,
|
||||
val relationKey: Key
|
||||
) : Modal()
|
||||
|
||||
data class EditTagOrStatusCell(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val target: Id,
|
||||
val relationKey: Key
|
||||
) : Modal()
|
||||
|
||||
data class SetNameForCreatedObject(val ctx: Id, val target: Id) : Modal()
|
||||
data class SetNameForCreatedObject(val ctx: Id, val space: Id, val target: Id) : Modal()
|
||||
|
||||
data class CreateBookmark(val ctx: Id) : Modal()
|
||||
data class CreateBookmark(val ctx: Id, val space: Id) : Modal()
|
||||
|
||||
data class OpenIconActionMenu(
|
||||
val target: Id,
|
||||
|
@ -87,16 +91,19 @@ sealed class ObjectSetCommand {
|
|||
|
||||
data class EditIntrinsicTextRelation(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val relation: Key
|
||||
) : Modal()
|
||||
|
||||
data class EditObjectRelationValue(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val relation: Key
|
||||
) : Modal()
|
||||
|
||||
data class EditTagOrStatusRelationValue(
|
||||
val ctx: Id,
|
||||
val space: Id,
|
||||
val relation: Key
|
||||
) : Modal()
|
||||
|
||||
|
|
|
@ -131,11 +131,11 @@ class ObjectSetCreateBookmarkRecordViewModel(
|
|||
)
|
||||
}
|
||||
|
||||
override fun onButtonClicked(target: Id, input: String) {
|
||||
override fun onButtonClicked(target: Id, space: Id, input: String) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
override fun onActionDone(target: Id, input: String) {
|
||||
override fun onActionDone(target: Id, space: Id, input: String) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class ObjectSetRecordViewModel(
|
|||
|
||||
val commands = MutableSharedFlow<Command>(replay = 0)
|
||||
|
||||
override fun onActionDone(target: Id, input: String) {
|
||||
override fun onActionDone(target: Id, space: Id, input: String) {
|
||||
viewModelScope.launch {
|
||||
setObjectDetails(
|
||||
UpdateDetail.Params(
|
||||
|
@ -31,10 +31,15 @@ class ObjectSetRecordViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
override fun onButtonClicked(target: Id, input: String) {
|
||||
override fun onButtonClicked(target: Id, space: Id, input: String) {
|
||||
viewModelScope.launch {
|
||||
if (input.isEmpty()) {
|
||||
commands.emit(Command.OpenObject(target))
|
||||
commands.emit(
|
||||
Command.OpenObject(
|
||||
ctx = target,
|
||||
space = space
|
||||
)
|
||||
)
|
||||
} else {
|
||||
setObjectDetails(
|
||||
UpdateDetail.Params(
|
||||
|
@ -45,10 +50,20 @@ class ObjectSetRecordViewModel(
|
|||
).process(
|
||||
failure = {
|
||||
Timber.e(it, "Error while updating data view record")
|
||||
commands.emit(Command.OpenObject(target))
|
||||
commands.emit(
|
||||
Command.OpenObject(
|
||||
ctx = target,
|
||||
space = space
|
||||
)
|
||||
)
|
||||
},
|
||||
success = {
|
||||
commands.emit(Command.OpenObject(target))
|
||||
commands.emit(
|
||||
Command.OpenObject(
|
||||
ctx = target,
|
||||
space = space
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -75,6 +90,6 @@ class ObjectSetRecordViewModel(
|
|||
}
|
||||
|
||||
sealed class Command {
|
||||
data class OpenObject(val ctx: Id) : Command()
|
||||
data class OpenObject(val ctx: Id, val space: Id) : Command()
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ import com.anytypeio.anytype.core_models.ObjectWrapper
|
|||
import com.anytypeio.anytype.core_models.Payload
|
||||
import com.anytypeio.anytype.core_models.RelationFormat
|
||||
import com.anytypeio.anytype.core_models.Relations
|
||||
import com.anytypeio.anytype.core_models.getSingleValue
|
||||
import com.anytypeio.anytype.core_models.multiplayer.SpaceMemberPermissions
|
||||
import com.anytypeio.anytype.core_models.primitives.SpaceId
|
||||
import com.anytypeio.anytype.core_models.primitives.TypeId
|
||||
|
@ -883,7 +884,8 @@ class ObjectSetViewModel(
|
|||
ObjectSetCommand.Modal.EditGridTextCell(
|
||||
ctx = context,
|
||||
relationKey = cell.relationKey,
|
||||
recordId = cell.id
|
||||
recordId = cell.id,
|
||||
space = cell.space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -892,7 +894,8 @@ class ObjectSetViewModel(
|
|||
ObjectSetCommand.Modal.EditGridDateCell(
|
||||
ctx = context,
|
||||
objectId = cell.id,
|
||||
relationKey = cell.relationKey
|
||||
relationKey = cell.relationKey,
|
||||
space = cell.space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -901,7 +904,8 @@ class ObjectSetViewModel(
|
|||
ObjectSetCommand.Modal.EditTagOrStatusCell(
|
||||
ctx = context,
|
||||
target = cell.id,
|
||||
relationKey = cell.relationKey
|
||||
relationKey = cell.relationKey,
|
||||
space = cell.space
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -911,7 +915,8 @@ class ObjectSetViewModel(
|
|||
ObjectSetCommand.Modal.EditObjectCell(
|
||||
ctx = context,
|
||||
target = cell.id,
|
||||
relationKey = cell.relationKey
|
||||
relationKey = cell.relationKey,
|
||||
space = cell.space
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
@ -1072,7 +1077,11 @@ class ObjectSetViewModel(
|
|||
}
|
||||
if (uniqueKey == ObjectTypeIds.BOOKMARK) {
|
||||
dispatch(
|
||||
ObjectSetCommand.Modal.CreateBookmark(ctx = context)
|
||||
ObjectSetCommand.Modal
|
||||
.CreateBookmark(
|
||||
ctx = context,
|
||||
space = requireNotNull(wrapper.spaceId)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
val validTemplateId = templateChosenBy ?: defaultTemplate
|
||||
|
@ -1095,7 +1104,10 @@ class ObjectSetViewModel(
|
|||
ObjectType.Layout.RELATION -> {
|
||||
if (objectTypeUniqueKey == ObjectTypeIds.BOOKMARK) {
|
||||
dispatch(
|
||||
ObjectSetCommand.Modal.CreateBookmark(ctx = context)
|
||||
ObjectSetCommand.Modal.CreateBookmark(
|
||||
ctx = context,
|
||||
space = requireNotNull(wrapper.spaceId)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
val validTemplateId = templateChosenBy ?: defaultTemplate
|
||||
|
@ -1165,7 +1177,10 @@ class ObjectSetViewModel(
|
|||
)
|
||||
if (type.key == ObjectTypeIds.BOOKMARK) {
|
||||
dispatch(
|
||||
ObjectSetCommand.Modal.CreateBookmark(ctx = context)
|
||||
ObjectSetCommand.Modal.CreateBookmark(
|
||||
ctx = context,
|
||||
space = space.value
|
||||
)
|
||||
)
|
||||
} else {
|
||||
proceedWithCreatingDataViewObject(createObjectParams) { result ->
|
||||
|
@ -1216,7 +1231,8 @@ class ObjectSetViewModel(
|
|||
dispatch(
|
||||
ObjectSetCommand.Modal.SetNameForCreatedObject(
|
||||
ctx = context,
|
||||
target = response.objectId
|
||||
target = response.objectId,
|
||||
space = requireNotNull(obj.spaceId)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -1403,6 +1419,7 @@ class ObjectSetViewModel(
|
|||
isCustomizeViewPanelVisible.value = false
|
||||
val event = AppNavigation.Command.OpenModalTemplateSelect(
|
||||
template = target,
|
||||
space = space.value,
|
||||
templateTypeId = targetTypeId,
|
||||
templateTypeKey = targetTypeKey
|
||||
)
|
||||
|
@ -1691,7 +1708,8 @@ class ObjectSetViewModel(
|
|||
_commands.emit(
|
||||
ObjectSetCommand.Modal.EditIntrinsicTextRelation(
|
||||
ctx = ctx,
|
||||
relation = relation.key
|
||||
relation = relation.key,
|
||||
space = requireNotNull(relation.spaceId)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -1708,7 +1726,8 @@ class ObjectSetViewModel(
|
|||
ObjectSetCommand.Modal.EditGridDateCell(
|
||||
ctx = context,
|
||||
objectId = context,
|
||||
relationKey = relation.key
|
||||
relationKey = relation.key,
|
||||
space = space.value
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -1717,7 +1736,8 @@ class ObjectSetViewModel(
|
|||
_commands.emit(
|
||||
ObjectSetCommand.Modal.EditTagOrStatusRelationValue(
|
||||
ctx = context,
|
||||
relation = relation.key
|
||||
relation = relation.key,
|
||||
space = requireNotNull(relation.spaceId)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -1726,7 +1746,8 @@ class ObjectSetViewModel(
|
|||
_commands.emit(
|
||||
ObjectSetCommand.Modal.EditObjectRelationValue(
|
||||
ctx = context,
|
||||
relation = relation.key
|
||||
relation = relation.key,
|
||||
space = requireNotNull(relation.spaceId)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@ abstract class SetDataViewObjectNameViewModelBase : BaseViewModel() {
|
|||
/**
|
||||
* @param [target] used when object is already created and we need to set name for it.
|
||||
*/
|
||||
abstract fun onActionDone(target: Id, input: String)
|
||||
abstract fun onActionDone(target: Id, space: Id, input: String)
|
||||
abstract fun onActionDone(input: String)
|
||||
/**
|
||||
* @param [target] used when object is already created and we need to set name for it.
|
||||
*/
|
||||
abstract fun onButtonClicked(target: Id, input: String)
|
||||
abstract fun onButtonClicked(target: Id, space: Id, input: String)
|
||||
abstract fun onButtonClicked(input: String)
|
||||
}
|
|
@ -40,6 +40,7 @@ suspend fun List<ColumnView>.buildGridRow(
|
|||
val image = obj.iconImage
|
||||
val done = obj.done
|
||||
val layout = obj.layout
|
||||
val space = requireNotNull(obj.spaceId)
|
||||
|
||||
val cells = mutableListOf<CellView>()
|
||||
this.map { column ->
|
||||
|
@ -49,7 +50,8 @@ suspend fun List<ColumnView>.buildGridRow(
|
|||
CellView.Description(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
text = ""
|
||||
text = "",
|
||||
space = requireNotNull(obj.spaceId)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
@ -61,7 +63,8 @@ suspend fun List<ColumnView>.buildGridRow(
|
|||
CellView.Description(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
text = obj.getValue<String>(column.key).orEmpty()
|
||||
text = obj.getValue<String>(column.key).orEmpty(),
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.NUMBER -> {
|
||||
|
@ -69,7 +72,8 @@ suspend fun List<ColumnView>.buildGridRow(
|
|||
CellView.Number(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
number = NumberParser.parse(value)
|
||||
number = NumberParser.parse(value),
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.DATE -> {
|
||||
|
@ -78,7 +82,8 @@ suspend fun List<ColumnView>.buildGridRow(
|
|||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
timeInSecs = DateParser.parse(value),
|
||||
dateFormat = column.getDateRelationFormat()
|
||||
dateFormat = column.getDateRelationFormat(),
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.FILE -> {
|
||||
|
@ -104,35 +109,40 @@ suspend fun List<ColumnView>.buildGridRow(
|
|||
CellView.File(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
files = files
|
||||
files = files,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.CHECKBOX -> {
|
||||
CellView.Checkbox(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
isChecked = obj.getValue<Boolean>(column.key) ?: false
|
||||
isChecked = obj.getValue<Boolean>(column.key) ?: false,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.URL -> {
|
||||
CellView.Url(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
url = obj.getValue<String>(column.key).orEmpty()
|
||||
url = obj.getValue<String>(column.key).orEmpty(),
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.EMAIL -> {
|
||||
CellView.Email(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
email = obj.getValue<String>(column.key).orEmpty()
|
||||
email = obj.getValue<String>(column.key).orEmpty(),
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.PHONE -> {
|
||||
CellView.Phone(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
phone = obj.getValue<String>(column.key).orEmpty()
|
||||
phone = obj.getValue<String>(column.key).orEmpty(),
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.OBJECT -> {
|
||||
|
@ -144,7 +154,8 @@ suspend fun List<ColumnView>.buildGridRow(
|
|||
CellView.Object(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
objects = objects
|
||||
objects = objects,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.TAG -> {
|
||||
|
@ -164,7 +175,8 @@ suspend fun List<ColumnView>.buildGridRow(
|
|||
CellView.Tag(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
tags = tags
|
||||
tags = tags,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
ColumnView.Format.STATUS -> {
|
||||
|
@ -191,7 +203,8 @@ suspend fun List<ColumnView>.buildGridRow(
|
|||
CellView.Status(
|
||||
id = obj.id,
|
||||
relationKey = column.key,
|
||||
status = status
|
||||
status = status,
|
||||
space = space
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.anytypeio.anytype.presentation.sets.model
|
||||
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
|
||||
sealed class CellView {
|
||||
|
||||
abstract val relationKey: String
|
||||
abstract val id: String
|
||||
abstract val space: Id
|
||||
|
||||
interface Text {
|
||||
val text: String
|
||||
|
@ -19,12 +22,14 @@ sealed class CellView {
|
|||
|
||||
data class Description(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
override val text: String
|
||||
) : CellView(), Text
|
||||
|
||||
data class Date(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
val timeInSecs: Long? = null,
|
||||
override val dateFormat: String,
|
||||
|
@ -32,54 +37,63 @@ sealed class CellView {
|
|||
|
||||
data class Number(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
override val number: String?
|
||||
) : CellView(), Numbered
|
||||
|
||||
data class Url(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
val url: String?
|
||||
) : CellView()
|
||||
|
||||
data class Email(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
val email: String?
|
||||
) : CellView()
|
||||
|
||||
data class Phone(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
val phone: String?
|
||||
) : CellView()
|
||||
|
||||
data class Tag(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
val tags: List<TagView>
|
||||
) : CellView()
|
||||
|
||||
data class Status(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
val status: List<StatusView>
|
||||
) : CellView()
|
||||
|
||||
data class Object(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
val objects: List<ObjectView>
|
||||
) : CellView()
|
||||
|
||||
data class Checkbox(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
val isChecked: Boolean
|
||||
): CellView()
|
||||
|
||||
data class File(
|
||||
override val id: String,
|
||||
override val space: Id,
|
||||
override val relationKey: String,
|
||||
val files: List<FileView>
|
||||
) : CellView()
|
||||
|
|
|
@ -12,6 +12,7 @@ sealed interface TemplateSelectView {
|
|||
|
||||
data class Template(
|
||||
val id: Id,
|
||||
val space: Id,
|
||||
val typeId: Id,
|
||||
val typeKey: Id,
|
||||
val layout: ObjectType.Layout,
|
||||
|
|
|
@ -80,7 +80,8 @@ class TemplateSelectViewModel(
|
|||
id = it.id,
|
||||
layout = it.layout ?: ObjectType.Layout.BASIC,
|
||||
typeId = objType.id,
|
||||
typeKey = objType.uniqueKey
|
||||
typeKey = objType.uniqueKey,
|
||||
space = requireNotNull(it.spaceId)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -31,8 +31,12 @@ class ObjectSetRecordViewModelTest {
|
|||
lateinit var setObjectDetails: UpdateDetail
|
||||
|
||||
private val ctx: Id = MockDataFactory.randomUuid()
|
||||
private val defaultSpace = MockDataFactory.randomUuid()
|
||||
private val obj = ObjectWrapper.Basic(
|
||||
mapOf(Relations.ID to MockDataFactory.randomUuid())
|
||||
mapOf(
|
||||
Relations.ID to MockDataFactory.randomUuid(),
|
||||
Relations.SPACE_ID to defaultSpace
|
||||
)
|
||||
)
|
||||
|
||||
@Before
|
||||
|
@ -61,7 +65,8 @@ class ObjectSetRecordViewModelTest {
|
|||
|
||||
vm.onActionDone(
|
||||
target = obj.id,
|
||||
input = input
|
||||
input = input,
|
||||
space = requireNotNull(obj.spaceId)
|
||||
)
|
||||
|
||||
verifyBlocking(setObjectDetails, times(1)) {
|
||||
|
@ -91,11 +96,13 @@ class ObjectSetRecordViewModelTest {
|
|||
vm.commands.test {
|
||||
vm.onButtonClicked(
|
||||
target = obj.id,
|
||||
input = input
|
||||
input = input,
|
||||
space = requireNotNull(obj.spaceId)
|
||||
)
|
||||
assertEquals(
|
||||
expected = ObjectSetRecordViewModel.Command.OpenObject(
|
||||
ctx = obj.id
|
||||
ctx = obj.id,
|
||||
space = requireNotNull(obj.spaceId)
|
||||
),
|
||||
actual = awaitItem()
|
||||
)
|
||||
|
@ -128,11 +135,13 @@ class ObjectSetRecordViewModelTest {
|
|||
vm.commands.test {
|
||||
vm.onButtonClicked(
|
||||
target = obj.id,
|
||||
input = emptyInput
|
||||
input = emptyInput,
|
||||
space = requireNotNull(obj.spaceId)
|
||||
)
|
||||
assertEquals(
|
||||
expected = ObjectSetRecordViewModel.Command.OpenObject(
|
||||
ctx = obj.id
|
||||
ctx = obj.id,
|
||||
space = requireNotNull(obj.spaceId)
|
||||
),
|
||||
actual = awaitItem()
|
||||
)
|
||||
|
|
|
@ -26,6 +26,8 @@ import kotlin.test.assertEquals
|
|||
|
||||
class TagAndStatusTests {
|
||||
|
||||
private val defaultSpace = MockDataFactory.randomUuid()
|
||||
|
||||
@Mock
|
||||
lateinit var gateway: Gateway
|
||||
|
||||
|
@ -51,21 +53,25 @@ class TagAndStatusTests {
|
|||
val selOptions = listOf(
|
||||
StubRelationOptionObject(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
space = defaultSpace,
|
||||
text = "Tag1",
|
||||
color = "000"
|
||||
),
|
||||
StubRelationOptionObject(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
space = defaultSpace,
|
||||
text = "Tag2",
|
||||
color = "111"
|
||||
),
|
||||
StubRelationOptionObject(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
space = defaultSpace,
|
||||
text = "Tag3",
|
||||
color = "222"
|
||||
),
|
||||
StubRelationOptionObject(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
space = defaultSpace,
|
||||
text = "Tag4",
|
||||
color = "333"
|
||||
)
|
||||
|
@ -74,6 +80,7 @@ class TagAndStatusTests {
|
|||
val recordId = MockDataFactory.randomUuid()
|
||||
val records = mapOf<String, Any?>(
|
||||
ObjectSetConfig.ID_KEY to recordId,
|
||||
Relations.SPACE_ID to defaultSpace,
|
||||
ObjectSetConfig.TYPE_KEY to "Type111",
|
||||
viewerRelations[0].key to "Title4",
|
||||
viewerRelations[1].key to listOf(selOptions[1].id, selOptions[2].id)
|
||||
|
@ -83,6 +90,7 @@ class TagAndStatusTests {
|
|||
ObjectWrapper.Relation(
|
||||
mapOf(
|
||||
Relations.RELATION_KEY to viewerRelations[0].key,
|
||||
Relations.SPACE_ID to defaultSpace,
|
||||
Relations.NAME to "name",
|
||||
Relations.RELATION_FORMAT to Relation.Format.LONG_TEXT.code.toDouble(),
|
||||
Relations.IS_READ_ONLY to true,
|
||||
|
@ -93,6 +101,7 @@ class TagAndStatusTests {
|
|||
ObjectWrapper.Relation(
|
||||
mapOf(
|
||||
Relations.RELATION_KEY to viewerRelations[1].key,
|
||||
Relations.SPACE_ID to defaultSpace,
|
||||
Relations.NAME to "Tags",
|
||||
Relations.RELATION_FORMAT to RelationFormat.TAG.code.toDouble(),
|
||||
Relations.IS_READ_ONLY to true,
|
||||
|
@ -135,7 +144,8 @@ class TagAndStatusTests {
|
|||
CellView.Description(
|
||||
id = recordId,
|
||||
relationKey = viewerRelations[0].key,
|
||||
text = "Title4"
|
||||
text = "Title4",
|
||||
space = defaultSpace
|
||||
),
|
||||
CellView.Tag(
|
||||
id = recordId,
|
||||
|
@ -151,7 +161,8 @@ class TagAndStatusTests {
|
|||
tag = selOptions[2].name.orEmpty(),
|
||||
color = selOptions[2].color
|
||||
)
|
||||
)
|
||||
),
|
||||
space = defaultSpace
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -179,21 +190,25 @@ class TagAndStatusTests {
|
|||
val selOptions = listOf(
|
||||
StubRelationOptionObject(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
space = defaultSpace,
|
||||
text = "Status1",
|
||||
color = "000"
|
||||
),
|
||||
StubRelationOptionObject(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
space = defaultSpace,
|
||||
text = "Status2",
|
||||
color = "111"
|
||||
),
|
||||
StubRelationOptionObject(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
space = defaultSpace,
|
||||
text = "Status3",
|
||||
color = "222"
|
||||
),
|
||||
StubRelationOptionObject(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
space = defaultSpace,
|
||||
text = "Status4",
|
||||
color = "333"
|
||||
)
|
||||
|
@ -202,6 +217,7 @@ class TagAndStatusTests {
|
|||
val recordId = MockDataFactory.randomUuid()
|
||||
val records = mapOf<String, Any?>(
|
||||
ObjectSetConfig.ID_KEY to recordId,
|
||||
Relations.SPACE_ID to defaultSpace,
|
||||
ObjectSetConfig.TYPE_KEY to "Type111",
|
||||
viewerRelations[0].key to "Title4",
|
||||
viewerRelations[1].key to listOf(selOptions[2].id)
|
||||
|
@ -211,6 +227,7 @@ class TagAndStatusTests {
|
|||
ObjectWrapper.Relation(
|
||||
mapOf(
|
||||
Relations.RELATION_KEY to viewerRelations[0].key,
|
||||
Relations.SPACE_ID to defaultSpace,
|
||||
Relations.NAME to "name",
|
||||
Relations.RELATION_FORMAT to Relation.Format.LONG_TEXT.code.toDouble(),
|
||||
Relations.IS_READ_ONLY to true,
|
||||
|
@ -221,6 +238,7 @@ class TagAndStatusTests {
|
|||
ObjectWrapper.Relation(
|
||||
mapOf(
|
||||
Relations.RELATION_KEY to viewerRelations[1].key,
|
||||
Relations.SPACE_ID to defaultSpace,
|
||||
Relations.NAME to "Status",
|
||||
Relations.RELATION_FORMAT to Relation.Format.STATUS.code.toDouble(),
|
||||
Relations.IS_READ_ONLY to true,
|
||||
|
@ -263,7 +281,8 @@ class TagAndStatusTests {
|
|||
CellView.Description(
|
||||
id = recordId,
|
||||
relationKey = viewerRelations[0].key,
|
||||
text = "Title4"
|
||||
text = "Title4",
|
||||
space = defaultSpace
|
||||
),
|
||||
CellView.Status(
|
||||
id = recordId,
|
||||
|
@ -274,7 +293,8 @@ class TagAndStatusTests {
|
|||
status = selOptions[2].name.orEmpty(),
|
||||
color = selOptions[2].color
|
||||
)
|
||||
)
|
||||
),
|
||||
space = defaultSpace
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -77,7 +77,8 @@ class ObjectSetCellTest : ObjectSetViewModelTestSetup() {
|
|||
cell = CellView.Description(
|
||||
id = mockObjectSet.obj1.id,
|
||||
relationKey = mockObjectSet.relationObject2.key,
|
||||
text = ""
|
||||
text = "",
|
||||
space = mockObjectSet.space
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -86,7 +87,8 @@ class ObjectSetCellTest : ObjectSetViewModelTestSetup() {
|
|||
cell = CellView.Description(
|
||||
id = mockObjectSet.obj1.id,
|
||||
relationKey = mockObjectSet.relationObject1.key,
|
||||
text = ""
|
||||
text = "",
|
||||
space = mockObjectSet.space
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -86,7 +86,8 @@ class ObjectSetNavigationTest : ObjectSetViewModelTestSetup() {
|
|||
cell = CellView.Tag(
|
||||
id = mockObjectSet.obj1.id,
|
||||
relationKey = mockObjectSet.relationObject3.key,
|
||||
tags = listOf()
|
||||
tags = listOf(),
|
||||
space = mockObjectSet.space
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -113,12 +114,14 @@ class ObjectSetNavigationTest : ObjectSetViewModelTestSetup() {
|
|||
val object3 = ObjectWrapper.Basic(
|
||||
mapOf(
|
||||
Relations.ID to MockDataFactory.randomUuid(),
|
||||
Relations.SPACE_ID to mockObjectSet.spaceId,
|
||||
mockObjectSet.relationObject4.key to targetObjectId
|
||||
)
|
||||
)
|
||||
val targetObject = ObjectWrapper.Basic(
|
||||
mapOf(
|
||||
Relations.ID to targetObjectId,
|
||||
Relations.SPACE_ID to mockObjectSet.spaceId,
|
||||
Relations.LAYOUT to SupportedLayouts.layouts.random().code.toDouble()
|
||||
)
|
||||
)
|
||||
|
@ -154,9 +157,10 @@ class ObjectSetNavigationTest : ObjectSetViewModelTestSetup() {
|
|||
ObjectView.Default(
|
||||
id = targetObjectId,
|
||||
name = "",
|
||||
icon = ObjectIcon.None
|
||||
icon = ObjectIcon.None,
|
||||
)
|
||||
)
|
||||
),
|
||||
space = mockObjectSet.space
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -34,11 +34,13 @@ fun StubRelationObject(
|
|||
|
||||
fun StubRelationOptionObject(
|
||||
id: String = MockDataFactory.randomUuid(),
|
||||
space: Id = MockDataFactory.randomUuid(),
|
||||
text: String = MockDataFactory.randomString(),
|
||||
color: String = MockDataFactory.randomString()
|
||||
): ObjectWrapper.Option = ObjectWrapper.Option(
|
||||
mapOf(
|
||||
Relations.ID to id,
|
||||
Relations.SPACE_ID to space,
|
||||
Relations.NAME to text,
|
||||
Relations.RELATION_OPTION_COLOR to color,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue