mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-1462 Widgets | Fix | Naming fixes (#127)
This commit is contained in:
parent
91443fc90a
commit
17815710bf
8 changed files with 21 additions and 16 deletions
|
@ -754,12 +754,12 @@ class BlockDataRepository(
|
|||
|
||||
override suspend fun updateWidget(
|
||||
ctx: Id,
|
||||
target: Id,
|
||||
widget: Id,
|
||||
source: Id,
|
||||
type: Block.Content.Widget.Layout
|
||||
): Payload = remote.updateWidget(
|
||||
ctx = ctx,
|
||||
target = target,
|
||||
widget = widget,
|
||||
source = source,
|
||||
type = type
|
||||
)
|
||||
|
|
|
@ -332,7 +332,7 @@ interface BlockRemote {
|
|||
|
||||
suspend fun updateWidget(
|
||||
ctx: Id,
|
||||
target: Id,
|
||||
widget: Id,
|
||||
source: Id,
|
||||
type: Block.Content.Widget.Layout
|
||||
): Payload
|
||||
|
|
|
@ -384,7 +384,7 @@ interface BlockRepository {
|
|||
|
||||
suspend fun updateWidget(
|
||||
ctx: Id,
|
||||
target: Id,
|
||||
widget: Id,
|
||||
source: Id,
|
||||
type: Block.Content.Widget.Layout
|
||||
): Payload
|
||||
|
|
|
@ -18,18 +18,18 @@ class UpdateWidget @Inject constructor(
|
|||
ctx = params.ctx,
|
||||
source = params.source,
|
||||
type = params.type,
|
||||
target = params.target
|
||||
widget = params.widget
|
||||
)
|
||||
|
||||
/**
|
||||
* [ctx] context of widgets — id of object containing widgets
|
||||
* [target] widget block to update
|
||||
* [widget] widget block to update
|
||||
* [source] source for the given widget block
|
||||
* [type] layout type to update
|
||||
*/
|
||||
data class Params(
|
||||
val ctx: Id,
|
||||
val target: Id,
|
||||
val widget: Id,
|
||||
val source: Id,
|
||||
val type: Block.Content.Widget.Layout
|
||||
)
|
||||
|
|
|
@ -718,12 +718,12 @@ class BlockMiddleware(
|
|||
|
||||
override suspend fun updateWidget(
|
||||
ctx: Id,
|
||||
target: Id,
|
||||
widget: Id,
|
||||
source: Id,
|
||||
type: Block.Content.Widget.Layout
|
||||
): Payload = middleware.updateWidget(
|
||||
): Payload = middleware.createWidgetByReplacingExistingWidget(
|
||||
ctx = ctx,
|
||||
target = target,
|
||||
widget = widget,
|
||||
source = source,
|
||||
type = type
|
||||
)
|
||||
|
|
|
@ -1974,15 +1974,15 @@ class Middleware(
|
|||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
fun updateWidget(
|
||||
fun createWidgetByReplacingExistingWidget(
|
||||
ctx: Id,
|
||||
target: Id,
|
||||
widget: Id,
|
||||
source: Id,
|
||||
type: WidgetLayout
|
||||
): Payload {
|
||||
val request = Rpc.Block.CreateWidget.Request(
|
||||
contextId = ctx,
|
||||
targetId = target,
|
||||
targetId = widget,
|
||||
widgetLayout = type.mw(),
|
||||
position = Block.Position.Replace,
|
||||
block = Block(
|
||||
|
|
|
@ -74,7 +74,6 @@ import com.anytypeio.anytype.presentation.widgets.WidgetDispatchEvent
|
|||
import com.anytypeio.anytype.presentation.widgets.WidgetSessionStateHolder
|
||||
import com.anytypeio.anytype.presentation.widgets.WidgetView
|
||||
import com.anytypeio.anytype.presentation.widgets.collection.Subscription
|
||||
import com.anytypeio.anytype.presentation.widgets.getActiveTabViews
|
||||
import com.anytypeio.anytype.presentation.widgets.parseActiveViews
|
||||
import com.anytypeio.anytype.presentation.widgets.parseWidgets
|
||||
import javax.inject.Inject
|
||||
|
@ -461,7 +460,7 @@ class HomeScreenViewModel(
|
|||
UpdateWidget.Params(
|
||||
ctx = config.widgets,
|
||||
source = source,
|
||||
target = widget,
|
||||
widget = widget,
|
||||
type = when (type) {
|
||||
Command.ChangeWidgetType.TYPE_LINK -> WidgetLayout.LINK
|
||||
Command.ChangeWidgetType.TYPE_TREE -> WidgetLayout.TREE
|
||||
|
|
|
@ -103,6 +103,9 @@ class SelectWidgetTypeViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flow for an existing widget
|
||||
*/
|
||||
fun onWidgetTypeClicked(
|
||||
ctx: Id,
|
||||
widget: Id,
|
||||
|
@ -121,7 +124,7 @@ class SelectWidgetTypeViewModel(
|
|||
updateWidget(
|
||||
UpdateWidget.Params(
|
||||
ctx = ctx,
|
||||
target = widget,
|
||||
widget = widget,
|
||||
source = source,
|
||||
type = newLayout
|
||||
)
|
||||
|
@ -146,6 +149,9 @@ class SelectWidgetTypeViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flow for a new widget
|
||||
*/
|
||||
fun onWidgetTypeClicked(
|
||||
source: Id,
|
||||
target: Id?,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue