Skip to content

feat: unify importers#3436

Open
mostafaNazari702 wants to merge 4 commits into
ReVanced:devfrom
mostafaNazari702:feat/unify-importers
Open

feat: unify importers#3436
mostafaNazari702 wants to merge 4 commits into
ReVanced:devfrom
mostafaNazari702:feat/unify-importers

Conversation

@mostafaNazari702

Copy link
Copy Markdown

No description provided.

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.
@mostafaNazari702

Copy link
Copy Markdown
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?

@mostafaNazari702 mostafaNazari702 changed the title feat(import): introduce transport handler abstraction feat: unify importers Jun 28, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant