Skip to content

feat: unify importers - #3436

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

feat: unify importers#3436
mostafaNazari702 wants to merge 21 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
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
Comment thread app/src/main/java/app/revanced/manager/domain/repository/PatchBundleRepository.kt Outdated
Comment thread app/src/main/java/app/revanced/manager/domain/manager/SourceManager.kt Outdated
@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,

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.

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(

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.

Where is this used

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.

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.

@oSumAtrIX oSumAtrIX Aug 3, 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.

Where is the full scheme, and where is source properties used, the question is still unanswered properly

@mostafaNazari702 mostafaNazari702 Aug 5, 2026

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.

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.

@mostafaNazari702

Copy link
Copy Markdown
Author

The 6.json alone made the diff massive
bild

@oSumAtrIX

Copy link
Copy Markdown
Member

Does it migrate from the old fields

@mostafaNazari702

mostafaNazari702 commented Aug 2, 2026

Copy link
Copy Markdown
Author

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) {

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.

This doesnt suite open closed principle well. Whats the reason for this implementation

)
)
},
placeholder = if (method == ImportMethod.Http) {

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.

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

@validcube
validcube self-requested a review August 4, 2026 11:27
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