Skip to content

Commit

Permalink
Merge pull request #100 from crimera/dev
Browse files Browse the repository at this point in the history
chore: Merge branch `dev` to `main`
  • Loading branch information
crimera authored Oct 29, 2024
2 parents 47d8c7d + 4eaa4e2 commit 384a4c1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 14 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## [1.32.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.31.3-dev.2...v1.32.0-dev.1) (2024-10-26)


### Features

* **Customize side bar items:** Allow for hiding of the "Jobs" item ([047946a](https://github.com/crimera/revanced-integrations/commit/047946aa9b5f7c494d56ad25d6fa9bfb7dbef524))

## [1.31.3-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.31.3-dev.1...v1.31.3-dev.2) (2024-10-26)


### Bug Fixes

* Remove new MainEvent ads from Explore page ([6bb196b](https://github.com/crimera/revanced-integrations/commit/6bb196bb01d7f09f6442d635e556fc985b1b9751))

## [1.31.3-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.31.2...v1.31.3-dev.1) (2024-10-26)


### Updates

* **Custom Downloader:** Only download files that doesn't already exist ([63c1664](https://github.com/crimera/revanced-integrations/commit/63c16647a7a7822465353fa58629ffcd2e4b8ca7))

## [1.31.2](https://github.com/crimera/revanced-integrations/compare/v1.31.1...v1.31.2) (2024-10-24)


Expand Down
32 changes: 21 additions & 11 deletions app/src/main/java/app/revanced/integrations/twitter/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ public static String[] addPref(String[] prefs, String pref) {
return bigger;
}

private static String getPath(String publicFolder, String subFolder, String filename) {
return publicFolder + "/" + subFolder + "/" + filename;
}

public static void downloadFile(String url, String mediaName, String ext) {
String filename = mediaName + "." + ext;
boolean isPhoto = ext.equals("jpg");
Expand All @@ -238,28 +242,34 @@ public static void downloadFile(String url, String mediaName, String ext) {
request.setTitle(filename);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);

String[] savePath = {"Pictures", "Twitter"};
String publicFolder = "Pictures";
String subFolder = "Twitter";

if (!isPhoto) {
savePath = new String[]{Pref.getPublicFolder(), Utils.getStringPref(Settings.VID_SUBFOLDER)};
publicFolder = Pref.getPublicFolder();
subFolder = Utils.getStringPref(Settings.VID_SUBFOLDER);
}
request.setDestinationInExternalPublicDir(publicFolder, subFolder + "/" + "temp_" + filename);

File file = new File(Environment.getExternalStorageDirectory(), getPath(publicFolder, subFolder, filename));
if (file.exists()) {
toast(strRes("exo_download_completed") + ": " + filename);
return;
}
request.setDestinationInExternalPublicDir(savePath[0], savePath[1] + "/" + "temp_" + filename);

DownloadManager manager = (DownloadManager) ctx.getSystemService(Context.DOWNLOAD_SERVICE);
long downloadId = manager.enqueue(request);

final String[] finalSavePath = savePath;
ctx.registerReceiver(new BroadcastReceiver() {

private String getPath(String filename) {
return finalSavePath[0] + "/" + finalSavePath[1] + "/" + filename;
}
File tempFile = new File(
Environment.getExternalStorageDirectory(),
getPath(publicFolder, subFolder, "temp_" + filename)
);

ctx.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
if (id == downloadId) {
File tempFile = new File(Environment.getExternalStorageDirectory(), getPath("temp_"+filename));
File file = new File(Environment.getExternalStorageDirectory(), getPath(filename));
tempFile.renameTo(file);

toast(strRes("exo_download_completed") + ": " + filename);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private static boolean isEntryIdRemove(String entryId) {
if (entryId.startsWith("messageprompt-") && hidePremiumPrompt) {
return true;
}
if (entryId.startsWith("main-event-") && hideMainEvent) {
if (entryId.startsWith("main-event-") || entryId2.equals("eventsummary") && hideMainEvent) {
return true;
}
if (entryId2.equals("tweet") && entryId.contains("-tweet-") && hideVideosForYou) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void setInitialValue(String key) {
entriesValues = new CharSequence[]{"tweets", "tweets_replies", "affiliated", "subs", "highlights", "articles", "media", "likes"};
}else if (key == Settings.CUSTOM_SIDEBAR_TABS.key) {
entries = Utils.getResourceStringArray("piko_array_sidebar");
entriesValues = new CharSequence[]{"Profile","Premium", "Grok","DMs","Communities","Bookmarks","Lists","TopArticles","BirdwatchNotes","Spaces","PendingFollowers","Monetization","ProfessionalToolsGroup","MediaTransparency","Imprint","SettingsAndSupportGroup"};
entriesValues = new CharSequence[]{"Profile","Premium", "Grok","DMs","Communities","Bookmarks","Lists","TopArticles","BirdwatchNotes","Spaces","PendingFollowers","Monetization","ProfessionalToolsGroup","MediaTransparency","Imprint","SettingsAndSupportGroup","Jobs"};
}else if (key == Settings.CUSTOM_NAVBAR_TABS.key) {
entries = Utils.getResourceStringArray("piko_array_navbar");
entriesValues = new CharSequence[]{"HOME","GUIDE", "SPACES","COMMUNITIES","NOTIFICATIONS","CONNECT","COMMUNITY_NOTES","BOOKMARKS","DMS","GROK","MEDIA_TAB"};
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
android.useAndroidX = true
version = 1.31.2
version = 1.32.0-dev.1

0 comments on commit 384a4c1

Please sign in to comment.