diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/createbutton/patch/CreateButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/createbutton/patch/CreateButtonRemoverPatch.kt
deleted file mode 100644
index ef58ed6c9..000000000
--- a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/createbutton/patch/CreateButtonRemoverPatch.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-package app.revanced.patches.youtube.layout.navigation.createbutton.patch
-
-import app.revanced.extensions.toErrorResult
-import app.revanced.patcher.annotation.Description
-import app.revanced.patcher.annotation.Name
-import app.revanced.patcher.annotation.Version
-import app.revanced.patcher.data.BytecodeContext
-import app.revanced.patcher.patch.BytecodePatch
-import app.revanced.patcher.patch.PatchResult
-import app.revanced.patcher.patch.PatchResultSuccess
-import app.revanced.patcher.patch.annotations.DependsOn
-import app.revanced.patcher.patch.annotations.Patch
-import app.revanced.patches.shared.annotation.YouTubeCompatibility
-import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint
-import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
-import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
-import app.revanced.util.integrations.Constants.NAVIGATION
-import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
-import app.revanced.util.pivotbar.InjectionUtils.injectHook
-import org.jf.dexlib2.Opcode
-
-@Patch
-@Name("hide-create-button")
-@Description("Hides the create button in the navigation bar.")
-@DependsOn(
- [
- SettingsPatch::class,
- SharedResourceIdPatch::class
- ]
-)
-@YouTubeCompatibility
-@Version("0.0.1")
-class CreateButtonRemoverPatch : BytecodePatch(
- listOf(
- PivotBarCreateButtonViewFingerprint
- )
-) {
- override fun execute(context: BytecodeContext): PatchResult {
-
- PivotBarCreateButtonViewFingerprint.result?.let { result ->
- with (result.mutableMethod) {
- val insertIndex = implementation!!.instructions.let {
- val scanStart = result.scanResult.patternScanResult!!.endIndex
-
- scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
- instruction.opcode == Opcode.INVOKE_STATIC
- }
- }
- injectHook(hook, insertIndex)
- }
- } ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
-
- /*
- * Add settings
- */
- SettingsPatch.addPreference(
- arrayOf(
- "PREFERENCE: NAVIGATION_SETTINGS",
- "SETTINGS: HIDE_CREATE_BUTTON"
- )
- )
-
- SettingsPatch.updatePatchStatus("hide-create-button")
-
- return PatchResultSuccess()
- }
-
- private companion object {
- const val hook =
- "invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, $NAVIGATION" +
- "->" +
- "hideCreateButton(Landroid/view/View;)V"
- }
-}
diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/homebutton/patch/HomeButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/homebutton/patch/HomeButtonRemoverPatch.kt
deleted file mode 100644
index 01d52abd5..000000000
--- a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/homebutton/patch/HomeButtonRemoverPatch.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-package app.revanced.patches.youtube.layout.navigation.homebutton.patch
-
-import app.revanced.patcher.annotation.Description
-import app.revanced.patcher.annotation.Name
-import app.revanced.patcher.annotation.Version
-import app.revanced.patcher.data.BytecodeContext
-import app.revanced.patcher.patch.BytecodePatch
-import app.revanced.patcher.patch.PatchResult
-import app.revanced.patcher.patch.PatchResultSuccess
-import app.revanced.patcher.patch.annotations.DependsOn
-import app.revanced.patcher.patch.annotations.Patch
-import app.revanced.patches.shared.annotation.YouTubeCompatibility
-import app.revanced.patches.youtube.misc.lastpivottab.patch.LastPivotTabHookPatch
-import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
-
-@Patch
-@Name("hide-home-button")
-@Description("Hides the home button in the navigation bar.")
-@DependsOn(
- [
- SettingsPatch::class,
- LastPivotTabHookPatch::class
- ]
-)
-@YouTubeCompatibility
-@Version("0.0.1")
-class HomeButtonRemoverPatch : BytecodePatch() {
- override fun execute(context: BytecodeContext): PatchResult {
-
- /*
- * Add settings
- */
- SettingsPatch.addPreference(
- arrayOf(
- "PREFERENCE: NAVIGATION_SETTINGS",
- "SETTINGS: HIDE_HOME_BUTTON"
- )
- )
-
- SettingsPatch.updatePatchStatus("hide-home-button")
-
- return PatchResultSuccess()
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/switchbutton/fingerprints/AutoMotiveFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/fingerprints/AutoMotiveFingerprint.kt
similarity index 79%
rename from src/main/kotlin/app/revanced/patches/youtube/layout/navigation/switchbutton/fingerprints/AutoMotiveFingerprint.kt
rename to src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/fingerprints/AutoMotiveFingerprint.kt
index 46b5014a9..0ec3fa0fb 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/switchbutton/fingerprints/AutoMotiveFingerprint.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/fingerprints/AutoMotiveFingerprint.kt
@@ -1,4 +1,4 @@
-package app.revanced.patches.youtube.layout.navigation.switchbutton.fingerprints
+package app.revanced.patches.youtube.layout.navigation.navigationbuttons.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/lastpivottab/fingerprints/PivotBarEnumFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/fingerprints/PivotBarEnumFingerprint.kt
similarity index 81%
rename from src/main/kotlin/app/revanced/patches/youtube/misc/lastpivottab/fingerprints/PivotBarEnumFingerprint.kt
rename to src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/fingerprints/PivotBarEnumFingerprint.kt
index 41783df71..085dc32b0 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/misc/lastpivottab/fingerprints/PivotBarEnumFingerprint.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/fingerprints/PivotBarEnumFingerprint.kt
@@ -1,4 +1,4 @@
-package app.revanced.patches.youtube.misc.lastpivottab.fingerprints
+package app.revanced.patches.youtube.layout.navigation.navigationbuttons.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/lastpivottab/fingerprints/PivotBarShortsButtonViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/fingerprints/PivotBarShortsButtonViewFingerprint.kt
similarity index 78%
rename from src/main/kotlin/app/revanced/patches/youtube/misc/lastpivottab/fingerprints/PivotBarShortsButtonViewFingerprint.kt
rename to src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/fingerprints/PivotBarShortsButtonViewFingerprint.kt
index bc38484cc..a680f69c3 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/misc/lastpivottab/fingerprints/PivotBarShortsButtonViewFingerprint.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/fingerprints/PivotBarShortsButtonViewFingerprint.kt
@@ -1,4 +1,4 @@
-package app.revanced.patches.youtube.misc.lastpivottab.fingerprints
+package app.revanced.patches.youtube.layout.navigation.navigationbuttons.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/lastpivottab/patch/LastPivotTabHookPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/patch/NavigationButtonsPatch.kt
similarity index 50%
rename from src/main/kotlin/app/revanced/patches/youtube/misc/lastpivottab/patch/LastPivotTabHookPatch.kt
rename to src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/patch/NavigationButtonsPatch.kt
index eb52fcf1f..8e0a6486e 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/misc/lastpivottab/patch/LastPivotTabHookPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/navigationbuttons/patch/NavigationButtonsPatch.kt
@@ -1,37 +1,53 @@
-package app.revanced.patches.youtube.misc.lastpivottab.patch
+package app.revanced.patches.youtube.layout.navigation.navigationbuttons.patch
import app.revanced.extensions.toErrorResult
+import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
+import app.revanced.patcher.extensions.addInstructions
+import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
+import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint
-import app.revanced.patches.youtube.misc.lastpivottab.fingerprints.PivotBarEnumFingerprint
-import app.revanced.patches.youtube.misc.lastpivottab.fingerprints.PivotBarShortsButtonViewFingerprint
+import app.revanced.patches.youtube.layout.navigation.navigationbuttons.fingerprints.*
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch
+import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.NAVIGATION
import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.util.pivotbar.InjectionUtils.injectHook
+import org.jf.dexlib2.Opcode
+import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
-@Name("last-pivot-tab-hook")
-@DependsOn([SharedResourceIdPatch::class])
+@Patch
+@Name("hide-navigation-buttons")
+@Description("Adds options to hide or change navigation buttons.")
+@DependsOn(
+ [
+ SettingsPatch::class,
+ SharedResourceIdPatch::class
+ ]
+)
@YouTubeCompatibility
@Version("0.0.1")
-class LastPivotTabHookPatch : BytecodePatch(
- listOf(PivotBarCreateButtonViewFingerprint)
+class NavigationButtonsPatch : BytecodePatch(
+ listOf(
+ AutoMotiveFingerprint,
+ PivotBarCreateButtonViewFingerprint
+ )
) {
override fun execute(context: BytecodeContext): PatchResult {
- /*
- * Resolve fingerprints
- */
-
PivotBarCreateButtonViewFingerprint.result?.let { parentResult ->
+
+ /**
+ * Home, Shorts, Subscriptions Button
+ */
with (
arrayOf(
PivotBarEnumFingerprint,
@@ -60,8 +76,51 @@ class LastPivotTabHookPatch : BytecodePatch(
}
}
+ /**
+ * Create Button
+ */
+ with (parentResult.mutableMethod) {
+ val insertIndex = implementation!!.instructions.let {
+ val scanStart = parentResult.scanResult.patternScanResult!!.endIndex
+
+ scanStart + it.subList(scanStart, it.size - 1).indexOfFirst { instruction ->
+ instruction.opcode == Opcode.INVOKE_STATIC
+ }
+ }
+ injectHook(createButtonHook, insertIndex)
+ }
+
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
+ /*
+ * Switch create button with notifications button
+ */
+ AutoMotiveFingerprint.result?.let {
+ with (it.mutableMethod) {
+ val insertIndex = it.scanResult.patternScanResult!!.endIndex
+ val register = (instruction(insertIndex) as OneRegisterInstruction).registerA
+
+ addInstructions(
+ insertIndex, """
+ invoke-static {v$register}, $NAVIGATION->switchCreateNotification(Z)Z
+ move-result v$register
+ """
+ )
+ }
+ } ?: return AutoMotiveFingerprint.toErrorResult()
+
+ /**
+ * Add settings
+ */
+ SettingsPatch.addPreference(
+ arrayOf(
+ "PREFERENCE: NAVIGATION_SETTINGS",
+ "SETTINGS: HIDE_NAVIGATION_BUTTONS"
+ )
+ )
+
+ SettingsPatch.updatePatchStatus("hide-navigation-buttons")
+
return PatchResultSuccess()
}
private companion object {
@@ -74,5 +133,10 @@ class LastPivotTabHookPatch : BytecodePatch(
"invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, $NAVIGATION" +
"->" +
"hideNavigationButton(Landroid/view/View;)V"
+
+ const val createButtonHook =
+ "invoke-static { v$REGISTER_TEMPLATE_REPLACEMENT }, $NAVIGATION" +
+ "->" +
+ "hideCreateButton(Landroid/view/View;)V"
}
}
\ No newline at end of file
diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/shortsbutton/patch/ShortsButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/shortsbutton/patch/ShortsButtonRemoverPatch.kt
deleted file mode 100644
index 1253522a1..000000000
--- a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/shortsbutton/patch/ShortsButtonRemoverPatch.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-package app.revanced.patches.youtube.layout.navigation.shortsbutton.patch
-
-import app.revanced.patcher.annotation.Description
-import app.revanced.patcher.annotation.Name
-import app.revanced.patcher.annotation.Version
-import app.revanced.patcher.data.BytecodeContext
-import app.revanced.patcher.patch.BytecodePatch
-import app.revanced.patcher.patch.PatchResult
-import app.revanced.patcher.patch.PatchResultSuccess
-import app.revanced.patcher.patch.annotations.DependsOn
-import app.revanced.patcher.patch.annotations.Patch
-import app.revanced.patches.shared.annotation.YouTubeCompatibility
-import app.revanced.patches.youtube.misc.lastpivottab.patch.LastPivotTabHookPatch
-import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
-
-@Patch
-@Name("hide-shorts-button")
-@Description("Hides the shorts button in the navigation bar.")
-@DependsOn(
- [
- SettingsPatch::class,
- LastPivotTabHookPatch::class
- ]
-)
-@YouTubeCompatibility
-@Version("0.0.1")
-class ShortsButtonRemoverPatch : BytecodePatch() {
- override fun execute(context: BytecodeContext): PatchResult {
-
- /*
- * Add settings
- */
- SettingsPatch.addPreference(
- arrayOf(
- "PREFERENCE: NAVIGATION_SETTINGS",
- "SETTINGS: HIDE_SHORTS_BUTTON"
- )
- )
-
- SettingsPatch.updatePatchStatus("hide-shorts-button")
-
- return PatchResultSuccess()
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/subscriptionsbutton/patch/SubscriptionsButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/subscriptionsbutton/patch/SubscriptionsButtonRemoverPatch.kt
deleted file mode 100644
index b77ab7d71..000000000
--- a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/subscriptionsbutton/patch/SubscriptionsButtonRemoverPatch.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-package app.revanced.patches.youtube.layout.navigation.subscriptionsbutton.patch
-
-import app.revanced.patcher.annotation.Description
-import app.revanced.patcher.annotation.Name
-import app.revanced.patcher.annotation.Version
-import app.revanced.patcher.data.BytecodeContext
-import app.revanced.patcher.patch.BytecodePatch
-import app.revanced.patcher.patch.PatchResult
-import app.revanced.patcher.patch.PatchResultSuccess
-import app.revanced.patcher.patch.annotations.DependsOn
-import app.revanced.patcher.patch.annotations.Patch
-import app.revanced.patches.shared.annotation.YouTubeCompatibility
-import app.revanced.patches.youtube.misc.lastpivottab.patch.LastPivotTabHookPatch
-import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
-
-@Patch
-@Name("hide-subscriptions-button")
-@Description("Hides the subscriptions button in the navigation bar.")
-@DependsOn(
- [
- SettingsPatch::class,
- LastPivotTabHookPatch::class
- ]
-)
-@YouTubeCompatibility
-@Version("0.0.1")
-class SubscriptionsButtonRemoverPatch : BytecodePatch() {
- override fun execute(context: BytecodeContext): PatchResult {
-
- /*
- * Add settings
- */
- SettingsPatch.addPreference(
- arrayOf(
- "PREFERENCE: NAVIGATION_SETTINGS",
- "SETTINGS: HIDE_SUBSCRIPTIONS_BUTTON"
- )
- )
-
- SettingsPatch.updatePatchStatus("hide-subscriptions-button")
-
- return PatchResultSuccess()
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/switchbutton/patch/SwitchCreateButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/switchbutton/patch/SwitchCreateButtonPatch.kt
deleted file mode 100644
index aa02cdef5..000000000
--- a/src/main/kotlin/app/revanced/patches/youtube/layout/navigation/switchbutton/patch/SwitchCreateButtonPatch.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-package app.revanced.patches.youtube.layout.navigation.switchbutton.patch
-
-import app.revanced.extensions.toErrorResult
-import app.revanced.patcher.annotation.Description
-import app.revanced.patcher.annotation.Name
-import app.revanced.patcher.annotation.Version
-import app.revanced.patcher.data.BytecodeContext
-import app.revanced.patcher.extensions.addInstructions
-import app.revanced.patcher.extensions.instruction
-import app.revanced.patcher.patch.BytecodePatch
-import app.revanced.patcher.patch.PatchResult
-import app.revanced.patcher.patch.PatchResultSuccess
-import app.revanced.patcher.patch.annotations.DependsOn
-import app.revanced.patcher.patch.annotations.Patch
-import app.revanced.patches.shared.annotation.YouTubeCompatibility
-import app.revanced.patches.youtube.layout.navigation.switchbutton.fingerprints.AutoMotiveFingerprint
-import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
-import app.revanced.util.integrations.Constants.NAVIGATION
-import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
-
-@Patch
-@Name("switch-create-notification")
-@Description("Switching the create button and notification button.")
-@DependsOn([SettingsPatch::class])
-@YouTubeCompatibility
-@Version("0.0.1")
-class SwitchCreateButtonPatch : BytecodePatch(
- listOf(AutoMotiveFingerprint)
-) {
- override fun execute(context: BytecodeContext): PatchResult {
-
- AutoMotiveFingerprint.result?.let {
- with (it.mutableMethod) {
- val insertIndex = it.scanResult.patternScanResult!!.endIndex
- val register = (instruction(insertIndex) as OneRegisterInstruction).registerA
-
- addInstructions(
- insertIndex, """
- invoke-static {v$register}, $NAVIGATION->switchCreateNotification(Z)Z
- move-result v$register
- """
- )
- }
- } ?: return AutoMotiveFingerprint.toErrorResult()
-
- /*
- * Add settings
- */
- SettingsPatch.addPreference(
- arrayOf(
- "PREFERENCE: NAVIGATION_SETTINGS",
- "SETTINGS: SWITCH_CREATE_NOTIFICATION"
- )
- )
-
- SettingsPatch.updatePatchStatus("switch-create-notification")
-
- return PatchResultSuccess()
- }
-}
\ No newline at end of file
diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml
index 860a34cd1..e28e460ab 100644
--- a/src/main/resources/youtube/settings/host/values/strings.xml
+++ b/src/main/resources/youtube/settings/host/values/strings.xml
@@ -411,14 +411,15 @@ Please do not report any issues you encounter while using this feature."Shorts shelves are shown
Shorts shelves are hidden
Hide shorts shelf
- Shorts
- Shorts player
Snackbar is shown
Snackbar is hidden
Hide snackbar
Stories shelves are shown
Stories shelves are hidden
Hide stories shelf
+ Subscriptions button is shown
+ Subscriptions button is hidden
+ Hide subscriptions button
Suggested actions shown
Suggested actions hidden
Hide suggested actions
@@ -513,6 +514,8 @@ Since these setting is quite outdated, it may not be valid"
Changing default Wi-Fi quality to:
Changing default speed to:
Seekbar
+ Shorts
+ Shorts player
Known issue: Title disappears when clicked
Show fullscreen title
SponsorBlock related settings
diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
index 783dd2cce..ddf710eb2 100644
--- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml
+++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
@@ -320,20 +320,12 @@
-
-
-
-
-
-
-
-
-
+