Skip to content

feat: unify importers#3436

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

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

Conversation

@mostafaNazari702

Copy link
Copy Markdown

No description provided.

@mostafaNazari702 mostafaNazari702 changed the title feat(import): introduce transport handler abstraction feat: unify importers Jun 28, 2026
Comment thread app/src/main/java/app/revanced/manager/domain/protocol/ProtocolHandler.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/protocol/ProtocolHandler.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/protocol/ProtocolHandler.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/network/service/HttpService.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/network/service/HttpService.kt Outdated
@oSumAtrIX

Copy link
Copy Markdown
Member

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.

Comment thread app/src/main/java/app/revanced/manager/di/ServiceModule.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/protocol/ProtocolHandler.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/protocol/ProtocolHandler.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/protocol/ProtocolHandler.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/protocol/ProtocolHandler.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/protocol/ProtocolHandler.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/network/service/HttpService.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/network/service/HttpService.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/MainActivity.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/MainActivity.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/MainActivity.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/MainActivity.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/ui/component/UiRequestHost.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/ui/component/UiRequestHost.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/ui/component/UiRequestHost.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/ui/component/UiRequestHost.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/util/UiRequest.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/util/UiRequest.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/ui/component/UiRequestHost.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/di/ServiceModule.kt Outdated
@mostafaNazari702

Copy link
Copy Markdown
Author

@mostafaNazari702

Copy link
Copy Markdown
Author

Comment thread app/src/main/java/app/revanced/manager/domain/sources/Source.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/sources/Source.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/data/room/sources/Source.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/sources/Source.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/di/ServiceModule.kt
// Imported files are copied into app storage and their origin is not recorded.
is SourceInfo.Local -> Uri.parse("rvp:${file.absolutePath}")
// Imported files are copied into app storage, the source points at that copy.
is SourceInfo.Local -> Uri.fromFile(file)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No distinction of local, api, or remote should exist

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The persistence needs to get rid of it as well, and instead a migration should be added to migrate the old schema to the new

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already fixed in 602a23c, it was pushed after this review, right before the "mostafa requested a review from oSuMATrix, "store sources as plain URLs and migrate old rows on boot".

The RoomSource sealed class is gone now, we just store a plain Uri in the entities and the converter is simply Uri.parse() / toString().

Old rows get migrated when the app starts in SourceManager.loadFromDb(): uid 0 gets updated to the configured default URL and old local rows without a scheme get rewritten to file:// URLs that point to their private copy.

The migration is safe to run more than once and the schema identity hash didnt change because the only thing that changed was the converter.

private fun Throwable.toValidationMessage() = when (asSourceException()) {
// wtf is this? this data is not a bundle, at least something!
is UnsupportedRemoteSourceException -> app.getString(R.string.remote_source_url_unsupported)
is UnsupportedSourceException -> app.getString(R.string.remote_source_url_unsupported)

@oSumAtrIX oSumAtrIX Jul 19, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

References to remote still exist.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.
validateUrl doesn't go through HttpService anymore, It now resolves the protocol through the handler mapjust like everything else so SourceManager no longer has any dependency on HTTP.

I also renamed the string resources from remote_source_url_* to source_url_*, and setEndpoint is now to setUrl.

The only place that still uses the old local/remote naming is ImportSourceDialog that's getting replaced by the Figma redesign anyway so i didn't think it was worth renaming a bunch of translated strings right before removing them. I can clean it up anyway, but are you truely sure you'd rather have it cleaned up?

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.

2 participants