Skip to content
This repository was archived by the owner on Apr 30, 2026. It is now read-only.

Commit a2654fa

Browse files
authored
Merge pull request #131 from crimera/dev
chore: Merge branch `dev` to `main`
2 parents 2f6256e + aefd1e1 commit a2654fa

11 files changed

Lines changed: 211 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
## [1.39.0-dev.3](https://github.com/crimera/revanced-integrations/compare/v1.39.0-dev.2...v1.39.0-dev.3) (2025-07-05)
2+
3+
4+
### Bug Fixes
5+
6+
* **Twitter - Settings patch:** Add bottom padding ([737cc56](https://github.com/crimera/revanced-integrations/commit/737cc5669fb3c2294a32e4daf5a4954224e6619b))
7+
8+
## [1.39.0-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.39.0-dev.1...v1.39.0-dev.2) (2025-07-05)
9+
10+
11+
### Bug Fixes
12+
13+
* **Twitter - Settings patch:** Add support for edge to edge ([cdbc3b7](https://github.com/crimera/revanced-integrations/commit/cdbc3b777a18117ac3db99b80823fe45b818c48f))
14+
15+
## [1.39.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.38.3...v1.39.0-dev.1) (2025-07-03)
16+
17+
18+
### Features
19+
20+
* **Twitter:** Added `Hide community badges` patch ([1c76b7d](https://github.com/crimera/revanced-integrations/commit/1c76b7d7635bdc1c7045154b601e6922e45e18e3))
21+
* **Twitter:** Added `Log server response` patch ([35dabb6](https://github.com/crimera/revanced-integrations/commit/35dabb66ebe792211a5a3637bb1b206c73a9ef2b))
22+
123
## [1.38.3](https://github.com/crimera/revanced-integrations/compare/v1.38.2...v1.38.3) (2025-06-17)
224

325

app/src/main/java/app/revanced/integrations/twitter/Pref.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
@SuppressWarnings("unused")
99
public class Pref {
10-
public static boolean ROUND_OFF_NUMBERS,ENABLE_FORCE_HD;
10+
public static boolean ROUND_OFF_NUMBERS,ENABLE_FORCE_HD, HIDE_COMM_BADGE;
1111
public static float POST_FONT_SIZE;
1212
static{
1313
ROUND_OFF_NUMBERS = isRoundOffNumbersEnabled();
1414
ENABLE_FORCE_HD = enableForceHD();
1515
POST_FONT_SIZE = setPostFontSize();
16+
HIDE_COMM_BADGE = hideCommBadge();
1617
}
1718
public static float setPostFontSize() {
1819
Float fontSize = 0.0f;
@@ -23,6 +24,16 @@ public static float setPostFontSize() {
2324
}
2425
return fontSize;
2526
}
27+
public static boolean serverResponseLogging() {
28+
return Utils.getBooleanPerf(Settings.LOG_RES);
29+
}
30+
public static boolean serverResponseLoggingOverwriteFile() {
31+
return Utils.getBooleanPerf(Settings.LOG_RES_OVRD);
32+
}
33+
public static boolean hideCommBadge() {
34+
return Utils.getBooleanPerf(Settings.TIMELINE_HIDE_COMM_BADGE);
35+
}
36+
2637
public static boolean showSensitiveMedia() {
2738
return Utils.getBooleanPerf(Settings.TIMELINE_SHOW_SENSITIVE_MEDIA);
2839
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package app.revanced.integrations.twitter.patches.loggers;
2+
3+
import java.io.File;
4+
import java.io.BufferedReader;
5+
import java.io.InputStreamReader;
6+
import java.io.ByteArrayInputStream;
7+
import java.io.InputStream;
8+
import java.io.OutputStream;
9+
import java.io.FileOutputStream;
10+
import android.os.Environment;
11+
12+
import app.revanced.integrations.twitter.Pref;
13+
import app.revanced.integrations.twitter.Utils;
14+
15+
public class ResponseLogger {
16+
private static boolean LOG_RES;
17+
static{
18+
LOG_RES = Pref.serverResponseLogging();
19+
if(Pref.serverResponseLoggingOverwriteFile()){
20+
writeFile("".getBytes(),false);
21+
// Utils.logger("Cleared response log file!!!");
22+
}
23+
}
24+
25+
public static InputStream saveInputStream(InputStream inputStream) throws Exception {
26+
if(!LOG_RES) return inputStream;
27+
28+
StringBuilder sb = new StringBuilder();
29+
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
30+
String line;
31+
while ((line = reader.readLine()) != null) {
32+
sb.append(line).append("\n");
33+
}
34+
sb.append("\n");
35+
inputStream.close();
36+
byte[] contentBytes = sb.toString().getBytes();
37+
if(!(sb.indexOf("session_token") == 2 || sb.indexOf("guest_token") == 2)){
38+
writeFile(contentBytes,true);
39+
}
40+
41+
return new ByteArrayInputStream(contentBytes);
42+
}
43+
44+
private static boolean writeFile(byte[] data,boolean append){
45+
try {
46+
File downloadsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
47+
File pikoDir = new File(downloadsDir, "Piko");
48+
49+
if (!pikoDir.exists()) {
50+
pikoDir.mkdirs();
51+
}
52+
53+
File outputFile = new File(pikoDir, "Server-Response-Log.txt");
54+
55+
FileOutputStream outputStream = new FileOutputStream(outputFile, append);
56+
outputStream.write(data);
57+
outputStream.close();
58+
return true;
59+
}catch (Exception e){
60+
Utils.logger(e.toString());
61+
}
62+
63+
return false;
64+
}
65+
66+
}

app/src/main/java/app/revanced/integrations/twitter/settings/ActivityHook.java

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
import android.app.Activity;
44
import android.content.Intent;
5+
import android.content.res.Configuration;
6+
import android.os.Build;
57
import android.os.Bundle;
68
import android.app.Fragment;
79
import android.app.FragmentTransaction;
10+
import android.view.View;
11+
import android.view.Window;
812
import androidx.appcompat.widget.Toolbar;
913
import app.revanced.integrations.shared.Utils;
10-
import android.app.Fragment;
1114
import app.revanced.integrations.twitter.settings.featureflags.FeatureFlagsFragment;
1215
import app.revanced.integrations.twitter.settings.fragments.*;
1316

@@ -17,50 +20,69 @@
1720
public class ActivityHook {
1821
public static Toolbar toolbar;
1922
private static final String EXTRA_PIKO = "piko";
20-
private static final String EXTRA_PIKO_SETTINGS = EXTRA_PIKO+"_settings";
23+
private static final String EXTRA_PIKO_SETTINGS = EXTRA_PIKO + "_settings";
2124

2225
public static boolean create(Activity act) {
2326
Intent intent = act.getIntent();
2427
if (!(intent.getBooleanExtra(EXTRA_PIKO, false))) return false;
2528

29+
Window window = act.getWindow();
30+
31+
if (Build.VERSION.SDK_INT >= 35) {
32+
int uiMode = act.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
33+
if (uiMode == Configuration.UI_MODE_NIGHT_YES) {
34+
window.getDecorView().setSystemUiVisibility(window.getDecorView().getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
35+
} else {
36+
window.getDecorView().setSystemUiVisibility(window.getDecorView().getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
37+
}
38+
39+
window.getDecorView().setOnApplyWindowInsetsListener((v, insets) -> {
40+
int statusBarHeight = insets.getSystemWindowInsetTop();
41+
int navBarHeight = insets.getSystemWindowInsetBottom();
42+
43+
window.getDecorView().setPadding(v.getPaddingLeft(), statusBarHeight, v.getPaddingRight(), navBarHeight);
44+
45+
return insets.consumeSystemWindowInsets();
46+
});
47+
}
2648

2749
Fragment fragment = null;
2850
boolean addToBackStack = false;
2951

3052
if (intent.getBooleanExtra(EXTRA_PIKO_SETTINGS, false)) {
3153
fragment = new SettingsFragment();
32-
}else if (intent.getBooleanExtra(Settings.FEATURE_FLAGS.key, false)) {
54+
} else if (intent.getBooleanExtra(Settings.FEATURE_FLAGS.key, false)) {
3355
fragment = new FeatureFlagsFragment();
3456
fragment.setArguments(intent.getExtras());
35-
}else if (intent.getBooleanExtra(Settings.PATCH_INFO.key, false)) {
57+
} else if (intent.getBooleanExtra(Settings.PATCH_INFO.key, false)) {
3658
fragment = new SettingsAboutFragment();
37-
}else{
59+
} else {
3860
fragment = new PageFragment();
3961
fragment.setArguments(intent.getExtras());
4062
}
4163

42-
if(fragment!=null) {
43-
startFragment(act,fragment,addToBackStack);
64+
if (fragment != null) {
65+
startFragment(act, fragment, addToBackStack);
4466
return true;
4567
}
4668
return false;
4769
}
4870

49-
public static void startFragment(Activity act, Fragment fragment,boolean addToBackStack){
71+
public static void startFragment(Activity act, Fragment fragment, boolean addToBackStack) {
5072
act.setContentView(Utils.getResourceIdentifier("preference_fragment_activity", "layout"));
5173
toolbar = act.findViewById(Utils.getResourceIdentifier("toolbar", "id"));
5274
toolbar.setNavigationIcon(Utils.getResourceIdentifier("ic_vector_arrow_left", "drawable"));
5375
toolbar.setTitle(Utils.getResourceString("piko_title_settings"));
5476
toolbar.setNavigationOnClickListener(view -> act.onBackPressed());
5577

5678
FragmentTransaction transaction = act.getFragmentManager().beginTransaction().replace(Utils.getResourceIdentifier("fragment_container", "id"), fragment);
57-
if(addToBackStack){
79+
if (addToBackStack) {
5880
transaction.addToBackStack(null);
5981
}
6082
transaction.commit();
6183
}
6284

63-
public static void startActivity(String activity_name, Bundle bundle)throws Exception{
85+
public static void startActivity(String activity_name, Bundle bundle) throws Exception {
6486
Intent intent = new Intent(context, Class.forName("com.twitter.android.AuthorizeAppActivity"));
6587
bundle.putBoolean(activity_name, true);
6688
bundle.putBoolean(EXTRA_PIKO, true);
@@ -69,11 +91,11 @@ public static void startActivity(String activity_name, Bundle bundle)throws Exce
6991
context.startActivity(intent);
7092
}
7193

72-
public static void startActivity(String activity_name)throws Exception{
94+
public static void startActivity(String activity_name) throws Exception {
7395
Bundle bundle = new Bundle();
7496
bundle.putBoolean(activity_name, true);
7597
bundle.putBoolean(EXTRA_PIKO, true);
76-
startActivity(activity_name,bundle);
98+
startActivity(activity_name, bundle);
7799
}
78100

79101
public static void startSettingsActivity() throws Exception {

app/src/main/java/app/revanced/integrations/twitter/settings/ScreenBuilder.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,43 @@ public void buildTimelineSection(boolean buildCategory){
790790
)
791791
);
792792
}
793+
if (SettingsStatus.hideCommBadge) {
794+
addPreference(category,
795+
helper.switchPreference(
796+
strRes("piko_pref_hide_community_badge"),
797+
"",
798+
Settings.TIMELINE_HIDE_COMM_BADGE
799+
)
800+
);
801+
}
793802
}
794803

804+
public void buildLoggingSection(boolean buildCategory) {
805+
LegacyTwitterPreferenceCategory category = null;
806+
if (buildCategory)
807+
category = preferenceCategory(strRes("piko_title_logging"));
808+
809+
if (SettingsStatus.serverResponseLogging) {
810+
addPreference(category,
811+
helper.switchPreference(
812+
strRes("piko_pref_server_response_logging"),
813+
strRes("piko_pref_server_response_logging_desc"),
814+
Settings.LOG_RES
815+
)
816+
);
817+
}
818+
819+
if (SettingsStatus.serverResponseLoggingOverwriteFile) {
820+
addPreference(category,
821+
helper.switchPreference(
822+
strRes("piko_pref_server_response_logging_file_overwrite"),
823+
strRes("piko_pref_server_response_logging_file_overwrite_desc"),
824+
Settings.LOG_RES_OVRD
825+
)
826+
);
827+
}
828+
829+
}
795830
public void buildExportSection(boolean buildCategory){
796831
LegacyTwitterPreferenceCategory category = null;
797832
if(buildCategory)
@@ -924,6 +959,17 @@ public void buildSinglePageSettings(){
924959
)
925960
);
926961
}
962+
963+
if (SettingsStatus.loggingSection()) {
964+
addPreference(
965+
helper.buttonPreference(
966+
strRes("piko_title_logging"),
967+
"",
968+
Settings.LOGGING_SECTION,
969+
"ic_vector_bug_stroke",null
970+
)
971+
);
972+
}
927973

928974
addPreference(
929975
helper.buttonPreference(

app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public class Settings extends BaseSettings {
6464
public static final BooleanSetting TIMELINE_ENABLE_VID_FORCE_HD = new BooleanSetting("timeline_enable_vid_force_hd", true);
6565
public static final BooleanSetting TIMELINE_HIDE_NUDGE_BUTTON = new BooleanSetting("timeline_hide_nudge_button", false);
6666
public static final BooleanSetting TIMELINE_SHOW_SENSITIVE_MEDIA = new BooleanSetting("timeline_show_sensitive_media", true);
67+
public static final BooleanSetting TIMELINE_HIDE_COMM_BADGE = new BooleanSetting("timeline_hide_community_badge", false);
6768

6869
public static final BooleanSetting PREMIUM_READER_MODE = new BooleanSetting("premium_reader_mode", false);
6970
public static final BooleanSetting PREMIUM_UNDO_POSTS = new BooleanSetting("premium_undo_posts", false);
@@ -83,6 +84,9 @@ public class Settings extends BaseSettings {
8384
public static final StringSetting CUSTOM_SEARCH_TYPE_AHEAD = new StringSetting("customisation_search_type_ahead", "");
8485
public static final StringSetting CUSTOM_POST_FONT_SIZE = new StringSetting("customisation_post_font_size", String.valueOf(Utils.getResourceDimension("font_size_normal")));
8586

87+
public static final BooleanSetting LOG_RES = new BooleanSetting("logging_response", false);
88+
public static final BooleanSetting LOG_RES_OVRD = new BooleanSetting("logging_response_overwrite_file", false);
89+
8690
public static final BooleanSetting EXPORT_PREF = new BooleanSetting("export_pref", true);
8791
public static final BooleanSetting EXPORT_FLAGS = new BooleanSetting("export_flags", true);
8892
public static final BooleanSetting IMPORT_PREF = new BooleanSetting("import_pref", true);
@@ -99,6 +103,7 @@ public class Settings extends BaseSettings {
99103
public static final BooleanSetting MISC_SECTION = new BooleanSetting("misc_section", true);
100104
public static final BooleanSetting CUSTOMISE_SECTION = new BooleanSetting("custommise_section", true);
101105
public static final BooleanSetting TIMELINE_SECTION = new BooleanSetting("timeline_section", true);
106+
public static final BooleanSetting LOGGING_SECTION = new BooleanSetting("logging_section", true);
102107
public static final BooleanSetting BACKUP_SECTION = new BooleanSetting("backup_section", true);
103108
public static final BooleanSetting NATIVE_SECTION = new BooleanSetting("native_section", true);
104109
public static final BooleanSetting SINGLE_PAGE_SETTINGS = new BooleanSetting("single_page_settings", false);

app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,19 @@ public class SettingsStatus {
7171
public static boolean hideNudgeButton = false;
7272
public static boolean hideSocialProof = false;
7373
public static boolean customPostFontSize = false;
74+
public static boolean hideCommBadge = false;
75+
public static boolean serverResponseLogging = false;
76+
public static boolean serverResponseLoggingOverwriteFile = false;
7477

78+
public static void serverResponseLogging() {
79+
serverResponseLogging = true;
80+
}
81+
public static void serverResponseLoggingOverwriteFile() {
82+
serverResponseLoggingOverwriteFile = true;
83+
}
84+
public static void hideCommBadge() {
85+
hideCommBadge = true;
86+
}
7587
public static void customPostFontSize() {
7688
customPostFontSize = true;
7789
}
@@ -322,7 +334,7 @@ public static void typeaheadCustomisation() {
322334
}
323335

324336
public static boolean enableTimelineSection() {
325-
return ( showSensitiveMedia || hideNudgeButton || disableAutoTimelineScroll || forceTranslate || hidePromoteButton || hideCommunityNote || hideLiveThreads || hideBanner || hideInlineBmk || showPollResultsEnabled || hideImmersivePlayer || enableVidAutoAdvance || enableForceHD);
337+
return ( hideCommBadge || showSensitiveMedia || hideNudgeButton || disableAutoTimelineScroll || forceTranslate || hidePromoteButton || hideCommunityNote || hideLiveThreads || hideBanner || hideInlineBmk || showPollResultsEnabled || hideImmersivePlayer || enableVidAutoAdvance || enableForceHD);
326338
}
327339

328340
public static boolean enableMiscSection() {
@@ -348,6 +360,9 @@ public static boolean enablePremiumSection() {
348360
public static boolean enableCustomisationSection() {
349361
return (searchTabCustomisation || typeaheadCustomisation || exploreTabCustomisation || customPostFontSize || inlineBarCustomisation || navBarCustomisation || sideBarCustomisation || profileTabCustomisation || timelineTabCustomisation || defaultReplySortFilter);
350362
}
363+
public static boolean loggingSection() {
364+
return (serverResponseLogging || serverResponseLoggingOverwriteFile);
365+
}
351366

352367
public static void load() {
353368
}

app/src/main/java/app/revanced/integrations/twitter/settings/fragments/PageFragment.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
6464
}else if (bundle.getBoolean(Settings.NATIVE_SECTION.key, false)) {
6565
screenBuilder.buildNativeSection(false);
6666
toolbarText = "piko_title_native";
67+
}else if (bundle.getBoolean(Settings.LOGGING_SECTION.key, false)) {
68+
screenBuilder.buildLoggingSection(false);
69+
toolbarText = "piko_title_logging";
6770
}
6871

6972
ActivityHook.toolbar.setTitle(StringRef.str(toolbarText));

app/src/main/java/app/revanced/integrations/twitter/settings/fragments/SettingsAboutFragment.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,13 @@ public void onCreate(@org.jetbrains.annotations.Nullable Bundle savedInstanceSta
117117
flags.put(strEnableRes("piko_pref_force_hd"),SettingsStatus.enableForceHD);
118118
flags.put(strRes("piko_pref_hide_nudge_button"),SettingsStatus.hideNudgeButton);
119119
flags.put(strRes("piko_pref_hide_social_proof"),SettingsStatus.hideSocialProof);
120+
flags.put(strRes("piko_pref_hide_community_badge"),SettingsStatus.hideCommBadge);
120121
flags.put(strRes("piko_title_native_translator"),SettingsStatus.nativeTranslator);
121122
flags.put(strRes("piko_pref_customisation_post_font_size"),SettingsStatus.customPostFontSize);
122123
flags.put(strRemoveRes("piko_pref_top_people_search"),SettingsStatus.hideTopPeopleSearch);
123124
flags.put(strRes("piko_pref_customisation_searchtabs"),SettingsStatus.searchTabCustomisation);
124125
flags.put(strRemoveRes("piko_pref_hide_todays_news"),SettingsStatus.hideTodaysNews);
126+
flags.put(strRemoveRes("piko_pref_server_response_logging"),SettingsStatus.serverResponseLogging);
125127

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

0 commit comments

Comments
 (0)