mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-07 09:53:55 +01:00
Compare commits
15 Commits
v4.7.0-dev
...
v4.8.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49db0cee1b | ||
|
|
531955a111 | ||
|
|
e53cc9bba9 | ||
|
|
fc43dd709f | ||
|
|
3a018ff002 | ||
|
|
86f11480e7 | ||
|
|
0190d5a5c9 | ||
|
|
50735fabbc | ||
|
|
653631703c | ||
|
|
2587508944 | ||
|
|
533f9a964d | ||
|
|
fb0b3bd673 | ||
|
|
96e17cf4de | ||
|
|
a7bd0b111e | ||
|
|
7ecd992def |
71
CHANGELOG.md
71
CHANGELOG.md
@@ -1,3 +1,74 @@
|
||||
# [4.8.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.8.0-dev.1...v4.8.0-dev.2) (2024-04-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Case patch option title correctly ([259c8b4](https://github.com/ReVanced/revanced-patches/commit/259c8b4e58df51d92d7e19417e13afa3848afc73))
|
||||
|
||||
# [4.8.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.7.0...v4.8.0-dev.1) (2024-04-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Hide video action buttons:** Remove obsolete `hide Shop button` ([#3057](https://github.com/ReVanced/revanced-patches/issues/3057)) ([b5e34f3](https://github.com/ReVanced/revanced-patches/commit/b5e34f3aabc1d9df8c41f92251618243caecdc9f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Hide Shorts components:** Hide like / dislike button in video ads ([#3062](https://github.com/ReVanced/revanced-patches/issues/3062)) ([1296985](https://github.com/ReVanced/revanced-patches/commit/12969853adfe530eb6006df38e1a5aa30b28fdf9))
|
||||
|
||||
# [4.7.0](https://github.com/ReVanced/revanced-patches/compare/v4.6.0...v4.7.0) (2024-04-21)
|
||||
|
||||
|
||||
### 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))
|
||||
* **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))
|
||||
* **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))
|
||||
* **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))
|
||||
* **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))
|
||||
* **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))
|
||||
* **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))
|
||||
* **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))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add `Hex` patch ([#3034](https://github.com/ReVanced/revanced-patches/issues/3034)) ([3c95aac](https://github.com/ReVanced/revanced-patches/commit/3c95aac838693b354d3a7b0e3dc57c6da5adfa9e))
|
||||
* **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))
|
||||
* **Strava - Unlock subscription:** Remove compatible version constraint ([80a5599](https://github.com/ReVanced/revanced-patches/commit/80a55991683d7b22626224fa2935a5bf9bfcbfee))
|
||||
* **Twitter:** Add `Sanitize sharing links` patch ([#3003](https://github.com/ReVanced/revanced-patches/issues/3003)) ([186b887](https://github.com/ReVanced/revanced-patches/commit/186b8874157eef1b882b05d491ba1d4ca2809535))
|
||||
* **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))
|
||||
* **YouTube - Hide layout components:** Hide playables ([8423515](https://github.com/ReVanced/revanced-patches/commit/842351548baa33737db09be1cbca9f87c1951341))
|
||||
* **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))
|
||||
* **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))
|
||||
* **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))
|
||||
* **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))
|
||||
* **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))
|
||||
* **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.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)
|
||||
|
||||
|
||||
|
||||
@@ -724,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 {
|
||||
@@ -1846,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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 4.7.0-dev.13
|
||||
version = 4.8.0-dev.2
|
||||
|
||||
@@ -19,7 +19,7 @@ class HexPatch : BaseHexPatch() {
|
||||
// Replace the custom option type with a stringArrayOption once the issue is resolved.
|
||||
private val replacementsOption by registerNewPatchOption<PatchClass<*>, List<String>>(
|
||||
key = "replacements",
|
||||
title = "replacements",
|
||||
title = "Replacements",
|
||||
description = """
|
||||
Hexadecimal patterns to search for and replace with another in a target file.
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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
|
||||
)
|
||||
)
|
||||
@@ -8,19 +8,15 @@ import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
object ResourceMappingPatch : ResourcePatch() {
|
||||
internal lateinit var resourceMappings: List<ResourceElement>
|
||||
private set
|
||||
private val resourceMappings = Collections.synchronizedList(mutableListOf<ResourceElement>())
|
||||
|
||||
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<ResourceElement>())
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,17 @@ object SettingsPatch : BytecodePatch(
|
||||
AddResourcesPatch(this::class)
|
||||
|
||||
PreferenceScreen.MISC.OTHER.addPreferences(
|
||||
SwitchPreference("revanced_debug")
|
||||
// The debug setting is shared across multiple apps and the key must be the same.
|
||||
// But the title and summary must be different, otherwise when the strings file is flattened
|
||||
// for Crowdin push, Crowdin gets confused by the duplicate keys.
|
||||
// FIXME: Ideally the shared debug strings are extracted into a common app group
|
||||
// and then both apps import that. But for now unique unique title and summary keys also works.
|
||||
SwitchPreference(
|
||||
key = "revanced_debug",
|
||||
titleKey = "revanced_twitch_debug_title",
|
||||
summaryOnKey = "revanced_twitch_debug_summary_on",
|
||||
summaryOffKey = "revanced_twitch_debug_summary_off"
|
||||
)
|
||||
)
|
||||
|
||||
// Hook onCreate to handle fragment creation
|
||||
|
||||
@@ -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"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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 =
|
||||
@@ -35,11 +35,11 @@ object HideAdsResourcePatch : ResourcePatch() {
|
||||
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"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
],
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
],
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -63,8 +65,7 @@ object HideButtonsPatch : ResourcePatch() {
|
||||
SwitchPreference("revanced_hide_download_button"),
|
||||
SwitchPreference("revanced_hide_thanks_button"),
|
||||
SwitchPreference("revanced_hide_clip_button"),
|
||||
SwitchPreference("revanced_hide_playlist_button"),
|
||||
SwitchPreference("revanced_hide_shop_button")
|
||||
SwitchPreference("revanced_hide_playlist_button")
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -57,7 +57,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"
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -101,7 +103,6 @@ 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"),
|
||||
@@ -120,6 +121,7 @@ object HideLayoutComponentsPatch : BytecodePatch(
|
||||
SwitchPreference("revanced_hide_mix_playlists"),
|
||||
SwitchPreference("revanced_hide_movies_section"),
|
||||
SwitchPreference("revanced_hide_notify_me_button"),
|
||||
SwitchPreference("revanced_hide_playables"),
|
||||
SwitchPreference("revanced_hide_search_result_recommendations"),
|
||||
SwitchPreference("revanced_hide_search_result_shelf_header"),
|
||||
SwitchPreference("revanced_hide_show_more_button"),
|
||||
|
||||
@@ -5,22 +5,22 @@ 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
|
||||
]
|
||||
AddResourcesPatch::class,
|
||||
],
|
||||
)
|
||||
internal object HideLayoutComponentsResourcePatch : ResourcePatch() {
|
||||
internal var expandButtonDownId: Long = -1
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
expandButtonDownId = ResourceMappingPatch.resourceMappings.single {
|
||||
it.type == "layout" && it.name == "expand_button_down"
|
||||
}.id
|
||||
expandButtonDownId = ResourceMappingPatch[
|
||||
"layout",
|
||||
"expand_button_down",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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,9 +12,15 @@ 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.util.exception
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfIdResourceOrThrow
|
||||
import app.revanced.util.injectHideViewCall
|
||||
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
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch(
|
||||
name = "Hide Shorts components",
|
||||
@@ -27,11 +30,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
LithoFilterPatch::class,
|
||||
HideShortsComponentsResourcePatch::class,
|
||||
ResourceMappingPatch::class,
|
||||
NavigationBarHookPatch::class
|
||||
NavigationBarHookPatch::class,
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.32.39",
|
||||
"18.37.36",
|
||||
"18.38.44",
|
||||
@@ -48,10 +52,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(
|
||||
@@ -60,8 +66,8 @@ object HideShortsComponentsPatch : BytecodePatch(
|
||||
ReelConstructorFingerprint,
|
||||
BottomNavigationBarFingerprint,
|
||||
RenderBottomNavigationBarParentFingerprint,
|
||||
SetPivotBarVisibilityParentFingerprint
|
||||
)
|
||||
SetPivotBarVisibilityParentFingerprint,
|
||||
),
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/ShortsFilter;"
|
||||
|
||||
@@ -79,7 +85,7 @@ object HideShortsComponentsPatch : BytecodePatch(
|
||||
insertIndex,
|
||||
viewRegister,
|
||||
FILTER_CLASS_DESCRIPTOR,
|
||||
"hideShortsShelf"
|
||||
"hideShortsShelf",
|
||||
)
|
||||
}
|
||||
} // Do not throw an exception if not resolved.
|
||||
@@ -93,7 +99,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.
|
||||
@@ -106,8 +111,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 {
|
||||
@@ -116,7 +122,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;",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -124,8 +130,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")
|
||||
@@ -142,7 +149,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
|
||||
@@ -150,18 +157,25 @@ object HideShortsComponentsPatch : BytecodePatch(
|
||||
// endregion
|
||||
}
|
||||
|
||||
|
||||
private enum class ShortsButtons(private val resourceName: String, private val methodName: String) {
|
||||
LIKE("reel_dyn_like", "hideLikeButton"),
|
||||
DISLIKE("reel_dyn_dislike", "hideDislikeButton"),
|
||||
COMMENTS("reel_dyn_comment", "hideShortsCommentsButton"),
|
||||
REMIX("reel_dyn_remix", "hideShortsRemixButton"),
|
||||
SHARE("reel_dyn_share", "hideShortsShareButton");
|
||||
|
||||
fun injectHideCall(method: MutableMethod) {
|
||||
val referencedIndex = method.findIndexForIdResource(resourceName)
|
||||
val referencedIndex = method.indexOfIdResourceOrThrow(resourceName)
|
||||
|
||||
val setIdIndex = referencedIndex + 1
|
||||
val instruction = method.implementation!!.instructions
|
||||
.subList(referencedIndex, referencedIndex + 20)
|
||||
.first {
|
||||
it.opcode == Opcode.INVOKE_VIRTUAL && it.getReference<MethodReference>()?.name == "setId"
|
||||
}
|
||||
|
||||
val setIdIndex = instruction.location.index
|
||||
val viewRegister = method.getInstruction<FiveRegisterInstruction>(setIdIndex).registerC
|
||||
method.injectHideViewCall(setIdIndex, viewRegister, FILTER_CLASS_DESCRIPTOR, methodName)
|
||||
method.injectHideViewCall(setIdIndex + 1, viewRegister, FILTER_CLASS_DESCRIPTOR, methodName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,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 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 }
|
||||
)
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -50,7 +50,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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -61,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"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 <reified T : Reference> 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<MethodFingerprint>.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<MethodFingerprint>.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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
<string name="revanced_hide_channel_bar_title">Hide channel bar</string>
|
||||
<string name="revanced_hide_channel_bar_summary_on">Channel bar is hidden</string>
|
||||
<string name="revanced_hide_channel_bar_summary_off">Channel bar is shown</string>
|
||||
<string name="revanced_hide_playables_title">Hide playables</string>
|
||||
<string name="revanced_hide_playables_title">Hide Playables</string>
|
||||
<string name="revanced_hide_playables_summary_on">Playables are hidden</string>
|
||||
<string name="revanced_hide_playables_summary_off">Playables are shown</string>
|
||||
<string name="revanced_hide_quick_actions_title">Hide quick actions in fullscreen</string>
|
||||
@@ -249,7 +249,7 @@
|
||||
<string name="revanced_hide_general_ads_summary_on">General ads are hidden</string>
|
||||
<string name="revanced_hide_general_ads_summary_off">General ads are shown</string>
|
||||
<string name="revanced_hide_fullscreen_ads_title">Hide fullscreen ads</string>
|
||||
<string name="revanced_hide_fullscreen_ads_summary_on">Fullscreen ads are hidden</string>
|
||||
<string name="revanced_hide_fullscreen_ads_summary_on">Fullscreen ads are hidden\n\nThis feature is only available for older devices</string>
|
||||
<string name="revanced_hide_fullscreen_ads_summary_off">Fullscreen ads are shown</string>
|
||||
<string name="revanced_hide_buttoned_ads_title">Hide buttoned ads</string>
|
||||
<string name="revanced_hide_buttoned_ads_summary_on">Buttoned ads are hidden</string>
|
||||
@@ -272,7 +272,7 @@
|
||||
<string name="revanced_hide_merchandise_banners_title">Hide merchandise banners</string>
|
||||
<string name="revanced_hide_merchandise_banners_summary_on">Merchandise banners are hidden</string>
|
||||
<string name="revanced_hide_merchandise_banners_summary_off">Merchandise banners are shown</string>
|
||||
<string name="revanced_hide_fullscreen_ads_feature_not_available_toast">Could not hide fullscreen ad. Hide setting disabled to prevent issues.</string>
|
||||
<string name="revanced_hide_fullscreen_ads_feature_not_available_toast">Hide fullscreen ads only works with older devices</string>
|
||||
</patch>
|
||||
<patch id="ad.getpremium.HideGetPremiumPatch">
|
||||
<string name="revanced_hide_get_premium_title">Hide YouTube Premium promotions</string>
|
||||
@@ -340,6 +340,10 @@
|
||||
<string name="revanced_swipe_save_and_restore_brightness_title">Save and restore brightness</string>
|
||||
<string name="revanced_swipe_save_and_restore_brightness_summary_on">Save and restore brightness when exiting or entering fullscreen</string>
|
||||
<string name="revanced_swipe_save_and_restore_brightness_summary_off">Do not save and restore brightness when exiting or entering fullscreen</string>
|
||||
<string name="revanced_swipe_lowest_value_enable_auto_brightness_title">Enable auto-brightness gesture</string>
|
||||
<string name="revanced_swipe_lowest_value_enable_auto_brightness_summary_on">Swiping down to the lowest value of the brightness gesture enable auto-brightness</string>
|
||||
<string name="revanced_swipe_lowest_value_enable_auto_brightness_summary_off">Swiping down to the lowest value does not enable auto-brightness</string>
|
||||
<string name="revanced_swipe_lowest_value_enable_auto_brightness_overlay_text">Auto</string>
|
||||
<string name="revanced_swipe_overlay_timeout_title">Swipe overlay timeout</string>
|
||||
<string name="revanced_swipe_overlay_timeout_summary">The amount of milliseconds the overlay is visible</string>
|
||||
<string name="revanced_swipe_text_overlay_size_title">Swipe overlay text size</string>
|
||||
@@ -389,11 +393,6 @@
|
||||
<string name="revanced_hide_playlist_button_title">Hide Save to playlist</string>
|
||||
<string name="revanced_hide_playlist_button_summary_on">Save to playlist button is hidden</string>
|
||||
<string name="revanced_hide_playlist_button_summary_off">Save to playlist button is shown</string>
|
||||
<!-- 'Shop' should be translated with the same localized wording that YouTube displays.
|
||||
Shop button appears only for some videos in certain regions. Translate the button name normally if this menu is never shown. -->
|
||||
<string name="revanced_hide_shop_button_title">Hide Shop</string>
|
||||
<string name="revanced_hide_shop_button_summary_on">Shop button is hidden</string>
|
||||
<string name="revanced_hide_shop_button_summary_off">Shop button is shown</string>
|
||||
</patch>
|
||||
<patch id="layout.buttons.autoplay.HideAutoplayButtonPatch">
|
||||
<string name="revanced_hide_autoplay_button_title">Hide autoplay button</string>
|
||||
@@ -1151,9 +1150,9 @@
|
||||
<string name="revanced_other_category_title">Other settings</string>
|
||||
<string name="revanced_client_ads_category_title">Client-side ads</string>
|
||||
<string name="revanced_surestream_ads_category_title">Server-side surestream ads</string>
|
||||
<string name="revanced_debug_title">Debug logging</string>
|
||||
<string name="revanced_debug_summary_on">Debug logs are enabled</string>
|
||||
<string name="revanced_debug_summary_off">Debug logs are disabled</string>
|
||||
<string name="revanced_twitch_debug_title">Debug logging</string>
|
||||
<string name="revanced_twitch_debug_summary_on">Debug logs are enabled</string>
|
||||
<string name="revanced_twitch_debug_summary_off">Debug logs are disabled</string>
|
||||
</patch>
|
||||
</app>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user