diff --git a/CHANGELOG.md b/CHANGELOG.md index da9f758430..398efa58a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,20 @@ -# [1.7.0](https://github.com/crimera/revanced-integrations/compare/v1.6.0...v1.7.0) (2024-03-22) +# [1.8.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.7.0...v1.8.0-dev.1) (2024-03-27) + + +### Features + +* **Twitter:** Added `App Icon and NavBar Customisation` settings ([796a33d](https://github.com/crimera/revanced-integrations/commit/796a33dca86a31a96c268c9fb8fe6122d98b3d65)) +* **Twitter:** Added `Undo Post Patch` in mod settings ([e82d8bf](https://github.com/crimera/revanced-integrations/commit/e82d8bfcdd38c7d7de4b4bf2702c4a2982c9be94)) + +# [1.7.0-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.7.0-dev.1...v1.7.0-dev.2) (2024-03-27) + + +### Features + +* **Twitter:** Added `App Icon and NavBar Customisation` settings ([796a33d](https://github.com/crimera/revanced-integrations/commit/796a33dca86a31a96c268c9fb8fe6122d98b3d65)) +* **Twitter:** Added `Undo Post Patch` in mod settings ([e82d8bf](https://github.com/crimera/revanced-integrations/commit/e82d8bfcdd38c7d7de4b4bf2702c4a2982c9be94)) + +# [1.7.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.6.0...v1.7.0-dev.1) (2024-03-22) ### Features diff --git a/app/src/main/java/app/revanced/integrations/twitter/Pref.java b/app/src/main/java/app/revanced/integrations/twitter/Pref.java index 07e4123d60..9ba30dbed0 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/Pref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/Pref.java @@ -74,6 +74,12 @@ public static boolean hideRPinnedPosts() { public static boolean hideDetailedPosts() { return Utils.getBooleanPerf(Settings.ADS_HIDE_DETAILED_POSTS); } + public static boolean enableReaderMode() { + return Utils.getBooleanPerf(Settings.PREMIUM_READER_MODE); + } + public static boolean enableUndoPosts() { + return Utils.getBooleanPerf(Settings.PREMIUM_UNDO_POSTS); + } //end } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/Utils.java b/app/src/main/java/app/revanced/integrations/twitter/Utils.java index 2d817f4536..872517d3e1 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/Utils.java +++ b/app/src/main/java/app/revanced/integrations/twitter/Utils.java @@ -25,10 +25,30 @@ private static void startActivity(Class cls) { ctx.startActivity(intent); } + private static void startActivityFromClassName(String className){ + try { + Class clazz = Class.forName(className); + startActivity(clazz); + }catch (Exception unused) { + + } + } + + public static void startSettingsActivity(){ startActivity(SettingsActivity.class); } + public static void startUndoPostActivity(){ + String className = "com.twitter.feature.subscriptions.settings.undotweet.UndoTweetSettingsActivity"; + startActivityFromClassName(className); + } + + public static void startAppIconNNavIconActivity(){ + String className = "com.twitter.feature.subscriptions.settings.extras.ExtrasSettingsActivity"; + startActivityFromClassName(className); + } + @SuppressWarnings("deprecation") public static String getStringPref(Setting setting) { String value = sp.getString(setting.key, setting.defaultValue); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java index f8d4ddcf02..809c581521 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java @@ -27,4 +27,8 @@ public class Settings extends BaseSettings { public static final BooleanSetting TIMELINE_HIDE_LIVETHREADS = new BooleanSetting("timeline_hide_livethreads", true); public static final BooleanSetting TIMELINE_HIDE_BANNER = new BooleanSetting("timeline_hide_banner", true); public static final BooleanSetting TIMELINE_HIDE_FORYOU = new BooleanSetting("timeline_hide_foryou", 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); + public static final String PREMIUM_ICONS = "premium_app_icon_n_nav_icon"; } diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java index 1a0dde93c0..5e9c72ed97 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java @@ -28,7 +28,7 @@ public void onCreate(Bundle savedInstanceState) { getFragmentManager().beginTransaction().add(Utils.getResourceIdentifier("fragment_container", "id"), new Screen()).commit(); } - public static class Screen extends PreferenceFragment { + public static class Screen extends PreferenceFragment implements Preference.OnPreferenceClickListener{ private Context context; @Override @@ -38,6 +38,44 @@ public void onCreate(@Nullable Bundle savedInstanceState) { PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(context); // SettingsStatus.load(); + if (SettingsStatus.enablePremiumSection()) { + LegacyTwitterPreferenceCategory premiumPrefs = preferenceCategory("Premium", screen); + if (SettingsStatus.enableReaderMode) { + premiumPrefs.addPreference( + switchPreference( + "Enable reader mode", + "Enables \"reader mode\" on long threads", + Settings.PREMIUM_READER_MODE + ) + ); + } + if (SettingsStatus.enableUndoPosts) { + premiumPrefs.addPreference( + switchPreference( + "Enable undo posts", + "Enables ability to undo posts before posting", + Settings.PREMIUM_UNDO_POSTS + ) + ); + + premiumPrefs.addPreference( + buttonPreference( + "Undo posts settings", + "", + Settings.PREMIUM_UNDO_POSTS.key + ) + ); + } + if (SettingsStatus.enableAppIconNNavIcon) { + premiumPrefs.addPreference( + buttonPreference( + "App icon and navbar customisation settings", + "", + Settings.PREMIUM_ICONS + ) + ); + } + } if (SettingsStatus.changeDownloadEnabled) { LegacyTwitterPreferenceCategory downloadPrefs = preferenceCategory("Download", screen); @@ -51,6 +89,16 @@ public void onCreate(@Nullable Bundle savedInstanceState) { "The subfolder to download videos to ([PublicFolder]/[Subfolder])", Settings.VID_SUBFOLDER )); + downloadPrefs.addPreference(listPreference( + "Public folder", + "The public folder to use for video downloads", + Settings.VID_PUBLIC_FOLDER + )); + downloadPrefs.addPreference(editTextPreference( + "Download subfolder", + "The subfolder to download videos to ([PublicFolder]/[Subfolder])", + Settings.VID_SUBFOLDER + )); } if(SettingsStatus.enableAdsSection()){ @@ -255,6 +303,16 @@ private Preference switchPreference(String title, String summary, BooleanSetting return preference; } + private Preference buttonPreference(String title, String summary, String key) { + Preference preference = new Preference(context); + preference.setKey(key); + preference.setTitle(title); + preference.setSummary(summary); + preference.setOnPreferenceClickListener(this); + + return preference; + } + private Preference listPreference(String title, String summary, StringSetting setting) { ListPreference preference = new ListPreference(context); preference.setTitle(title); @@ -274,5 +332,19 @@ private LegacyTwitterPreferenceCategory preferenceCategory(String title, Prefere screen.addPreference(preferenceCategory); return preferenceCategory; } + + @Override + public boolean onPreferenceClick(Preference preference) { + String key = preference.getKey(); + if(key.equals(Settings.PREMIUM_UNDO_POSTS.key.toString())){ + app.revanced.integrations.twitter.Utils.startUndoPostActivity(); + } + else if(key.equals(Settings.PREMIUM_ICONS)){ + app.revanced.integrations.twitter.Utils.startAppIconNNavIconActivity(); + } + return true; + } } + + } diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java index f4fceb502c..7383a6d438 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java @@ -21,6 +21,10 @@ public class SettingsStatus { public static boolean hideRBMK = false; public static boolean hideRPinnedPosts = false; + public static boolean enableReaderMode = false; + public static boolean enableUndoPosts = false; + public static boolean enableAppIconNNavIcon = false; + public static void enableDownloadFolder() { changeDownloadEnabled = true; } public static void enableFont() { enableFontMod = true; } @@ -43,9 +47,15 @@ public class SettingsStatus { public static void hideRevistPinnedPost() { hideRPinnedPosts = true; } public static void hidePromotedTrends() { hidePromotedTrend = true; } + public static void enableReaderMode() { enableReaderMode = true; } + public static void enableUndoPosts() { enableUndoPosts = true; } + 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 enableAdsSection() {return (hideAds|| hideGAds || hideWTF || hideCTS || hideCTJ || hideDetailedPosts || hideRBMK ||hidePromotedTrend); } + public static boolean enablePremiumSection() {return (enableReaderMode || enableUndoPosts || enableAppIconNNavIcon); } + public static void load() {} } diff --git a/gradle.properties b/gradle.properties index ba78657a15..a36b92b42e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.7.0 +version = 1.8.0-dev.1