mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-28 21:00:19 +02:00
add hide-snackbar
patch
This commit is contained in:
parent
d83862ad21
commit
f18d64cfb2
@ -0,0 +1,12 @@
|
||||
package app.revanced.patches.youtube.layout.general.snackbar.bytecode.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;" }
|
||||
)
|
@ -0,0 +1,40 @@
|
||||
package app.revanced.patches.youtube.layout.general.snackbar.bytecode.patch
|
||||
|
||||
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.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.layout.general.snackbar.bytecode.fingerprints.HideSnackbarFingerprint
|
||||
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.shared.extensions.toErrorResult
|
||||
import app.revanced.shared.util.integrations.Constants.GENERAL_LAYOUT
|
||||
|
||||
@Name("hide-snackbar-bytecode-patch")
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideSnackbarBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
HideSnackbarFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
HideSnackbarFingerprint.result?.mutableMethod?.let {
|
||||
it.addInstructions(
|
||||
0, """
|
||||
invoke-static {}, $GENERAL_LAYOUT->hideSnackbar()Z
|
||||
move-result v0
|
||||
if-eqz v0, :default
|
||||
return-void
|
||||
""", listOf(ExternalLabel("default", it.instruction(0)))
|
||||
)
|
||||
} ?: return HideSnackbarFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package app.revanced.patches.youtube.layout.general.snackbar.resource.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patches.youtube.layout.general.snackbar.bytecode.patch.HideSnackbarBytecodePatch
|
||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.shared.util.resources.ResourceHelper
|
||||
|
||||
@Patch
|
||||
@Name("hide-snackbar")
|
||||
@Description("Hides the snackbar action popup.")
|
||||
@DependsOn(
|
||||
[
|
||||
HideSnackbarBytecodePatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideSnackbarPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
||||
/*
|
||||
add settings
|
||||
*/
|
||||
ResourceHelper.addSettings2(
|
||||
context,
|
||||
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
|
||||
"PREFERENCE: LAYOUT_SETTINGS",
|
||||
"PREFERENCE_HEADER: GENERAL",
|
||||
"SETTINGS: HIDE_SNACKBAR"
|
||||
)
|
||||
|
||||
ResourceHelper.patchSuccess(
|
||||
context,
|
||||
"hide-snackbar"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -402,6 +402,9 @@ Is it ready to submit?"</string>
|
||||
<string name="revanced_hide_shorts_shelf_summary_off">Shorts shelves are shown</string>
|
||||
<string name="revanced_hide_shorts_shelf_summary_on">Shorts shelves are hidden</string>
|
||||
<string name="revanced_hide_shorts_shelf_title">Hide shorts shelf</string>
|
||||
<string name="revanced_hide_snackbar_summary_off">Snackbar is shown</string>
|
||||
<string name="revanced_hide_snackbar_summary_on">Snackbar is hidden</string>
|
||||
<string name="revanced_hide_snackbar_title">Hide snackbar</string>
|
||||
<string name="revanced_hide_startup_shorts_player_summary_off">Shorts player is shown at app startup</string>
|
||||
<string name="revanced_hide_startup_shorts_player_summary_on">Shorts player is hidden at app startup</string>
|
||||
<string name="revanced_hide_startup_shorts_player_title">Hide shorts player at app startup</string>
|
||||
|
@ -139,6 +139,9 @@
|
||||
<!-- SETTINGS: HIDE_EMAIL_ADDRESS
|
||||
<SwitchPreference android:title="@string/revanced_hide_email_address_title" android:key="revanced_hide_email_address" android:defaultValue="true" android:summaryOn="@string/revanced_hide_email_address_summary_on" android:summaryOff="@string/revanced_hide_email_address_summary_off" />SETTINGS: HIDE_EMAIL_ADDRESS -->
|
||||
|
||||
<!-- SETTINGS: HIDE_SNACKBAR
|
||||
<SwitchPreference android:title="@string/revanced_hide_snackbar_title" android:key="revanced_hide_snackbar" android:defaultValue="false" android:summaryOn="@string/revanced_hide_snackbar_summary_on" android:summaryOff="@string/revanced_hide_snackbar_summary_off" />SETTINGS: HIDE_SNACKBAR -->
|
||||
|
||||
<!-- SETTINGS: HEADER_SWITCH
|
||||
<SwitchPreference android:title="@string/revanced_override_premium_header_title" android:key="revanced_override_premium_header" android:defaultValue="false" android:summaryOn="@string/revanced_override_premium_header_summary_on" android:summaryOff="@string/revanced_override_premium_header_summary_off" />SETTINGS: HEADER_SWITCH -->
|
||||
|
||||
@ -364,6 +367,7 @@
|
||||
<Preference android:title="hide-mix-playlists" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="hide-crowdfunding-box" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="hide-email-address" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="hide-snackbar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="header-switch" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_layout_settings_player" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user