feat: unify importers - #3436
Conversation
8cf92f3 to
2a88257
Compare
|
Next steps after review can concern with registering the handlers or getting rid of the "Local" and "Remote" concept by merging both into one. A local and remote source of patches therefore becomes identical in shape and behaviour. |
| @ColumnInfo(name = "name") val name: String, | ||
| @ColumnInfo(name = "version") val versionHash: String? = null, | ||
| @ColumnInfo(name = "source") val source: Source, | ||
| @ColumnInfo(name = "source") val source: Uri, |
There was a problem hiding this comment.
This should be renamed to url and be of type URL not Uri, migration needs to be added for it
| import android.net.Uri | ||
| import androidx.room.ColumnInfo | ||
|
|
||
| data class SourceProperties( |
There was a problem hiding this comment.
Its the partial type returned by dbGetProps(uid), used by updateDb to update only the mutable fields without loading the full entity. Both DAOs return it from getProps.
There was a problem hiding this comment.
Where is the full scheme, and where is source properties used, the question is still unanswered properly
There was a problem hiding this comment.
The full schema is the entity. PatchBundleEntity has uid, name, version, url, auto_update, released_at. DownloaderEntity is the same.
SourceProperties is a projection of the columns that can change after a row is created. It is the return type of getProps in both DAOs.
It is used by updateDb in SourceManager: read the props, copy with the changes then rebuild the entity with entityFromProps. createEntity uses the same path. uid is not in it because it is the primary key, not a mutable field.
|
Does it migrate from the old fields |
It does, tested on my phone. |
| // Auto accepts any text and defers the scheme to the handlers, URL expects a | ||
| // well-formed web address before the network is even touched. | ||
| val isValidUrl = url.trim().let { URLUtil.isHttpUrl(it) || URLUtil.isHttpsUrl(it) } | ||
| val inputsAreValid = when (method) { |
There was a problem hiding this comment.
This doesnt suite open closed principle well. Whats the reason for this implementation
| ) | ||
| ) | ||
| }, | ||
| placeholder = if (method == ImportMethod.Http) { |
There was a problem hiding this comment.
Breaks open closed, the set of handlers should map to composeables, so that you can iterate over the map and inject the respective composable into the ui, not manually hardcode them

No description provided.