Skip to content

Commit

Permalink
feat(YouTube Music - Hide ads): Changed the default value of `Hide fu…
Browse files Browse the repository at this point in the history
…llscreen ads` setting to off and added a warning to the setting
  • Loading branch information
inotia00 authored and anddea committed Dec 11, 2024
1 parent 58b5fbf commit d337d21
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.revanced.extension.shared.patches;

@SuppressWarnings("unused")
public class PatchStatus {
public static boolean HideFullscreenAdsDefaultBoolean() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
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;

/**
Expand All @@ -24,7 +26,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ val adsPatch = bytecodePatch(
addSwitchPreference(
CategoryType.ADS,
"revanced_hide_fullscreen_ads",
"true"
"false"
)
addSwitchPreference(
CategoryType.ADS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -129,6 +132,13 @@ val adsPatch = bytecodePatch(

// endregion

findMethodOrThrow("$PATCHES_PATH/PatchStatus;") {
name == "HideFullscreenAdsDefaultBoolean"
}.replaceInstruction(
0,
"const/4 v0, 0x1"
)

// region add settings

addPreference(
Expand Down

0 comments on commit d337d21

Please sign in to comment.