mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
feat(YouTube Music/Settings): add Open MicroG
settings
This commit is contained in:
@ -10,16 +10,21 @@ internal object Constants {
|
||||
*/
|
||||
const val MICROG_VENDOR = "com.mgoogle"
|
||||
|
||||
/**
|
||||
* microG package name
|
||||
*/
|
||||
const val MICROG_PACKAGE_NAME = "$MICROG_VENDOR.android.gms"
|
||||
|
||||
/**
|
||||
* meta-data for microG package name spoofing on patched builds
|
||||
*/
|
||||
const val META_SPOOFED_PACKAGE_NAME = "$MICROG_VENDOR.android.gms.SPOOFED_PACKAGE_NAME"
|
||||
const val META_SPOOFED_PACKAGE_NAME = "$MICROG_PACKAGE_NAME.SPOOFED_PACKAGE_NAME"
|
||||
|
||||
/**
|
||||
* meta-data for microG package signature spoofing on patched builds
|
||||
*/
|
||||
const val META_SPOOFED_PACKAGE_SIGNATURE =
|
||||
"$MICROG_VENDOR.android.gms.SPOOFED_PACKAGE_SIGNATURE"
|
||||
"$MICROG_PACKAGE_NAME.SPOOFED_PACKAGE_SIGNATURE"
|
||||
|
||||
/**
|
||||
* meta-data for microG package detection
|
||||
|
@ -107,6 +107,33 @@ internal object MusicResourceHelper {
|
||||
)
|
||||
}
|
||||
|
||||
internal fun ResourceContext.addMicroGPreference(
|
||||
category: String,
|
||||
key: String,
|
||||
packageName: String,
|
||||
targetClassName: String
|
||||
) {
|
||||
this.xmlEditor[YOUTUBE_MUSIC_SETTINGS_PATH].use { editor ->
|
||||
val tags = editor.file.getElementsByTagName(YOUTUBE_MUSIC_PREFERENCE_SCREEN_TAG_NAME)
|
||||
List(tags.length) { tags.item(it) as Element }
|
||||
.filter { it.getAttribute("android:key").contains("revanced_settings_$category") }
|
||||
.forEach {
|
||||
it.adoptChild("Preference") {
|
||||
setAttribute("android:title", "@string/$key" + "_title")
|
||||
setAttribute("android:summary", "@string/$key" + "_summary")
|
||||
this.adoptChild("intent") {
|
||||
setAttribute("android:targetPackage", packageName)
|
||||
setAttribute("android:data", key)
|
||||
setAttribute(
|
||||
"android:targetClass",
|
||||
targetClassName
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun ResourceContext.addMusicPreference(
|
||||
category: String,
|
||||
key: String,
|
||||
|
Reference in New Issue
Block a user