diff --git a/.github/workflows/pull_strings.yml b/.github/workflows/pull_strings.yml index 8202912d0..9c8832ddb 100644 --- a/.github/workflows/pull_strings.yml +++ b/.github/workflows/pull_strings.yml @@ -3,7 +3,7 @@ name: Pull strings on: workflow_dispatch: schedule: - - cron: 0 * 1 * * + - cron: 0 0 1 * * jobs: pull: diff --git a/CHANGELOG.md b/CHANGELOG.md index ee60dd237..d3dcdf8d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,138 @@ +# [4.7.0-dev.16](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.15...v4.7.0-dev.16) (2024-04-21) + + +### Features + +* **YouTube - Swipe controls:** Save and restore brightness and add auto-brightness toggle ([#2996](https://github.com/ReVanced/revanced-patches/issues/2996)) ([f6c3bc4](https://github.com/ReVanced/revanced-patches/commit/f6c3bc43190d33e06f49b74fc056d26da1bb014a)) + +# [4.7.0-dev.15](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.14...v4.7.0-dev.15) (2024-04-20) + + +### Features + +* **YouTube:** Support version `19.09.38`, `19.10.39` and `19.11.43` ([#2971](https://github.com/ReVanced/revanced-patches/issues/2971)) ([730f3e3](https://github.com/ReVanced/revanced-patches/commit/730f3e3a7e058b60f9a8130980ecb0a747fa0a8a)) + +# [4.7.0-dev.14](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.13...v4.7.0-dev.14) (2024-04-20) + + +### Features + +* **YT Music - Hide 'Get Music Premium' label:** Remove occurences of label in settings ([#3046](https://github.com/ReVanced/revanced-patches/issues/3046)) ([10e170a](https://github.com/ReVanced/revanced-patches/commit/10e170a7302fdb585efee663ca13c814aea46c54)) + +# [4.7.0-dev.13](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.12...v4.7.0-dev.13) (2024-04-18) + + +### Bug Fixes + +* **YouTube Music - Remove upgrade button:** Fix compatibility with latest versions ([#3045](https://github.com/ReVanced/revanced-patches/issues/3045)) ([80de996](https://github.com/ReVanced/revanced-patches/commit/80de99666555694670529bbfe2e0be7a14d66555)) + +# [4.7.0-dev.12](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.11...v4.7.0-dev.12) (2024-04-18) + + +### Features + +* Add `Hex` patch ([#3034](https://github.com/ReVanced/revanced-patches/issues/3034)) ([3c95aac](https://github.com/ReVanced/revanced-patches/commit/3c95aac838693b354d3a7b0e3dc57c6da5adfa9e)) + +# [4.7.0-dev.11](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.10...v4.7.0-dev.11) (2024-04-18) + + +### Bug Fixes + +* **YouTube - Spoof device dimensions:** Warn about potential performance issues ([#3039](https://github.com/ReVanced/revanced-patches/issues/3039)) ([9d6f305](https://github.com/ReVanced/revanced-patches/commit/9d6f305b7c923e62b89581d221fedbe1e3f81835)) + +# [4.7.0-dev.10](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.9...v4.7.0-dev.10) (2024-04-17) + + +### Features + +* **YouTube:** Add 'About' preference to settings menu ([#2981](https://github.com/ReVanced/revanced-patches/issues/2981)) ([5abf894](https://github.com/ReVanced/revanced-patches/commit/5abf89444a3e6a211ec03c242eb9a7847542b08c)) +* **YouTube:** Match overlay icons style to YouTube ([#3023](https://github.com/ReVanced/revanced-patches/issues/3023)) ([6849393](https://github.com/ReVanced/revanced-patches/commit/684939314be3d0d43482f229b2adb033e7aa492a)) + +# [4.7.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.8...v4.7.0-dev.9) (2024-04-15) + + +### Bug Fixes + +* **YouTube - Hide ads:** rename `Hide paid content` to `Hide paid promotion label` ([#3026](https://github.com/ReVanced/revanced-patches/issues/3026)) ([17e4ac9](https://github.com/ReVanced/revanced-patches/commit/17e4ac978a2f109fd62469a3163b636cd63c55ae)) + +# [4.7.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.7...v4.7.0-dev.8) (2024-04-14) + + +### Features + +* **YouTube - Hide Shorts components:** Hide tagged products, hide search suggestions ([#3019](https://github.com/ReVanced/revanced-patches/issues/3019)) ([e0d2fe5](https://github.com/ReVanced/revanced-patches/commit/e0d2fe5bd2e681b9a5252a8e4ad582cc019b1606)) + +# [4.7.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.6...v4.7.0-dev.7) (2024-04-14) + + +### Features + +* **YouTube - Hide layout components:** Hide playables ([8423515](https://github.com/ReVanced/revanced-patches/commit/842351548baa33737db09be1cbca9f87c1951341)) + +# [4.7.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.5...v4.7.0-dev.6) (2024-04-12) + + +### Features + +* **YouTube - Hide Shorts components:** Hide `Shop`, `Location` and `Save sound to playlist` buttons ([#3018](https://github.com/ReVanced/revanced-patches/issues/3018)) ([5210ac4](https://github.com/ReVanced/revanced-patches/commit/5210ac431c191987264865bf8e789ea9f3fdd360)) + +# [4.7.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.4...v4.7.0-dev.5) (2024-04-10) + + +### Bug Fixes + +* **YouTube - Hide Shorts components:** Correctly hide Shorts if navigation tab is changed using device back button ([#3007](https://github.com/ReVanced/revanced-patches/issues/3007)) ([e5848e9](https://github.com/ReVanced/revanced-patches/commit/e5848e99c4cc838595164ef673a77fe60d28086b)) + +# [4.7.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.3...v4.7.0-dev.4) (2024-04-09) + + +### Features + +* **Amazon:** Add `Always allow deep-linking` patch ([#3000](https://github.com/ReVanced/revanced-patches/issues/3000)) ([a92b7fb](https://github.com/ReVanced/revanced-patches/commit/a92b7fb43c8b1b45577360cdc6d883fe2815c2f2)) +* **Twitter:** Add `Sanitize sharing links` patch ([#3003](https://github.com/ReVanced/revanced-patches/issues/3003)) ([186b887](https://github.com/ReVanced/revanced-patches/commit/186b8874157eef1b882b05d491ba1d4ca2809535)) + +# [4.7.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.2...v4.7.0-dev.3) (2024-04-09) + + +### Bug Fixes + +* **Tumblr - Fix old versions:** Improve reliability by removing remnances of Tumblr Live ([#2988](https://github.com/ReVanced/revanced-patches/issues/2988)) ([897b4db](https://github.com/ReVanced/revanced-patches/commit/897b4dbce984270ae1fd7de5bd30bd05153e45f2)) + +# [4.7.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.7.0-dev.1...v4.7.0-dev.2) (2024-04-06) + + +### Features + +* **Strava - Unlock subscription:** Remove compatible version constraint ([80a5599](https://github.com/ReVanced/revanced-patches/commit/80a55991683d7b22626224fa2935a5bf9bfcbfee)) + +# [4.7.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.6.1-dev.3...v4.7.0-dev.1) (2024-04-06) + + +### Features + +* **YouTube - Hide layout components:** Add option to hide horizontal shelves ([#2951](https://github.com/ReVanced/revanced-patches/issues/2951)) ([9ae0650](https://github.com/ReVanced/revanced-patches/commit/9ae0650c0005d882299996aa442410bab4261395)) + +## [4.6.1-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.6.1-dev.2...v4.6.1-dev.3) (2024-04-06) + + +### Bug Fixes + +* **YouTube - GmsCore support:** Prompt to disable battery optimizations, if not done already ([#2958](https://github.com/ReVanced/revanced-patches/issues/2958)) ([82acb84](https://github.com/ReVanced/revanced-patches/commit/82acb84b5f6ff0722a2eb080b53da9dd3622502f)) + +## [4.6.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.6.1-dev.1...v4.6.1-dev.2) (2024-04-04) + + +### Bug Fixes + +* **YouTube - Hide load more button:** Include patch with `Hide layout components`, and hide button only in search feed ([#2959](https://github.com/ReVanced/revanced-patches/issues/2959)) ([b007e8e](https://github.com/ReVanced/revanced-patches/commit/b007e8e06a3afad79b40bec1c6a14604f059049c)) + +## [4.6.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.6.0...v4.6.1-dev.1) (2024-04-04) + + +### Bug Fixes + +* **YouTube - Player flyout menu:** Add hide Lock screen menu ([#2985](https://github.com/ReVanced/revanced-patches/issues/2985)) ([308de4a](https://github.com/ReVanced/revanced-patches/commit/308de4a63ca99b8d30d6b3242f98d6f0e2aefb37)) + # [4.6.0](https://github.com/ReVanced/revanced-patches/compare/v4.5.0...v4.6.0) (2024-04-02) diff --git a/api/revanced-patches.api b/api/revanced-patches.api index 4bba02a52..6ee21cc71 100644 --- a/api/revanced-patches.api +++ b/api/revanced-patches.api @@ -28,6 +28,10 @@ public final class app/revanced/patches/all/misc/debugging/EnableAndroidDebuggin public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V } +public final class app/revanced/patches/all/misc/hex/HexPatch : app/revanced/patches/shared/misc/hex/BaseHexPatch { + public fun ()V +} + public final class app/revanced/patches/all/misc/network/OverrideCertificatePinningPatch : app/revanced/patcher/patch/ResourcePatch { public static final field INSTANCE Lapp/revanced/patches/all/misc/network/OverrideCertificatePinningPatch; public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V @@ -152,6 +156,12 @@ public final class app/revanced/patches/all/telephony/sim/spoof/SpoofSimCountryP public fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lkotlin/Pair;)V } +public final class app/revanced/patches/amazon/deeplinking/DeepLinkingPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/amazon/deeplinking/DeepLinkingPatch; + public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V + public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V +} + public final class app/revanced/patches/backdrops/misc/pro/ProUnlockPatch : app/revanced/patcher/patch/BytecodePatch { public static final field INSTANCE Lapp/revanced/patches/backdrops/misc/pro/ProUnlockPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V @@ -663,6 +673,21 @@ public abstract class app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportRes protected final fun getGmsCoreVendorGroupId ()Ljava/lang/String; } +public abstract class app/revanced/patches/shared/misc/hex/BaseHexPatch : app/revanced/patcher/patch/RawResourcePatch { + public fun ()V + public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V + public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V +} + +public final class app/revanced/patches/shared/misc/hex/BaseHexPatch$Replacement { + public static final field Companion Lapp/revanced/patches/shared/misc/hex/BaseHexPatch$Replacement$Companion; + public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + public final fun replacePattern ([B)V +} + +public final class app/revanced/patches/shared/misc/hex/BaseHexPatch$Replacement$Companion { +} + public abstract class app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch : app/revanced/patcher/patch/BytecodePatch { public fun (Ljava/lang/String;Ljava/util/Set;)V public fun (Ljava/util/Set;)V @@ -699,6 +724,7 @@ public final class app/revanced/patches/shared/misc/mapping/ResourceMappingPatch public static final field INSTANCE Lapp/revanced/patches/shared/misc/mapping/ResourceMappingPatch; public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V + public final fun get (Ljava/lang/String;Ljava/lang/String;)J } public final class app/revanced/patches/shared/misc/mapping/ResourceMappingPatch$ResourceElement { @@ -838,6 +864,8 @@ public final class app/revanced/patches/shared/misc/settings/preference/ListPref } public final class app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference : app/revanced/patches/shared/misc/settings/preference/BasePreference { + public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getSelectable ()Z @@ -1062,10 +1090,6 @@ public final class app/revanced/patches/tumblr/fixes/FixOldVersionsPatch : app/r public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } -public final class app/revanced/patches/tumblr/fixes/fingerprints/HttpPathParserFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint { - public static final field INSTANCE Lapp/revanced/patches/tumblr/fixes/fingerprints/HttpPathParserFingerprint; -} - public final class app/revanced/patches/tumblr/live/DisableTumblrLivePatch : app/revanced/patcher/patch/BytecodePatch { public static final field INSTANCE Lapp/revanced/patches/tumblr/live/DisableTumblrLivePatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V @@ -1200,6 +1224,12 @@ public final class app/revanced/patches/twitter/misc/links/OpenLinksWithAppChoos public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V } +public final class app/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatch : app/revanced/patcher/patch/BytecodePatch { + public static final field INSTANCE Lapp/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatch; + public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V + public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V +} + public final class app/revanced/patches/vsco/misc/pro/UnlockProPatch : app/revanced/patcher/patch/BytecodePatch { public static final field INSTANCE Lapp/revanced/patches/vsco/misc/pro/UnlockProPatch; public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V @@ -1817,11 +1847,12 @@ public final class app/revanced/patches/yuka/misc/unlockpremium/UnlockPremiumPat public final class app/revanced/util/BytecodeUtilsKt { public static final fun containsWideLiteralInstructionValue (Lcom/android/tools/smali/dexlib2/iface/Method;J)Z - public static final fun findIndexForIdResource (Lcom/android/tools/smali/dexlib2/iface/Method;Ljava/lang/String;)I public static final fun findMutableMethodOf (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod; public static final fun getException (Lapp/revanced/patcher/fingerprint/MethodFingerprint;)Lapp/revanced/patcher/patch/PatchException; public static final fun indexOfFirstInstruction (Lcom/android/tools/smali/dexlib2/iface/Method;Lkotlin/jvm/functions/Function1;)I public static final fun indexOfFirstWideLiteralInstructionValue (Lcom/android/tools/smali/dexlib2/iface/Method;J)I + public static final fun indexOfIdResource (Lcom/android/tools/smali/dexlib2/iface/Method;Ljava/lang/String;)I + public static final fun indexOfIdResourceOrThrow (Lcom/android/tools/smali/dexlib2/iface/Method;Ljava/lang/String;)I public static final fun injectHideViewCall (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;IILjava/lang/String;Ljava/lang/String;)V public static final fun resultOrThrow (Lapp/revanced/patcher/fingerprint/MethodFingerprint;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult; public static final fun returnEarly (Ljava/util/List;Z)V diff --git a/build.gradle.kts b/build.gradle.kts index 58308fbf4..a9e0830e2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ repositories { mavenLocal() google() maven { - // A repository must be speficied for some reason. "registry" is a dummy. + // A repository must be specified for some reason. "registry" is a dummy. url = uri("https://maven.pkg.github.com/revanced/registry") credentials { username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") diff --git a/gradle.properties b/gradle.properties index 0de6d25de..5cf87b2b0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true kotlin.code.style = official -version = 4.6.0 +version = 4.7.0-dev.16 diff --git a/src/main/kotlin/app/revanced/patches/all/misc/hex/HexPatch.kt b/src/main/kotlin/app/revanced/patches/all/misc/hex/HexPatch.kt new file mode 100644 index 000000000..164eaa13a --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/all/misc/hex/HexPatch.kt @@ -0,0 +1,55 @@ +package app.revanced.patches.all.misc.hex + +import app.revanced.patcher.patch.PatchException +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.registerNewPatchOption +import app.revanced.patches.shared.misc.hex.BaseHexPatch +import app.revanced.util.Utils.trimIndentMultiline +import app.revanced.patcher.patch.Patch as PatchClass + +@Patch( + name = "Hex", + description = "Replaces a hexadecimal patterns of bytes of files in an APK.", + use = false, +) +@Suppress("unused") +class HexPatch : BaseHexPatch() { + // TODO: Instead of stringArrayOption, use a custom option type to work around + // https://github.com/ReVanced/revanced-library/issues/48. + // Replace the custom option type with a stringArrayOption once the issue is resolved. + private val replacementsOption by registerNewPatchOption, List>( + key = "replacements", + title = "replacements", + description = """ + Hexadecimal patterns to search for and replace with another in a target file. + + A pattern is a sequence of case insensitive strings, each representing hexadecimal bytes, separated by spaces. + An example pattern is 'aa 01 02 FF'. + + Every pattern must be followed by a pipe ('|'), the replacement pattern, + another pipe ('|'), and the path to the file to make the changes in relative to the APK root. + The replacement pattern must have the same length as the original pattern. + + Full example of a valid input: + 'aa 01 02 FF|00 00 00 00|path/to/file' + """.trimIndentMultiline(), + required = true, + valueType = "StringArray", + ) + + override val replacements + get() = replacementsOption!!.map { from -> + val (pattern, replacementPattern, targetFilePath) = try { + from.split("|", limit = 3) + } catch (e: Exception) { + throw PatchException( + "Invalid input: $from.\n" + + "Every pattern must be followed by a pipe ('|'), " + + "the replacement pattern, another pipe ('|'), " + + "and the path to the file to make the changes in relative to the APK root. ", + ) + } + + Replacement(pattern, replacementPattern, targetFilePath) + } +} diff --git a/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingFingerprint.kt b/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingFingerprint.kt new file mode 100644 index 000000000..8caa3ece4 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingFingerprint.kt @@ -0,0 +1,11 @@ +package app.revanced.patches.amazon.deeplinking + +import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags + +internal object DeepLinkingFingerprint : MethodFingerprint( + "Z", + parameters = listOf("L"), + accessFlags = AccessFlags.PRIVATE.value, + strings = listOf("https://www.", "android.intent.action.VIEW") +) diff --git a/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingPatch.kt b/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingPatch.kt new file mode 100644 index 000000000..96cf44545 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/amazon/deeplinking/DeepLinkingPatch.kt @@ -0,0 +1,28 @@ +package app.revanced.patches.amazon.deeplinking + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.util.exception + +@Patch( + name = "Always allow deep-linking", + description = "Open Amazon links, even if the app is not set to handle Amazon links.", + compatiblePackages = [CompatiblePackage("com.amazon.mShop.android.shopping")] +) +@Suppress("unused") +object DeepLinkingPatch : BytecodePatch( + setOf(DeepLinkingFingerprint) +) { + override fun execute(context: BytecodeContext) { + DeepLinkingFingerprint.result?.mutableMethod?.addInstructions( + 0, + """ + const/4 v0, 0x1 + return v0 + """ + ) ?: throw DeepLinkingFingerprint.exception + } +} diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt index 4be4470dc..4475dafce 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt @@ -2,23 +2,28 @@ package app.revanced.patches.music.layout.premium import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint +import app.revanced.patches.music.layout.premium.fingerprints.MembershipSettingsFingerprint import app.revanced.util.exception import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction @Patch( name = "Hide 'Get Music Premium' label", - description = "Hides the red \"Get Music Premium\" label from the account menu.", + description = "Hides the \"Get Music Premium\" label from the account menu and settings.", compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], ) @Suppress("unused") object HideGetPremiumPatch : BytecodePatch( - setOf(HideGetPremiumFingerprint), + setOf( + HideGetPremiumFingerprint, + MembershipSettingsFingerprint, + ), ) { override fun execute(context: BytecodeContext) { HideGetPremiumFingerprint.result?.let { @@ -41,5 +46,13 @@ object HideGetPremiumPatch : BytecodePatch( ) } } ?: throw HideGetPremiumFingerprint.exception + + MembershipSettingsFingerprint.result?.mutableMethod?.addInstructions( + 0, + """ + const/4 v0, 0x0 + return-object v0 + """, + ) ?: throw MembershipSettingsFingerprint.exception } } diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumFingerprint.kt index e97251de5..c5c346409 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumFingerprint.kt @@ -12,6 +12,8 @@ internal object HideGetPremiumFingerprint : MethodFingerprint( listOf( Opcode.IF_NEZ, Opcode.CONST_16, + Opcode.GOTO, + Opcode.NOP, Opcode.INVOKE_VIRTUAL, ), listOf("FEmusic_history", "FEmusic_offline"), diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/MembershipSettingsFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/MembershipSettingsFingerprint.kt new file mode 100644 index 000000000..0f6c8b661 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/MembershipSettingsFingerprint.kt @@ -0,0 +1,20 @@ +package app.revanced.patches.music.layout.premium.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode + +internal object MembershipSettingsFingerprint : MethodFingerprint( + returnType = "Ljava/lang/CharSequence;", + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + opcodes = listOf( + Opcode.IGET_OBJECT, + Opcode.INVOKE_INTERFACE, + Opcode.MOVE_RESULT_OBJECT, + Opcode.INVOKE_VIRTUAL, + Opcode.MOVE_RESULT_OBJECT, + Opcode.IF_EQZ, + Opcode.IGET_OBJECT + ) +) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt index ee7ffbcb8..09980c6a9 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt @@ -13,6 +13,7 @@ internal object PivotBarConstructorFingerprint : MethodFingerprint( Opcode.CHECK_CAST, Opcode.INVOKE_INTERFACE, Opcode.GOTO, + Opcode.NOP, Opcode.IPUT_OBJECT, Opcode.RETURN_VOID, ), diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt index 060d3447c..3c99992fc 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/GmsCoreSupportPatch.kt @@ -5,7 +5,6 @@ import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption import app.revanced.patches.music.misc.gms.fingerprints.* import app.revanced.patches.music.misc.integrations.IntegrationsPatch -import app.revanced.patches.music.misc.integrations.fingerprints.ApplicationInitFingerprint import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch @@ -21,7 +20,7 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( CastDynamiteModuleV2Fingerprint, CastContextFetchFingerprint, ), - mainActivityOnCreateFingerprint = ApplicationInitFingerprint, + mainActivityOnCreateFingerprint = MusicActivityOnCreateFingerprint, integrationsPatchDependency = IntegrationsPatch::class, gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch, compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")), diff --git a/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/MusicActivityOnCreateFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/MusicActivityOnCreateFingerprint.kt new file mode 100644 index 000000000..2e46df2d9 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/music/misc/gms/fingerprints/MusicActivityOnCreateFingerprint.kt @@ -0,0 +1,11 @@ +package app.revanced.patches.music.misc.gms.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint + +internal object MusicActivityOnCreateFingerprint : MethodFingerprint( + returnType = "V", + parameters = listOf("Landroid/os/Bundle;"), + customFingerprint = { methodDef, classDef -> + methodDef.name == "onCreate" && classDef.type.endsWith("/MusicActivity;") + } +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt index 9d2544b7e..dd3fa0b59 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt @@ -98,9 +98,9 @@ abstract class BaseGmsCoreSupportPatch( // Verify GmsCore is installed and whitelisted for power optimizations and background usage. mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions( - 1, // Hack to not disturb other patches (such as the YTMusic integrations patch). + 0, "invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" + - "checkGmsCore(Landroid/content/Context;)V", + "checkGmsCore(Landroid/app/Activity;)V", ) ?: throw mainActivityOnCreateFingerprint.exception // Change the vendor of GmsCore in ReVanced Integrations. diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/hex/BaseHexPatch.kt b/src/main/kotlin/app/revanced/patches/shared/misc/hex/BaseHexPatch.kt new file mode 100644 index 000000000..781444d68 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/misc/hex/BaseHexPatch.kt @@ -0,0 +1,120 @@ +package app.revanced.patches.shared.misc.hex + +import app.revanced.patcher.data.ResourceContext +import app.revanced.patcher.patch.PatchException +import app.revanced.patcher.patch.RawResourcePatch +import kotlin.math.max + +abstract class BaseHexPatch : RawResourcePatch() { + internal abstract val replacements: List + + override fun execute(context: ResourceContext) { + replacements.groupBy { it.targetFilePath }.forEach { (targetFilePath, replacements) -> + val targetFile = try { + context[targetFilePath, true] + } catch (e: Exception) { + throw PatchException("Could not find target file: $targetFilePath") + } + + // TODO: Use a file channel to read and write the file instead of reading the whole file into memory, + // in order to reduce memory usage. + val targetFileBytes = targetFile.readBytes() + + replacements.forEach { replacement -> + replacement.replacePattern(targetFileBytes) + } + + targetFile.writeBytes(targetFileBytes) + } + } + + /** + * Represents a pattern to search for and its replacement pattern. + * + * @property pattern The pattern to search for. + * @property replacementPattern The pattern to replace the [pattern] with. + * @property targetFilePath The path to the file to make the changes in relative to the APK root. + */ + class Replacement( + private val pattern: String, + replacementPattern: String, + internal val targetFilePath: String, + ) { + private val patternBytes = pattern.toByteArrayPattern() + private val replacementPattern = replacementPattern.toByteArrayPattern() + + init { + if (this.patternBytes.size != this.replacementPattern.size) { + throw PatchException("Pattern and replacement pattern must have the same length: $pattern") + } + } + + /** + * Replaces the [patternBytes] with the [replacementPattern] in the [targetFileBytes]. + * + * @param targetFileBytes The bytes of the file to make the changes in. + */ + fun replacePattern(targetFileBytes: ByteArray) { + val startIndex = indexOfPatternIn(targetFileBytes) + + if (startIndex == -1) { + throw PatchException("Pattern not found in target file: $pattern") + } + + replacementPattern.copyInto(targetFileBytes, startIndex) + } + + // TODO: Allow searching in a file channel instead of a byte array to reduce memory usage. + /** + * Returns the index of the first occurrence of [patternBytes] in the haystack + * using the Boyer-Moore algorithm. + * + * @param haystack The array to search in. + * + * @return The index of the first occurrence of the [patternBytes] in the haystack or -1 + * if the [patternBytes] is not found. + */ + private fun indexOfPatternIn(haystack: ByteArray): Int { + val needle = patternBytes + + val haystackLength = haystack.size - 1 + val needleLength = needle.size - 1 + val right = IntArray(256) { -1 } + + for (i in 0 until needleLength) right[needle[i].toInt().and(0xFF)] = i + + var skip: Int + for (i in 0..haystackLength - needleLength) { + skip = 0 + + for (j in needleLength - 1 downTo 0) + if (needle[j] != haystack[i + j]) { + skip = max(1, j - right[haystack[i + j].toInt().and(0xFF)]) + + break + } + + if (skip == 0) return i + } + return -1 + } + + companion object { + /** + * Convert a string representing a pattern of hexadecimal bytes to a byte array. + * + * @return The byte array representing the pattern. + * @throws PatchException If the pattern is invalid. + */ + private fun String.toByteArrayPattern() = try { + split(" ").map { it.toInt(16).toByte() }.toByteArray() + } catch (e: NumberFormatException) { + throw PatchException( + "Could not parse pattern: $this. A pattern is a sequence of case insensitive strings " + + "representing hexadecimal bytes separated by spaces", + e, + ) + } + } + } +} diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch.kt index c1c849c01..7c461f6ee 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch.kt @@ -2,17 +2,21 @@ package app.revanced.patches.shared.misc.integrations import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchException import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.IntegrationsFingerprint.IRegisterResolver +import app.revanced.patches.shared.misc.integrations.fingerprints.ReVancedUtilsPatchesVersionFingerprint +import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.ClassDef import com.android.tools.smali.dexlib2.iface.Method +import java.util.jar.JarFile abstract class BaseIntegrationsPatch( private val hooks: Set, -) : BytecodePatch(hooks) { +) : BytecodePatch(hooks + setOf(ReVancedUtilsPatchesVersionFingerprint)) { @Deprecated( "Use the constructor without the integrationsDescriptor parameter", @@ -34,6 +38,46 @@ abstract class BaseIntegrationsPatch( hooks.forEach { hook -> hook.invoke(INTEGRATIONS_CLASS_DESCRIPTOR) } + + // Modify Utils method to include the patches release version version. + ReVancedUtilsPatchesVersionFingerprint.resultOrThrow().mutableMethod.apply { + val manifestValue = getPatchesManifestEntry("Version") + + addInstructions( + 0, + """ + const-string v0, "$manifestValue" + return-object v0 + """, + ) + } + } + + /** + * @return The value for the manifest entry, + * or "Unknown" if the entry does not exist or is blank. + */ + @Suppress("SameParameterValue") + private fun getPatchesManifestEntry(attributeKey: String) = JarFile(getCurrentJarFilePath()).use { jarFile -> + jarFile.manifest.mainAttributes.entries.firstOrNull { it.key.toString() == attributeKey }?.value?.toString() + ?: "Unknown" + } + + /** + * @return The file path for the jar this classfile is contained inside. + */ + private fun getCurrentJarFilePath(): String { + val className = object {}::class.java.enclosingClass.name.replace('.', '/') + ".class" + val classUrl = object {}::class.java.classLoader.getResource(className) + if (classUrl != null) { + val urlString = classUrl.toString() + + if (urlString.startsWith("jar:file:")) { + val end = urlString.indexOf('!') + return urlString.substring("jar:file:".length, end) + } + } + throw IllegalStateException("Not running from inside a JAR file.") } /** @@ -50,7 +94,7 @@ abstract class BaseIntegrationsPatch( strings: Iterable? = null, customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null, private val insertIndexResolver: ((Method) -> Int) = object : IHookInsertIndexResolver {}, - private val contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {} + private val contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {}, ) : MethodFingerprint( returnType, accessFlags, @@ -59,9 +103,11 @@ abstract class BaseIntegrationsPatch( strings, customFingerprint, ) { - @Deprecated("Previous constructor that is missing the insert index." + + @Deprecated( + "Previous constructor that is missing the insert index." + "Here only for binary compatibility, " + - "and this can be removed after the next major version update.") + "and this can be removed after the next major version update.", + ) constructor( returnType: String? = null, accessFlags: Int? = null, @@ -69,7 +115,7 @@ abstract class BaseIntegrationsPatch( opcodes: Iterable? = null, strings: Iterable? = null, customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null, - contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {} + contextRegisterResolver: (Method) -> Int = object : IRegisterResolver {}, ) : this( returnType, accessFlags, @@ -78,7 +124,7 @@ abstract class BaseIntegrationsPatch( strings, customFingerprint, object : IHookInsertIndexResolver {}, - contextRegisterResolver + contextRegisterResolver, ) fun invoke(integrationsDescriptor: String) { @@ -103,7 +149,7 @@ abstract class BaseIntegrationsPatch( } } - private companion object { - private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/shared/Utils;" + internal companion object { + internal const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/shared/Utils;" } } diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/integrations/fingerprints/ReVancedUtilsPatchesVersionFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/misc/integrations/fingerprints/ReVancedUtilsPatchesVersionFingerprint.kt new file mode 100644 index 000000000..2f577087e --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/misc/integrations/fingerprints/ReVancedUtilsPatchesVersionFingerprint.kt @@ -0,0 +1,16 @@ +package app.revanced.patches.shared.misc.integrations.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch +import com.android.tools.smali.dexlib2.AccessFlags + +internal object ReVancedUtilsPatchesVersionFingerprint : MethodFingerprint( + accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, + returnType = "Ljava/lang/String;", + parameters = listOf(), + customFingerprint = { methodDef, classDef -> + methodDef.name == "getPatchesReleaseVersion" && + classDef.type == BaseIntegrationsPatch.INTEGRATIONS_CLASS_DESCRIPTOR + } +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/mapping/ResourceMappingPatch.kt b/src/main/kotlin/app/revanced/patches/shared/misc/mapping/ResourceMappingPatch.kt index 23831eb41..388c4ef61 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/mapping/ResourceMappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/mapping/ResourceMappingPatch.kt @@ -8,19 +8,15 @@ import java.util.concurrent.Executors import java.util.concurrent.TimeUnit object ResourceMappingPatch : ResourcePatch() { - internal lateinit var resourceMappings: List - private set + private val resourceMappings = Collections.synchronizedList(mutableListOf()) private val THREAD_COUNT = Runtime.getRuntime().availableProcessors() private val threadPoolExecutor = Executors.newFixedThreadPool(THREAD_COUNT) override fun execute(context: ResourceContext) { - // save the file in memory to concurrently read from + // sSve the file in memory to concurrently read from it. val resourceXmlFile = context.get("res/values/public.xml").readBytes() - // create a synchronized list to store the resource mappings - val mappings = Collections.synchronizedList(mutableListOf()) - for (threadIndex in 0 until THREAD_COUNT) { threadPoolExecutor.execute thread@{ context.xmlEditor[resourceXmlFile.inputStream()].use { editor -> @@ -33,7 +29,7 @@ object ResourceMappingPatch : ResourcePatch() { val batchStart = jobSize * threadIndex val batchEnd = jobSize * (threadIndex + 1) element@ for (i in batchStart until batchEnd) { - // make sure to not go out of bounds when rounding errors occur at calculating the jobSize + // Prevent out of bounds. if (i >= resourcesLength) return@thread val node = resources.item(i) @@ -46,18 +42,18 @@ object ResourceMappingPatch : ResourcePatch() { val id = node.getAttribute("id").substring(2).toLong(16) - mappings.add(ResourceElement(typeAttribute, nameAttribute, id)) + resourceMappings.add(ResourceElement(typeAttribute, nameAttribute, id)) } } } } - threadPoolExecutor - .also { it.shutdown() } - .awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS) - - resourceMappings = mappings + threadPoolExecutor.also { it.shutdown() }.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS) } + operator fun get(type: String, name: String) = resourceMappings.first { + it.type == type && it.name == name + }.id + data class ResourceElement(val type: String, val name: String, val id: Long) } diff --git a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference.kt b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference.kt index f9525f92a..787115dba 100644 --- a/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference.kt +++ b/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/NonInteractivePreference.kt @@ -16,10 +16,19 @@ import org.w3c.dom.Document @Suppress("MemberVisibilityCanBePrivate") class NonInteractivePreference( key: String, + titleKey: String = "${key}_title", summaryKey: String? = "${key}_summary", tag: String = "Preference", val selectable: Boolean = false -) : BasePreference(null, "${key}_title", summaryKey, tag) { +) : BasePreference(key, titleKey, summaryKey, tag) { + + @Deprecated("Here only for binary compatibility, and should be removed after the next major version update.") + constructor( + key: String, + summaryKey: String? = "${key}_summary", + tag: String = "Preference", + selectable: Boolean = false + ) : this(key, "${key}_title", summaryKey, tag, selectable) override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) = super.serialize(ownerDocument, resourceCallback).apply { diff --git a/src/main/kotlin/app/revanced/patches/spotify/navbar/PremiumNavbarTabResourcePatch.kt b/src/main/kotlin/app/revanced/patches/spotify/navbar/PremiumNavbarTabResourcePatch.kt index 5f2ac4b22..40018925d 100644 --- a/src/main/kotlin/app/revanced/patches/spotify/navbar/PremiumNavbarTabResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/spotify/navbar/PremiumNavbarTabResourcePatch.kt @@ -11,12 +11,11 @@ object PremiumNavbarTabResourcePatch : ResourcePatch() { internal var premiumTabId = -1L override fun execute(context: ResourceContext) { - premiumTabId = ResourceMappingPatch.resourceMappings.single { - it.type == "id" && it.name == "premium_tab" - }.id + premiumTabId = ResourceMappingPatch["id", "premium_tab"] - showBottomNavigationItemsTextId = ResourceMappingPatch.resourceMappings.single { - it.type == "bool" && it.name == "show_bottom_navigation_items_text" - }.id + showBottomNavigationItemsTextId = ResourceMappingPatch[ + "bool", + "show_bottom_navigation_items_text", + ] } } diff --git a/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt b/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt index 173abd998..7642837f3 100644 --- a/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt @@ -1,17 +1,16 @@ package app.revanced.patches.strava.subscription - -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.strava.subscription.fingerprints.GetSubscribedFingerprint +import app.revanced.util.exception @Patch( name = "Unlock subscription features", description = "Unlocks \"Routes\", \"Matched Runs\" and \"Segment Efforts\".", - compatiblePackages = [CompatiblePackage("com.strava", ["320.12"])] + compatiblePackages = [CompatiblePackage("com.strava")], ) @Suppress("unused") object UnlockSubscriptionPatch : BytecodePatch(setOf(GetSubscribedFingerprint)) { diff --git a/src/main/kotlin/app/revanced/patches/tumblr/fixes/FixOldVersionsPatch.kt b/src/main/kotlin/app/revanced/patches/tumblr/fixes/FixOldVersionsPatch.kt index 9fe883d9e..4a3377857 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/fixes/FixOldVersionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/fixes/FixOldVersionsPatch.kt @@ -5,34 +5,63 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.tumblr.fixes.fingerprints.AddQueryParamFingerprint import app.revanced.patches.tumblr.fixes.fingerprints.HttpPathParserFingerprint import app.revanced.util.exception @Patch( name = "Fix old versions", description = "Fixes old versions of the app (v33.2 and earlier) breaking due to Tumblr removing remnants of Tumblr" + - " Live from the API, which causes many requests to fail. This patch has no effect on newer versions of the app.", + " Live from the API, which causes many requests to fail. This patch has no effect on newer versions of the app.", compatiblePackages = [CompatiblePackage("com.tumblr")], use = false, ) @Suppress("unused") object FixOldVersionsPatch : BytecodePatch( - setOf(HttpPathParserFingerprint), + setOf(HttpPathParserFingerprint, AddQueryParamFingerprint), ) { - override fun execute(context: BytecodeContext) = + override fun execute(context: BytecodeContext) { + val liveQueryParameters = listOf( + ",?live_now", + ",?live_streaming_user_id", + ) + HttpPathParserFingerprint.result?.let { val endIndex = it.scanResult.patternScanResult!!.endIndex - - it.mutableMethod.addInstructions( - endIndex + 1, - """ - # Remove "?live_now" from the request path p2. - # p2 = p2.replace(p1, p3) - const-string p1, ",?live_now" - const-string p3, "" - invoke-virtual {p2, p1, p3}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String; - move-result-object p2 - """, - ) + // Remove the live query parameters from the path when it's specified via a @METHOD annotation. + for (liveQueryParameter in liveQueryParameters) { + it.mutableMethod.addInstructions( + endIndex + 1, + """ + # urlPath = urlPath.replace(liveQueryParameter, "") + const-string p1, "$liveQueryParameter" + const-string p3, "" + invoke-virtual {p2, p1, p3}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String; + move-result-object p2 + """, + ) + } } ?: throw HttpPathParserFingerprint.exception + + AddQueryParamFingerprint.result?.let { + // Remove the live query parameters when passed via a parameter which has the @Query annotation. + // e.g. an API call could be defined like this: + // @GET("api/me/info") + // ApiResponse getCurrentUserInfo(@Query("fields[blog]") String value) + // which would result in the path "api/me/inf0?fields[blog]=${value}" + // Here we make sure that this value doesn't contain the broken query parameters. + for (liveQueryParameter in liveQueryParameters) { + it.mutableMethod.addInstructions( + 0, + """ + # queryParameterValue = queryParameterValue.replace(liveQueryParameter, "") + const-string v0, "$liveQueryParameter" + const-string v1, "" + invoke-virtual {p2, v0, v1}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String; + move-result-object p2 + """, + ) + } + } ?: throw AddQueryParamFingerprint.exception + } } diff --git a/src/main/kotlin/app/revanced/patches/tumblr/fixes/fingerprints/AddQueryParamFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/fixes/fingerprints/AddQueryParamFingerprint.kt new file mode 100644 index 000000000..a908d7e64 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/tumblr/fixes/fingerprints/AddQueryParamFingerprint.kt @@ -0,0 +1,11 @@ +package app.revanced.patches.tumblr.fixes.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint + +// Fingerprint for the addQueryParam method from retrofit2 +// https://github.com/square/retrofit/blob/trunk/retrofit/src/main/java/retrofit2/RequestBuilder.java#L186 +// Injecting here allows modifying dynamically set query parameters +internal object AddQueryParamFingerprint : MethodFingerprint( + strings = listOf("Malformed URL. Base: ", ", Relative: "), + parameters = listOf("Ljava/lang/String;", "Ljava/lang/String;", "Z"), +) diff --git a/src/main/kotlin/app/revanced/patches/tumblr/fixes/fingerprints/HttpPathParserFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/fixes/fingerprints/HttpPathParserFingerprint.kt index 0ef376ed9..e807ef22b 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/fixes/fingerprints/HttpPathParserFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/fixes/fingerprints/HttpPathParserFingerprint.kt @@ -3,13 +3,13 @@ package app.revanced.patches.tumblr.fixes.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.Opcode -// Fingerprint for the parseHttpMethodAndPath from retrofit2 +// Fingerprint for the parseHttpMethodAndPath method from retrofit2 // https://github.com/square/retrofit/blob/ebf87b10997e2136af4d335276fa950221852c64/retrofit/src/main/java/retrofit2/RequestFactory.java#L270-L302 // Injecting here allows modifying the path/query params of API endpoints defined via annotations -object HttpPathParserFingerprint : MethodFingerprint( +internal object HttpPathParserFingerprint : MethodFingerprint( strings = listOf("Only one HTTP method is allowed. Found: %s and %s."), opcodes = listOf( Opcode.IPUT_OBJECT, - Opcode.IPUT_BOOLEAN - ) -) \ No newline at end of file + Opcode.IPUT_BOOLEAN, + ), +) diff --git a/src/main/kotlin/app/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatch.kt b/src/main/kotlin/app/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatch.kt new file mode 100644 index 000000000..4e358f5a5 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatch.kt @@ -0,0 +1,29 @@ +package app.revanced.patches.twitter.misc.links + +import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.addInstructions +import app.revanced.patcher.patch.BytecodePatch +import app.revanced.patcher.patch.annotation.CompatiblePackage +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.twitter.misc.links.fingerprints.SanitizeSharingLinksFingerprint +import app.revanced.util.exception + +@Patch( + name = "Sanitize sharing links", + description = "Removes the tracking query parameters from links before they are shared.", + compatiblePackages = [CompatiblePackage("com.twitter.android")], +) +object SanitizeSharingLinksPatch : BytecodePatch( + setOf(SanitizeSharingLinksFingerprint), +) { + override fun execute(context: BytecodeContext) { + SanitizeSharingLinksFingerprint.result?.mutableMethod?.addInstructions( + 0, + """ + # Method takes in a link (string, param 0) and then appends the tracking query params, + # so all we need to do is return back the passed-in string + return-object p0 + """, + ) ?: throw SanitizeSharingLinksFingerprint.exception + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/twitter/misc/links/fingerprints/SanitizeSharingLinksFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitter/misc/links/fingerprints/SanitizeSharingLinksFingerprint.kt new file mode 100644 index 000000000..4e90fffb8 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/twitter/misc/links/fingerprints/SanitizeSharingLinksFingerprint.kt @@ -0,0 +1,8 @@ +package app.revanced.patches.twitter.misc.links.fingerprints + +import app.revanced.patcher.fingerprint.MethodFingerprint + +internal object SanitizeSharingLinksFingerprint : MethodFingerprint( + strings = listOf("", "shareParam", "sessionToken"), + returnType = "Ljava/lang/String;", +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt index 063f033ec..99d73e4cd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt @@ -42,7 +42,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsResourcePatch.kt index c89ba7eca..8cc3ed113 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsResourcePatch.kt @@ -14,8 +14,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch LithoFilterPatch::class, SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) object HideAdsResourcePatch : ResourcePatch() { private const val FILTER_CLASS_DESCRIPTOR = @@ -30,16 +30,16 @@ object HideAdsResourcePatch : ResourcePatch() { SwitchPreference("revanced_hide_general_ads"), SwitchPreference("revanced_hide_fullscreen_ads"), SwitchPreference("revanced_hide_buttoned_ads"), - SwitchPreference("revanced_hide_paid_content_ads"), + SwitchPreference("revanced_hide_paid_promotion_label"), SwitchPreference("revanced_hide_self_sponsor_ads"), SwitchPreference("revanced_hide_products_banner"), SwitchPreference("revanced_hide_shopping_links"), SwitchPreference("revanced_hide_web_search_results"), - SwitchPreference("revanced_hide_merchandise_banners") + SwitchPreference("revanced_hide_merchandise_banners"), ) LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR) - adAttributionId = ResourceMappingPatch.resourceMappings.single { it.name == "ad_attribution" }.id + adAttributionId = ResourceMappingPatch["id", "ad_attribution"] } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt index a90956e0f..b3094ea2c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt @@ -36,7 +36,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt index 06e496e0e..c000e0898 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt @@ -41,7 +41,9 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt index 89398b8d2..87d91821c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlBytecodePatch.kt @@ -29,7 +29,9 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt index 7fdacaeff..a5de50f0b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt @@ -38,7 +38,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt index 6147a3d54..10e1de2de 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt @@ -35,7 +35,9 @@ import app.revanced.util.resultOrThrow "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt index e18a8f076..d3df068c2 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt @@ -38,7 +38,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt index 3c4be5ad0..c428b2497 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt @@ -40,7 +40,9 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt index eb5ef93cd..a4c7de09e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt @@ -36,7 +36,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt index 5e21c6074..c49b74f59 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt @@ -20,7 +20,7 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod dependencies = [ IntegrationsPatch::class, PlayerTypeHookPatch::class, - SwipeControlsResourcePatch::class + SwipeControlsResourcePatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -42,17 +42,22 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod "19.06.39", "19.07.40", "19.08.36", - "19.09.37" - ] - ) - ] + "19.09.38", + "19.10.39", + "19.11.43", // 19.12.x has an issue with opening YT using external links, + // and the app then crashes if double tap to skip forward/back is immediately used. + // The stack trace shows a call coming from integrations SwipeController, + // but it may be a bug in YT itself as other target versions do not have this issue. + ], + ), + ], ) @Suppress("unused") object SwipeControlsBytecodePatch : BytecodePatch( setOf( MainActivityFingerprint, - SwipeControlsHostActivityFingerprint - ) + SwipeControlsHostActivityFingerprint, + ), ) { override fun execute(context: BytecodeContext) { val wrapperClass = SwipeControlsHostActivityFingerprint.result!!.mutableClass @@ -74,9 +79,9 @@ object SwipeControlsBytecodePatch : BytecodePatch( accessFlags and AccessFlags.FINAL.value.inv(), annotations, hiddenApiRestrictions, - implementation + implementation, ).toMutable() } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsResourcePatch.kt index 70fe6e505..51a7c9919 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsResourcePatch.kt @@ -24,6 +24,7 @@ internal object SwipeControlsResourcePatch : ResourcePatch() { SwitchPreference("revanced_swipe_press_to_engage"), SwitchPreference("revanced_swipe_haptic_feedback"), SwitchPreference("revanced_swipe_save_and_restore_brightness"), + SwitchPreference("revanced_swipe_lowest_value_enable_auto_brightness"), TextPreference("revanced_swipe_overlay_timeout", inputType = InputType.NUMBER), TextPreference("revanced_swipe_text_overlay_size", inputType = InputType.NUMBER), TextPreference("revanced_swipe_overlay_background_alpha", inputType = InputType.NUMBER), diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt index 00f15cab3..188fa14b0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt @@ -40,7 +40,9 @@ import app.revanced.util.exception "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt index 2a6284827..deaebe49c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt @@ -39,7 +39,9 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt index d96caab79..6eba4ff47 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt @@ -14,7 +14,7 @@ import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.patches.youtube.shared.fingerprints.LayoutConstructorFingerprint import app.revanced.util.exception -import app.revanced.util.findIndexForIdResource +import app.revanced.util.indexOfIdResourceOrThrow import com.android.tools.smali.dexlib2.iface.instruction.Instruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction @@ -27,7 +27,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference IntegrationsPatch::class, SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], compatiblePackages = [ CompatiblePackage( @@ -49,27 +49,29 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.06.39", "19.07.40", "19.08.36", - "19.09.37" - ] - ) - ] + "19.09.38", + "19.10.39", + "19.11.43", + ], + ), + ], ) @Suppress("unused") object HideAutoplayButtonPatch : BytecodePatch( - setOf(LayoutConstructorFingerprint) + setOf(LayoutConstructorFingerprint), ) { override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_autoplay_button") + SwitchPreference("revanced_hide_autoplay_button"), ) LayoutConstructorFingerprint.result?.mutableMethod?.apply { val layoutGenMethodInstructions = implementation!!.instructions // resolve the offsets of where to insert the branch instructions and ... - val insertIndex = findIndexForIdResource("autonav_preview_stub") + val insertIndex = indexOfIdResourceOrThrow("autonav_preview_stub") // where to branch away val branchIndex = @@ -90,8 +92,8 @@ object HideAutoplayButtonPatch : BytecodePatch( move-result v$clobberRegister if-eqz v$clobberRegister, :hidden """, - ExternalLabel("hidden", jumpInstruction) + ExternalLabel("hidden", jumpInstruction), ) } ?: throw LayoutConstructorFingerprint.exception } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt index 88e856686..7ee8e1f3c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt @@ -40,7 +40,9 @@ import com.android.tools.smali.dexlib2.Opcode "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt index c660344de..1cdbe20d1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt @@ -47,7 +47,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37", + "19.09.38", + "19.10.39", + "19.11.43" ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt index b51f3270e..441709113 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt @@ -44,7 +44,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt index b11b24435..3877397a4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt @@ -38,7 +38,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt index 08b54204f..e8265b68d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) internal object AlbumCardsResourcePatch : ResourcePatch() { @@ -22,11 +22,9 @@ internal object AlbumCardsResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_album_cards") + SwitchPreference("revanced_hide_album_cards"), ) - albumCardId = ResourceMappingPatch.resourceMappings.single { - it.type == "layout" && it.name == "album_card" - }.id + albumCardId = ResourceMappingPatch["layout", "album_card"] } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt index 34e2232bb..5eee2b3bc 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt @@ -1,73 +1,13 @@ package app.revanced.patches.youtube.layout.hide.breakingnews -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.InstructionExtensions.addInstruction -import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.annotation.CompatiblePackage -import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.youtube.layout.hide.breakingnews.fingerprints.BreakingNewsFingerprint -import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch -import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsPatch -@Patch( - name = "Hide breaking news shelf", - description = "Adds an option to hide the breaking news shelf on the homepage tab.", - dependencies = [ - IntegrationsPatch::class, - BreakingNewsResourcePatch::class - ], - compatiblePackages = [ - CompatiblePackage( - "com.google.android.youtube", - [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.43", - "18.48.39", - "18.49.37", - "19.01.34", - "19.02.39", - "19.03.36", - "19.04.38", - "19.05.36", - "19.06.39", - "19.07.40", - "19.08.36", - "19.09.37" - ] - ) - ] -) -@Suppress("unused") +@Deprecated("This patch has been merged to HideLayoutComponentsPatch.") object BreakingNewsPatch : BytecodePatch( - setOf(BreakingNewsFingerprint) + dependencies = setOf(HideLayoutComponentsPatch::class), ) { override fun execute(context: BytecodeContext) { - BreakingNewsFingerprint.result?.let { - val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1 - val moveResultIndex = insertIndex - 1 - - it.mutableMethod.apply { - val breakingNewsViewRegister = - getInstruction(moveResultIndex).registerA - - addInstruction( - insertIndex, - """ - invoke-static {v$breakingNewsViewRegister}, - Lapp/revanced/integrations/youtube/patches/HideBreakingNewsPatch; - -> - hideBreakingNews(Landroid/view/View;)V - """ - ) - } - - } ?: throw BreakingNewsFingerprint.exception - } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsResourcePatch.kt deleted file mode 100644 index 81b69fe48..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsResourcePatch.kt +++ /dev/null @@ -1,32 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.breakingnews - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.all.misc.resources.AddResourcesPatch -import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch -import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.youtube.misc.settings.SettingsPatch - -@Patch( - dependencies = [ - SettingsPatch::class, - ResourceMappingPatch::class, - AddResourcesPatch::class - ], -) -internal object BreakingNewsResourcePatch : ResourcePatch() { - internal var horizontalCardListId: Long = -1 - - override fun execute(context: ResourceContext) { - AddResourcesPatch(this::class) - - SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_breaking_news") - ) - - horizontalCardListId = ResourceMappingPatch.resourceMappings.single { - it.type == "layout" && it.name == "horizontal_card_list" - }.id - } -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/fingerprints/BreakingNewsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/fingerprints/BreakingNewsFingerprint.kt deleted file mode 100644 index a67ad6f05..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/fingerprints/BreakingNewsFingerprint.kt +++ /dev/null @@ -1,20 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.breakingnews.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patches.youtube.layout.hide.breakingnews.BreakingNewsResourcePatch -import app.revanced.util.patch.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags -import com.android.tools.smali.dexlib2.Opcode - -internal object BreakingNewsFingerprint : LiteralValueFingerprint( - accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, - opcodes = listOf( - Opcode.CONST, - Opcode.CONST_4, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.CHECK_CAST, - Opcode.IPUT_OBJECT, - ), - literalSupplier = { BreakingNewsResourcePatch.horizontalCardListId } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt index 9cdb9c9b9..9a6ee70e6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt @@ -38,7 +38,9 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] @@ -55,9 +57,10 @@ object CommentsPatch : ResourcePatch() { PreferenceScreen( "revanced_comments_screen", preferences = setOf( - SwitchPreference("revanced_hide_comments_section"), - SwitchPreference("revanced_hide_preview_comment") - ) + SwitchPreference("revanced_hide_preview_comment"), + SwitchPreference("revanced_hide_comments_section") + ), + sorting = PreferenceScreen.Sorting.UNSORTED ) ) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt index b429d69a6..fa0f45934 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt @@ -38,7 +38,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt index 4e61c0953..f1763704c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) internal object CrowdfundingBoxResourcePatch : ResourcePatch() { @@ -22,11 +22,12 @@ internal object CrowdfundingBoxResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_crowdfunding_box") + SwitchPreference("revanced_hide_crowdfunding_box"), ) - crowdfundingBoxId = ResourceMappingPatch.resourceMappings.single { - it.type == "layout" && it.name == "donation_companion" - }.id + crowdfundingBoxId = ResourceMappingPatch[ + "layout", + "donation_companion", + ] } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt index aecd7cf12..02145fa5f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt @@ -41,7 +41,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsResourcePatch.kt index 13231b7bd..40878824a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) internal object HideEndscreenCardsResourcePatch : ResourcePatch() { @@ -24,15 +24,13 @@ internal object HideEndscreenCardsResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_endscreen_cards") + SwitchPreference("revanced_hide_endscreen_cards"), ) - fun findEndscreenResourceId(name: String) = ResourceMappingPatch.resourceMappings.single { - it.type == "layout" && it.name == "endscreen_element_layout_$name" - }.id + fun idOf(name: String) = ResourceMappingPatch["layout", "endscreen_element_layout_$name"] - layoutCircle = findEndscreenResourceId("circle") - layoutIcon = findEndscreenResourceId("icon") - layoutVideo = findEndscreenResourceId("video") + layoutCircle = idOf("circle") + layoutIcon = idOf("icon") + layoutVideo = idOf("video") } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt index 0a836aa5a..f63a78bf0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt @@ -38,7 +38,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt index a10d22a09..d49df7a5b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarResourcePatch.kt @@ -25,15 +25,12 @@ internal object HideFilterBarResourcePatch : ResourcePatch() { SwitchPreference("revanced_hide_filter_bar_feed_in_feed"), SwitchPreference("revanced_hide_filter_bar_feed_in_search"), SwitchPreference("revanced_hide_filter_bar_feed_in_related_videos"), - ) - ) + ), + ), ) - relatedChipCloudMarginId = "related_chip_cloud_reduced_margins".layoutResourceId("layout") - filterBarHeightId = "filter_bar_height".layoutResourceId() - barContainerHeightId = "bar_container_height".layoutResourceId() + relatedChipCloudMarginId = ResourceMappingPatch["layout", "related_chip_cloud_reduced_margins"] + filterBarHeightId = ResourceMappingPatch["dimen", "filter_bar_height"] + barContainerHeightId = ResourceMappingPatch["dimen", "bar_container_height"] } - - private fun String.layoutResourceId(type: String = "dimen") = - ResourceMappingPatch.resourceMappings.single { it.type == type && it.name == this }.id -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt index 1b4606c4e..2ddda6f79 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt @@ -34,7 +34,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt index 7dbd6a154..30dd8e84d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonResourcePatch.kt @@ -1,7 +1,6 @@ package app.revanced.patches.youtube.layout.hide.floatingmicrophone import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.all.misc.resources.AddResourcesPatch @@ -13,8 +12,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) internal object HideFloatingMicrophoneButtonResourcePatch : ResourcePatch() { internal var fabButtonId: Long = -1 @@ -23,10 +22,9 @@ internal object HideFloatingMicrophoneButtonResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences( - SwitchPreference("revanced_hide_floating_microphone_button") + SwitchPreference("revanced_hide_floating_microphone_button"), ) - fabButtonId = ResourceMappingPatch.resourceMappings.find { it.type == "id" && it.name == "fab" }?.id - ?: throw PatchException("Can not find required fab button resource id") + fabButtonId = ResourceMappingPatch["id", "fab"] } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt index 0a4ea85b0..dcefb0d1a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt @@ -34,7 +34,9 @@ import app.revanced.util.exception "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index 5a7428d7e..8944dbbf9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -1,6 +1,7 @@ package app.revanced.patches.youtube.layout.hide.general import app.revanced.patcher.data.BytecodeContext +import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -11,22 +12,19 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.all.misc.resources.AddResourcesPatch -import app.revanced.patches.shared.misc.settings.preference.InputType -import app.revanced.patches.shared.misc.settings.preference.NonInteractivePreference -import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen +import app.revanced.patches.shared.misc.settings.preference.* import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen.Sorting -import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.shared.misc.settings.preference.TextPreference +import app.revanced.patches.youtube.layout.hide.general.fingerprints.HideShowMoreButtonFingerprint import app.revanced.patches.youtube.layout.hide.general.fingerprints.ParseElementFromBufferFingerprint import app.revanced.patches.youtube.layout.hide.general.fingerprints.PlayerOverlayFingerprint import app.revanced.patches.youtube.layout.hide.general.fingerprints.ShowWatermarkFingerprint import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch -import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction +import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction @Patch( @@ -36,8 +34,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction LithoFilterPatch::class, SettingsPatch::class, AddResourcesPatch::class, + HideLayoutComponentsResourcePatch::class, NavigationBarHookPatch::class, - PlayerTypeHookPatch::class // Used by Keyword Content filter. ], compatiblePackages = [ CompatiblePackage( @@ -59,14 +57,16 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37", + "19.09.38", + "19.10.39", + "19.11.43" ], ), ], ) @Suppress("unused") object HideLayoutComponentsPatch : BytecodePatch( - setOf(ParseElementFromBufferFingerprint, PlayerOverlayFingerprint), + setOf(ParseElementFromBufferFingerprint, PlayerOverlayFingerprint, HideShowMoreButtonFingerprint), ) { private const val LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/LayoutComponentsFilter;" @@ -103,6 +103,7 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_info_panels"), SwitchPreference("revanced_hide_join_membership_button"), SwitchPreference("revanced_hide_medical_panels"), + SwitchPreference("revanced_hide_playables"), SwitchPreference("revanced_hide_quick_actions"), SwitchPreference("revanced_hide_related_videos"), SwitchPreference("revanced_hide_subscribers_community_guidelines"), @@ -115,6 +116,7 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_compact_banner"), SwitchPreference("revanced_hide_feed_survey"), SwitchPreference("revanced_hide_for_you_shelf"), + SwitchPreference("revanced_hide_horizontal_shelves"), SwitchPreference("revanced_hide_image_shelf"), SwitchPreference("revanced_hide_latest_posts_ads"), SwitchPreference("revanced_hide_mix_playlists"), @@ -122,9 +124,7 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_notify_me_button"), SwitchPreference("revanced_hide_search_result_recommendations"), SwitchPreference("revanced_hide_search_result_shelf_header"), - ) - - SettingsPatch.PreferenceScreen.FEED.addPreferences( + SwitchPreference("revanced_hide_show_more_button"), PreferenceScreen( key = "revanced_hide_keyword_content_screen", sorting = Sorting.UNSORTED, @@ -133,9 +133,9 @@ object HideLayoutComponentsPatch : BytecodePatch( SwitchPreference("revanced_hide_keyword_content_subscriptions"), SwitchPreference("revanced_hide_keyword_content_search"), TextPreference("revanced_hide_keyword_content_phrases", inputType = InputType.TEXT_MULTI_LINE), - NonInteractivePreference("revanced_hide_keyword_content_about") - ) - ) + NonInteractivePreference("revanced_hide_keyword_content_about"), + ), + ), ) SettingsPatch.PreferenceScreen.GENERAL_LAYOUT.addPreferences( @@ -203,5 +203,24 @@ object HideLayoutComponentsPatch : BytecodePatch( } // endregion + + // region Show more button + + HideShowMoreButtonFingerprint.resultOrThrow().let { + it.mutableMethod.apply { + val moveRegisterIndex = it.scanResult.patternScanResult!!.endIndex + val viewRegister = + getInstruction(moveRegisterIndex).registerA + + val insertIndex = moveRegisterIndex + 1 + addInstruction( + insertIndex, + "invoke-static { v$viewRegister }, " + + "$LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR->hideShowMoreButton(Landroid/view/View;)V", + ) + } + } + + // endregion } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsResourcePatch.kt new file mode 100644 index 000000000..c7b60d544 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsResourcePatch.kt @@ -0,0 +1,26 @@ +package app.revanced.patches.youtube.layout.hide.general + +import app.revanced.patcher.data.ResourceContext +import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotation.Patch +import app.revanced.patches.all.misc.resources.AddResourcesPatch +import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch +import app.revanced.patches.youtube.misc.settings.SettingsPatch + +@Patch( + dependencies = [ + SettingsPatch::class, + ResourceMappingPatch::class, + AddResourcesPatch::class, + ], +) +internal object HideLayoutComponentsResourcePatch : ResourcePatch() { + internal var expandButtonDownId: Long = -1 + + override fun execute(context: ResourceContext) { + expandButtonDownId = ResourceMappingPatch[ + "layout", + "expand_button_down", + ] + } +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/HideShowMoreButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/HideShowMoreButtonFingerprint.kt new file mode 100644 index 000000000..a9e66c3a6 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/fingerprints/HideShowMoreButtonFingerprint.kt @@ -0,0 +1,15 @@ +package app.revanced.patches.youtube.layout.hide.general.fingerprints + +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsResourcePatch +import app.revanced.util.patch.LiteralValueFingerprint +import com.android.tools.smali.dexlib2.Opcode + +internal object HideShowMoreButtonFingerprint : LiteralValueFingerprint( + opcodes = listOf( + Opcode.CONST, + Opcode.CONST_4, + Opcode.INVOKE_STATIC, + Opcode.MOVE_RESULT_OBJECT + ), + literalSupplier = { HideLayoutComponentsResourcePatch.expandButtonDownId } +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt index 7cb8d8658..cc8e17933 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt @@ -45,7 +45,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfocardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfocardsResourcePatch.kt index 6ac2377fa..228cc1505 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfocardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfocardsResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) object HideInfocardsResourcePatch : ResourcePatch() { @@ -22,11 +22,12 @@ object HideInfocardsResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_hide_info_cards") + SwitchPreference("revanced_hide_info_cards"), ) - drawerResourceId = ResourceMappingPatch.resourceMappings.single { - it.type == "id" && it.name == "info_cards_drawer_header" - }.id + drawerResourceId = ResourceMappingPatch[ + "id", + "info_cards_drawer_header", + ] } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt index 91948d7f2..0ad1000d6 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt @@ -1,65 +1,12 @@ package app.revanced.patches.youtube.layout.hide.loadmorebutton -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.InstructionExtensions.addInstruction -import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.annotation.CompatiblePackage -import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.youtube.layout.hide.loadmorebutton.fingerprints.HideLoadMoreButtonFingerprint -import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction +import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsPatch -@Patch( - name = "Hide \'Load more\' button", - description = "Adds an option to hide the button under videos that loads similar videos.", - dependencies = [HideLoadMoreButtonResourcePatch::class], - compatiblePackages = [ - CompatiblePackage( - "com.google.android.youtube", - [ - "18.32.39", - "18.37.36", - "18.38.44", - "18.43.45", - "18.44.41", - "18.45.43", - "18.48.39", - "18.49.37", - "19.01.34", - "19.02.39", - "19.03.36", - "19.04.38", - "19.05.36", - "19.06.39", - "19.07.40", - "19.08.36", - "19.09.37" - ] - ) - ] -) -@Suppress("unused") +@Deprecated("This patch class has been merged into HideLayoutComponentsPatch.") object HideLoadMoreButtonPatch : BytecodePatch( - setOf(HideLoadMoreButtonFingerprint) + dependencies = setOf(HideLayoutComponentsPatch::class) ) { - private const val INTEGRATIONS_CLASS_DESCRIPTOR = - "Lapp/revanced/integrations/youtube/patches/HideLoadMoreButtonPatch;" - - override fun execute(context: BytecodeContext) { - HideLoadMoreButtonFingerprint.result?.let { - it.mutableMethod.apply { - val moveRegisterIndex = it.scanResult.patternScanResult!!.endIndex - val viewRegister = - getInstruction(moveRegisterIndex).registerA - - val insertIndex = moveRegisterIndex + 1 - addInstruction( - insertIndex, - "invoke-static { v$viewRegister }, " + - "$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V" - ) - } - } ?: throw HideLoadMoreButtonFingerprint.exception - } -} + override fun execute(context: BytecodeContext) {} +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonResourcePatch.kt deleted file mode 100644 index 86d4734f1..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonResourcePatch.kt +++ /dev/null @@ -1,32 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.loadmorebutton - -import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.ResourcePatch -import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.all.misc.resources.AddResourcesPatch -import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch -import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.youtube.misc.settings.SettingsPatch - -@Patch( - dependencies = [ - SettingsPatch::class, - ResourceMappingPatch::class, - AddResourcesPatch::class - ] -) -internal object HideLoadMoreButtonResourcePatch : ResourcePatch() { - internal var expandButtonDownId: Long = -1 - - override fun execute(context: ResourceContext) { - AddResourcesPatch(this::class) - - SettingsPatch.PreferenceScreen.FEED.addPreferences( - SwitchPreference("revanced_hide_load_more_button") - ) - - expandButtonDownId = ResourceMappingPatch.resourceMappings.single { - it.type == "layout" && it.name == "expand_button_down" - }.id - } -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/fingerprints/HideLoadMoreButtonFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/fingerprints/HideLoadMoreButtonFingerprint.kt deleted file mode 100644 index 2433ae38b..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/fingerprints/HideLoadMoreButtonFingerprint.kt +++ /dev/null @@ -1,15 +0,0 @@ -package app.revanced.patches.youtube.layout.hide.loadmorebutton.fingerprints - -import app.revanced.patches.youtube.layout.hide.loadmorebutton.HideLoadMoreButtonResourcePatch -import app.revanced.util.patch.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.Opcode - -internal object HideLoadMoreButtonFingerprint : LiteralValueFingerprint( - opcodes = listOf( - Opcode.CONST, - Opcode.CONST_4, - Opcode.INVOKE_STATIC, - Opcode.MOVE_RESULT_OBJECT - ), - literalSupplier = { HideLoadMoreButtonResourcePatch.expandButtonDownId } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt index 904de9c05..9d1d48a90 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt @@ -39,7 +39,9 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] @@ -64,6 +66,7 @@ object HidePlayerFlyoutMenuPatch : ResourcePatch() { SwitchPreference("revanced_hide_player_flyout_report"), SwitchPreference("revanced_hide_player_flyout_help"), SwitchPreference("revanced_hide_player_flyout_speed"), + SwitchPreference("revanced_hide_player_flyout_lock_screen"), SwitchPreference("revanced_hide_player_flyout_more_info"), SwitchPreference("revanced_hide_player_flyout_audio_track"), SwitchPreference("revanced_hide_player_flyout_watch_in_vr"), diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt index 5758d813f..8ee810b97 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt @@ -36,7 +36,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt index 8e8434af9..485ec1044 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt @@ -41,7 +41,9 @@ import app.revanced.patches.youtube.shared.fingerprints.SeekbarOnDrawFingerprint "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt index e65eced6c..3471c5dff 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt @@ -1,8 +1,5 @@ package app.revanced.patches.youtube.layout.hide.shorts -import app.revanced.util.exception -import app.revanced.util.findIndexForIdResource -import app.revanced.util.injectHideViewCall import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -15,7 +12,9 @@ import app.revanced.patches.youtube.layout.hide.shorts.fingerprints.* import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch -import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch +import app.revanced.util.exception +import app.revanced.util.indexOfIdResourceOrThrow +import app.revanced.util.injectHideViewCall import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction @@ -29,11 +28,11 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction HideShortsComponentsResourcePatch::class, ResourceMappingPatch::class, NavigationBarHookPatch::class, - PlayerTypeHookPatch::class ], compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.32.39", "18.37.36", "18.38.44", @@ -50,10 +49,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" - ] - ) - ] + "19.09.38", + "19.10.39", + "19.11.43", + ], + ), + ], ) @Suppress("unused") object HideShortsComponentsPatch : BytecodePatch( @@ -62,8 +63,8 @@ object HideShortsComponentsPatch : BytecodePatch( ReelConstructorFingerprint, BottomNavigationBarFingerprint, RenderBottomNavigationBarParentFingerprint, - SetPivotBarVisibilityParentFingerprint - ) + SetPivotBarVisibilityParentFingerprint, + ), ) { private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/ShortsFilter;" @@ -81,7 +82,7 @@ object HideShortsComponentsPatch : BytecodePatch( insertIndex, viewRegister, FILTER_CLASS_DESCRIPTOR, - "hideShortsShelf" + "hideShortsShelf", ) } } // Do not throw an exception if not resolved. @@ -95,7 +96,6 @@ object HideShortsComponentsPatch : BytecodePatch( ShortsButtons.entries.forEach { button -> button.injectHideCall(it.mutableMethod) } } ?: throw CreateShortsButtonsFingerprint.exception - // endregion // region Hide the Shorts buttons in newer versions of YouTube. @@ -108,8 +108,9 @@ object HideShortsComponentsPatch : BytecodePatch( // Hook to get the pivotBar view. SetPivotBarVisibilityParentFingerprint.result?.let { - if (!SetPivotBarVisibilityFingerprint.resolve(context, it.classDef)) + if (!SetPivotBarVisibilityFingerprint.resolve(context, it.classDef)) { throw SetPivotBarVisibilityFingerprint.exception + } SetPivotBarVisibilityFingerprint.result!!.let { result -> result.mutableMethod.apply { @@ -118,7 +119,7 @@ object HideShortsComponentsPatch : BytecodePatch( addInstruction( insertIndex, "sput-object v$viewRegister, $FILTER_CLASS_DESCRIPTOR->pivotBar:" + - "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;" + "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;", ) } } @@ -126,8 +127,9 @@ object HideShortsComponentsPatch : BytecodePatch( // Hook to hide the navigation bar when Shorts are being played. RenderBottomNavigationBarParentFingerprint.result?.let { - if (!RenderBottomNavigationBarFingerprint.resolve(context, it.classDef)) + if (!RenderBottomNavigationBarFingerprint.resolve(context, it.classDef)) { throw RenderBottomNavigationBarFingerprint.exception + } RenderBottomNavigationBarFingerprint.result!!.mutableMethod.apply { addInstruction(0, "invoke-static { }, $FILTER_CLASS_DESCRIPTOR->hideNavigationBar()V") @@ -144,7 +146,7 @@ object HideShortsComponentsPatch : BytecodePatch( addInstruction( insertIndex, "invoke-static { v$viewRegister }, $FILTER_CLASS_DESCRIPTOR->" + - "hideNavigationBar(Landroid/view/View;)Landroid/view/View;" + "hideNavigationBar(Landroid/view/View;)Landroid/view/View;", ) } } ?: throw BottomNavigationBarFingerprint.exception @@ -152,14 +154,14 @@ object HideShortsComponentsPatch : BytecodePatch( // endregion } - private enum class ShortsButtons(private val resourceName: String, private val methodName: String) { COMMENTS("reel_dyn_comment", "hideShortsCommentsButton"), REMIX("reel_dyn_remix", "hideShortsRemixButton"), - SHARE("reel_dyn_share", "hideShortsShareButton"); + SHARE("reel_dyn_share", "hideShortsShareButton"), + ; fun injectHideCall(method: MutableMethod) { - val referencedIndex = method.findIndexForIdResource(resourceName) + val referencedIndex = method.indexOfIdResourceOrThrow(resourceName) val setIdIndex = referencedIndex + 1 val viewRegister = method.getInstruction(setIdIndex).registerC diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt index 8593cd056..47381c2d5 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt @@ -34,10 +34,14 @@ object HideShortsComponentsResourcePatch : ResourcePatch() { SwitchPreference("revanced_hide_shorts_sound_button"), // Everything else. - SwitchPreference("revanced_hide_shorts_thanks_button"), SwitchPreference("revanced_hide_shorts_join_button"), SwitchPreference("revanced_hide_shorts_subscribe_button"), - SwitchPreference("revanced_hide_shorts_subscribe_button_paused"), + SwitchPreference("revanced_hide_shorts_paused_overlay_buttons"), + SwitchPreference("revanced_hide_shorts_save_sound_button"), + SwitchPreference("revanced_hide_shorts_shop_button"), + SwitchPreference("revanced_hide_shorts_tagged_products"), + SwitchPreference("revanced_hide_shorts_search_suggestions"), + SwitchPreference("revanced_hide_shorts_location_label"), SwitchPreference("revanced_hide_shorts_channel_bar"), SwitchPreference("revanced_hide_shorts_info_panel"), SwitchPreference("revanced_hide_shorts_full_video_link_label"), @@ -46,15 +50,19 @@ object HideShortsComponentsResourcePatch : ResourcePatch() { SwitchPreference("revanced_hide_shorts_navigation_bar"), ) - ResourceMappingPatch.resourceMappings.find { - it.type == "layout" && it.name == "reel_multiple_items_shelf" - }?.also { - reelMultipleItemShelfId = it.id - } + reelPlayerRightCellButtonHeight = ResourceMappingPatch[ + "dimen", + "reel_player_right_cell_button_height", + ] - reelPlayerRightCellButtonHeight = - ResourceMappingPatch.resourceMappings.single { - it.type == "dimen" && it.name == "reel_player_right_cell_button_height" - }.id + // Resource not present in new versions of the app. + try { + ResourceMappingPatch[ + "dimen", + "reel_player_right_cell_button_height", + ] + } catch (e: NoSuchElementException) { + return + }.also { reelPlayerRightCellButtonHeight = it } } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/CreateShortsButtonsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/CreateShortsButtonsFingerprint.kt index 97ac69121..da5cdc634 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/CreateShortsButtonsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/fingerprints/CreateShortsButtonsFingerprint.kt @@ -1,13 +1,10 @@ package app.revanced.patches.youtube.layout.hide.shorts.fingerprints -import app.revanced.patcher.extensions.or import app.revanced.patches.youtube.layout.hide.shorts.HideShortsComponentsResourcePatch import app.revanced.util.patch.LiteralValueFingerprint -import com.android.tools.smali.dexlib2.AccessFlags internal object CreateShortsButtonsFingerprint : LiteralValueFingerprint( - accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, + // YT 19.12.x moved this code inside another method, and each method has different parameters. returnType = "V", - parameters = listOf("Z", "Z", "L"), literalSupplier = { HideShortsComponentsResourcePatch.reelPlayerRightCellButtonHeight } ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt index c939e786d..68407dc68 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt @@ -33,7 +33,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenResourcePatch.kt index 28122d1a2..7d9c1ad61 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenResourcePatch.kt @@ -12,7 +12,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch dependencies = [ SettingsPatch::class, ResourceMappingPatch::class, - AddResourcesPatch::class + AddResourcesPatch::class, ], ) internal object DisableSuggestedVideoEndScreenResourcePatch : ResourcePatch() { @@ -22,11 +22,12 @@ internal object DisableSuggestedVideoEndScreenResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - SwitchPreference("revanced_disable_suggested_video_end_screen") + SwitchPreference("revanced_disable_suggested_video_end_screen"), ) - sizeAdjustableLiteAutoNavOverlay = ResourceMappingPatch.resourceMappings.single { - it.type == "layout" && it.name == "size_adjustable_lite_autonav_overlay" - }.id + sizeAdjustableLiteAutoNavOverlay = ResourceMappingPatch[ + "layout", + "size_adjustable_lite_autonav_overlay", + ] } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt index a3c731ef1..cb741ddf1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt @@ -34,7 +34,9 @@ import app.revanced.util.exception "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt index 58fade4e0..a50d781a3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt @@ -35,7 +35,9 @@ import app.revanced.util.exception "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt index d5e1893a2..aa9f4b9f1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/background/PlayerControlsBackgroundPatch.kt @@ -30,7 +30,9 @@ import org.w3c.dom.Element "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityResourcePatch.kt index 147ccaccf..4037fe20a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityResourcePatch.kt @@ -10,7 +10,7 @@ import app.revanced.patches.shared.misc.settings.preference.TextPreference import app.revanced.patches.youtube.misc.settings.SettingsPatch @Patch( - dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class] + dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class], ) internal object CustomPlayerOverlayOpacityResourcePatch : ResourcePatch() { internal var scrimOverlayId = -1L @@ -19,11 +19,12 @@ internal object CustomPlayerOverlayOpacityResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.PLAYER.addPreferences( - TextPreference("revanced_player_overlay_opacity", inputType = InputType.NUMBER) + TextPreference("revanced_player_overlay_opacity", inputType = InputType.NUMBER), ) - scrimOverlayId = ResourceMappingPatch.resourceMappings.single { - it.type == "id" && it.name == "scrim_overlay" - }.id + scrimOverlayId = ResourceMappingPatch[ + "id", + "scrim_overlay", + ] } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt index 783474eb3..6a2a03522 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt @@ -64,7 +64,9 @@ import com.android.tools.smali.dexlib2.iface.reference.TypeReference "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikeResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikeResourcePatch.kt index 06226fc0c..d39a8fa3e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikeResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikeResourcePatch.kt @@ -12,8 +12,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsResourcePatch @Patch( dependencies = [ SettingsPatch::class, - AddResourcesPatch::class - ] + AddResourcesPatch::class, + ], ) internal object ReturnYouTubeDislikeResourcePatch : ResourcePatch() { internal var oldUIDislikeId: Long = -1 @@ -25,11 +25,12 @@ internal object ReturnYouTubeDislikeResourcePatch : ResourcePatch() { key = "revanced_settings_screen_09", titleKey = "revanced_ryd_settings_title", summaryKey = null, - intent = SettingsPatch.newIntent("revanced_ryd_settings_intent") + intent = SettingsPatch.newIntent("revanced_ryd_settings_intent"), ) - oldUIDislikeId = ResourceMappingPatch.resourceMappings.single { - it.type == "id" && it.name == "dislike_button" - }.id + oldUIDislikeId = ResourceMappingPatch[ + "id", + "dislike_button", + ] } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt index 3cd258b78..0e72bddaf 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt @@ -39,7 +39,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt index 77de2e752..c621a95dd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt @@ -35,7 +35,9 @@ import app.revanced.util.exception "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorResourcePatch.kt index 09a686be3..84ea503a4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorResourcePatch.kt @@ -15,18 +15,18 @@ internal object SeekbarColorResourcePatch : ResourcePatch() { internal var inlineTimeBarPlayedNotHighlightedColorId = -1L override fun execute(context: ResourceContext) { - fun findColorResource(resourceName: String): Long { - return ResourceMappingPatch.resourceMappings - .find { it.type == "color" && it.name == resourceName }?.id - ?: throw PatchException("Could not find color resource: $resourceName") - } - - reelTimeBarPlayedColorId = - findColorResource("reel_time_bar_played_color") - inlineTimeBarColorizedBarPlayedColorDarkId = - findColorResource("inline_time_bar_colorized_bar_played_color_dark") - inlineTimeBarPlayedNotHighlightedColorId = - findColorResource("inline_time_bar_played_not_highlighted_color") + reelTimeBarPlayedColorId = ResourceMappingPatch[ + "color", + "reel_time_bar_played_color", + ] + inlineTimeBarColorizedBarPlayedColorDarkId = ResourceMappingPatch[ + "color", + "inline_time_bar_colorized_bar_played_color_dark", + ] + inlineTimeBarPlayedNotHighlightedColorId = ResourceMappingPatch[ + "color", + "inline_time_bar_played_not_highlighted_color", + ] // Edit the resume playback drawable and replace the progress bar with a custom drawable context.xmlEditor["res/drawable/resume_playback_progressbar_drawable.xml"].use { editor -> @@ -39,10 +39,9 @@ internal object SeekbarColorResourcePatch : ResourcePatch() { } val scaleNode = progressNode.getElementsByTagName("scale").item(0) as Element val shapeNode = scaleNode.getElementsByTagName("shape").item(0) as Element - val replacementNode = - document.createElement( - "app.revanced.integrations.youtube.patches.theme.ProgressBarDrawable", - ) + val replacementNode = document.createElement( + "app.revanced.integrations.youtube.patches.theme.ProgressBarDrawable", + ) scaleNode.replaceChild(replacementNode, shapeNode) } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt index 52ab535e8..8ba36ef11 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.youtube.layout.sponsorblock -import app.revanced.util.exception import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions @@ -25,6 +24,7 @@ import app.revanced.patches.youtube.shared.fingerprints.SeekbarFingerprint import app.revanced.patches.youtube.shared.fingerprints.SeekbarOnDrawFingerprint import app.revanced.patches.youtube.video.information.VideoInformationPatch import app.revanced.patches.youtube.video.videoid.VideoIdPatch +import app.revanced.util.exception import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.* import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c @@ -37,7 +37,8 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference description = "Adds options to enable and configure SponsorBlock, which can skip undesired video segments such as sponsored content.", compatiblePackages = [ CompatiblePackage( - "com.google.android.youtube", [ + "com.google.android.youtube", + [ "18.48.39", "18.49.37", "19.01.34", @@ -48,9 +49,11 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference "19.06.39", "19.07.40", "19.08.36", - "19.09.37" - ] - ) + "19.09.38", + "19.10.39", + "19.11.43", + ], + ), ], dependencies = [ IntegrationsPatch::class, @@ -60,8 +63,8 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference // Used to prevent SponsorBlock from running on Shorts because SponsorBlock does not yet support Shorts. PlayerTypeHookPatch::class, PlayerControlsBytecodePatch::class, - SponsorBlockResourcePatch::class - ] + SponsorBlockResourcePatch::class, + ], ) @Suppress("unused") object SponsorBlockBytecodePatch : BytecodePatch( @@ -69,8 +72,8 @@ object SponsorBlockBytecodePatch : BytecodePatch( SeekbarFingerprint, AppendTimeFingerprint, LayoutConstructorFingerprint, - AutoRepeatParentFingerprint - ) + AutoRepeatParentFingerprint, + ), ) { private const val INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/sponsorblock/SegmentPlaybackController;" @@ -83,8 +86,9 @@ object SponsorBlockBytecodePatch : BytecodePatch( override fun execute(context: BytecodeContext) { LayoutConstructorFingerprint.result?.let { - if (!ControlsOverlayFingerprint.resolve(context, it.classDef)) + if (!ControlsOverlayFingerprint.resolve(context, it.classDef)) { throw ControlsOverlayFingerprint.exception + } } ?: throw LayoutConstructorFingerprint.exception /* @@ -93,7 +97,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( with(VideoInformationPatch) { videoTimeHook( INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR, - "setVideoTime" + "setVideoTime", ) } @@ -121,7 +125,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( seekbarMethod.addInstruction( moveRectangleToRegisterIndex + 1, "invoke-static/range {p0 .. p0}, " + - "$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarRect(Ljava/lang/Object;)V" + "$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarRect(Ljava/lang/Object;)V", ) for ((index, instruction) in seekbarMethodInstructions.withIndex()) { @@ -136,7 +140,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( seekbarMethod.addInstruction( insertIndex, "invoke-static {v${invokeInstruction.registerC}}, " + - "$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarThickness(I)V" + "$INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->setSponsorBarThickness(I)V", ) break } @@ -154,7 +158,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( } seekbarMethod.addInstruction( i, - "invoke-static {v$canvasInstance, v$centerY}, $INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->drawSponsorTimeBars(Landroid/graphics/Canvas;F)V" + "invoke-static {v$canvasInstance, v$centerY}, $INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->drawSponsorTimeBars(Landroid/graphics/Canvas;F)V", ) break @@ -166,9 +170,9 @@ object SponsorBlockBytecodePatch : BytecodePatch( val controlsMethodResult = PlayerControlsBytecodePatch.showPlayerControlsFingerprintResult val controlsLayoutStubResourceId = - ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "controls_layout_stub" }.id + ResourceMappingPatch["id", "controls_layout_stub"] val zoomOverlayResourceId = - ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "video_zoom_overlay_stub" }.id + ResourceMappingPatch["id", "video_zoom_overlay_stub"] methods@ for (method in controlsMethodResult.mutableClass.methods) { val instructions = method.implementation?.instructions!! @@ -188,7 +192,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( """ invoke-static {v$inflatedViewRegister}, $INTEGRATIONS_CREATE_SEGMENT_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/View;)V invoke-static {v$inflatedViewRegister}, $INTEGRATIONS_VOTING_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/View;)V - """ + """, ) } @@ -201,7 +205,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( """ invoke-static {p1}, $INTEGRATIONS_CREATE_SEGMENT_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->changeVisibilityNegatedImmediate(Z)V invoke-static {p1}, $INTEGRATIONS_VOTING_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->changeVisibilityNegatedImmediate(Z)V - """.trimIndent() + """.trimIndent(), ) } } @@ -223,7 +227,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( """ invoke-static {v$targetRegister}, $INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR->appendTimeWithoutSegments(Ljava/lang/String;)Ljava/lang/String; move-result-object v$targetRegister - """ + """, ) // initialize the player controller @@ -236,10 +240,10 @@ object SponsorBlockBytecodePatch : BytecodePatch( val frameLayoutRegister = (getInstruction(startIndex + 2) as OneRegisterInstruction).registerA addInstruction( startIndex + 3, - "invoke-static {v$frameLayoutRegister}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/ViewGroup;)V" + "invoke-static {v$frameLayoutRegister}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/ViewGroup;)V", ) } - } ?: throw ControlsOverlayFingerprint.exception + } ?: throw ControlsOverlayFingerprint.exception // get rectangle field name RectangleFieldInvalidatorFingerprint.resolve(context, seekbarSignatureResult.classDef) @@ -258,7 +262,8 @@ object SponsorBlockBytecodePatch : BytecodePatch( fun MutableMethod.replaceStringInstruction(index: Int, instruction: Instruction, with: String) { val register = (instruction as OneRegisterInstruction).registerA this.replaceInstruction( - index, "const-string v$register, \"$with\"" + index, + "const-string v$register, \"$with\"", ) } for ((index, it) in method.implementation!!.instructions.withIndex()) { @@ -268,13 +273,12 @@ object SponsorBlockBytecodePatch : BytecodePatch( "replaceMeWithsetSponsorBarRect" -> method.replaceStringInstruction( index, it, - rectangleFieldName + rectangleFieldName, ) } } } ?: throw PatchException("Could not find the method which contains the replaceMeWith* strings") - // The vote and create segment buttons automatically change their visibility when appropriate, // but if buttons are showing when the end of the video is reached then they will not automatically hide. // Add a hook to forcefully hide when the end of the video is reached. @@ -283,7 +287,7 @@ object SponsorBlockBytecodePatch : BytecodePatch( it.resolve(context, AutoRepeatParentFingerprint.result!!.classDef) }.result?.mutableMethod?.addInstruction( 0, - "invoke-static {}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->endOfVideoReached()V" + "invoke-static {}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->endOfVideoReached()V", ) ?: throw AutoRepeatFingerprint.exception // TODO: isSBChannelWhitelisting implementation diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockResourcePatch.kt index 6484216ce..459e7d9d8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockResourcePatch.kt @@ -43,8 +43,10 @@ internal object SponsorBlockResourcePatch : ResourcePatch() { // required resource for back button, because when the base APK is used, this resource will not exist "drawable", "revanced_sb_adjust.xml", + "revanced_sb_backward.xml", "revanced_sb_compare.xml", "revanced_sb_edit.xml", + "revanced_sb_forward.xml", "revanced_sb_logo.xml", "revanced_sb_publish.xml", "revanced_sb_voting.xml", diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt index b4a64d790..82557e6a0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt @@ -38,7 +38,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt index 7ed287816..57a4d1632 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt @@ -44,7 +44,9 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt index b770c7743..80297fe36 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt @@ -43,7 +43,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ) ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorParentFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorParentFingerprint.kt index 244bf33d0..2e1612373 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorParentFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/fingerprints/MiniPlayerDimensionsCalculatorParentFingerprint.kt @@ -12,7 +12,7 @@ internal object MiniPlayerDimensionsCalculatorParentFingerprint : MethodFingerpr opcodes = listOf( Opcode.CONST_HIGH16, Opcode.ADD_FLOAT_2ADDR, - Opcode.MUL_FLOAT, + null, // Opcode.MUL_FLOAT or Opcode.MUL_FLOAT_2ADDR Opcode.CONST_4, Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT, diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt index ac69564d2..04b3dc0bb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt @@ -10,11 +10,14 @@ import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatc import app.revanced.patches.all.misc.resources.AddResourcesPatch import app.revanced.patches.shared.misc.settings.preference.SwitchPreference import app.revanced.patches.youtube.layout.seekbar.SeekbarColorBytecodePatch +import app.revanced.patches.youtube.layout.theme.fingerprints.ThemeHelperDarkColorFingerprint +import app.revanced.patches.youtube.layout.theme.fingerprints.ThemeHelperLightColorFingerprint import app.revanced.patches.youtube.layout.theme.fingerprints.UseGradientLoadingScreenFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.exception import app.revanced.util.indexOfFirstWideLiteralInstructionValue +import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @Patch( @@ -47,14 +50,20 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] ) @Suppress("unused") object ThemeBytecodePatch : BytecodePatch( - setOf(UseGradientLoadingScreenFingerprint) + setOf( + UseGradientLoadingScreenFingerprint, + ThemeHelperLightColorFingerprint, + ThemeHelperDarkColorFingerprint + ) ) { private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/theme/ThemePatch;" @@ -121,6 +130,21 @@ object ThemeBytecodePatch : BytecodePatch( ) } ?: throw UseGradientLoadingScreenFingerprint.exception + + mapOf( + ThemeHelperLightColorFingerprint to lightThemeBackgroundColor, + ThemeHelperDarkColorFingerprint to darkThemeBackgroundColor + ).forEach { (fingerprint, color) -> + fingerprint.resultOrThrow().mutableMethod.apply { + addInstructions( + 0, """ + const-string v0, "$color" + return-object v0 + """ + ) + } + } + LithoColorHookPatch.lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getValue") } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/ThemeHelperDarkColorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/ThemeHelperDarkColorFingerprint.kt new file mode 100644 index 000000000..1f04e17e4 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/ThemeHelperDarkColorFingerprint.kt @@ -0,0 +1,16 @@ +package app.revanced.patches.youtube.layout.theme.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.youtube.misc.settings.SettingsPatch +import com.android.tools.smali.dexlib2.AccessFlags + +internal object ThemeHelperDarkColorFingerprint : MethodFingerprint( + accessFlags = AccessFlags.PRIVATE or AccessFlags.STATIC, + returnType = "Ljava/lang/String;", + parameters = listOf(), + customFingerprint = { methodDef, classDef -> + methodDef.name == "darkThemeResourceName" && + classDef.type == SettingsPatch.THEME_HELPER_DESCRIPTOR + } +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/ThemeHelperLightColorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/ThemeHelperLightColorFingerprint.kt new file mode 100644 index 000000000..0defdd140 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/fingerprints/ThemeHelperLightColorFingerprint.kt @@ -0,0 +1,16 @@ +package app.revanced.patches.youtube.layout.theme.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.youtube.misc.settings.SettingsPatch +import com.android.tools.smali.dexlib2.AccessFlags + +internal object ThemeHelperLightColorFingerprint : MethodFingerprint( + accessFlags = AccessFlags.PRIVATE or AccessFlags.STATIC, + returnType = "Ljava/lang/String;", + parameters = listOf(), + customFingerprint = { methodDef, classDef -> + methodDef.name == "lightThemeResourceName" && + classDef.type == SettingsPatch.THEME_HELPER_DESCRIPTOR + } +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt index 2f624435b..b028dad8b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt @@ -23,7 +23,6 @@ import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.reques import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnSucceededFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch -import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.AccessFlags @@ -40,8 +39,7 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class, - NavigationBarHookPatch::class, - PlayerTypeHookPatch::class + NavigationBarHookPatch::class ], compatiblePackages = [ CompatiblePackage( @@ -63,7 +61,9 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt index 55c110966..b8c0157f9 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt @@ -39,7 +39,9 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt index 123bbd356..86b2967fd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt @@ -14,7 +14,7 @@ import app.revanced.util.exception @Patch( name = "Spoof device dimensions", - description = "Adds an option to spoof the device dimensions which unlocks higher video qualities if they aren't available on the device.", + description = "Adds an option to spoof the device dimensions which can unlock higher video qualities.", dependencies = [IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class], compatiblePackages = [ CompatiblePackage( @@ -34,7 +34,9 @@ import app.revanced.util.exception "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofSignatureResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofSignatureResourcePatch.kt index 54bfa7540..d65e23ee3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofSignatureResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/SpoofSignatureResourcePatch.kt @@ -11,8 +11,9 @@ object SpoofSignatureResourcePatch : ResourcePatch() { internal var scrubbedPreviewThumbnailResourceId: Long = -1 override fun execute(context: ResourceContext) { - scrubbedPreviewThumbnailResourceId = ResourceMappingPatch.resourceMappings.single { - it.type == "id" && it.name == "thumbnail" - }.id + scrubbedPreviewThumbnailResourceId = ResourceMappingPatch[ + "id", + "thumbnail", + ] } } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt index 6547f0ec3..4c9e526ec 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt @@ -44,7 +44,9 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch( "19.06.39", "19.07.40", "19.08.36", - "19.09.37", + "19.09.38", + "19.10.39", + "19.11.43" ), ), ), diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt index 3228a7c68..cafaa942b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt @@ -36,7 +36,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt index 682868644..a9cf1bf8c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt @@ -40,7 +40,9 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt index 4374262a3..b54cc4f40 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt @@ -45,7 +45,9 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt index 5b19cdc0a..eb9f31e81 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt @@ -10,6 +10,7 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.navigation.fingerprints.* +import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstruction import app.revanced.util.resultOrThrow @@ -25,6 +26,7 @@ import com.android.tools.smali.dexlib2.util.MethodUtil dependencies = [ IntegrationsPatch::class, NavigationBarHookResourcePatch::class, + PlayerTypeHookPatch::class // Required to detect the search bar in all situations. ], ) @Suppress("unused") @@ -34,7 +36,9 @@ object NavigationBarHookPatch : BytecodePatch( NavigationEnumFingerprint, PivotBarButtonsCreateDrawableViewFingerprint, PivotBarButtonsCreateResourceViewFingerprint, + PivotBarButtonsViewSetSelectedFingerprint, NavigationBarHookCallbackFingerprint, + MainActivityOnBackPressedFingerprint, ActionBarSearchResultsFingerprint, ), ) { @@ -88,6 +92,29 @@ object NavigationBarHookPatch : BytecodePatch( } } + PivotBarButtonsViewSetSelectedFingerprint.resultOrThrow().mutableMethod.apply { + val index = PivotBarButtonsViewSetSelectedFingerprint.indexOfSetViewSelectedInstruction(this) + val instruction = getInstruction(index) + val viewRegister = instruction.registerC + val isSelectedRegister = instruction.registerD + + addInstruction( + index + 1, + "invoke-static { v$viewRegister, v$isSelectedRegister }, " + + "$INTEGRATIONS_CLASS_DESCRIPTOR->navigationTabSelected(Landroid/view/View;Z)V", + ) + } + + // Hook onto back button pressed. Needed to fix race problem with + // litho filtering based on navigation tab before the tab is updated. + MainActivityOnBackPressedFingerprint.resultOrThrow().mutableMethod.apply { + addInstruction( + 0, + "invoke-static { p0 }, " + + "$INTEGRATIONS_CLASS_DESCRIPTOR->onBackPressed(Landroid/app/Activity;)V", + ) + } + // Hook the search bar. // Two different layouts are used at the hooked code. diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookResourcePatch.kt index 3841f2bfa..614fbd65c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookResourcePatch.kt @@ -6,19 +6,14 @@ import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch @Patch( - dependencies = [ResourceMappingPatch::class] + dependencies = [ResourceMappingPatch::class], ) internal object NavigationBarHookResourcePatch : ResourcePatch() { internal var imageOnlyTabResourceId: Long = -1 internal var actionBarSearchResultsViewMicId: Long = -1 override fun execute(context: ResourceContext) { - imageOnlyTabResourceId = ResourceMappingPatch.resourceMappings.first { - it.type == "layout" && it.name == "image_only_tab" - }.id - - actionBarSearchResultsViewMicId = ResourceMappingPatch.resourceMappings.first { - it.type == "layout" && it.name == "action_bar_search_results_view_mic" - }.id + imageOnlyTabResourceId = ResourceMappingPatch["layout", "image_only_tab"] + actionBarSearchResultsViewMicId = ResourceMappingPatch["layout", "action_bar_search_results_view_mic"] } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/fingerprints/MainActivityOnBackPressedFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/fingerprints/MainActivityOnBackPressedFingerprint.kt new file mode 100644 index 000000000..23ee74887 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/fingerprints/MainActivityOnBackPressedFingerprint.kt @@ -0,0 +1,17 @@ +package app.revanced.patches.youtube.misc.navigation.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags + +internal object MainActivityOnBackPressedFingerprint : MethodFingerprint( + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + returnType = "V", + parameters = listOf(), + customFingerprint = { methodDef, _ -> + (methodDef.definingClass.endsWith("MainActivity;") || + // Old versions of YouTube called this class "WatchWhileActivity" instead. + methodDef.definingClass.endsWith("WatchWhileActivity;")) + && methodDef.name == "onBackPressed" + } +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/fingerprints/PivotBarButtonsViewSetSelectedFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/fingerprints/PivotBarButtonsViewSetSelectedFingerprint.kt new file mode 100644 index 000000000..8e1c36213 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/fingerprints/PivotBarButtonsViewSetSelectedFingerprint.kt @@ -0,0 +1,27 @@ +package app.revanced.patches.youtube.misc.navigation.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.MethodFingerprint +import app.revanced.patches.youtube.misc.navigation.fingerprints.PivotBarButtonsViewSetSelectedFingerprint.indexOfSetViewSelectedInstruction +import app.revanced.util.getReference +import app.revanced.util.indexOfFirstInstruction +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.iface.Method +import com.android.tools.smali.dexlib2.iface.reference.MethodReference + +internal object PivotBarButtonsViewSetSelectedFingerprint : MethodFingerprint( + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + parameters = listOf("I", "Z"), + returnType = "V", + customFingerprint = { methodDef, classDef -> + classDef.type == "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;" && + indexOfSetViewSelectedInstruction(methodDef) >= 0 + } +) { + fun indexOfSetViewSelectedInstruction(methodDef: Method) = + methodDef.indexOfFirstInstruction { + opcode == Opcode.INVOKE_VIRTUAL && getReference()?.name == "setSelected" + } +} + diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/BottomControlsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/BottomControlsResourcePatch.kt index d2b1c195d..474ccf479 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/BottomControlsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/BottomControlsResourcePatch.kt @@ -24,8 +24,7 @@ object BottomControlsResourcePatch : ResourcePatch(), Closeable { resourceContext = context targetDocumentEditor = context.xmlEditor[TARGET_RESOURCE] - bottomUiContainerResourceId = ResourceMappingPatch.resourceMappings - .single { it.type == "id" && it.name == "bottom_ui_container_stub" }.id + bottomUiContainerResourceId = ResourceMappingPatch["id", "bottom_ui_container_stub"] } /** diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt index 28404a8f4..f1af3d569 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt @@ -41,7 +41,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt index 0ada6925a..6f96dcffa 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt @@ -12,6 +12,7 @@ import app.revanced.patches.all.misc.resources.AddResourcesPatch import app.revanced.patches.shared.misc.settings.preference.BasePreferenceScreen import app.revanced.patches.shared.misc.settings.preference.InputType import app.revanced.patches.shared.misc.settings.preference.IntentPreference +import app.revanced.patches.shared.misc.settings.preference.NonInteractivePreference import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen.Sorting import app.revanced.patches.shared.misc.settings.preference.TextPreference import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch @@ -39,12 +40,20 @@ object SettingsPatch : private const val INTEGRATIONS_PACKAGE = "app/revanced/integrations/youtube" private const val ACTIVITY_HOOK_CLASS_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/settings/LicenseActivityHook;" - private const val THEME_HELPER_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/ThemeHelper;" + internal const val THEME_HELPER_DESCRIPTOR = "L$INTEGRATIONS_PACKAGE/ThemeHelper;" private const val SET_THEME_METHOD_NAME: String = "setTheme" override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) + // Add an about preference to the top. + SettingsResourcePatch += NonInteractivePreference( + key = "revanced_settings_screen_00_about", + summaryKey = null, + tag = "app.revanced.integrations.youtube.settings.preference.ReVancedYouTubeAboutPreference", + selectable = true, + ) + PreferenceScreen.MISC.addPreferences( TextPreference( key = null, @@ -52,7 +61,7 @@ object SettingsPatch : summaryKey = "revanced_pref_import_export_summary", inputType = InputType.TEXT_MULTI_LINE, tag = "app.revanced.integrations.shared.settings.preference.ImportExportPreference", - ), + ) ) SetThemeFingerprint.result?.mutableMethod?.let { setThemeMethod -> @@ -69,7 +78,7 @@ object SettingsPatch : replaceInstruction( returnIndex, "invoke-static { v$register }, " + - "$THEME_HELPER_DESCRIPTOR->$SET_THEME_METHOD_NAME(Ljava/lang/Object;)V", + "$THEME_HELPER_DESCRIPTOR->$SET_THEME_METHOD_NAME(Ljava/lang/Enum;)V", ) addInstruction(returnIndex + 1, "return-object v$register") } diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsResourcePatch.kt index 3f8b1d16d..2783a0266 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsResourcePatch.kt @@ -31,10 +31,7 @@ object SettingsResourcePatch : BaseSettingsResourcePatch( AddResourcesPatch(this::class) // Used for a fingerprint from SettingsPatch. - appearanceStringId = - ResourceMappingPatch.resourceMappings.find { - it.type == "string" && it.name == "app_theme_appearance_dark" - }!!.id + appearanceStringId = ResourceMappingPatch["string", "app_theme_appearance_dark"] arrayOf( ResourceGroup("layout", "revanced_settings_with_toolbar.xml"), diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt index 858d30b14..62249f848 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt @@ -45,7 +45,9 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt index f8e9330a5..671dff006 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt @@ -25,7 +25,9 @@ import app.revanced.patches.youtube.video.speed.remember.RememberPlaybackSpeedPa "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ], ), ], diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt index 2fc51faaa..0981e7f55 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedResourcePatch.kt @@ -8,8 +8,9 @@ internal object CustomPlaybackSpeedResourcePatch : ResourcePatch() { var speedUnavailableId: Long = -1 override fun execute(context: ResourceContext) { - speedUnavailableId = ResourceMappingPatch.resourceMappings.single { - it.type == "string" && it.name == "varispeed_unavailable_message" - }.id + speedUnavailableId = ResourceMappingPatch[ + "string", + "varispeed_unavailable_message", + ] } -} \ No newline at end of file +} diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt index 25b01b1ab..a2ccd3e94 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt @@ -41,7 +41,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction "19.06.39", "19.07.40", "19.08.36", - "19.09.37" + "19.09.38", + "19.10.39", + "19.11.43" ] ) ] diff --git a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuResourcePatch.kt index 7221e80b1..8de2a9b0e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuResourcePatch.kt @@ -1,7 +1,6 @@ package app.revanced.patches.youtube.video.videoqualitymenu import app.revanced.patcher.data.ResourceContext -import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.all.misc.resources.AddResourcesPatch @@ -10,7 +9,7 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference import app.revanced.patches.youtube.misc.settings.SettingsPatch @Patch( - dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class] + dependencies = [SettingsPatch::class, ResourceMappingPatch::class, AddResourcesPatch::class], ) object RestoreOldVideoQualityMenuResourcePatch : ResourcePatch() { internal var videoQualityBottomSheetListFragmentTitle = -1L @@ -19,13 +18,13 @@ object RestoreOldVideoQualityMenuResourcePatch : ResourcePatch() { AddResourcesPatch(this::class) SettingsPatch.PreferenceScreen.VIDEO.addPreferences( - SwitchPreference("revanced_restore_old_video_quality_menu") + SwitchPreference("revanced_restore_old_video_quality_menu"), ) - fun findResource(name: String) = ResourceMappingPatch.resourceMappings.find { it.name == name }?.id - ?: throw PatchException("Could not find resource") - // Used for the old type of the video quality menu. - videoQualityBottomSheetListFragmentTitle = findResource("video_quality_bottom_sheet_list_fragment_title") + videoQualityBottomSheetListFragmentTitle = ResourceMappingPatch[ + "layout", + "video_quality_bottom_sheet_list_fragment_title", + ] } } diff --git a/src/main/kotlin/app/revanced/util/BytecodeUtils.kt b/src/main/kotlin/app/revanced/util/BytecodeUtils.kt index 8daf77702..ccd9c1b08 100644 --- a/src/main/kotlin/app/revanced/util/BytecodeUtils.kt +++ b/src/main/kotlin/app/revanced/util/BytecodeUtils.kt @@ -15,7 +15,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction import com.android.tools.smali.dexlib2.iface.reference.Reference import com.android.tools.smali.dexlib2.util.MethodUtil - fun MethodFingerprint.resultOrThrow() = result ?: throw exception /** @@ -59,24 +58,41 @@ fun MutableMethod.injectHideViewCall( insertIndex: Int, viewRegister: Int, classDescriptor: String, - targetMethod: String + targetMethod: String, ) = addInstruction( insertIndex, - "invoke-static { v$viewRegister }, $classDescriptor->$targetMethod(Landroid/view/View;)V" + "invoke-static { v$viewRegister }, $classDescriptor->$targetMethod(Landroid/view/View;)V", ) /** - * Find the index of the first instruction with the id of the given resource name. + * Get the index of the first instruction with the id of the given resource name. + * + * Requires [ResourceMappingPatch] as a dependency. * * @param resourceName the name of the resource to find the id for. * @return the index of the first instruction with the id of the given resource name, or -1 if not found. + * @throws PatchException if the resource cannot be found. + * @see [indexOfIdResourceOrThrow] */ -fun Method.findIndexForIdResource(resourceName: String): Int { - fun getIdResourceId(resourceName: String) = ResourceMappingPatch.resourceMappings.single { - it.type == "id" && it.name == resourceName - }.id +fun Method.indexOfIdResource(resourceName: String): Int { + val resourceId = ResourceMappingPatch["id", resourceName] + return indexOfFirstWideLiteralInstructionValue(resourceId) +} - return indexOfFirstWideLiteralInstructionValue(getIdResourceId(resourceName)) +/** + * Get the index of the first instruction with the id of the given resource name or throw a [PatchException]. + * + * Requires [ResourceMappingPatch] as a dependency. + * + * @throws [PatchException] if the resource is not found, or the method does not contain the resource id literal value. + */ +fun Method.indexOfIdResourceOrThrow(resourceName: String): Int { + val index = indexOfIdResource(resourceName) + if (index < 0) { + throw PatchException("Found resource id for: '$resourceName' but method does not contain the id: $this") + } + + return index } /** @@ -130,27 +146,29 @@ inline fun Instruction.getReference() = (this as? Refere fun Method.indexOfFirstInstruction(predicate: Instruction.() -> Boolean) = this.implementation!!.instructions.indexOfFirst(predicate) - /** - * Return the resolved methods of [MethodFingerprint]s early. - */ - fun List.returnEarly(bool: Boolean = false) { - val const = if (bool) "0x1" else "0x0" - this.forEach { fingerprint -> - fingerprint.result?.let { result -> - val stringInstructions = when (result.method.returnType.first()) { - 'L' -> """ +/** + * Return the resolved methods of [MethodFingerprint]s early. + */ +fun List.returnEarly(bool: Boolean = false) { + val const = if (bool) "0x1" else "0x0" + this.forEach { fingerprint -> + fingerprint.result?.let { result -> + val stringInstructions = when (result.method.returnType.first()) { + 'L' -> + """ const/4 v0, $const return-object v0 """ - 'V' -> "return-void" - 'I', 'Z' -> """ + 'V' -> "return-void" + 'I', 'Z' -> + """ const/4 v0, $const return v0 """ - else -> throw Exception("This case should never happen.") - } + else -> throw Exception("This case should never happen.") + } - result.mutableMethod.addInstructions(0, stringInstructions) - } ?: throw fingerprint.exception - } + result.mutableMethod.addInstructions(0, stringInstructions) + } ?: throw fingerprint.exception } +} diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index 50e59bf27..f59fcb612 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -1,3 +1,31 @@ + @@ -13,23 +41,27 @@ Import failed: %s - - GmsCore is not installed. Install it. - - Follow the \"Don\'t kill my app\" guide for GmsCore. + + MicroG GmsCore is not installed. Install it. Action needed - GmsCore is not whitelisted from battery optimization.\n\nFollow the \"Don\'t kill my app\" guide for GmsCore. - GmsCore does not have permission to run in the background.\n\nFollow the \"Don\'t kill my app\" guide for GmsCore. - Open website + MicroG GmsCore does not have permission to run in the background.\n\nFollow the \"Don\'t kill my app\" guide for your phone, and apply the instructions to your MicroG installation.\n\nThis is required for the app to work. + Open website + MicroG GmsCore battery optimizations must be disabled to prevent issues.\n\nTap on the continue button and disable battery optimizations. + Continue ReVanced + You are using ReVanced Patches version <i>%s</i> + Note + This version is a pre-release and you may experience unexpected issues + Official links Import / Export Import / Export ReVanced settings + About Ads Alternative thumbnails Feed @@ -62,24 +94,38 @@ Hide gray separator Gray separators are hidden Gray separators are shown - Hide \'Join\' button - Button is hidden - Button is shown Hide channel watermark Watermark is hidden Watermark is shown + Hide horizontal shelves + Shelves are hidden such as:\n• Breaking news\n• Continue watching\n• Explore more channels\n• Shopping\n• Watch it again + Shelves are shown + + Hide \'Join\' button + Button is hidden + Button is shown + Hide \'For you\' shelf in channel page Shelf is hidden Shelf is shown + Hide \'Notify me\' button Button is hidden Button is shown - Hide timed reactions - Timed reactions are hidden - Timed reactions are shown + Hide \'People also watched\' recommendations Recommendations are hidden Recommendations are shown + + Hide \'Show more\' button + Button is hidden + Button is shown + Hide timed reactions + Timed reactions are hidden + Timed reactions are shown Hide search result shelf header Shelf header is hidden Shelf header is shown @@ -125,6 +171,9 @@ Hide channel bar Channel bar is hidden Channel bar is shown + Hide playables + Playables are hidden + Playables are shown Hide quick actions in fullscreen Quick actions are hidden Quick actions are shown @@ -172,6 +221,7 @@ Custom filter is enabled Custom filter is disabled Custom filter + List of component path builder strings to filter separated by new line Invalid custom filter: %s Hide keyword content @@ -186,11 +236,13 @@ Search results are filtered by keywords Search results are not filtered by keywords Keywords to hide + Keywords and phrases to hide, separated by new lines\n\nWords with uppercase letters in the middle must be entered with the casing (ie: iPhone, TikTok, LeBlanc) About keyword filtering Home/Subscription/Search results are filtered to hide content that matches keyword phrases\n\nLimitations\n• Some Shorts may not be hidden\n• Some UI components may not be hidden\n• Searching for a keyword may show no results Invalid keyword. Cannot use: \'%s\' as a filter - Invalid keyword. \'%1$s\' is less than %2$s characters + Invalid keyword. \'%1$s\' is less than %2$d characters Hide general ads @@ -199,12 +251,12 @@ Hide fullscreen ads Fullscreen ads are hidden Fullscreen ads are shown - Hide buttoned ad + Hide buttoned ads Buttoned ads are hidden Buttoned ads are shown - Hide paid content - Paid content is hidden - Paid content is shown + Hide paid promotion label + Paid promotion label is hidden + Paid promotion label is shown Hide self sponsored cards Self sponsored cards are hidden Self sponsored cards are shown @@ -220,7 +272,7 @@ Hide merchandise banners Merchandise banners are hidden Merchandise banners are shown - Failed to hide full-screen ad. Disabling to prevent issues + Could not hide fullscreen ad. Hide setting disabled to prevent issues. Hide YouTube Premium promotions @@ -254,6 +306,7 @@ Show external download button Download button shown in player Download button not shown in player + Override download action button Download button opens your external downloader Download button opens the native in-app downloader @@ -287,6 +340,10 @@ Save and restore brightness Save and restore brightness when exiting or entering fullscreen Do not save and restore brightness when exiting or entering fullscreen + Enable auto-brightness gesture + Swiping down to the lowest value of the brightness gesture enable auto-brightness + Swiping down to the lowest value does not enable auto-brightness + Auto Swipe overlay timeout The amount of milliseconds the overlay is visible Swipe overlay text size @@ -307,27 +364,37 @@ Hide Like and Dislike Like and Dislike buttons are hidden Like and Dislike buttons are shown + Hide Share Share button is hidden Share button is shown + Hide Report Report button is hidden Report button is shown + Hide Remix Remix button is hidden Remix button is shown + Hide Download Download button is hidden Download button is shown + Hide Thanks Thanks button is hidden Thanks button is shown + Hide Clip Clip button is hidden Clip button is shown + Hide Save to playlist Save to playlist button is hidden Save to playlist button is shown + Hide Shop Shop button is hidden Shop button is shown @@ -338,6 +405,7 @@ Autoplay button is shown + Hide captions button Captions button is hidden Captions button is shown @@ -350,18 +418,23 @@ Navigation buttons Hide or change buttons in the navigation bar + Hide Home Home button is hidden Home button is shown + Hide Shorts Shorts button is hidden Shorts button is shown + Hide Create Create button is hidden Create button is shown + Hide Subscriptions Subscriptions button is hidden Subscriptions button is shown + Switch Create with Notifications Create button is switched with Notifications button Create button is not switched with Notifications button @@ -369,33 +442,49 @@ Flyout menu Hide or show player flyout menu items + Hide Captions Captions menu is hidden Captions menu is shown + Hide Additional settings Additional settings menu is hidden Additional settings menu is shown + Hide Loop video Loop video menu is hidden Loop video menu is shown + Hide Ambient mode Ambient mode menu is hidden Ambient mode menu is shown + Hide Report Report menu is hidden Report menu is shown + Hide Help & feedback Help & feedback menu is hidden Help & feedback menu is shown + Hide Playback speed Playback speed menu is hidden Playback speed menu is shown + Hide More info More info menu is hidden More info menu is shown + + Hide Lock screen + Lock screen menu is hidden + Lock screen menu is shown + Hide Audio track Audio track menu is hidden Audio track menu is shown + Hide Watch in VR Watch in VR menu is hidden Watch in VR menu is shown @@ -410,20 +499,15 @@ Album cards are hidden Album cards are shown - - Hide breaking news - Breaking news are hidden - Breaking news are shown - Comments Hide or show comments section components - Hide comments section - Comment section is hidden - Comment section is shown Hide preview comment Preview comment is hidden Preview comment is shown + Hide comments section + Comment section is hidden + Comment section is shown Hide crowdfunding box @@ -463,11 +547,6 @@ Info cards are hidden Info cards are shown - - Hide \'Load More\' button - Button is hidden - Button is shown - Disable rolling number animations Rolling numbers are not animated @@ -482,27 +561,43 @@ Thumbnail seekbar is shown + Hide Shorts in home feed Shorts in home feed are hidden Shorts in home feed are shown + Hide Shorts in subscription feed Shorts in subscription feed are hidden Shorts in subscription feed are shown Hide Shorts in search results Shorts in search results are hidden Shorts in search results are shown + Hide join button Join button is hidden Join button is shown + Hide subscribe button Subscribe button is hidden Subscribe button is shown - Hide subscribe button when paused - Subscribe button is hidden - Subscribe button is shown - Hide thanks button - Thanks button is hidden - Thanks button is shown + Hide paused overlay buttons + Paused overlay buttons are hidden + Paused overlay buttons are shown + Hide shop button + Shop button is hidden + Shop button is shown + Hide tagged products + Tagged products are hidden + Tagged products are shown + Hide location label + Location label is hidden + Location label is shown + Hide save sound to playlist button + Save sound to playlist is hidden + Save sound to playlist is shown + Hide search suggestions + Search suggestions are hidden + Search suggestions are shown Hide like button Like button is hidden Like button is shown @@ -512,9 +607,11 @@ Hide comments button Comments button is hidden Comments button is shown + Hide remix button Remix button is hidden Remix button is shown + Hide share button Share button is hidden Share button is shown @@ -528,11 +625,11 @@ Title is hidden Title is shown Hide sound metadata label - Label is hidden - Label is shown + Metadata label is hidden + Metadata label is shown Hide full video link label - Label is hidden - Label is shown + Video link label is hidden + Video link label is shown Hide sound button Sound button is hidden Sound button is shown @@ -562,23 +659,24 @@ Return YouTube Dislike Hidden + Dislikes temporarily not available (API timed out) Dislikes not available (status %d) Dislikes not available (client API limit reached) Dislikes not available (%s) - - Reload video to vote using ReturnYouTubeDislike + + Reload video to vote using Return YouTube Dislike Return YouTube Dislike Dislikes are shown Dislikes are not shown Show dislikes on Shorts - - Dislikes shown on Shorts %s + Dislikes shown on Shorts + Dislikes shown on Shorts\n\nLimitation: Dislikes may not appear in incognito mode Dislikes hidden on Shorts - Limitation: Dislikes may not appear in incognito mode Dislikes as percentage Dislikes shown as percentage Dislikes shown as number + Compact like button Like button styled for minimum width Like button styled for best appearance @@ -588,7 +686,7 @@ About ReturnYouTubeDislike.com Data is provided by the Return YouTube Dislike API. Tap here to learn more - + ReturnYouTubeDislike API statistics of this device API response time, average API response time, minimum @@ -624,6 +722,7 @@ Show voting button Segment voting button is shown Segment voting button is not shown + Use compact skip button Skip button styled for minimum width Skip button styled for best appearance @@ -657,19 +756,19 @@ Lets the SponsorBlock leaderboard know how much time is saved. A message is sent to the leaderboard each time a segment is skipped Skip count tracking is not enabled Minimum segment duration - Segments shorter than this value (in seconds) will not be shown or skipped + Segments shorter than this value (in seconds) will not be shown or skipped Your private user id This should be kept private. This is like a password and should not be shared with anyone. If someone has this, they can impersonate you Private user id must be at least 30 characters long Change API URL - The address SponsorBlock uses to make calls to the server. Do not change this unless you know what you\'re doing + The address SponsorBlock uses to make calls to the server API URL reset API URL is invalid API URL changed Import/Export settings Copy - Your SponsorBlock JSON configuration that can be imported/exported to ReVanced and other SponsorBlock platforms %s - This includes your private user id. Be sure to share this wisely + Your SponsorBlock JSON configuration that can be imported/exported to ReVanced and other SponsorBlock platforms + Your SponsorBlock JSON configuration that can be imported/exported to ReVanced and other SponsorBlock platforms. This includes your private user id. Be sure to share this wisely Settings imported successfully Failed to import: %s Failed to export: %s @@ -737,9 +836,10 @@ Can\'t submit the segment: %s Can\'t submit the segment.\nAlready exists Segment submitted successfully - SponsorBlock temporarily not available - SponsorBlock temporarily not available (status %d) + SponsorBlock temporarily not available (API timed out) + SponsorBlock temporarily not available (status %d) + SponsorBlock temporarily not available Unable to vote for segment (API timed out) Unable to vote for segment (status: %1$d %2$s) Unable to vote for segment: %s @@ -750,6 +850,8 @@ Choose the segment category Category is disabled in settings. Enable category to submit. New SponsorBlock segment + Set %1$02d:%2$02d:%3$03d as the start or end of a new segment? start end @@ -757,6 +859,8 @@ Time the segment begins at Time the segment ends at Are the times correct? + The segment lasts from %1$02d:%2$02d to %3$02d:%4$02d (%5$d minutes %6$02d seconds)\nIs it ready to submit? Start must be before the end Mark two locations on the time bar first @@ -765,6 +869,7 @@ Do you want to edit the timing for the start or end of the segment? Invalid time given Stats + Stats temporarily not available (API is down) Loading... SponsorBlock is disabled @@ -802,7 +907,7 @@ Spoof app version target - + 18.33.40 - Restore RYD on Shorts incognito mode 18.20.39 - Restore wide video speed & quality menu 18.09.39 - Restore library tab @@ -812,13 +917,17 @@ Set start page Default + Home Search + Subscriptions Explore Shorts - Library + + You tab Liked videos + History Trending @@ -829,7 +938,6 @@ Enable tablet layout - Settings related to the layout Tablet layout is enabled Tablet layout is disabled Community posts do not show up on tablet layouts @@ -853,8 +961,11 @@ Invalid seekbar color value. Using default value. + Home tab + Subscription tab + You tab Player playlists, recommendations Search results @@ -878,6 +989,7 @@ Beginning of video Middle of video End of video + DeArrow temporarily not available (status code: %s) DeArrow temporarily not available @@ -896,25 +1008,9 @@ Spoof device dimensions - Device dimensions spoofed - Device dimensions not spoofed\n\nSpoofing the device dimensions can unlock higher video qualities but unknown side effects may occur - - - - Spoof app signature - Spoof the app signature to prevent playback issues - Spoof app signature - App signature spoofed\n\nSide effects include:\n• Enhanced bitrate is not available\n• Videos cannot be downloaded\n• No seekbar thumbnails for paid videos - App signature not spoofed\n\nVideo playback may not work - Turning off this setting will cause video playback issues. - Spoof app signature in feed - App signature spoofed\n\nSide effects include:\n• Feed videos are missing subtitles\n• Automatically played feed videos will show up in your watch history - App signature not spoofed for feed videos\n\nFeed videos will play for less than 1 minute before encountering playback issues - Spoof storyboard - Storyboard spoofed - Storyboard not spoofed\n\nSide effects include:\n• No ambient mode\n• Seekbar thumbnails are hidden - Spoof storyboard temporarily not available (API timed out) - Spoof storyboard temporarily not available: %s + Device dimensions spoofed\n\nHigher video qualities might be unlocked but you may experience video playback stuttering, worse battery life, and unknown side effects + Device dimensions not spoofed\n\nEnabling this can unlock higher video qualities + Enabling this can cause video playback stuttering, worse battery life, and unknown side effects. GmsCore Settings @@ -944,12 +1040,6 @@ Haptics are disabled Haptics are enabled - - - Enable auto HDR brightness - Auto HDR brightness is enabled - Auto HDR brightness is disabled - Automatic quality 2160p @@ -972,7 +1062,7 @@ Custom playback speeds Add or change the available playback speeds - Custom speeds must be less than %s Using default values. + Custom speeds must be less than %s. Using default values. Invalid custom playback speeds. Using default values. @@ -992,6 +1082,29 @@ Slide to seek is enabled Slide to seek is not enabled + + + Spoof app signature + Spoof the app signature to prevent playback issues + Spoof app signature + App signature spoofed\n\nSide effects include:\n• Enhanced bitrate is not available\n• Videos cannot be downloaded\n• No seekbar thumbnails for paid videos + App signature not spoofed\n\nVideo playback may not work + Turning off this setting will cause video playback issues. + Spoof app signature in feed + App signature spoofed\n\nSide effects include:\n• Feed videos are missing subtitles\n• Automatically played feed videos will show up in your watch history + App signature not spoofed for feed videos\n\nFeed videos will play for less than 1 minute before encountering playback issues + Spoof storyboard + Storyboard spoofed + Storyboard not spoofed\n\nSide effects include:\n• No ambient mode\n• Seekbar thumbnails are hidden + Spoof storyboard temporarily not available (API timed out) + Spoof storyboard temporarily not available: %s + + + + Enable auto HDR brightness + Auto HDR brightness is enabled + Auto HDR brightness is disabled + @@ -1025,6 +1138,7 @@ Channel Points are not claimed automatically + Enable Twitch debug mode Twitch debug mode is enabled (not recommended) Twitch debug mode is disabled diff --git a/src/main/resources/copyvideourl/drawable/revanced_yt_copy.xml b/src/main/resources/copyvideourl/drawable/revanced_yt_copy.xml index e97458c26..008393c30 100644 --- a/src/main/resources/copyvideourl/drawable/revanced_yt_copy.xml +++ b/src/main/resources/copyvideourl/drawable/revanced_yt_copy.xml @@ -1,10 +1,30 @@ - + + + + android:fillColor="@android:color/white" + android:pathData="m 9.7348145,16.94238 q -0.5966913,0 -1.0062178,-0.39988 Q 8.319101,16.14259 8.319101,15.5599 V 5.88248 q 0,-0.58269 0.4094957,-0.9826 Q 9.1381232,4.5 9.7348145,4.5 h 7.1494615 q 0.596701,0 1.006218,0.39988 Q 18.3,5.29979 18.3,5.88248 v 9.67742 q 0,0.58269 -0.409506,0.9826 -0.409517,0.39988 -1.006218,0.39988 z m 0,-0.82949 h 7.1494615 q 0.212367,0 0.389322,-0.1728 0.176965,-0.17283 0.176965,-0.38019 V 5.88248 q 0,-0.20738 -0.176965,-0.38019 -0.176955,-0.1728 -0.389322,-0.1728 H 9.7348145 q -0.212336,0 -0.389322,0.1728 Q 9.1685373,5.6751 9.1685373,5.88248 v 9.67742 q 0,0.20736 0.1769552,0.38019 0.176986,0.1728 0.389322,0.1728 z M 7.1157237,19.5 Q 6.519022,19.5 6.1094957,19.10009 5.7,18.70021 5.7,18.1175 V 7.61058 H 6.5494363 V 18.1175 q 0,0.20738 0.1769552,0.38018 0.1769655,0.17281 0.3893322,0.17281 H 15.114611 V 19.5 Z M 9.1685373,16.11289 V 5.32949 Z"/> diff --git a/src/main/resources/copyvideourl/drawable/revanced_yt_copy_timestamp.xml b/src/main/resources/copyvideourl/drawable/revanced_yt_copy_timestamp.xml index f1c2e819d..841038b37 100644 --- a/src/main/resources/copyvideourl/drawable/revanced_yt_copy_timestamp.xml +++ b/src/main/resources/copyvideourl/drawable/revanced_yt_copy_timestamp.xml @@ -1,11 +1,31 @@ - + + + + android:fillColor="@android:color/white" + android:pathData="M 9.734375 4.5 C 9.3365813 4.5 9.0015328 4.6338045 8.7285156 4.9003906 C 8.4555191 5.1669968 8.3183594 5.4943533 8.3183594 5.8828125 L 8.3183594 15.560547 C 8.3183594 15.949005 8.4555191 16.276362 8.7285156 16.542969 C 9.0015328 16.809554 9.3365813 16.941406 9.734375 16.941406 L 11.259766 16.941406 C 11.220306 16.699026 11.199219 16.450296 11.199219 16.195312 C 11.199219 16.167903 11.200672 16.140551 11.201172 16.113281 L 9.734375 16.113281 C 9.5928176 16.113281 9.4636936 16.054651 9.3457031 15.939453 C 9.2277332 15.824233 9.1679687 15.698787 9.1679688 15.560547 L 9.1679688 5.8828125 C 9.1679688 5.7445594 9.2277329 5.6171596 9.3457031 5.5019531 C 9.4636936 5.3867533 9.5928176 5.3300781 9.734375 5.3300781 L 16.884766 5.3300781 C 17.026342 5.3300781 17.155468 5.3867532 17.273438 5.5019531 C 17.391413 5.6171596 17.451172 5.7445594 17.451172 5.8828125 L 17.451172 12.052734 C 17.453072 12.053553 17.455131 12.053788 17.457031 12.054688 C 17.760014 12.185563 18.041487 12.342729 18.300781 12.525391 L 18.300781 5.8828125 C 18.300781 5.4943533 18.163629 5.1669968 17.890625 4.9003906 C 17.617573 4.6338045 17.282565 4.5 16.884766 4.5 L 9.734375 4.5 z M 5.6992188 7.6113281 L 5.6992188 18.117188 C 5.6992188 18.505659 5.8363784 18.833024 6.109375 19.099609 C 6.382392 19.366216 6.717434 19.5 7.1152344 19.5 L 12.642578 19.5 C 12.600698 19.46116 12.558138 19.42142 12.517578 19.380859 C 12.299781 19.163062 12.107686 18.926178 11.939453 18.669922 L 7.1152344 18.669922 C 6.9736568 18.669922 6.8445393 18.613252 6.7265625 18.498047 C 6.6085926 18.382847 6.5488281 18.25544 6.5488281 18.117188 L 6.5488281 7.6113281 L 5.6992188 7.6113281 z M 15.75 12.5 C 15.231251 12.5 14.743359 12.598047 14.287109 12.794922 C 13.83086 12.991797 13.435156 13.260157 13.097656 13.597656 C 12.760157 13.935156 12.491797 14.33086 12.294922 14.787109 C 12.098047 15.243359 12 15.731251 12 16.25 C 12 16.768749 12.098047 17.256641 12.294922 17.712891 C 12.491797 18.16914 12.760157 18.564844 13.097656 18.902344 C 13.435156 19.239843 13.83086 19.508203 14.287109 19.705078 C 14.743359 19.901953 15.231251 20 15.75 20 C 16.268749 20 16.756641 19.901953 17.212891 19.705078 C 17.66914 19.508203 18.064844 19.239843 18.402344 18.902344 C 18.739843 18.564844 19.008203 18.16914 19.205078 17.712891 C 19.401953 17.256641 19.5 16.768749 19.5 16.25 C 19.5 15.731251 19.401953 15.243359 19.205078 14.787109 C 19.008203 14.33086 18.739843 13.935156 18.402344 13.597656 C 18.064844 13.260157 17.66914 12.991797 17.212891 12.794922 C 16.756641 12.598047 16.268749 12.5 15.75 12.5 z M 15.75 13.25 C 16.581249 13.25 17.288672 13.542578 17.873047 14.126953 C 18.457421 14.711327 18.75 15.418751 18.75 16.25 C 18.75 17.081249 18.457421 17.788672 17.873047 18.373047 C 17.288672 18.957421 16.581249 19.25 15.75 19.25 C 14.918751 19.25 14.211327 18.957421 13.626953 18.373047 C 13.042578 17.788672 12.75 17.081249 12.75 16.25 C 12.75 15.418751 13.042578 14.711327 13.626953 14.126953 C 14.211327 13.542578 14.918751 13.25 15.75 13.25 z M 15.375 14.375 L 15.375 16.400391 L 16.988281 18.011719 L 17.511719 17.488281 L 16.125 16.099609 L 16.125 14.375 L 15.375 14.375 z"/> diff --git a/src/main/resources/downloads/drawable/revanced_yt_download_button.xml b/src/main/resources/downloads/drawable/revanced_yt_download_button.xml index 69ab6992b..9e988c5ee 100644 --- a/src/main/resources/downloads/drawable/revanced_yt_download_button.xml +++ b/src/main/resources/downloads/drawable/revanced_yt_download_button.xml @@ -1,4 +1,30 @@ - - - + + + + diff --git a/src/main/resources/sponsorblock/drawable/revanced_sb_adjust.xml b/src/main/resources/sponsorblock/drawable/revanced_sb_adjust.xml index 76a4b8bc9..c609ab8c8 100644 --- a/src/main/resources/sponsorblock/drawable/revanced_sb_adjust.xml +++ b/src/main/resources/sponsorblock/drawable/revanced_sb_adjust.xml @@ -1,10 +1,30 @@ + + + android:tint="#FFFFFF" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="@android:color/white" + android:pathData="m 12,14.156532 q 0.913052,0 1.534792,-0.62174 0.62174,-0.62174 0.62174,-1.534792 0,-0.913052 -0.62174,-1.534792 Q 12.913052,9.843468 12,9.843468 q -0.913052,0 -1.534792,0.62174 -0.62174,0.62174 -0.62174,1.534792 0,0.913052 0.62174,1.534792 0.62174,0.62174 1.534792,0.62174 z M 12.0052,22 Q 9.930936,22 8.1033049,21.211917 6.2756454,20.423835 4.9237012,19.072851 3.5717572,17.721839 2.7858786,15.899494 2,14.077147 2,12.005172 2,9.930908 2.788083,8.1032766 3.576166,6.2756454 4.9271491,4.9237012 6.2781605,3.5717572 8.100507,2.7858786 9.922853,2 11.994828,2 q 2.074264,0 3.901896,0.788083 1.827631,0.788083 3.179575,2.1390661 1.351944,1.3510114 2.137823,3.1733579 Q 22,9.922853 22,11.994828 q 0,2.074264 -0.788083,3.901896 -0.788082,1.827631 -2.139066,3.179575 -1.351012,1.351944 -3.173357,2.137823 Q 14.077147,22 12.005172,22 Z m -0.0059,-1.043476 q 3.738745,0 6.347988,-2.608508 2.609242,-2.608536 2.609242,-6.347309 0,-3.7387455 -2.608508,-6.347988 -2.608536,-2.6092425 -6.347309,-2.6092425 -3.7387453,0 -6.3479878,2.6085077 -2.6092425,2.6085359 -2.6092425,6.3473088 0,3.738746 2.6085077,6.347988 2.608536,2.609243 6.3473096,2.609243 z M 12,12 Z"/> diff --git a/src/main/resources/sponsorblock/drawable/revanced_sb_backward.xml b/src/main/resources/sponsorblock/drawable/revanced_sb_backward.xml new file mode 100644 index 000000000..be1aff2d8 --- /dev/null +++ b/src/main/resources/sponsorblock/drawable/revanced_sb_backward.xml @@ -0,0 +1,30 @@ + + + + + diff --git a/src/main/resources/sponsorblock/drawable/revanced_sb_compare.xml b/src/main/resources/sponsorblock/drawable/revanced_sb_compare.xml index 04cc65e40..8e792377d 100644 --- a/src/main/resources/sponsorblock/drawable/revanced_sb_compare.xml +++ b/src/main/resources/sponsorblock/drawable/revanced_sb_compare.xml @@ -1,10 +1,30 @@ + + + android:tint="#FFFFFF" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="@android:color/white" + android:pathData="M 10.825834,24 V 21.361845 H 3.9569613 q -0.8248376,0 -1.3908832,-0.529956 Q 2,20.301968 2,19.535186 V 4.4648145 Q 2,3.6980325 2.5660781,3.1681093 3.1321238,2.6381557 3.9569613,2.6381557 H 10.825834 V 0 H 12 V 24 Z M 3.1741963,19.071741 h 7.6516377 v -8.583184 z m 11.2719827,2.290104 v -9.43514 l 6.379624,7.145036 V 4.4702328 q 0,-0.2748156 -0.244607,-0.503814 Q 20.336588,3.7374204 20.043037,3.7374204 H 14.446179 V 2.6381568 h 5.596858 q 0.824836,0 1.390889,0.5299536 Q 22,3.6980329 22,4.4648145 V 19.535186 q 0,0.766776 -0.566074,1.296706 -0.566053,0.529956 -1.390889,0.529956 z"/> diff --git a/src/main/resources/sponsorblock/drawable/revanced_sb_edit.xml b/src/main/resources/sponsorblock/drawable/revanced_sb_edit.xml index e93574bd9..12a05f838 100644 --- a/src/main/resources/sponsorblock/drawable/revanced_sb_edit.xml +++ b/src/main/resources/sponsorblock/drawable/revanced_sb_edit.xml @@ -1,10 +1,30 @@ + + + android:tint="#FFFFFF" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="@android:color/white" + android:pathData="m 3.1764691,20.823532 h 1.321094 L 18.151971,7.1727918 16.827212,5.8480338 3.1764691,19.506133 Z M 2,22 V 19.004901 L 18.642147,2.3296522 Q 18.818253,2.1719951 19.031033,2.0859976 19.243843,2 19.48495,2 q 0.236708,0 0.4586,0.07902 0.221893,0.079052 0.425336,0.2579928 l 1.301467,1.3051305 q 0.17894,0.1875125 0.254297,0.4089585 0.07534,0.2214462 0.07534,0.4471302 0,0.2407231 -0.08201,0.4619463 -0.08201,0.2212231 -0.249803,0.3912747 L 4.9951003,22 Z M 20.848038,4.4938664 19.506138,3.1519662 Z m -3.368881,2.0269814 -0.651945,-0.672814 1.324759,1.324758 z"/> diff --git a/src/main/resources/sponsorblock/drawable/revanced_sb_forward.xml b/src/main/resources/sponsorblock/drawable/revanced_sb_forward.xml new file mode 100644 index 000000000..1ac21ea75 --- /dev/null +++ b/src/main/resources/sponsorblock/drawable/revanced_sb_forward.xml @@ -0,0 +1,30 @@ + + + + + diff --git a/src/main/resources/sponsorblock/drawable/revanced_sb_logo.xml b/src/main/resources/sponsorblock/drawable/revanced_sb_logo.xml index c39b9e0b8..709b1cdb9 100644 --- a/src/main/resources/sponsorblock/drawable/revanced_sb_logo.xml +++ b/src/main/resources/sponsorblock/drawable/revanced_sb_logo.xml @@ -1,19 +1,19 @@ - - - - + + + + android:fillColor="@android:color/white" + android:pathData="M 12.000145,2.0000008 C 8.8230689,1.9990926 5.6959192,2.7864027 2.9017488,4.2906678 2.3373945,4.5948398 1.9899198,5.1860103 2.000223,5.8244635 2.0930396,12.358829 5.4926743,18.31271 11.094442,21.749998 c 0.557183,0.333336 1.253849,0.333336 1.811031,0 5.601767,-3.438045 9.001096,-9.391169 9.094295,-15.9255345 0.01052,-0.6386247 -0.337035,-1.2300179 -0.9016,-1.5341683 -2.794107,-1.5040456 -5.92111,-2.2912233 -9.098023,-2.2902944 z m 0.08082,0.8705548 c 3.003625,0.013255 5.957553,0.7636027 8.599879,2.1845129 0.277414,0.151228 0.448533,0.4421907 0.44513,0.7568723 C 21.034684,12.23921 17.58825,17.8544 12.446767,21.009378 c -0.274165,0.167124 -0.619386,0.167124 -0.893551,0 C 6.4117365,17.854399 2.9652339,12.239209 2.8739372,5.8119397 2.8705209,5.4972741 3.0416092,5.2063196 3.3189962,5.0550685 6.0095892,3.608201 9.0224769,2.8570356 12.080969,2.8705556 Z M 9.6351953,6.7701615 v 8.3406435 l 7.2606727,-4.170358 z"/> diff --git a/src/main/resources/sponsorblock/drawable/revanced_sb_publish.xml b/src/main/resources/sponsorblock/drawable/revanced_sb_publish.xml index de4e58d3a..47ad9f2b9 100644 --- a/src/main/resources/sponsorblock/drawable/revanced_sb_publish.xml +++ b/src/main/resources/sponsorblock/drawable/revanced_sb_publish.xml @@ -1,10 +1,30 @@ + + + android:tint="#FFFFFF" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="@android:color/white" + android:pathData="M 11.332873,22 V 9.436807 L 7.973321,12.79636 7.0294692,11.858168 12,6.8876376 16.984553,11.858168 16.040737,12.79636 12.681187,9.436807 V 22 Z M 2,7.723326 V 4.2422092 Q 2,3.3000372 2.6500003,2.6500003 3.3000372,2 4.2433411,2 H 19.756696 Q 20.699964,2 21.35,2.6500003 22,3.3000372 22,4.2422092 V 7.723326 H 20.651687 V 4.2471755 q 0,-0.3370874 -0.280888,-0.6179751 Q 20.089912,3.3483125 19.752825,3.3483125 H 4.2471755 q -0.3370874,0 -0.6179751,0.2808879 Q 3.3483125,3.9100881 3.3483125,4.2471755 V 7.723326 Z"/> diff --git a/src/main/resources/sponsorblock/drawable/revanced_sb_voting.xml b/src/main/resources/sponsorblock/drawable/revanced_sb_voting.xml index 30224f149..45101e5ab 100644 --- a/src/main/resources/sponsorblock/drawable/revanced_sb_voting.xml +++ b/src/main/resources/sponsorblock/drawable/revanced_sb_voting.xml @@ -1,10 +1,30 @@ + + + android:tint="#FFFFFF" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="@android:color/white" + android:pathData="m 3.3559223,13.077965 q -0.5714933,0 -0.9637189,-0.387709 Q 2,12.302548 2,11.722042 V 6.5635083 Q 2,6.4155507 2.0610119,6.272176 2.1220462,6.1288014 2.2453475,6.0054996 L 6.2508464,2 6.5932091,2.3423629 q 0.080402,0.082054 0.1368085,0.1887203 0.056429,0.1066661 0.056429,0.1943391 V 2.8542325 L 6.0203498,6.1627116 h 4.3059752 q 0.523856,0 0.87164,0.3508458 0.347805,0.3508459 0.347805,0.86948 v 0.2717442 q 0,0.1367424 -0.02204,0.2380763 -0.02203,0.1013119 -0.0661,0.2088374 L 9.5355944,12.549151 q -0.1142458,0.252068 -0.323656,0.390441 -0.2093882,0.138373 -0.4774967,0.138373 z M 8.7694977,12.264407 10.73219,7.6779612 V 7.5186341 q 0,-0.2288001 -0.152541,-0.3855933 -0.15254,-0.1567713 -0.389824,-0.1567713 H 5.0406784 L 5.7593141,3.6517056 2.8135578,6.6008558 v 5.1211862 q 0,0.237284 0.1525407,0.389824 0.1525406,0.152541 0.3898238,0.152541 z M 17.74915,22 17.403703,21.656866 q -0.07423,-0.07545 -0.132182,-0.182155 -0.05797,-0.10671 -0.05797,-0.20064 v -0.128303 l 0.766093,-3.30848 h -4.305975 q -0.523857,0 -0.87164,-0.346615 -0.347805,-0.346593 -0.347805,-0.87371 v -0.264187 q 0,-0.135817 0.02204,-0.235829 0.02204,-0.09999 0.06611,-0.218642 l 1.92204,-4.447456 q 0.111865,-0.242373 0.319491,-0.385594 0.207626,-0.14322 0.480515,-0.14322 h 5.379665 q 0.571494,0 0.963719,0.392203 Q 22,11.706464 22,12.277958 v 5.159327 q 0,0.159371 -0.06399,0.303054 -0.06396,0.143684 -0.183477,0.256276 z m -2.518651,-10.264407 -1.962692,4.586446 v 0.159327 q 0,0.237283 0.152541,0.389824 0.15254,0.15254 0.389823,0.15254 h 5.149147 l -0.718636,3.333048 2.945756,-2.94915 v -5.12967 q 0,-0.228801 -0.152541,-0.385593 -0.15254,-0.156772 -0.389824,-0.156772 z M 2.8135578,11.722042 V 6.6008558 12.264407 Z m 18.3728802,0.555916 v 5.12967 -5.672035 z"/> diff --git a/src/main/resources/sponsorblock/layout/revanced_sb_new_segment.xml b/src/main/resources/sponsorblock/layout/revanced_sb_new_segment.xml index 30204a391..05b4dd89d 100644 --- a/src/main/resources/sponsorblock/layout/revanced_sb_new_segment.xml +++ b/src/main/resources/sponsorblock/layout/revanced_sb_new_segment.xml @@ -26,7 +26,7 @@ android:paddingTop="3.0dip" android:paddingEnd="5.0dip" android:paddingBottom="3.0dip" - android:src="@drawable/player_fast_rewind" /> + android:src="@drawable/revanced_sb_backward" /> + android:src="@drawable/revanced_sb_forward" /> - + + + + diff --git a/src/main/resources/swipecontrols/drawable/revanced_ic_sc_brightness_manual.xml b/src/main/resources/swipecontrols/drawable/revanced_ic_sc_brightness_manual.xml index 2f6c7072d..b80ab2097 100644 --- a/src/main/resources/swipecontrols/drawable/revanced_ic_sc_brightness_manual.xml +++ b/src/main/resources/swipecontrols/drawable/revanced_ic_sc_brightness_manual.xml @@ -1,5 +1,30 @@ - - + + + + diff --git a/src/main/resources/swipecontrols/drawable/revanced_ic_sc_volume_mute.xml b/src/main/resources/swipecontrols/drawable/revanced_ic_sc_volume_mute.xml index 73dc595f4..2628b330d 100644 --- a/src/main/resources/swipecontrols/drawable/revanced_ic_sc_volume_mute.xml +++ b/src/main/resources/swipecontrols/drawable/revanced_ic_sc_volume_mute.xml @@ -1,5 +1,30 @@ - - + + + + diff --git a/src/main/resources/swipecontrols/drawable/revanced_ic_sc_volume_normal.xml b/src/main/resources/swipecontrols/drawable/revanced_ic_sc_volume_normal.xml index 30dff4be1..45a19e956 100644 --- a/src/main/resources/swipecontrols/drawable/revanced_ic_sc_volume_normal.xml +++ b/src/main/resources/swipecontrols/drawable/revanced_ic_sc_volume_normal.xml @@ -1,5 +1,30 @@ - - + + + +