feat(YouTube Music - Hide ads): Changed the default value of Hide fullscreen ads setting to off and added a warning to the setting

This commit is contained in:
inotia00 2024-12-08 15:44:50 +09:00
parent 654368ffe2
commit ac72748834
5 changed files with 26 additions and 3 deletions

View File

@ -0,0 +1,8 @@
package app.revanced.extension.shared.patches;
@SuppressWarnings("unused")
public class PatchStatus {
public static boolean HideFullscreenAdsDefaultBoolean() {
return false;
}
}

View File

@ -3,6 +3,8 @@ package app.revanced.extension.shared.settings;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static app.revanced.extension.shared.patches.PatchStatus.HideFullscreenAdsDefaultBoolean;
import app.revanced.extension.shared.patches.ReturnYouTubeUsernamePatch.DisplayFormat;
/**
@ -23,7 +25,7 @@ public class BaseSettings {
/**
* These settings are used by YouTube and YouTube Music.
*/
public static final BooleanSetting HIDE_FULLSCREEN_ADS = new BooleanSetting("revanced_hide_fullscreen_ads", TRUE, true);
public static final BooleanSetting HIDE_FULLSCREEN_ADS = new BooleanSetting("revanced_hide_fullscreen_ads", HideFullscreenAdsDefaultBoolean(), true);
public static final BooleanSetting HIDE_PROMOTION_ALERT_BANNER = new BooleanSetting("revanced_hide_promotion_alert_banner", TRUE);
public static final BooleanSetting DISABLE_AUTO_CAPTIONS = new BooleanSetting("revanced_disable_auto_captions", FALSE, true);

View File

@ -151,7 +151,7 @@ val adsPatch = bytecodePatch(
addSwitchPreference(
CategoryType.ADS,
"revanced_hide_fullscreen_ads",
"true"
"false"
)
addSwitchPreference(
CategoryType.ADS,

View File

@ -2,11 +2,13 @@ package app.revanced.patches.youtube.ads.general
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.ads.baseAdsPatch
import app.revanced.patches.shared.ads.hookLithoFullscreenAds
import app.revanced.patches.shared.ads.hookNonLithoFullscreenAds
import app.revanced.patches.shared.extension.Constants.PATCHES_PATH
import app.revanced.patches.shared.litho.addLithoFilter
import app.revanced.patches.shared.litho.lithoFilterPatch
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
@ -20,6 +22,7 @@ import app.revanced.patches.youtube.utils.resourceid.interstitialsContainer
import app.revanced.patches.youtube.utils.resourceid.sharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference
import app.revanced.patches.youtube.utils.settings.settingsPatch
import app.revanced.util.findMethodOrThrow
import app.revanced.util.findMutableMethodOf
import app.revanced.util.fingerprint.matchOrThrow
import app.revanced.util.fingerprint.methodOrThrow
@ -129,6 +132,13 @@ val adsPatch = bytecodePatch(
// endregion
findMethodOrThrow("$PATCHES_PATH/PatchStatus;") {
name == "HideFullscreenAdsDefaultBoolean"
}.replaceInstruction(
0,
"const/4 v0, 0x1"
)
// region add settings
addPreference(

View File

@ -58,7 +58,10 @@ Please download %2$s from the website."</string>
<string name="revanced_preference_screen_ads_title">Ads</string>
<string name="revanced_hide_fullscreen_ads_title">Hide fullscreen ads</string>
<string name="revanced_hide_fullscreen_ads_summary">Hides fullscreen ads.</string>
<string name="revanced_hide_fullscreen_ads_summary">"Hides fullscreen ads.
Limitations:
• Sometimes you may see a blank black screen instead of the home feed."</string>
<string name="revanced_hide_general_ads_title">Hide general ads</string>
<string name="revanced_hide_general_ads_summary">Hides general ads.</string>
<string name="revanced_hide_music_ads_title">Hide media ads</string>