2023-09-20 05:33:02 +02:00
|
|
|
package app.revanced.patches.youtube.layout.startupshortsreset
|
2022-09-29 23:53:58 +02:00
|
|
|
|
2022-10-05 04:03:10 +02:00
|
|
|
import app.revanced.patcher.data.BytecodeContext
|
2023-06-07 03:46:13 +02:00
|
|
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
2022-10-05 04:03:10 +02:00
|
|
|
import app.revanced.patcher.patch.BytecodePatch
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|
|
|
import app.revanced.patcher.patch.annotation.Patch
|
2023-02-19 23:54:29 +01:00
|
|
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|
|
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
2022-10-04 01:40:11 +02:00
|
|
|
import app.revanced.patches.youtube.layout.startupshortsreset.fingerprints.UserWasInShortsFingerprint
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
|
|
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
2022-09-29 23:53:58 +02:00
|
|
|
|
2023-09-20 05:33:02 +02:00
|
|
|
@Patch(
|
|
|
|
name = "Disable Shorts on startup",
|
|
|
|
description = "Disables playing YouTube Shorts when launching YouTube.",
|
|
|
|
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
|
|
|
compatiblePackages = [
|
|
|
|
CompatiblePackage(
|
|
|
|
"com.google.android.youtube", [
|
|
|
|
"18.16.37",
|
|
|
|
"18.19.35",
|
|
|
|
"18.20.39",
|
|
|
|
"18.23.35",
|
|
|
|
"18.29.38",
|
2023-09-28 01:28:25 +02:00
|
|
|
"18.32.39",
|
2023-10-08 03:37:42 +02:00
|
|
|
"18.37.36",
|
2023-11-12 16:43:11 +01:00
|
|
|
"18.38.44",
|
2023-11-12 17:01:49 +01:00
|
|
|
"18.43.45",
|
|
|
|
"18.44.41",
|
2023-09-20 05:33:02 +02:00
|
|
|
]
|
|
|
|
)
|
|
|
|
]
|
|
|
|
)
|
|
|
|
@Suppress("unused")
|
|
|
|
object DisableShortsOnStartupPatch : BytecodePatch(
|
|
|
|
setOf(UserWasInShortsFingerprint)
|
2022-09-29 23:53:58 +02:00
|
|
|
) {
|
2023-08-27 21:40:49 +02:00
|
|
|
override fun execute(context: BytecodeContext) {
|
2022-09-29 23:53:58 +02:00
|
|
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
|
|
|
SwitchPreference(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_disable_resuming_shorts_player",
|
2023-07-10 20:02:05 +02:00
|
|
|
StringResource("revanced_disable_resuming_shorts_player_title", "Disable Shorts player at app startup"),
|
2023-05-15 09:51:43 +02:00
|
|
|
StringResource("revanced_disable_resuming_shorts_player_summary_on", "Shorts player is disabled at app startup"),
|
|
|
|
StringResource("revanced_disable_resuming_shorts_player_summary_off", "Shorts player is enabled at app startup")
|
2022-09-29 23:53:58 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2022-10-04 07:43:01 +02:00
|
|
|
val userWasInShortsResult = UserWasInShortsFingerprint.result!!
|
|
|
|
val userWasInShortsMethod = userWasInShortsResult.mutableMethod
|
|
|
|
val moveResultIndex = userWasInShortsResult.scanResult.patternScanResult!!.endIndex
|
2022-09-29 23:53:58 +02:00
|
|
|
|
2023-06-07 03:46:13 +02:00
|
|
|
userWasInShortsMethod.addInstructionsWithLabels(
|
|
|
|
moveResultIndex + 1,
|
|
|
|
"""
|
|
|
|
invoke-static { }, Lapp/revanced/integrations/patches/DisableStartupShortsPlayerPatch;->disableStartupShortsPlayer()Z
|
|
|
|
move-result v5
|
|
|
|
if-eqz v5, :disable_shorts_player
|
|
|
|
return-void
|
|
|
|
:disable_shorts_player
|
|
|
|
nop
|
|
|
|
"""
|
2022-09-29 23:53:58 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|