Skip to content

Commit

Permalink
Merge pull request #17 from crimera/feat/customsharingdomain
Browse files Browse the repository at this point in the history
feat(Twitter): Add `Custom sharing domain` patch
  • Loading branch information
crimera authored Mar 31, 2024
2 parents 29c116b + b4b3b48 commit eaa6926
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 5 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 @@ -14,6 +14,11 @@ public static String getVideoFolder(String filename) {
return Utils.getStringPref(Settings.VID_SUBFOLDER)+"/"+filename;
}

public static String getSharingLink(String link) {
String domain = Utils.getStringPref(Settings.CUSTOM_SHARING_DOMAIN);
return link.replace("x", domain);
}

public static ArrayList hideRecommendedUsers(ArrayList users) {
if (Utils.getBooleanPerf(Settings.MISC_HIDE_RECOMMENDED_USERS)) { return null; }
return users;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class Settings extends BaseSettings {
public static final StringSetting VID_PUBLIC_FOLDER = new StringSetting("vid_public_folder", "Movies");
public static final StringSetting VID_SUBFOLDER = new StringSetting("vid_subfolder", "Twitter");

public static final StringSetting CUSTOM_SHARING_DOMAIN = new StringSetting("misc_custom_sharing_domain", "fxtwitter");
public static final BooleanSetting MISC_FONT = new BooleanSetting("misc_font", false);
public static final BooleanSetting MISC_HIDE_FAB = new BooleanSetting("misc_hide_fab", true);
public static final BooleanSetting MISC_HIDE_RECOMMENDED_USERS = new BooleanSetting("misc_hide_recommended_users", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
)
);
}

if (SettingsStatus.customSharingDomainEnabled) {
miscPrefs.addPreference(
editTextPreference(
"Custom sharing domain",
"The domain to use when sharing tweets",
Settings.CUSTOM_SHARING_DOMAIN
)
);
}
}

if (SettingsStatus.enableTimelineSection()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public class SettingsStatus {
public static boolean changeDownloadEnabled = false;
public static boolean customSharingDomainEnabled = false;
public static boolean enableFontMod = false;
public static boolean hideRecommendedUsers = false;
public static boolean hidePromotedTrend = false;
Expand All @@ -27,6 +28,7 @@ public class SettingsStatus {


public static void enableDownloadFolder() { changeDownloadEnabled = true; }
public static void enableCustomSharingDomain() { customSharingDomainEnabled = true; }
public static void enableFont() { enableFontMod = true; }

public static void hideRecommendedUsers() { hideRecommendedUsers = true; }
Expand All @@ -52,7 +54,7 @@ public class SettingsStatus {
public static void enableAppIconNNavIcon() { enableAppIconNNavIcon = true; }

public static boolean enableTimelineSection(){ return (hideLiveThreads || hideBanner || hideForyou); }
public static boolean enableMiscSection() { return (enableFontMod || hideRecommendedUsers || hideFAB || hideViewCount || hideCommunityNote); }
public static boolean enableMiscSection() { return (enableFontMod || hideRecommendedUsers || hideFAB || hideViewCount || hideCommunityNote || customSharingDomainEnabled); }
public static boolean enableAdsSection() {return (hideAds|| hideGAds || hideWTF || hideCTS || hideCTJ || hideDetailedPosts || hideRBMK ||hidePromotedTrend); }

public static boolean enablePremiumSection() {return (enableReaderMode || enableUndoPosts || enableAppIconNNavIcon); }
Expand Down

0 comments on commit eaa6926

Please sign in to comment.