Skip to content

Commit

Permalink
feat(Twitter): Added Round off numbers patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Swakshan committed May 18, 2024
1 parent b6cd2e5 commit 18cd14f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
7 changes: 7 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 @@ -7,7 +7,14 @@

@SuppressWarnings("unused")
public class Pref {
public static boolean ROUND_OFF_NUMBERS;
static{
ROUND_OFF_NUMBERS = isRoundOffNumbersEnabled();
}

public static boolean isRoundOffNumbersEnabled() {
return Utils.getBooleanPerf(Settings.MISC_ROUND_OFF_NUMBERS);
}
public static boolean isChirpFontEnabled() {
return Utils.getBooleanPerf(Settings.MISC_FONT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting MISC_HIDE_VIEW_COUNT = new BooleanSetting("misc_hide_view_count", true);
public static final BooleanSetting MISC_BROWSER_CHOOSER = new BooleanSetting("misc_browser_chooser", false);
public static final StringSetting MISC_FEATURE_FLAGS = new StringSetting("misc_feature_flags", "");
public static final BooleanSetting MISC_ROUND_OFF_NUMBERS = new BooleanSetting("misc_round_off_numbers", true);

public static final BooleanSetting ADS_HIDE_PROMOTED_TRENDS = new BooleanSetting("ads_hide_promoted_trends", true);
public static final BooleanSetting ADS_HIDE_PROMOTED_POSTS = new BooleanSetting("ads_hide_promoted_posts", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public void onCreate(@org.jetbrains.annotations.Nullable Bundle savedInstanceSta
flags.put(strRes("piko_pref_clear_tracking_params"),SettingsStatus.cleartrackingparams);
flags.put(strRes("piko_pref_unshorten_link"),SettingsStatus.unshortenlink);
flags.put(strRes("piko_pref_force_translate"),SettingsStatus.forceTranslate);
flags.put(strRes("piko_pref_round_off_numbers"),SettingsStatus.roundOffNumbers);

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

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

if (SettingsStatus.roundOffNumbers) {
miscPrefs.addPreference(
switchPreference(
strRes("piko_pref_round_off_numbers"),
strRes("piko_pref_round_off_numbers_desc"),
Settings.MISC_ROUND_OFF_NUMBERS
)
);
}

if (SettingsStatus.featureFlagsEnabled) {
miscPrefs.addPreference(
buttonPreference(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class SettingsStatus {
public static boolean featureFlagsEnabled = false;
public static boolean forceTranslate = false;
public static boolean hidePromoteButton = false;
public static boolean roundOffNumbers = false;

public static boolean hideAds = false;
public static boolean hideGAds = false;
Expand Down Expand Up @@ -56,6 +57,8 @@ public class SettingsStatus {
public static void mediaLinkHandle() { mediaLinkHandle = true; }
public static void enableCustomSharingDomain() { customSharingDomainEnabled = true; }
public static void enableFont() { enableFontMod = true; }

public static void roundOffNumbers() { roundOffNumbers = true; }
public static void enableFeatureFlags() { featureFlagsEnabled = true; }
public static void enableBrowserChooser() { browserChooserEnabled = true; }

Expand Down Expand Up @@ -94,7 +97,7 @@ public class SettingsStatus {
public static void navBarCustomisation() { navBarCustomisation = true; }

public static boolean enableTimelineSection(){ return (navBarCustomisation || disableAutoTimelineScroll || forceTranslate || hidePromoteButton || hideCommunityNote|| hideLiveThreads || hideBanner || hideInlineBmk || showPollResultsEnabled || hideImmersivePlayer); }
public static boolean enableMiscSection() { return (enableFontMod || hideRecommendedUsers || hideFAB || hideViewCount || customSharingDomainEnabled || hideFABBtns); }
public static boolean enableMiscSection() { return (roundOffNumbers || enableFontMod || hideRecommendedUsers || hideFAB || hideViewCount || customSharingDomainEnabled || hideFABBtns); }
public static boolean enableAdsSection() {return (hideAds|| hideGAds || hideWTF || hideCTS || hideCTJ || hideDetailedPosts || hideRBMK ||hidePromotedTrend); }
public static boolean enableDownloadSection() {return (changeDownloadEnabled || mediaLinkHandle); }

Expand Down

0 comments on commit 18cd14f

Please sign in to comment.