mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
add hide-get-premium
patch
This commit is contained in:
@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.general.getpremium.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object CompactYpcOfferModuleViewFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.ADD_INT_2ADDR,
|
||||||
|
Opcode.ADD_INT_2ADDR,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.RETURN_VOID
|
||||||
|
),
|
||||||
|
customFingerprint = { it.definingClass.endsWith("CompactYpcOfferModuleView;") && it.name == "onMeasure" }
|
||||||
|
)
|
@ -0,0 +1,69 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.general.getpremium.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.getpremium.fingerprints.CompactYpcOfferModuleViewFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.integrations.Constants.GENERAL
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("hide-get-premium")
|
||||||
|
@Description("Hides the YouTube Premium promotion banner between the player and video description.")
|
||||||
|
@DependsOn([SettingsPatch::class])
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideGetPremiumPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
CompactYpcOfferModuleViewFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
CompactYpcOfferModuleViewFingerprint.result?.let {
|
||||||
|
with (it.mutableMethod) {
|
||||||
|
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
|
val measuredWidthRegister = (instruction(startIndex) as TwoRegisterInstruction).registerA
|
||||||
|
val measuredHeightInstruction = instruction(startIndex + 1) as TwoRegisterInstruction
|
||||||
|
val measuredHeightRegister = measuredHeightInstruction.registerA
|
||||||
|
val tempRegister = measuredHeightInstruction.registerB
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
startIndex + 2, """
|
||||||
|
invoke-static {}, $GENERAL->hideGetPremium()Z
|
||||||
|
move-result v$tempRegister
|
||||||
|
if-eqz v$tempRegister, :show
|
||||||
|
const/4 v$measuredWidthRegister, 0x0
|
||||||
|
const/4 v$measuredHeightRegister, 0x0
|
||||||
|
""", listOf(ExternalLabel("show", instruction(startIndex + 2)))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return CompactYpcOfferModuleViewFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add settings
|
||||||
|
*/
|
||||||
|
SettingsPatch.addPreference(
|
||||||
|
arrayOf(
|
||||||
|
"PREFERENCE: GENERAL_SETTINGS",
|
||||||
|
"SETTINGS: HIDE_GET_PREMIUM"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
SettingsPatch.updatePatchStatus("hide-get-premium")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -283,6 +283,9 @@ Please do not report any issues you encounter while using this feature."</string
|
|||||||
<string name="revanced_hide_fullscreen_panels_summary_off">Fullscreen panels are shown</string>
|
<string name="revanced_hide_fullscreen_panels_summary_off">Fullscreen panels are shown</string>
|
||||||
<string name="revanced_hide_fullscreen_panels_summary_on">Fullscreen panels are hidden</string>
|
<string name="revanced_hide_fullscreen_panels_summary_on">Fullscreen panels are hidden</string>
|
||||||
<string name="revanced_hide_fullscreen_panels_title">Hide fullscreen panels</string>
|
<string name="revanced_hide_fullscreen_panels_title">Hide fullscreen panels</string>
|
||||||
|
<string name="revanced_hide_get_premium_summary_off">YouTube Premium promotion are shown</string>
|
||||||
|
<string name="revanced_hide_get_premium_summary_on">YouTube Premium promotion are hidden</string>
|
||||||
|
<string name="revanced_hide_get_premium_title">Hide YouTube Premium promotion</string>
|
||||||
<string name="revanced_hide_home_button_summary_off">Home button is shown</string>
|
<string name="revanced_hide_home_button_summary_off">Home button is shown</string>
|
||||||
<string name="revanced_hide_home_button_summary_on">Home button is hidden</string>
|
<string name="revanced_hide_home_button_summary_on">Home button is hidden</string>
|
||||||
<string name="revanced_hide_home_button_title">Hide home button</string>
|
<string name="revanced_hide_home_button_title">Hide home button</string>
|
||||||
|
@ -95,6 +95,9 @@
|
|||||||
<!-- SETTINGS: HIDE_CROWDFUNDING_BOX
|
<!-- SETTINGS: HIDE_CROWDFUNDING_BOX
|
||||||
<SwitchPreference android:title="@string/revanced_hide_crowdfunding_box_title" android:key="revanced_hide_crowdfunding_box" android:defaultValue="true" android:summaryOn="@string/revanced_hide_crowdfunding_box_summary_on" android:summaryOff="@string/revanced_hide_crowdfunding_box_summary_off" />SETTINGS: HIDE_CROWDFUNDING_BOX -->
|
<SwitchPreference android:title="@string/revanced_hide_crowdfunding_box_title" android:key="revanced_hide_crowdfunding_box" android:defaultValue="true" android:summaryOn="@string/revanced_hide_crowdfunding_box_summary_on" android:summaryOff="@string/revanced_hide_crowdfunding_box_summary_off" />SETTINGS: HIDE_CROWDFUNDING_BOX -->
|
||||||
|
|
||||||
|
<!-- SETTINGS: HIDE_GET_PREMIUM
|
||||||
|
<SwitchPreference android:title="@string/revanced_hide_get_premium_title" android:key="revanced_hide_get_premium" android:defaultValue="true" android:summaryOn="@string/revanced_hide_get_premium_summary_on" android:summaryOff="@string/revanced_hide_get_premium_summary_off" />SETTINGS: HIDE_GET_PREMIUM -->
|
||||||
|
|
||||||
<!-- SETTINGS: HIDE_EMAIL_ADDRESS
|
<!-- 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 -->
|
<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 -->
|
||||||
|
|
||||||
@ -471,6 +474,7 @@
|
|||||||
<Preference android:title="hide-auto-player-popup-panels" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-auto-player-popup-panels" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-mix-playlists" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<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-crowdfunding-box" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
<Preference android:title="hide-get-premium" 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-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="hide-snackbar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="hide-search-terms" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="hide-search-terms" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
Reference in New Issue
Block a user