mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-15 21:52:27 +01:00
Compare commits
4 Commits
v4.7.0-dev
...
v4.7.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04a72d52de | ||
|
|
be76e49a8b | ||
|
|
fa1c616014 | ||
|
|
e97aaf4aae |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
||||
# [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)
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 4.7.0-dev.4
|
||||
version = 4.7.0-dev.6
|
||||
|
||||
@@ -35,6 +35,9 @@ object HideShortsComponentsResourcePatch : ResourcePatch() {
|
||||
|
||||
// Everything else.
|
||||
SwitchPreference("revanced_hide_shorts_thanks_button"),
|
||||
SwitchPreference("revanced_hide_shorts_shop_button"),
|
||||
SwitchPreference("revanced_hide_shorts_location_button"),
|
||||
SwitchPreference("revanced_hide_shorts_save_sound_button"),
|
||||
SwitchPreference("revanced_hide_shorts_join_button"),
|
||||
SwitchPreference("revanced_hide_shorts_subscribe_button"),
|
||||
SwitchPreference("revanced_hide_shorts_subscribe_button_paused"),
|
||||
|
||||
@@ -36,7 +36,9 @@ object NavigationBarHookPatch : BytecodePatch(
|
||||
NavigationEnumFingerprint,
|
||||
PivotBarButtonsCreateDrawableViewFingerprint,
|
||||
PivotBarButtonsCreateResourceViewFingerprint,
|
||||
PivotBarButtonsViewSetSelectedFingerprint,
|
||||
NavigationBarHookCallbackFingerprint,
|
||||
MainActivityOnBackPressedFingerprint,
|
||||
ActionBarSearchResultsFingerprint,
|
||||
),
|
||||
) {
|
||||
@@ -90,6 +92,29 @@ object NavigationBarHookPatch : BytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
PivotBarButtonsViewSetSelectedFingerprint.resultOrThrow().mutableMethod.apply {
|
||||
val index = PivotBarButtonsViewSetSelectedFingerprint.indexOfSetViewSelectedInstruction(this)
|
||||
val instruction = getInstruction<FiveRegisterInstruction>(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.
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
)
|
||||
@@ -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<MethodReference>()?.name == "setSelected"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,6 +577,15 @@
|
||||
<string name="revanced_hide_shorts_thanks_button_title">Hide thanks button</string>
|
||||
<string name="revanced_hide_shorts_thanks_button_summary_on">Thanks button is hidden</string>
|
||||
<string name="revanced_hide_shorts_thanks_button_summary_off">Thanks button is shown</string>
|
||||
<string name="revanced_hide_shorts_shop_button_title">Hide shop button</string>
|
||||
<string name="revanced_hide_shorts_shop_button_summary_on">Shop button is hidden</string>
|
||||
<string name="revanced_hide_shorts_shop_button_summary_off">Shop button is shown</string>
|
||||
<string name="revanced_hide_shorts_location_button_title">Hide location button</string>
|
||||
<string name="revanced_hide_shorts_location_button_summary_on">Location button is hidden</string>
|
||||
<string name="revanced_hide_shorts_location_button_summary_off">Location button is shown</string>
|
||||
<string name="revanced_hide_shorts_save_sound_button_title">Hide save sound to playlist button</string>
|
||||
<string name="revanced_hide_shorts_save_sound_button_summary_on">Save sound to playlist is hidden</string>
|
||||
<string name="revanced_hide_shorts_save_sound_button_summary_off">save sound to playlist is shown</string>
|
||||
<string name="revanced_hide_shorts_like_button_title">Hide like button</string>
|
||||
<string name="revanced_hide_shorts_like_button_summary_on">Like button is hidden</string>
|
||||
<string name="revanced_hide_shorts_like_button_summary_off">Like button is shown</string>
|
||||
|
||||
Reference in New Issue
Block a user