mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 01:01:56 +01:00
fix(YouTube): Rename Restore old seekbar thumbnails
and Restore old quality menu
(#3235)
This commit is contained in:
parent
e34b7d2ea4
commit
7e3ffc8863
5 changed files with 27 additions and 27 deletions
|
@ -9,13 +9,13 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.layout.seekbar.fingerprints.EnableNewSeekbarThumbnailsFingerprint
|
||||
import app.revanced.patches.youtube.layout.seekbar.fingerprints.FullscreenSeekbarThumbnailsFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
name = "Enable old seekbar thumbnails",
|
||||
description = "Enables the old seekbar thumbnails that appear above the seekbar instead of in fullscreen.",
|
||||
name = "Restore old seekbar thumbnails",
|
||||
description = "Restores the old seekbar thumbnails that appear above the seekbar instead of fullscreen thumbnails.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
|
@ -27,38 +27,38 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
|||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object EnableOldSeekbarThumbnailsPatch : BytecodePatch(
|
||||
setOf(EnableNewSeekbarThumbnailsFingerprint)
|
||||
object RestoreOldSeekbarThumbnailsPatch : BytecodePatch(
|
||||
setOf(FullscreenSeekbarThumbnailsFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/EnableOldSeekbarThumbnailsPatch;"
|
||||
"Lapp/revanced/integrations/patches/RestoreOldSeekbarThumbnailsPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_enable_old_seekbar_thumbnails",
|
||||
"revanced_restore_old_seekbar_thumbnails",
|
||||
StringResource(
|
||||
"revanced_enable_old_seekbar_thumbnails_title",
|
||||
"Enable old seekbar thumbnails"
|
||||
"revanced_restore_old_seekbar_thumbnails_title",
|
||||
"Restore old seekbar thumbnails"
|
||||
),
|
||||
StringResource(
|
||||
"revanced_enable_old_seekbar_thumbnails_summary_on",
|
||||
"revanced_restore_old_seekbar_thumbnails_summary_on",
|
||||
"Seekbar thumbnails will appear above the seekbar"
|
||||
),
|
||||
StringResource(
|
||||
"revanced_enable_old_seekbar_thumbnails_summary_off",
|
||||
"revanced_restore_old_seekbar_thumbnails_summary_off",
|
||||
"Seekbar thumbnails will appear in fullscreen"
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
EnableNewSeekbarThumbnailsFingerprint.result?.mutableMethod?.apply {
|
||||
FullscreenSeekbarThumbnailsFingerprint.result?.mutableMethod?.apply {
|
||||
val moveResultIndex = getInstructions().lastIndex - 1
|
||||
|
||||
addInstruction(
|
||||
moveResultIndex,
|
||||
"invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->enableOldSeekbarThumbnails()Z"
|
||||
"invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->useFullscreenSeekbarThumbnails()Z"
|
||||
)
|
||||
} ?: throw EnableNewSeekbarThumbnailsFingerprint.exception
|
||||
} ?: throw FullscreenSeekbarThumbnailsFingerprint.exception
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import app.revanced.patcher.extensions.or
|
|||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object EnableNewSeekbarThumbnailsFingerprint : LiteralValueFingerprint(
|
||||
object FullscreenSeekbarThumbnailsFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
|
@ -13,11 +13,11 @@ import app.revanced.patches.youtube.video.videoqualitymenu.fingerprints.VideoQua
|
|||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Old video quality menu",
|
||||
description = "Shows the old video quality with the advanced video quality options instead of the new one.",
|
||||
name = "Restore old video quality menu",
|
||||
description = "Restores the old video quality with advanced video quality options.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
OldVideoQualityMenuResourcePatch::class,
|
||||
RestoreOldVideoQualityMenuResourcePatch::class,
|
||||
LithoFilterPatch::class,
|
||||
RecyclerViewTreeHookPatch::class
|
||||
],
|
||||
|
@ -36,14 +36,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object OldVideoQualityMenuPatch : BytecodePatch(
|
||||
object RestoreOldVideoQualityMenuPatch : BytecodePatch(
|
||||
setOf(VideoQualityMenuViewInflateFingerprint)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/VideoQualityMenuFilterPatch;"
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/quality/OldVideoQualityMenuPatch;"
|
||||
"Lapp/revanced/integrations/patches/playback/quality/RestoreOldVideoQualityMenuPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Patch for the old type of the video quality menu.
|
|
@ -12,16 +12,16 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
|||
@Patch(
|
||||
dependencies = [SettingsPatch::class, ResourceMappingPatch::class]
|
||||
)
|
||||
object OldVideoQualityMenuResourcePatch : ResourcePatch() {
|
||||
object RestoreOldVideoQualityMenuResourcePatch : ResourcePatch() {
|
||||
internal var videoQualityBottomSheetListFragmentTitle = -1L
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_show_old_video_quality_menu",
|
||||
StringResource("revanced_show_old_video_quality_menu_title", "Show old video quality menu"),
|
||||
StringResource("revanced_show_old_video_quality_menu_summary_on", "Old video quality menu is shown"),
|
||||
StringResource("revanced_show_old_video_quality_menu_summary_off", "New video quality menu is hidden")
|
||||
"revanced_restore_old_video_quality_menu",
|
||||
StringResource("revanced_restore_old_video_quality_menu_title", "Restore old video quality menu"),
|
||||
StringResource("revanced_restore_old_video_quality_menu_summary_on", "Old video quality menu is shown"),
|
||||
StringResource("revanced_restore_old_video_quality_menu_summary_off", "Old video quality menu is not shown")
|
||||
)
|
||||
)
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package app.revanced.patches.youtube.video.videoqualitymenu.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.video.videoqualitymenu.OldVideoQualityMenuResourcePatch
|
||||
import app.revanced.patches.youtube.video.videoqualitymenu.RestoreOldVideoQualityMenuResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
@ -26,5 +26,5 @@ object VideoQualityMenuViewInflateFingerprint : LiteralValueFingerprint(
|
|||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST
|
||||
),
|
||||
literalSupplier = { OldVideoQualityMenuResourcePatch.videoQualityBottomSheetListFragmentTitle }
|
||||
literalSupplier = { RestoreOldVideoQualityMenuResourcePatch.videoQualityBottomSheetListFragmentTitle }
|
||||
)
|
Loading…
Reference in a new issue