feat(YouTube): Add Enable old seekbar thumbnails
patch
This commit is contained in:
parent
bb8e583764
commit
e97e0e6631
|
@ -15,7 +15,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Disable fullscreen ambient mode",
|
name = "Disable fullscreen ambient mode",
|
||||||
description = "Disables the ambient mode when in fullscreen.",
|
description = "Disables the ambient mode when in fullscreen.",
|
||||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class, IntegrationsPatch::class],
|
dependencies = [SettingsPatch::class, IntegrationsPatch::class],
|
||||||
compatiblePackages = [
|
compatiblePackages = [
|
||||||
CompatiblePackage(
|
CompatiblePackage(
|
||||||
"com.google.android.youtube", [
|
"com.google.android.youtube", [
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package app.revanced.patches.youtube.layout.seekbar
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
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.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.",
|
||||||
|
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||||
|
compatiblePackages = [
|
||||||
|
CompatiblePackage(
|
||||||
|
"com.google.android.youtube", [
|
||||||
|
"18.37.36",
|
||||||
|
"18.38.44"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object EnableOldSeekbarThumbnailsPatch : BytecodePatch(
|
||||||
|
setOf(EnableNewSeekbarThumbnailsFingerprint)
|
||||||
|
) {
|
||||||
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/patches/EnableOldSeekbarThumbnailsPatch;"
|
||||||
|
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_enable_old_seekbar_thumbnails",
|
||||||
|
StringResource(
|
||||||
|
"revanced_enable_old_seekbar_thumbnails_title",
|
||||||
|
"Enable old seekbar thumbnails"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_enable_old_seekbar_thumbnails_summary_on",
|
||||||
|
"Seekbar thumbnails will appear above the seekbar"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_enable_old_seekbar_thumbnails_summary_off",
|
||||||
|
"Seekbar thumbnails will appear in fullscreen"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
EnableNewSeekbarThumbnailsFingerprint.result?.mutableMethod?.apply {
|
||||||
|
val moveResultIndex = getInstructions().lastIndex - 1
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
moveResultIndex,
|
||||||
|
"invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->enableOldSeekbarThumbnails()Z"
|
||||||
|
)
|
||||||
|
} ?: throw EnableNewSeekbarThumbnailsFingerprint.exception
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package app.revanced.patches.youtube.layout.seekbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.util.patch.LiteralValueFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object EnableNewSeekbarThumbnailsFingerprint : LiteralValueFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = emptyList(),
|
||||||
|
literalSupplier = { 45398577 }
|
||||||
|
)
|
Loading…
Reference in a new issue