Skip to content

Commit

Permalink
Merge pull request #58 from swakwork/dev
Browse files Browse the repository at this point in the history
Hide `buy premium` banner && hide `hidden replies`
  • Loading branch information
crimera authored May 22, 2024
2 parents e3da453 + 9b9dd0d commit 6153efb
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/src/main/java/app/revanced/integrations/twitter/Pref.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ public static boolean hideImmersivePlayer() {
return !Utils.getBooleanPerf(Settings.TIMELINE_HIDE_IMMERSIVE_PLAYER);
}

public static boolean hideHiddenReplies(boolean bool){
if(Utils.getBooleanPerf(Settings.TIMELINE_HIDE_HIDDEN_REPLIES)){
return false;
}
return bool;
}

public static boolean hidePromotedTrend(Object data) {
if (data != null && Utils.getBooleanPerf(Settings.ADS_HIDE_PROMOTED_TRENDS)) {
return true;
Expand Down Expand Up @@ -200,13 +207,18 @@ public static boolean hideDetailedPosts() {
return Utils.getBooleanPerf(Settings.ADS_HIDE_DETAILED_POSTS);
}

public static boolean hidePremiumPrompt() {
return Utils.getBooleanPerf(Settings.ADS_HIDE_PREMIUM_PROMPT);
}

public static boolean enableReaderMode() {
return Utils.getBooleanPerf(Settings.PREMIUM_READER_MODE);
}

public static boolean enableUndoPosts() {
return Utils.getBooleanPerf(Settings.PREMIUM_UNDO_POSTS);
}

public static boolean enableDebugMenu() {
return Utils.getBooleanPerf(Settings.MISC_DEBUG_MENU);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import app.revanced.integrations.twitter.settings.SettingsStatus;

public class TimelineEntry {
private static final boolean hideAds,hideGAds,hideWTF,hideCTS,hideCTJ,hideDetailedPosts,hideRBMK,hidePinnedPosts;
private static final boolean hideAds,hideGAds,hideWTF,hideCTS,hideCTJ,hideDetailedPosts,hideRBMK,hidePinnedPosts,hidePremiumPrompt;
static {
hideAds = (Pref.hideAds() && SettingsStatus.hideAds);
hideGAds = (Pref.hideGoogleAds() && SettingsStatus.hideGAds);
Expand All @@ -16,6 +16,7 @@ public class TimelineEntry {
hideDetailedPosts = (Pref.hideDetailedPosts() && SettingsStatus.hideDetailedPosts);
hideRBMK = (Pref.hideRBMK() && SettingsStatus.hideRBMK);
hidePinnedPosts = (Pref.hideRPinnedPosts() && SettingsStatus.hideRPinnedPosts);
hidePremiumPrompt = (Pref.hidePremiumPrompt() && SettingsStatus.hidePremiumPrompt);
}


Expand Down Expand Up @@ -48,6 +49,9 @@ private static boolean isEntryIdRemove(String entryId) {
if (entryId.startsWith("pinned-tweets") && hidePinnedPosts) {
return true;
}
if (entryId.startsWith("messageprompt-premium") && hidePremiumPrompt) {
return true;
}
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting ADS_HIDE_REVISIT_BMK = new BooleanSetting("ads_hide_revisit_bookmark", true);
public static final BooleanSetting ADS_HIDE_REVISIT_PINNED_POSTS = new BooleanSetting("ads_hide_revisit_pinned_posts", true);
public static final BooleanSetting ADS_HIDE_DETAILED_POSTS = new BooleanSetting("ads_hide_detailed_posts", true);
public static final BooleanSetting ADS_HIDE_PREMIUM_PROMPT = new BooleanSetting("ads_hide_premium_prompt", true);

public static final BooleanSetting TIMELINE_DISABLE_AUTO_SCROLL = new BooleanSetting("timeline_disable_auto_scroll", true);
public static final BooleanSetting TIMELINE_HIDE_LIVETHREADS = new BooleanSetting("timeline_hide_livethreads", true);
Expand All @@ -40,6 +41,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting TIMELINE_HIDE_IMMERSIVE_PLAYER = new BooleanSetting("timeline_hide_immersive_player", false);
public static final BooleanSetting TIMELINE_HIDE_PROMOTE_BUTTON = new BooleanSetting("timeline_hide_promote_button", false);
public static final BooleanSetting TIMELINE_HIDE_FORCE_TRANSLATE = new BooleanSetting("timeline_force_translate", false);
public static final BooleanSetting TIMELINE_HIDE_HIDDEN_REPLIES = new BooleanSetting("timeline_hide_hidden_replies", false);

public static final BooleanSetting PREMIUM_READER_MODE = new BooleanSetting("premium_reader_mode", false);
public static final BooleanSetting PREMIUM_UNDO_POSTS = new BooleanSetting("premium_undo_posts", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public void onCreate(@org.jetbrains.annotations.Nullable Bundle savedInstanceSta
flags.put(strRes("piko_pref_round_off_numbers"),SettingsStatus.roundOffNumbers);
flags.put(strRes("piko_pref_customisation_inlinetabs"),SettingsStatus.inlineBarCustomisation);
flags.put(strRes("piko_pref_debug_menu"),SettingsStatus.enableDebugMenu);
flags.put(strRes("piko_pref_hide_premium_prompt"),SettingsStatus.hidePremiumPrompt);
flags.put(strRes("piko_pref_hide_hidden_replies"),SettingsStatus.hideHiddenReplies);

LegacyTwitterPreferenceCategory patPref = preferenceCategory(strRes("piko_pref_patches"), screen);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
);
}

if (SettingsStatus.hidePremiumPrompt) {
adsPrefs.addPreference(
switchPreference(
strRes("piko_pref_hide_premium_prompt"),
"",
Settings.ADS_HIDE_PREMIUM_PROMPT
)
);
}


}

Expand Down Expand Up @@ -437,6 +447,15 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
);
}

if (SettingsStatus.hideHiddenReplies) {
timelinePrefs.addPreference(
switchPreference(
strRes("piko_pref_hide_hidden_replies"),
"",
Settings.TIMELINE_HIDE_HIDDEN_REPLIES
)
);
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class SettingsStatus {
public static boolean hideDetailedPosts = false;
public static boolean hideRBMK = false;
public static boolean hideRPinnedPosts = false;
public static boolean hidePremiumPrompt = false;
public static boolean hideHiddenReplies = false;

public static boolean enableReaderMode = false;
public static boolean enableUndoPosts = false;
Expand Down Expand Up @@ -73,8 +75,10 @@ public class SettingsStatus {
public static void disableAutoTimelineScroll() { disableAutoTimelineScroll = true; }
public static void hideLiveThreads() { hideLiveThreads = true; }
public static void hideBanner() { hideBanner = true; }
public static void hidePremiumPrompt(){ hidePremiumPrompt = true; }
public static void enableShowPollResults() { showPollResultsEnabled = true; }
public static void forceTranslate() { forceTranslate = true; }
public static void hideHiddenReplies() { hideHiddenReplies = true; }
public static void hidePromoteButton() { hidePromoteButton = true; }
public static void enableDebugMenu() { enableDebugMenu = true; }

Expand Down

0 comments on commit 6153efb

Please sign in to comment.