feat: unify importers#3436
Open
mostafaNazari702 wants to merge 4 commits into
Open
Conversation
We now got a SourceHandler system that uses the URI scheme (like http or file) to decide how to fetch data. Now we are separating "how we get data" from "what we do with it" which makes the importer easier to manage and extend. - SourceHandler defines two basic actions: streamTo(uri, out) to read data and peekVersion(uri) to check version info. - HttpSourceHandler handles web links. It fetches the asset JSON and then downloads the linked file. - FileSourceHandler handles local files. it uses Android's ContentResolver (SAF) so it doesn't need broad storage permissions. Local files are treated as fixed snapshots (not expected to update). - Made a shared error types (SourceVersion, SourceAccessException) so all failures are handled in a consistent way no matter where they come from. - Register everything in a handler registry and wire it through Koin (dependency injection). Now this is purely additive, meaning nothing existing changes yet. the new system is just set up and registered but not connected to the current importer flow.
Author
|
A new domain/sources/handler/ package + Koin module, registered in the graph. every existing Source/SourceManager/repository/persistence/UI path is byte for byte the same, the handlers are constructible but resolved/called by nothing. The api:// dynamic-URL strategy is intentionally held for another phase/commit. One design choice to confirm, since it shapes future phase(s): i included peekVersion now (vs. a streamTo-only interface). My reasoning is it's required for metered "check-only" parity and encodes the agreed "file = non-updatable snapshot" but it's currently unused. Fine to keep or want it trimmed until future phases/commits needs it @oSumAtrIX? |
So i updated the Room converter so it can also read the new URI formats that later steps will write. this lets us switch to using URIs in storage without needing a database migration. Source.from() now understands rvp:// as Local (snapshot) and api:// as API, in addition to the old values like "local", "api", and http(s) URLs. I didnt change how things are saved, the data model, or the schema. The schema hash stays exactly the same, so NO migration is needed. We also don't handle file:// or content:// here on purpose since those are temporary picker links and aren’t meant to be stored.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.