ARK-Builders / arklib

Core of the programs in ARK family
MIT License
1 stars 10 forks source link

Lightweight, single-resource update method #38

Closed kirillt closed 10 months ago

kirillt commented 1 year ago

Technically, it is more sound to perform a full update, even when only a single resource is of interest. Because other resources could have been changed, too. However, it is not always easy for the client to process additional updates.

Single-resource update function could be convenient. This function should receive path of the resource to update.

Here are some scenarios where this function would be applicable:

  1. We could use this function when we delete a resource, although it would always return Deleted event.
  2. When an external application is used to modify a resource. In this case, we know that its id has changed, and we want it right in the place where we returned from the external app. For instance, a user browses resources in Gallery, edits an image, and once saving completed, returns to the Gallery. At this moment, either all resources must be updated, or the edited image must be temporarily removed. With the single-resource update, the edited image could simply be updated and presented to the user.
kirillt commented 1 year ago

Also, manual update of several selected resources could be useful too.

Examples from Navigator:

  1. ResourcesPresenter:onMoveSelectedResourcesClicked
  2. ResourcesPresenter:onRemoveSelectedResourcesClicked

These two methods implement bulk move/remove of resources.

kirillt commented 10 months ago

Also see #41

kirillt commented 10 months ago

Implemented in #42