feat(youtube): use better patch descriptions

This commit is contained in:
inotia00
2023-05-08 05:01:46 +09:00
parent 9eb15b2e34
commit a7107a54e8
9 changed files with 53 additions and 127 deletions

View File

@ -86,7 +86,7 @@ class HideEndScreenOverlayPatch : BytecodePatch() {
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: FULLSCREEN_SETTINGS",
"SETTINGS: HIDE_ENDSCREEN_OVERLAY"
"SETTINGS: HIDE_END_SCREEN_OVERLAY"
)
)

View File

@ -1,12 +0,0 @@
package app.revanced.patches.youtube.layout.general.snackbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object HideSnackbarFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L", "L"),
customFingerprint = { it.definingClass == "Lcom/google/android/apps/youtube/app/common/ui/bottomui/BottomUiContainer;" }
)

View File

@ -1,59 +0,0 @@
package app.revanced.patches.youtube.layout.general.snackbar.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.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.snackbar.fingerprints.HideSnackbarFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL
@Patch
@Name("hide-snackbar")
@Description("Hides the snackbar action popup.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideSnackbarPatch : BytecodePatch(
listOf(
HideSnackbarFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
HideSnackbarFingerprint.result?.mutableMethod?.let {
it.addInstructions(
0, """
invoke-static {}, $GENERAL->hideSnackbar()Z
move-result v0
if-eqz v0, :default
return-void
""", listOf(ExternalLabel("default", it.instruction(0)))
)
} ?: return HideSnackbarFingerprint.toErrorResult()
/*
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: GENERAL_SETTINGS",
"SETTINGS: HIDE_SNACKBAR"
)
)
SettingsPatch.updatePatchStatus("hide-snackbar")
return PatchResultSuccess()
}
}

View File

@ -72,7 +72,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: GENERAL_SETTINGS",
"SETTINGS: ENABLE_TABLET_MINIPLAYER"
"SETTINGS: ENABLE_TABLET_MINI_PLAYER"
)
)

View File

@ -61,7 +61,7 @@ class HideEndscreenCardsPatch : BytecodePatch(
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: PLAYER_SETTINGS",
"SETTINGS: HIDE_ENDSCREEN_CARDS"
"SETTINGS: HIDE_END_SCREEN_CARDS"
)
)