Compare commits

...

19 Commits

Author SHA1 Message Date
semantic-release-bot
ef052c0d8f chore: Release v5.48.0 [skip ci]
# [5.48.0](https://github.com/ReVanced/revanced-patches/compare/v5.47.0...v5.48.0) (2026-01-19)

### Bug Fixes

* **Boost for Reddit - Fix missing audio in video downloads:** Make it work again by reflecting Reddits latest changes ([#6500](https://github.com/ReVanced/revanced-patches/issues/6500)) ([eecc44b](eecc44b956))
* **Disney+ - Skip ads:** Remove unsupported package names ([#6422](https://github.com/ReVanced/revanced-patches/issues/6422)) ([44e7dbc](44e7dbcf4d))
* Fix build error introduced in `4046bee` ([#6417](https://github.com/ReVanced/revanced-patches/issues/6417)) ([789f0a5](789f0a5628))
* Fix compilation error introduced in `6bb6281` ([#6409](https://github.com/ReVanced/revanced-patches/issues/6409)) ([71c6cb5](71c6cb569e))
* Fix compilation error introduced in dc69f243 ([#6392](https://github.com/ReVanced/revanced-patches/issues/6392)) ([a429824](a429824bb7))
* **Instagram:** `Sanitize sharing links` ([#6483](https://github.com/ReVanced/revanced-patches/issues/6483)) ([8724759](87247590de))
* **YouTube - Hide layout components:** Hide new type of crowdfunding box ([#6380](https://github.com/ReVanced/revanced-patches/issues/6380)) ([dc69f24](dc69f2433e))

### Features

* Add `Disable Sentry telemetry` patch ([#6416](https://github.com/ReVanced/revanced-patches/issues/6416)) ([4cc3159](4cc315952d))
* Add `Prevent screenshot detection` patch ([#6482](https://github.com/ReVanced/revanced-patches/issues/6482)) ([83c0127](83c0127ebb))
* Disable Play Integrity patch ([#6412](https://github.com/ReVanced/revanced-patches/issues/6412)) ([6312fe8](6312fe8d60))
* **Instagram - Hides navigation buttons:** Add more buttons to hide ([#6390](https://github.com/ReVanced/revanced-patches/issues/6390)) ([6bb6281](6bb6281149))
* **Instagram:** Add `Hide highlights tray` patch ([#6489](https://github.com/ReVanced/revanced-patches/issues/6489)) ([8725a49](8725a49ba3))
* **Instagram:** Add `Remove build expired popup` patch ([#6488](https://github.com/ReVanced/revanced-patches/issues/6488)) ([18c0b04](18c0b04f0c))
* **Instagram:** Disable `Disable Reels scrolling` by default ([3401467](3401467a6d))
* **Letterboxd:** Add `Unlock app icons` patch ([#6415](https://github.com/ReVanced/revanced-patches/issues/6415)) ([d25dcfe](d25dcfe49a))
* **ProtonVPN:** Add `Unlock split tunneling` patch ([#6353](https://github.com/ReVanced/revanced-patches/issues/6353)) ([e0f3346](e0f33468e6))
* **SBS On Demand:** Add `Remove ads` patch ([#6378](https://github.com/ReVanced/revanced-patches/issues/6378)) ([315931c](315931cbf8))
* **Strava:** Add `Add 'Give Kudos' button to 'Group Activity'` patch ([#6475](https://github.com/ReVanced/revanced-patches/issues/6475)) ([4c4ba1c](4c4ba1c78c))
* **Strava:** Add `Add media download` patch ([#6449](https://github.com/ReVanced/revanced-patches/issues/6449)) ([778d13c](778d13ce8b))
* **Strava:** Add `Block Snowplow tracking` patch ([#6413](https://github.com/ReVanced/revanced-patches/issues/6413)) ([c47beae](c47beae213))
* **Strava:** Add `Disable Quick Edit` patch ([#6452](https://github.com/ReVanced/revanced-patches/issues/6452)) ([f5cbb31](f5cbb31724))
* **Strava:** Add `Enable password login` patch ([#6396](https://github.com/ReVanced/revanced-patches/issues/6396)) ([8f3f4c9](8f3f4c95bb))
* **Strava:** Add `Overwrite media upload parameters` patch ([#6410](https://github.com/ReVanced/revanced-patches/issues/6410)) ([b42ae27](b42ae27ce6))
* **YouTube:** Add `Pause on audio interrupt` patch ([#6464](https://github.com/ReVanced/revanced-patches/issues/6464)) ([19f146c](19f146c01d))
2026-01-19 09:28:58 +00:00
oSumAtrIX
d9fa580222 chore: Merge branch dev to main (#6385) 2026-01-19 10:25:41 +01:00
semantic-release-bot
182224c79d chore: Release v5.48.0-dev.13 [skip ci]
# [5.48.0-dev.13](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.12...v5.48.0-dev.13) (2026-01-19)

### Features

* Add `Prevent screenshot detection` patch ([#6482](https://github.com/ReVanced/revanced-patches/issues/6482)) ([83c0127](83c0127ebb))
2026-01-19 09:21:21 +00:00
xehpuk
83c0127ebb feat: Add Prevent screenshot detection patch (#6482)
Co-authored-by: Swakshan <56347042+Swakshan@users.noreply.github.com>
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2026-01-19 10:16:30 +01:00
semantic-release-bot
3762f1de08 chore: Release v5.48.0-dev.12 [skip ci]
# [5.48.0-dev.12](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.11...v5.48.0-dev.12) (2026-01-19)

### Features

* **Instagram:** Add `Remove build expired popup` patch ([#6488](https://github.com/ReVanced/revanced-patches/issues/6488)) ([18c0b04](18c0b04f0c))
* **Strava:** Add `Add 'Give Kudos' button to 'Group Activity'` patch ([#6475](https://github.com/ReVanced/revanced-patches/issues/6475)) ([4c4ba1c](4c4ba1c78c))
2026-01-19 09:06:41 +00:00
Swakshan
18c0b04f0c feat(Instagram): Add Remove build expired popup patch (#6488)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2026-01-19 10:01:42 +01:00
xehpuk
4c4ba1c78c feat(Strava): Add Add 'Give Kudos' button to 'Group Activity' patch (#6475)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2026-01-19 10:00:25 +01:00
semantic-release-bot
7cef24a5e9 chore: Release v5.48.0-dev.11 [skip ci]
# [5.48.0-dev.11](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.10...v5.48.0-dev.11) (2026-01-19)

### Features

* **Instagram:** Add `Hide highlights tray` patch ([#6489](https://github.com/ReVanced/revanced-patches/issues/6489)) ([8725a49](8725a49ba3))
2026-01-19 08:56:06 +00:00
Swakshan
8725a49ba3 feat(Instagram): Add Hide highlights tray patch (#6489)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2026-01-19 09:52:36 +01:00
semantic-release-bot
8b6360e34f chore: Release v5.48.0-dev.10 [skip ci]
# [5.48.0-dev.10](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.9...v5.48.0-dev.10) (2026-01-19)

### Bug Fixes

* **Boost for Reddit - Fix missing audio in video downloads:** Make it work again by reflecting Reddits latest changes ([#6500](https://github.com/ReVanced/revanced-patches/issues/6500)) ([eecc44b](eecc44b956))
* **Instagram:** `Sanitize sharing links` ([#6483](https://github.com/ReVanced/revanced-patches/issues/6483)) ([8724759](87247590de))

### Features

* **Instagram:** Disable `Disable Reels scrolling` by default ([3401467](3401467a6d))
* **Strava:** Add `Add media download` patch ([#6449](https://github.com/ReVanced/revanced-patches/issues/6449)) ([778d13c](778d13ce8b))
* **YouTube:** Add `Pause on audio interrupt` patch ([#6464](https://github.com/ReVanced/revanced-patches/issues/6464)) ([19f146c](19f146c01d))
2026-01-19 08:40:58 +00:00
Pun Butrach
a10c51f160 ci: Include require environment variables in release step (#6493) 2026-01-19 09:38:25 +01:00
scruz
eecc44b956 fix(Boost for Reddit - Fix missing audio in video downloads): Make it work again by reflecting Reddits latest changes (#6500) 2026-01-18 16:21:59 +01:00
oSumAtrIX
3401467a6d feat(Instagram): Disable Disable Reels scrolling by default 2026-01-15 23:30:17 +01:00
Swakshan
87247590de fix(Instagram): Sanitize sharing links (#6483) 2026-01-13 20:10:25 +01:00
xehpuk
41e2590584 chore(Strava): Restructure media package (#6480) 2026-01-13 15:46:49 +01:00
xehpuk
778d13ce8b feat(Strava): Add Add media download patch (#6449)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2026-01-12 23:28:15 +01:00
ekaunt
19f146c01d feat(YouTube): Add Pause on audio interrupt patch (#6464)
Co-authored-by: bengross <bengross@vecta.com>
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2026-01-12 23:18:09 +01:00
Pun Butrach
12b819d20e ci: Schedule Crowdin to runs weekly instead of every 12 hours (#6466) 2026-01-12 02:40:19 +01:00
Pun Butrach
004b5908db build: Use Gradle credentials system (#6467) 2026-01-11 16:59:48 +01:00
44 changed files with 1368 additions and 48 deletions

View File

@@ -25,7 +25,8 @@ jobs:
- name: Build - name: Build
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ORG_GRADLE_PROJECT_githubPackagesUsername: ${{ env.GITHUB_ACTOR }}
ORG_GRADLE_PROJECT_githubPackagesPassword: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :patches:buildAndroid --no-daemon run: ./gradlew :patches:buildAndroid --no-daemon
- name: Upload artifacts - name: Upload artifacts

View File

@@ -2,7 +2,7 @@ name: Pull strings
on: on:
schedule: schedule:
- cron: "0 */12 * * *" - cron: "0 0 * * 0"
workflow_dispatch: workflow_dispatch:
jobs: jobs:

View File

@@ -31,7 +31,8 @@ jobs:
- name: Build - name: Build
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ORG_GRADLE_PROJECT_githubPackagesUsername: ${{ github.actor }}
ORG_GRADLE_PROJECT_githubPackagesPassword: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :patches:buildAndroid clean run: ./gradlew :patches:buildAndroid clean
- name: Setup Node.js - name: Setup Node.js
@@ -55,6 +56,8 @@ jobs:
id: release id: release
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_githubPackagesUsername: ${{ github.actor }}
ORG_GRADLE_PROJECT_githubPackagesPassword: ${{ secrets.GITHUB_TOKEN }}
- name: Attest - name: Attest
if: steps.release.outputs.new_release_published == 'true' if: steps.release.outputs.new_release_published == 'true'

View File

@@ -1,3 +1,74 @@
# [5.48.0](https://github.com/ReVanced/revanced-patches/compare/v5.47.0...v5.48.0) (2026-01-19)
### Bug Fixes
* **Boost for Reddit - Fix missing audio in video downloads:** Make it work again by reflecting Reddits latest changes ([#6500](https://github.com/ReVanced/revanced-patches/issues/6500)) ([eecc44b](https://github.com/ReVanced/revanced-patches/commit/eecc44b9567bf2ca72ac99e0dafa483a6803c0f9))
* **Disney+ - Skip ads:** Remove unsupported package names ([#6422](https://github.com/ReVanced/revanced-patches/issues/6422)) ([44e7dbc](https://github.com/ReVanced/revanced-patches/commit/44e7dbcf4d7eaf94dd0164baba847d3e19250154))
* Fix build error introduced in `4046bee` ([#6417](https://github.com/ReVanced/revanced-patches/issues/6417)) ([789f0a5](https://github.com/ReVanced/revanced-patches/commit/789f0a562861825065633d172445ebf35a1ba8d8))
* Fix compilation error introduced in `6bb6281` ([#6409](https://github.com/ReVanced/revanced-patches/issues/6409)) ([71c6cb5](https://github.com/ReVanced/revanced-patches/commit/71c6cb569ebf7b93cf73ee391839e5220557ce7c))
* Fix compilation error introduced in dc69f243 ([#6392](https://github.com/ReVanced/revanced-patches/issues/6392)) ([a429824](https://github.com/ReVanced/revanced-patches/commit/a429824bb77b49aea14b0b54f2204ae24d5209a1))
* **Instagram:** `Sanitize sharing links` ([#6483](https://github.com/ReVanced/revanced-patches/issues/6483)) ([8724759](https://github.com/ReVanced/revanced-patches/commit/87247590de3db74680cb02ba1d87bf683b2269e2))
* **YouTube - Hide layout components:** Hide new type of crowdfunding box ([#6380](https://github.com/ReVanced/revanced-patches/issues/6380)) ([dc69f24](https://github.com/ReVanced/revanced-patches/commit/dc69f2433e2650654e2dffdd76b0b0c8a52bf515))
### Features
* Add `Disable Sentry telemetry` patch ([#6416](https://github.com/ReVanced/revanced-patches/issues/6416)) ([4cc3159](https://github.com/ReVanced/revanced-patches/commit/4cc315952db557c565872de9e8484805f2e42305))
* Add `Prevent screenshot detection` patch ([#6482](https://github.com/ReVanced/revanced-patches/issues/6482)) ([83c0127](https://github.com/ReVanced/revanced-patches/commit/83c0127ebb8f53ab8a067758619faaac5596c145))
* Disable Play Integrity patch ([#6412](https://github.com/ReVanced/revanced-patches/issues/6412)) ([6312fe8](https://github.com/ReVanced/revanced-patches/commit/6312fe8d60da24465c0c1b0fa4e94ceb79873d9c))
* **Instagram - Hides navigation buttons:** Add more buttons to hide ([#6390](https://github.com/ReVanced/revanced-patches/issues/6390)) ([6bb6281](https://github.com/ReVanced/revanced-patches/commit/6bb62811493da04812cc3e392e68d874f95cbef9))
* **Instagram:** Add `Hide highlights tray` patch ([#6489](https://github.com/ReVanced/revanced-patches/issues/6489)) ([8725a49](https://github.com/ReVanced/revanced-patches/commit/8725a49ba3a06fee0280ffcf4be62cd960cd301e))
* **Instagram:** Add `Remove build expired popup` patch ([#6488](https://github.com/ReVanced/revanced-patches/issues/6488)) ([18c0b04](https://github.com/ReVanced/revanced-patches/commit/18c0b04f0cd1bf8cd78b05af3b8ebe3a6a5f9e48))
* **Instagram:** Disable `Disable Reels scrolling` by default ([3401467](https://github.com/ReVanced/revanced-patches/commit/3401467a6d49fc75b6757a15e5c848330c1b7307))
* **Letterboxd:** Add `Unlock app icons` patch ([#6415](https://github.com/ReVanced/revanced-patches/issues/6415)) ([d25dcfe](https://github.com/ReVanced/revanced-patches/commit/d25dcfe49ac331c9b3dca739ba0be95dbab669cc))
* **ProtonVPN:** Add `Unlock split tunneling` patch ([#6353](https://github.com/ReVanced/revanced-patches/issues/6353)) ([e0f3346](https://github.com/ReVanced/revanced-patches/commit/e0f33468e6e96b9f10cf35ec67622d6488528c90))
* **SBS On Demand:** Add `Remove ads` patch ([#6378](https://github.com/ReVanced/revanced-patches/issues/6378)) ([315931c](https://github.com/ReVanced/revanced-patches/commit/315931cbf8f61cd4b3a54ace1ff03685d748614c))
* **Strava:** Add `Add 'Give Kudos' button to 'Group Activity'` patch ([#6475](https://github.com/ReVanced/revanced-patches/issues/6475)) ([4c4ba1c](https://github.com/ReVanced/revanced-patches/commit/4c4ba1c78c9f4568a2b572f5c69e9c6c734e1a7f))
* **Strava:** Add `Add media download` patch ([#6449](https://github.com/ReVanced/revanced-patches/issues/6449)) ([778d13c](https://github.com/ReVanced/revanced-patches/commit/778d13ce8b28ca6df3a665530320e4a21a27ae44))
* **Strava:** Add `Block Snowplow tracking` patch ([#6413](https://github.com/ReVanced/revanced-patches/issues/6413)) ([c47beae](https://github.com/ReVanced/revanced-patches/commit/c47beae21376dd17ab8bc09afe73e9094481bde9))
* **Strava:** Add `Disable Quick Edit` patch ([#6452](https://github.com/ReVanced/revanced-patches/issues/6452)) ([f5cbb31](https://github.com/ReVanced/revanced-patches/commit/f5cbb31724d15f7e939b96ee0186fd0a108f9fdc))
* **Strava:** Add `Enable password login` patch ([#6396](https://github.com/ReVanced/revanced-patches/issues/6396)) ([8f3f4c9](https://github.com/ReVanced/revanced-patches/commit/8f3f4c95bb8f151fc9a2c272bf7d0e905c2f01fc))
* **Strava:** Add `Overwrite media upload parameters` patch ([#6410](https://github.com/ReVanced/revanced-patches/issues/6410)) ([b42ae27](https://github.com/ReVanced/revanced-patches/commit/b42ae27ce66ebad9e9cfc5b70fc121df5bad7567))
* **YouTube:** Add `Pause on audio interrupt` patch ([#6464](https://github.com/ReVanced/revanced-patches/issues/6464)) ([19f146c](https://github.com/ReVanced/revanced-patches/commit/19f146c01dc381b3cccd61e61ba4901872ff12d8))
# [5.48.0-dev.13](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.12...v5.48.0-dev.13) (2026-01-19)
### Features
* Add `Prevent screenshot detection` patch ([#6482](https://github.com/ReVanced/revanced-patches/issues/6482)) ([83c0127](https://github.com/ReVanced/revanced-patches/commit/83c0127ebb8f53ab8a067758619faaac5596c145))
# [5.48.0-dev.12](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.11...v5.48.0-dev.12) (2026-01-19)
### Features
* **Instagram:** Add `Remove build expired popup` patch ([#6488](https://github.com/ReVanced/revanced-patches/issues/6488)) ([18c0b04](https://github.com/ReVanced/revanced-patches/commit/18c0b04f0cd1bf8cd78b05af3b8ebe3a6a5f9e48))
* **Strava:** Add `Add 'Give Kudos' button to 'Group Activity'` patch ([#6475](https://github.com/ReVanced/revanced-patches/issues/6475)) ([4c4ba1c](https://github.com/ReVanced/revanced-patches/commit/4c4ba1c78c9f4568a2b572f5c69e9c6c734e1a7f))
# [5.48.0-dev.11](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.10...v5.48.0-dev.11) (2026-01-19)
### Features
* **Instagram:** Add `Hide highlights tray` patch ([#6489](https://github.com/ReVanced/revanced-patches/issues/6489)) ([8725a49](https://github.com/ReVanced/revanced-patches/commit/8725a49ba3a06fee0280ffcf4be62cd960cd301e))
# [5.48.0-dev.10](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.9...v5.48.0-dev.10) (2026-01-19)
### Bug Fixes
* **Boost for Reddit - Fix missing audio in video downloads:** Make it work again by reflecting Reddits latest changes ([#6500](https://github.com/ReVanced/revanced-patches/issues/6500)) ([eecc44b](https://github.com/ReVanced/revanced-patches/commit/eecc44b9567bf2ca72ac99e0dafa483a6803c0f9))
* **Instagram:** `Sanitize sharing links` ([#6483](https://github.com/ReVanced/revanced-patches/issues/6483)) ([8724759](https://github.com/ReVanced/revanced-patches/commit/87247590de3db74680cb02ba1d87bf683b2269e2))
### Features
* **Instagram:** Disable `Disable Reels scrolling` by default ([3401467](https://github.com/ReVanced/revanced-patches/commit/3401467a6d49fc75b6757a15e5c848330c1b7307))
* **Strava:** Add `Add media download` patch ([#6449](https://github.com/ReVanced/revanced-patches/issues/6449)) ([778d13c](https://github.com/ReVanced/revanced-patches/commit/778d13ce8b28ca6df3a665530320e4a21a27ae44))
* **YouTube:** Add `Pause on audio interrupt` patch ([#6464](https://github.com/ReVanced/revanced-patches/issues/6464)) ([19f146c](https://github.com/ReVanced/revanced-patches/commit/19f146c01dc381b3cccd61e61ba4901872ff12d8))
# [5.48.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.8...v5.48.0-dev.9) (2026-01-08) # [5.48.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v5.48.0-dev.8...v5.48.0-dev.9) (2026-01-08)

View File

@@ -311,6 +311,10 @@ public class Utils {
return resourceId; return resourceId;
} }
public static String getResourceString(int id) throws Resources.NotFoundException {
return getContext().getResources().getString(id);
}
public static int getResourceInteger(String resourceIdentifierName) throws Resources.NotFoundException { public static int getResourceInteger(String resourceIdentifierName) throws Resources.NotFoundException {
return getContext().getResources().getInteger(getResourceIdentifierOrThrow(resourceIdentifierName, "integer")); return getContext().getResources().getInteger(getResourceIdentifierOrThrow(resourceIdentifierName, "integer"));
} }

View File

@@ -0,0 +1,5 @@
dependencies {
compileOnly(project(":extensions:shared:library"))
compileOnly(project(":extensions:strava:stub"))
compileOnly(libs.okhttp)
}

View File

@@ -0,0 +1 @@
<manifest/>

View File

@@ -0,0 +1,216 @@
package app.revanced.extension.strava;
import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.MediaStore;
import android.webkit.MimeTypeMap;
import com.strava.core.data.MediaType;
import com.strava.photos.data.Media;
import okhttp3.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import app.revanced.extension.shared.Utils;
@SuppressLint("NewApi")
public final class AddMediaDownloadPatch {
public static final int ACTION_DOWNLOAD = -1;
public static final int ACTION_OPEN_LINK = -2;
public static final int ACTION_COPY_LINK = -3;
private static final OkHttpClient client = new OkHttpClient();
public static boolean handleAction(int actionId, Media media) {
String url = getUrl(media);
switch (actionId) {
case ACTION_DOWNLOAD:
String name = media.getId();
if (media.getType() == MediaType.VIDEO) {
downloadVideo(url, name);
} else {
downloadPhoto(url, name);
}
return true;
case ACTION_OPEN_LINK:
Utils.openLink(url);
return true;
case ACTION_COPY_LINK:
copyLink(url);
return true;
default:
return false;
}
}
public static void copyLink(CharSequence url) {
Utils.setClipboard(url);
showInfoToast("link_copied_to_clipboard", "🔗");
}
public static void downloadPhoto(String url, String name) {
showInfoToast("loading", "");
Utils.runOnBackgroundThread(() -> {
try (Response response = fetch(url)) {
ResponseBody body = response.body();
String mimeType = body.contentType().toString();
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
ContentResolver resolver = Utils.getContext().getContentResolver();
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DISPLAY_NAME, name + '.' + extension);
values.put(MediaStore.Images.Media.IS_PENDING, 1);
values.put(MediaStore.Images.Media.MIME_TYPE, mimeType);
values.put(MediaStore.Images.Media.RELATIVE_PATH, Environment.DIRECTORY_PICTURES + "/Strava");
Uri collection = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
? MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL)
: MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
Uri row = resolver.insert(collection, values);
try (OutputStream outputStream = resolver.openOutputStream(row)) {
transferTo(body.byteStream(), outputStream);
} finally {
values.clear();
values.put(MediaStore.Images.Media.IS_PENDING, 0);
resolver.update(row, values, null);
}
showInfoToast("yis_2024_local_save_image_success", "✔️");
} catch (IOException e) {
showErrorToast("download_failure", "", e);
}
});
}
/**
* Downloads a video in the M3U8 / HLS (HTTP Live Streaming) format.
*/
public static void downloadVideo(String url, String name) {
// The first request yields multiple URLs with different stream options.
// In case of Strava, the first one is always of highest quality.
// Each stream can consist of multiple chunks.
// The second request yields the URLs of all of these chunks.
// Fetch all of them concurrently and pipe their streams into the file in order.
showInfoToast("loading", "");
Utils.runOnBackgroundThread(() -> {
try {
String highestQualityStreamUrl;
try (Response response = fetch(url)) {
highestQualityStreamUrl = replaceFileName(url, lines(response).findFirst().get());
}
List<Future<Response>> futures;
try (Response response = fetch(highestQualityStreamUrl)) {
futures = lines(response)
.map(line -> replaceFileName(highestQualityStreamUrl, line))
.map(chunkUrl -> Utils.submitOnBackgroundThread(() -> fetch(chunkUrl)))
.collect(Collectors.toList());
}
ContentResolver resolver = Utils.getContext().getContentResolver();
ContentValues values = new ContentValues();
values.put(MediaStore.Video.Media.DISPLAY_NAME, name + '.' + "mp4");
values.put(MediaStore.Video.Media.IS_PENDING, 1);
values.put(MediaStore.Video.Media.MIME_TYPE, MimeTypeMap.getSingleton().getMimeTypeFromExtension("mp4"));
values.put(MediaStore.Video.Media.RELATIVE_PATH, Environment.DIRECTORY_MOVIES + "/Strava");
Uri collection = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
? MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL)
: MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
Uri row = resolver.insert(collection, values);
try (OutputStream outputStream = resolver.openOutputStream(row)) {
Throwable error = null;
for (Future<Response> future : futures) {
if (error != null) {
if (future.cancel(true)) {
continue;
}
}
try (Response response = future.get()) {
if (error == null) {
transferTo(response.body().byteStream(), outputStream);
}
} catch (InterruptedException | IOException e) {
error = e;
} catch (ExecutionException e) {
error = e.getCause();
}
}
if (error != null) {
throw new IOException(error);
}
} finally {
values.clear();
values.put(MediaStore.Video.Media.IS_PENDING, 0);
resolver.update(row, values, null);
}
showInfoToast("yis_2024_local_save_video_success", "✔️");
} catch (IOException e) {
showErrorToast("download_failure", "", e);
}
});
}
private static String getUrl(Media media) {
return media.getType() == MediaType.VIDEO
? ((Media.Video) media).getVideoUrl()
: media.getLargestUrl();
}
private static String getString(String name, String fallback) {
int id = Utils.getResourceIdentifier(name, "string");
return id != 0
? Utils.getResourceString(id)
: fallback;
}
private static void showInfoToast(String resourceName, String fallback) {
String text = getString(resourceName, fallback);
Utils.showToastShort(text);
}
private static void showErrorToast(String resourceName, String fallback, IOException exception) {
String text = getString(resourceName, fallback);
Utils.showToastLong(text + ' ' + exception.getLocalizedMessage());
}
private static Response fetch(String url) throws IOException {
Request request = new Request.Builder().url(url).build();
Response response = client.newCall(request).execute();
if (!response.isSuccessful()) {
throw new IOException("Got HTTP status code " + response.code());
}
return response;
}
/**
* {@code inputStream.transferTo(outputStream)} is "too new".
*/
private static void transferTo(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024 * 8];
int length;
while ((length = in.read(buffer)) != -1) {
out.write(buffer, 0, length);
}
}
/**
* Gets all file names.
*/
private static Stream<String> lines(Response response) {
BufferedReader reader = new BufferedReader(response.body().charStream());
return reader.lines().filter(line -> !line.startsWith("#"));
}
private static String replaceFileName(String uri, String newName) {
return uri.substring(0, uri.lastIndexOf('/') + 1) + newName;
}
}

View File

@@ -0,0 +1,12 @@
plugins {
alias(libs.plugins.android.library)
}
android {
namespace = "app.revanced.extension"
compileSdk = 34
defaultConfig {
minSdk = 21
}
}

View File

@@ -0,0 +1 @@
<manifest/>

View File

@@ -0,0 +1,15 @@
package com.strava.core.data;
import java.io.Serializable;
public interface MediaContent extends Serializable {
String getCaption();
String getId();
String getReferenceId();
MediaType getType();
void setCaption(String caption);
}

View File

@@ -0,0 +1,44 @@
package com.strava.core.data;
import java.io.Serializable;
public final class MediaDimension implements Comparable<MediaDimension>, Serializable {
private final int height;
private final int width;
public MediaDimension(int width, int height) {
this.width = width;
this.height = height;
}
public int getHeight() {
return height;
}
public float getHeightScale() {
if (width <= 0 || height <= 0) {
return 1f;
}
return height / width;
}
public int getWidth() {
return width;
}
public float getWidthScale() {
if (width <= 0 || height <= 0) {
return 1f;
}
return width / height;
}
public boolean isLandscape() {
return width > 0 && width >= height;
}
@Override
public int compareTo(MediaDimension other) {
return 0;
}
}

View File

@@ -0,0 +1,16 @@
package com.strava.core.data;
public enum MediaType {
PHOTO(1),
VIDEO(2);
private final int remoteValue;
private MediaType(int remoteValue) {
this.remoteValue = remoteValue;
}
public int getRemoteValue() {
return remoteValue;
}
}

View File

@@ -0,0 +1,17 @@
package com.strava.core.data;
import java.util.SortedMap;
public interface RemoteMediaContent extends MediaContent {
MediaDimension getLargestSize();
String getLargestUrl();
SortedMap<Integer, MediaDimension> getSizes();
String getSmallestUrl();
RemoteMediaStatus getStatus();
SortedMap<Integer, String> getUrls();
}

View File

@@ -0,0 +1,11 @@
package com.strava.core.data;
public enum RemoteMediaStatus {
NEW,
PENDING,
PROCESSED,
REPORTED,
REINSTATED,
DELETED,
FAILED
}

View File

@@ -0,0 +1,286 @@
package com.strava.photos.data;
import com.strava.core.data.MediaDimension;
import com.strava.core.data.MediaType;
import com.strava.core.data.RemoteMediaContent;
import com.strava.core.data.RemoteMediaStatus;
import java.util.SortedMap;
public abstract class Media implements RemoteMediaContent {
public static final class Photo extends Media {
private final Long activityId;
private final String activityName;
private final long athleteId;
private String caption;
private final String createdAt;
private final String createdAtLocal;
private final String cursor;
private final String id;
private final SortedMap<Integer, MediaDimension> sizes;
private final RemoteMediaStatus status;
private final String tag;
private final MediaType type;
private final SortedMap<Integer, String> urls;
@Override
public Long getActivityId() {
return activityId;
}
@Override
public String getActivityName() {
return activityName;
}
@Override
public long getAthleteId() {
return athleteId;
}
@Override
public String getCaption() {
return caption;
}
@Override
public String getCreatedAt() {
return createdAt;
}
@Override
public String getCreatedAtLocal() {
return createdAtLocal;
}
@Override
public String getCursor() {
return cursor;
}
@Override
public String getId() {
return id;
}
@Override
public SortedMap<Integer, MediaDimension> getSizes() {
return sizes;
}
@Override
public RemoteMediaStatus getStatus() {
return status;
}
@Override
public String getTag() {
return tag;
}
@Override
public MediaType getType() {
return type;
}
@Override
public SortedMap<Integer, String> getUrls() {
return urls;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
public Photo(String id,
String caption,
SortedMap<Integer, String> urls,
SortedMap<Integer, MediaDimension> sizes,
long athleteId,
String createdAt,
String createdAtLocal,
Long activityId,
String activityName,
RemoteMediaStatus status,
String tag,
String cursor) {
this.id = id;
this.caption = caption;
this.urls = urls;
this.sizes = sizes;
this.athleteId = athleteId;
this.createdAt = createdAt;
this.createdAtLocal = createdAtLocal;
this.activityId = activityId;
this.activityName = activityName;
this.status = status;
this.tag = tag;
this.cursor = cursor;
this.type = MediaType.PHOTO;
}
}
public static final class Video extends Media {
private final Long activityId;
private final String activityName;
private final long athleteId;
private String caption;
private final String createdAt;
private final String createdAtLocal;
private final String cursor;
private final Float durationSeconds;
private final String id;
private final SortedMap<Integer, MediaDimension> sizes;
private final RemoteMediaStatus status;
private final String tag;
private final MediaType type;
private final SortedMap<Integer, String> urls;
private final String videoUrl;
@Override
public Long getActivityId() {
return activityId;
}
@Override
public String getActivityName() {
return activityName;
}
@Override
public long getAthleteId() {
return athleteId;
}
@Override
public String getCaption() {
return caption;
}
@Override
public String getCreatedAt() {
return createdAt;
}
@Override
public String getCreatedAtLocal() {
return createdAtLocal;
}
@Override
public String getCursor() {
return cursor;
}
public final Float getDurationSeconds() {
return durationSeconds;
}
@Override
public String getId() {
return id;
}
@Override
public SortedMap<Integer, MediaDimension> getSizes() {
return sizes;
}
@Override
public RemoteMediaStatus getStatus() {
return status;
}
@Override
public String getTag() {
return tag;
}
@Override
public MediaType getType() {
return type;
}
@Override
public SortedMap<Integer, String> getUrls() {
return urls;
}
public final String getVideoUrl() {
return videoUrl;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
public Video(String id,
String caption,
SortedMap<Integer, String> urls,
SortedMap<Integer, MediaDimension> sizes,
long athleteId,
String createdAt,
String createdAtLocal,
Long activityId,
String activityName,
RemoteMediaStatus status,
String videoUrl,
Float durationSeconds,
String tag,
String cursor) {
this.id = id;
this.caption = caption;
this.urls = urls;
this.sizes = sizes;
this.athleteId = athleteId;
this.createdAt = createdAt;
this.createdAtLocal = createdAtLocal;
this.activityId = activityId;
this.activityName = activityName;
this.status = status;
this.videoUrl = videoUrl;
this.durationSeconds = durationSeconds;
this.tag = tag;
this.cursor = cursor;
this.type = MediaType.VIDEO;
}
}
public abstract Long getActivityId();
public abstract String getActivityName();
public abstract long getAthleteId();
public abstract String getCreatedAt();
public abstract String getCreatedAtLocal();
public abstract String getCursor();
@Override
public MediaDimension getLargestSize() {
return null;
}
@Override
public String getLargestUrl() {
return null;
}
@Override
public String getReferenceId() {
return null;
}
@Override
public String getSmallestUrl() {
return null;
}
public abstract String getTag();
private Media() {
}
}

View File

@@ -0,0 +1,30 @@
package app.revanced.extension.youtube.patches;
import app.revanced.extension.youtube.settings.Settings;
@SuppressWarnings("unused")
public class PauseOnAudioInterruptPatch {
private static final int AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK = -3;
private static final int AUDIOFOCUS_LOSS_TRANSIENT = -2;
/**
* Injection point for AudioFocusRequest builder.
* Returns true if audio ducking should be disabled (willPauseWhenDucked = true).
*/
public static boolean shouldPauseOnAudioInterrupt() {
return Settings.PAUSE_ON_AUDIO_INTERRUPT.get();
}
/**
* Injection point for onAudioFocusChange callback.
* Converts AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK to AUDIOFOCUS_LOSS_TRANSIENT
* when the setting is enabled, causing YouTube to pause instead of ducking.
*/
public static int overrideAudioFocusChange(int focusChange) {
if (Settings.PAUSE_ON_AUDIO_INTERRUPT.get() && focusChange == AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) {
return AUDIOFOCUS_LOSS_TRANSIENT;
}
return focusChange;
}
}

View File

@@ -356,6 +356,7 @@ public class Settings extends BaseSettings {
public static final IntegerSetting ANNOUNCEMENT_LAST_ID = new IntegerSetting("revanced_announcement_last_id", -1, false, false); public static final IntegerSetting ANNOUNCEMENT_LAST_ID = new IntegerSetting("revanced_announcement_last_id", -1, false, false);
public static final BooleanSetting LOOP_VIDEO = new BooleanSetting("revanced_loop_video", FALSE); public static final BooleanSetting LOOP_VIDEO = new BooleanSetting("revanced_loop_video", FALSE);
public static final BooleanSetting LOOP_VIDEO_BUTTON = new BooleanSetting("revanced_loop_video_button", FALSE); public static final BooleanSetting LOOP_VIDEO_BUTTON = new BooleanSetting("revanced_loop_video_button", FALSE);
public static final BooleanSetting PAUSE_ON_AUDIO_INTERRUPT = new BooleanSetting("revanced_pause_on_audio_interrupt", FALSE, true);
public static final BooleanSetting BYPASS_URL_REDIRECTS = new BooleanSetting("revanced_bypass_url_redirects", TRUE); public static final BooleanSetting BYPASS_URL_REDIRECTS = new BooleanSetting("revanced_bypass_url_redirects", TRUE);
public static final BooleanSetting DISABLE_HAPTIC_FEEDBACK_CHAPTERS = new BooleanSetting("revanced_disable_haptic_feedback_chapters", FALSE); public static final BooleanSetting DISABLE_HAPTIC_FEEDBACK_CHAPTERS = new BooleanSetting("revanced_disable_haptic_feedback_chapters", FALSE);
public static final BooleanSetting DISABLE_HAPTIC_FEEDBACK_PRECISE_SEEKING = new BooleanSetting("revanced_disable_haptic_feedback_precise_seeking", FALSE); public static final BooleanSetting DISABLE_HAPTIC_FEEDBACK_PRECISE_SEEKING = new BooleanSetting("revanced_disable_haptic_feedback_precise_seeking", FALSE);

View File

@@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M
org.gradle.parallel = true org.gradle.parallel = true
android.useAndroidX = true android.useAndroidX = true
kotlin.code.style = official kotlin.code.style = official
version = 5.48.0-dev.9 version = 5.48.0

View File

@@ -124,6 +124,10 @@ public final class app/revanced/patches/all/misc/screencapture/RemoveScreenCaptu
public static final fun getRemoveScreenCaptureRestrictionPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getRemoveScreenCaptureRestrictionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }
public final class app/revanced/patches/all/misc/screenshot/PreventScreenshotDetectionPatchKt {
public static final fun getPreventScreenshotDetectionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/all/misc/screenshot/RemoveScreenshotRestrictionPatchKt { public final class app/revanced/patches/all/misc/screenshot/RemoveScreenshotRestrictionPatchKt {
public static final fun getRemoveScreenshotRestrictionPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getRemoveScreenshotRestrictionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }
@@ -308,6 +312,10 @@ public final class app/revanced/patches/instagram/hide/explore/HideExploreFeedKt
public static final fun getHideExploreFeedPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getHideExploreFeedPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }
public final class app/revanced/patches/instagram/hide/highlightsTray/HideHighlightsTrayPatchKt {
public static final fun getHideHighlightsTrayPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/instagram/hide/navigation/HideNavigationButtonsKt { public final class app/revanced/patches/instagram/hide/navigation/HideNavigationButtonsKt {
public static final fun getHideNavigationButtonsPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getHideNavigationButtonsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }
@@ -332,6 +340,10 @@ public final class app/revanced/patches/instagram/misc/links/OpenLinksExternally
public static final fun getOpenLinksExternallyPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getOpenLinksExternallyPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }
public final class app/revanced/patches/instagram/misc/removeBuildExpiredPopup/RemoveBuildExpiredPopupPatchKt {
public static final fun getRemoveBuildExpiredPopupPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/instagram/misc/share/domain/ChangeLinkSharingDomainPatchKt { public final class app/revanced/patches/instagram/misc/share/domain/ChangeLinkSharingDomainPatchKt {
public static final fun getChangeLinkSharingDomainPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getChangeLinkSharingDomainPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }
@@ -1200,10 +1212,22 @@ public final class app/revanced/patches/stocard/layout/HideStoryBubblesPatchKt {
public static final fun getHideStoryBubblesPatch ()Lapp/revanced/patcher/patch/ResourcePatch; public static final fun getHideStoryBubblesPatch ()Lapp/revanced/patcher/patch/ResourcePatch;
} }
public final class app/revanced/patches/strava/mediaupload/OverwriteMediaUploadParametersPatchKt { public final class app/revanced/patches/strava/groupkudos/AddGiveGroupKudosButtonToGroupActivityKt {
public static final fun getAddGiveGroupKudosButtonToGroupActivity ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/strava/media/download/AddMediaDownloadPatchKt {
public static final fun getAddMediaDownloadPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/strava/media/upload/OverwriteMediaUploadParametersPatchKt {
public static final fun getOverwriteMediaUploadParametersPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getOverwriteMediaUploadParametersPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }
public final class app/revanced/patches/strava/misc/extension/SharedExtensionPatchKt {
public static final fun getSharedExtensionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/strava/password/EnablePasswordLoginPatchKt { public final class app/revanced/patches/strava/password/EnablePasswordLoginPatchKt {
public static final fun getEnablePasswordLoginPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getEnablePasswordLoginPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }
@@ -1696,6 +1720,10 @@ public final class app/revanced/patches/youtube/misc/announcements/Announcements
public static final fun getAnnouncementsPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getAnnouncementsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }
public final class app/revanced/patches/youtube/misc/audiofocus/PauseOnAudioInterruptPatchKt {
public static final fun getPauseOnAudioInterruptPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatchKt { public final class app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatchKt {
public static final fun getAutoRepeatPatch ()Lapp/revanced/patcher/patch/BytecodePatch; public static final fun getAutoRepeatPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
} }

View File

@@ -50,12 +50,9 @@ kotlin {
publishing { publishing {
repositories { repositories {
maven { maven {
name = "GitHubPackages" name = "githubPackages"
url = uri("https://maven.pkg.github.com/revanced/revanced-patches") url = uri("https://maven.pkg.github.com/revanced/revanced-patches")
credentials { credentials(PasswordCredentials::class)
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
} }
} }
} }

View File

@@ -0,0 +1,51 @@
package app.revanced.patches.all.misc.screenshot
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
import app.revanced.util.getReference
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference
import com.android.tools.smali.dexlib2.util.MethodUtil
private val registerScreenCaptureCallbackMethodReference = ImmutableMethodReference(
"Landroid/app/Activity;",
"registerScreenCaptureCallback",
listOf(
"Ljava/util/concurrent/Executor;",
"Landroid/app/Activity\$ScreenCaptureCallback;",
),
"V"
)
private val unregisterScreenCaptureCallbackMethodReference = ImmutableMethodReference(
"Landroid/app/Activity;",
"unregisterScreenCaptureCallback",
listOf(
"Landroid/app/Activity\$ScreenCaptureCallback;",
),
"V"
)
@Suppress("unused")
val preventScreenshotDetectionPatch = bytecodePatch(
name = "Prevent screenshot detection",
description = "Removes the registration of all screen capture callbacks. This prevents the app from detecting screenshots.",
) {
dependsOn(transformInstructionsPatch(
filterMap = { _, _, instruction, instructionIndex ->
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return@transformInstructionsPatch null
val reference = instruction.getReference<MethodReference>() ?: return@transformInstructionsPatch null
instructionIndex.takeIf {
MethodUtil.methodSignaturesMatch(reference, registerScreenCaptureCallbackMethodReference) ||
MethodUtil.methodSignaturesMatch(reference, unregisterScreenCaptureCallbackMethodReference)
}
},
transform = { mutableMethod, instructionIndex ->
mutableMethod.removeInstruction(instructionIndex)
}
))
}

View File

@@ -1,29 +1,7 @@
package app.revanced.patches.instagram.hide.explore package app.revanced.patches.instagram.hide.explore
import app.revanced.patcher.Fingerprint
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import app.revanced.patches.instagram.shared.replaceStringWithBogus
context(BytecodePatchContext)
internal fun Fingerprint.replaceJsonFieldWithBogus(
key: String,
) {
val targetStringIndex = stringMatches!!.first { match -> match.string == key }.index
val targetStringRegister = method.getInstruction<OneRegisterInstruction>(targetStringIndex).registerA
/**
* Replacing the JSON key we want to skip with a random string that is not a valid JSON key.
* This way the feeds array will never be populated.
* Received JSON keys that are not handled are simply ignored, so there are no side effects.
*/
method.replaceInstruction(
targetStringIndex,
"const-string v$targetStringRegister, \"BOGUS\"",
)
}
@Suppress("unused") @Suppress("unused")
val hideExploreFeedPatch = bytecodePatch( val hideExploreFeedPatch = bytecodePatch(
@@ -34,6 +12,6 @@ val hideExploreFeedPatch = bytecodePatch(
compatibleWith("com.instagram.android") compatibleWith("com.instagram.android")
execute { execute {
exploreResponseJsonParserFingerprint.replaceJsonFieldWithBogus(EXPLORE_KEY_TO_BE_HIDDEN) exploreResponseJsonParserFingerprint.replaceStringWithBogus(EXPLORE_KEY_TO_BE_HIDDEN)
} }
} }

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.instagram.hide.highlightsTray
import app.revanced.patcher.fingerprint
internal const val TARGET_STRING = "highlights_tray"
internal val highlightsUrlBuilderFingerprint = fingerprint {
strings(TARGET_STRING,"X-IG-Accept-Hint")
}

View File

@@ -0,0 +1,17 @@
package app.revanced.patches.instagram.hide.highlightsTray
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.instagram.shared.replaceStringWithBogus
@Suppress("unused")
val hideHighlightsTrayPatch = bytecodePatch(
name = "Hide highlights tray",
description = "Hides the highlights tray in profile section.",
use = false
) {
compatibleWith("com.instagram.android")
execute {
highlightsUrlBuilderFingerprint.replaceStringWithBogus(TARGET_STRING)
}
}

View File

@@ -1,7 +1,7 @@
package app.revanced.patches.instagram.hide.suggestions package app.revanced.patches.instagram.hide.suggestions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.instagram.hide.explore.replaceJsonFieldWithBogus import app.revanced.patches.instagram.shared.replaceStringWithBogus
@Suppress("unused") @Suppress("unused")
val hideSuggestedContent = bytecodePatch( val hideSuggestedContent = bytecodePatch(
@@ -13,7 +13,7 @@ val hideSuggestedContent = bytecodePatch(
execute { execute {
FEED_ITEM_KEYS_TO_BE_HIDDEN.forEach { key -> FEED_ITEM_KEYS_TO_BE_HIDDEN.forEach { key ->
feedItemParseFromJsonFingerprint.replaceJsonFieldWithBogus(key) feedItemParseFromJsonFingerprint.replaceStringWithBogus(key)
} }
} }
} }

View File

@@ -0,0 +1,12 @@
package app.revanced.patches.instagram.misc.removeBuildExpiredPopup
import app.revanced.patcher.fingerprint
import app.revanced.util.literal
internal const val MILLISECOND_IN_A_DAY_LITERAL = 0x5265c00L
internal val appUpdateLockoutBuilderFingerprint = fingerprint {
strings("android.hardware.sensor.hinge_angle")
literal { MILLISECOND_IN_A_DAY_LITERAL }
}

View File

@@ -0,0 +1,27 @@
package app.revanced.patches.instagram.misc.removeBuildExpiredPopup
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
@Suppress("unused")
val removeBuildExpiredPopupPatch = bytecodePatch(
name = "Remove build expired popup",
description = "Removes the popup that appears after a while, when the app version ages.",
) {
compatibleWith("com.instagram.android")
execute {
appUpdateLockoutBuilderFingerprint.method.apply {
val longToIntIndex = instructions.first { it.opcode == Opcode.LONG_TO_INT }.location.index
val appAgeRegister = getInstruction<TwoRegisterInstruction>(longToIntIndex).registerA
// Set app age to 0 days old such that the build expired popup doesn't appear.
addInstruction(longToIntIndex + 1, "const v$appAgeRegister, 0x0")
}
}
}

View File

@@ -13,7 +13,7 @@ internal val storyUrlResponseJsonParserFingerprint = fingerprint {
} }
internal val profileUrlResponseJsonParserFingerprint = fingerprint { internal val profileUrlResponseJsonParserFingerprint = fingerprint {
strings("profile_to_share_url", "ProfileUrlResponse") strings("profile_to_share_url")
custom { method, _ -> method.name == "parseFromJson" } custom { method, _ -> method.name == "parseFromJson" }
} }

View File

@@ -9,7 +9,7 @@ val disableReelsScrollingPatch = bytecodePatch(
name = "Disable Reels scrolling", name = "Disable Reels scrolling",
description = "Disables the endless scrolling behavior in Instagram Reels, preventing swiping to the next Reel. " + description = "Disables the endless scrolling behavior in Instagram Reels, preventing swiping to the next Reel. " +
"Note: On a clean install, the 'Tip' animation may appear but will stop on its own after a few seconds.", "Note: On a clean install, the 'Tip' animation may appear but will stop on its own after a few seconds.",
use = true use = false
) { ) {
compatibleWith("com.instagram.android") compatibleWith("com.instagram.android")

View File

@@ -0,0 +1,25 @@
package app.revanced.patches.instagram.shared
import app.revanced.patcher.Fingerprint
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatchContext
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
context(BytecodePatchContext)
internal fun Fingerprint.replaceStringWithBogus(
targetString: String,
) {
val targetStringIndex = stringMatches!!.first { match -> match.string == targetString }.index
val targetStringRegister = method.getInstruction<OneRegisterInstruction>(targetStringIndex).registerA
/**
* Replaces the 'target string' with 'BOGUS'.
* This is usually done when we need to override a JSON key or url,
* to skip with a random string that is not a valid JSON key.
*/
method.replaceInstruction(
targetStringIndex,
"const-string v$targetStringRegister, \"BOGUS\"",
)
}

View File

@@ -14,8 +14,8 @@ val fixAudioMissingInDownloadsPatch = bytecodePatch(
execute { execute {
val endpointReplacements = mapOf( val endpointReplacements = mapOf(
"/DASH_audio.mp4" to "/DASH_AUDIO_128.mp4", "/DASH_audio.mp4" to "/CMAF_AUDIO_128.mp4",
"/audio" to "/DASH_AUDIO_64.mp4", "/audio" to "/CMAF_AUDIO_64.mp4",
) )
downloadAudioFingerprint.method.apply { downloadAudioFingerprint.method.apply {

View File

@@ -0,0 +1,201 @@
package app.revanced.patches.strava.groupkudos
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.resourcePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.util.childElementsSequence
import app.revanced.util.findElementByAttributeValueOrThrow
import app.revanced.util.getReference
import com.android.tools.smali.dexlib2.AccessFlags.*
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction11x
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction31i
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c
import com.android.tools.smali.dexlib2.iface.instruction.NarrowLiteralInstruction
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
import com.android.tools.smali.dexlib2.immutable.ImmutableClassDef
import com.android.tools.smali.dexlib2.immutable.ImmutableField
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
import org.w3c.dom.Element
private const val VIEW_CLASS_DESCRIPTOR = "Landroid/view/View;"
private const val ON_CLICK_LISTENER_CLASS_DESCRIPTOR = "Landroid/view/View\$OnClickListener;"
private var shakeToKudosStringId = -1
private var kudosIdId = -1
private var leaveIdId = -1
private val addGiveKudosButtonToLayoutPatch = resourcePatch {
fun String.toResourceId() = substring(2).toInt(16)
execute {
document("res/values/public.xml").use { public ->
fun Sequence<Element>.firstByName(name: String) = first {
it.getAttribute("name") == name
}
val publicElements = public.documentElement.childElementsSequence().filter {
it.tagName == "public"
}
val idElements = publicElements.filter {
it.getAttribute("type") == "id"
}
val stringElements = publicElements.filter {
it.getAttribute("type") == "string"
}
shakeToKudosStringId =
stringElements.firstByName("shake_to_kudos_dialog_title").getAttribute("id").toResourceId()
val kudosIdNode = idElements.firstByName("kudos").apply {
kudosIdId = getAttribute("id").toResourceId()
}
document("res/layout/grouped_activities_dialog_group_tab.xml").use { layout ->
layout.childNodes.findElementByAttributeValueOrThrow("android:id", "@id/leave_group_button_container")
.apply {
// Change from "FrameLayout".
layout.renameNode(this, namespaceURI, "LinearLayout")
val leaveButton = childElementsSequence().first()
// Get "Leave Group" button ID for bytecode matching.
val leaveButtonIdName = leaveButton.getAttribute("android:id").substringAfter('/')
leaveIdId = idElements.firstByName(leaveButtonIdName).getAttribute("id").toResourceId()
// Add surrounding padding to offset decrease on buttons.
setAttribute("android:paddingHorizontal", "@dimen/space_2xs")
// Place buttons next to each other with equal width.
val kudosButton = leaveButton.apply {
setAttribute("android:layout_width", "0dp")
setAttribute("android:layout_weight", "1")
// Decrease padding between buttons from "@dimen/button_large_padding" ...
setAttribute("android:paddingHorizontal", "@dimen/space_xs")
}.cloneNode(true) as Element
kudosButton.apply {
setAttribute("android:id", "@id/${kudosIdNode.getAttribute("name")}")
setAttribute("android:text", "@string/kudos_button")
}.let(::appendChild)
// Downgrade emphasis of "Leave Group" button from "primary".
leaveButton.setAttribute("app:emphasis", "secondary")
}
}
}
}
}
@Suppress("unused")
val addGiveGroupKudosButtonToGroupActivity = bytecodePatch(
name = "Add 'Give Kudos' button to 'Group Activity'",
description = "Adds a button that triggers the same action as shaking your phone would."
) {
compatibleWith("com.strava")
dependsOn(addGiveKudosButtonToLayoutPatch)
execute {
val className = initFingerprint.originalClassDef.type
val onClickListenerClassName = "${className.substringBeforeLast(';')}\$GiveKudosOnClickListener;"
initFingerprint.method.apply {
val constLeaveIdInstruction = instructions.filterIsInstance<BuilderInstruction31i>().first {
it.narrowLiteral == leaveIdId
}
val findViewByIdInstruction =
getInstruction<BuilderInstruction35c>(constLeaveIdInstruction.location.index + 1)
val moveViewInstruction = getInstruction<BuilderInstruction11x>(constLeaveIdInstruction.location.index + 2)
val checkCastButtonInstruction =
getInstruction<BuilderInstruction21c>(constLeaveIdInstruction.location.index + 3)
val buttonClassName = checkCastButtonInstruction.getReference<TypeReference>()!!.type
addInstructions(
constLeaveIdInstruction.location.index,
"""
${constLeaveIdInstruction.opcode.name} v${constLeaveIdInstruction.registerA}, $kudosIdId
${findViewByIdInstruction.opcode.name} { v${findViewByIdInstruction.registerC}, v${findViewByIdInstruction.registerD} }, ${findViewByIdInstruction.reference}
${moveViewInstruction.opcode.name} v${moveViewInstruction.registerA}
${checkCastButtonInstruction.opcode.name} v${checkCastButtonInstruction.registerA}, ${checkCastButtonInstruction.reference}
new-instance v0, $onClickListenerClassName
invoke-direct { v0, p0 }, $onClickListenerClassName-><init>($className)V
invoke-virtual { p3, v0 }, $buttonClassName->setOnClickListener($ON_CLICK_LISTENER_CLASS_DESCRIPTOR)V
"""
)
}
val actionHandlerMethod = actionHandlerFingerprint.match(initFingerprint.originalClassDef).method
val constShakeToKudosStringIndex = actionHandlerMethod.instructions.indexOfFirst {
it is NarrowLiteralInstruction && it.narrowLiteral == shakeToKudosStringId
}
val getSingletonInstruction = actionHandlerMethod.instructions.filterIsInstance<BuilderInstruction21c>().last {
it.opcode == Opcode.SGET_OBJECT && it.location.index < constShakeToKudosStringIndex
}
val outerThisField = ImmutableField(
onClickListenerClassName,
"outerThis",
className,
PUBLIC.value or FINAL.value or SYNTHETIC.value,
null,
listOf(),
setOf()
)
val initFieldMethod = ImmutableMethod(
onClickListenerClassName,
"<init>",
listOf(ImmutableMethodParameter(className, setOf(), "outerThis")),
"V",
PUBLIC.value or SYNTHETIC.value or CONSTRUCTOR.value,
setOf(),
setOf(),
MutableMethodImplementation(2)
).toMutable().apply {
addInstructions(
"""
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, $outerThisField
return-void
"""
)
}
val onClickMethod = ImmutableMethod(
onClickListenerClassName,
"onClick",
listOf(ImmutableMethodParameter(VIEW_CLASS_DESCRIPTOR, setOf(), "v")),
"V",
PUBLIC.value or FINAL.value,
setOf(),
setOf(),
MutableMethodImplementation(2)
).toMutable().apply {
addInstructions(
"""
sget-object p1, ${getSingletonInstruction.reference}
iget-object p0, p0, $outerThisField
invoke-virtual { p0, p1 }, ${actionHandlerFingerprint.method}
return-void
"""
)
}
ImmutableClassDef(
onClickListenerClassName,
PUBLIC.value or FINAL.value or SYNTHETIC.value,
"Ljava/lang/Object;",
listOf(ON_CLICK_LISTENER_CLASS_DESCRIPTOR),
"ProGuard", // Same as source file name of other classes.
listOf(),
setOf(outerThisField),
setOf(initFieldMethod, onClickMethod)
).let(classes::add)
}
}

View File

@@ -0,0 +1,14 @@
package app.revanced.patches.strava.groupkudos
import app.revanced.patcher.fingerprint
internal val initFingerprint = fingerprint {
parameters("Lcom/strava/feed/view/modal/GroupTabFragment;" , "Z" , "Landroidx/fragment/app/FragmentManager;")
custom { method, _ ->
method.name == "<init>"
}
}
internal val actionHandlerFingerprint = fingerprint {
strings("state")
}

View File

@@ -0,0 +1,116 @@
package app.revanced.patches.strava.media.download
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.misc.mapping.get
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
import app.revanced.patches.shared.misc.mapping.resourceMappings
import app.revanced.patches.strava.misc.extension.sharedExtensionPatch
import app.revanced.util.getReference
import app.revanced.util.writeRegister
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22c
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
private const val ACTION_CLASS_DESCRIPTOR = "Lcom/strava/bottomsheet/Action;"
private const val MEDIA_CLASS_DESCRIPTOR = "Lcom/strava/photos/data/Media;"
private const val MEDIA_DOWNLOAD_CLASS_DESCRIPTOR = "Lapp/revanced/extension/strava/AddMediaDownloadPatch;"
@Suppress("unused")
val addMediaDownloadPatch = bytecodePatch(
name = "Add media download",
description = "Extends the full-screen media viewer menu with items to copy or open their URLs or download them directly."
) {
compatibleWith("com.strava")
dependsOn(
resourceMappingPatch,
sharedExtensionPatch
)
execute {
val fragmentClass = classBy { it.endsWith("/FullscreenMediaFragment;") }!!.mutableClass
// region Extend menu of `FullscreenMediaFragment` with actions.
createAndShowFragmentFingerprint.match(fragmentClass).method.apply {
val setTrueIndex = instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.IPUT_BOOLEAN
}
val actionRegistrarRegister = getInstruction<BuilderInstruction22c>(setTrueIndex).registerB
val actionRegister = instructions.first { instruction ->
instruction.getReference<TypeReference>()?.type == ACTION_CLASS_DESCRIPTOR
}.writeRegister!!
fun addMenuItem(actionId: String, string: String, color: String, drawable: String) = addInstructions(
setTrueIndex + 1,
"""
new-instance v$actionRegister, $ACTION_CLASS_DESCRIPTOR
sget v${actionRegister + 1}, $MEDIA_DOWNLOAD_CLASS_DESCRIPTOR->$actionId:I
const v${actionRegister + 2}, 0x0
const v${actionRegister + 3}, ${resourceMappings["string", string]}
const v${actionRegister + 4}, ${resourceMappings["color", color]}
const v${actionRegister + 5}, ${resourceMappings["drawable", drawable]}
move/from16 v${actionRegister + 6}, v${actionRegister + 4}
invoke-direct/range { v$actionRegister .. v${actionRegister + 7} }, $ACTION_CLASS_DESCRIPTOR-><init>(ILjava/lang/String;IIIILjava/io/Serializable;)V
invoke-virtual { v$actionRegistrarRegister, v$actionRegister }, Lcom/strava/bottomsheet/a;->a(Lcom/strava/bottomsheet/BottomSheetItem;)V
"""
)
addMenuItem("ACTION_COPY_LINK", "copy_link", "core_o3", "actions_link_normal_xsmall")
addMenuItem("ACTION_OPEN_LINK", "fallback_menu_item_open_in_browser", "core_o3", "actions_link_external_normal_xsmall")
addMenuItem("ACTION_DOWNLOAD", "download", "core_o3", "actions_download_normal_xsmall")
// Move media to last parameter of `Action` constructor.
val getMediaInstruction = instructions.first { instruction ->
instruction.getReference<FieldReference>()?.type == MEDIA_CLASS_DESCRIPTOR
}
addInstruction(
getMediaInstruction.location.index + 1,
"move-object/from16 v${actionRegister + 7}, v${getMediaInstruction.writeRegister}"
)
}
// endregion
// region Handle new actions.
val actionClass = classes.first { clazz ->
clazz.type == ACTION_CLASS_DESCRIPTOR
}
val actionSerializableField = actionClass.instanceFields.first { field ->
field.type == "Ljava/io/Serializable;"
}
// Handle "copy link" & "open link" & "download" actions.
handleMediaActionFingerprint.match(fragmentClass).method.apply {
// Call handler if action ID < 0 (= custom).
val moveInstruction = instructions.first { instruction ->
instruction.opcode == Opcode.MOVE_RESULT
}
val indexAfterMoveInstruction = moveInstruction.location.index + 1
val actionIdRegister = moveInstruction.writeRegister
addInstructionsWithLabels(
indexAfterMoveInstruction,
"""
if-gez v$actionIdRegister, :move
check-cast p2, $ACTION_CLASS_DESCRIPTOR
iget-object v0, p2, $actionSerializableField
check-cast v0, $MEDIA_CLASS_DESCRIPTOR
invoke-static { v$actionIdRegister, v0 }, $MEDIA_DOWNLOAD_CLASS_DESCRIPTOR->handleAction(I$MEDIA_CLASS_DESCRIPTOR)Z
move-result v0
return v0
""",
ExternalLabel("move", instructions[indexAfterMoveInstruction])
)
}
// endregion
}
}

View File

@@ -0,0 +1,15 @@
package app.revanced.patches.strava.media.download
import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.AccessFlags
internal val createAndShowFragmentFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("V")
parameters("L")
strings("mediaType")
}
internal val handleMediaActionFingerprint = fingerprint {
parameters("Landroid/view/View;", "Lcom/strava/bottomsheet/BottomSheetItem;")
}

View File

@@ -1,4 +1,4 @@
package app.revanced.patches.strava.mediaupload package app.revanced.patches.strava.media.upload
import app.revanced.patcher.fingerprint import app.revanced.patcher.fingerprint

View File

@@ -1,4 +1,4 @@
package app.revanced.patches.strava.mediaupload package app.revanced.patches.strava.media.upload
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.intOption import app.revanced.patcher.patch.intOption

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.strava.misc.extension
import app.revanced.patches.shared.misc.extension.extensionHook
internal val applicationOnCreateHook = extensionHook {
custom { method, classDef ->
method.name == "onCreate" && classDef.endsWith("/StravaApplication;")
}
}

View File

@@ -0,0 +1,5 @@
package app.revanced.patches.strava.misc.extension
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
val sharedExtensionPatch = sharedExtensionPatch("strava", applicationOnCreateHook)

View File

@@ -0,0 +1,14 @@
package app.revanced.patches.youtube.misc.audiofocus
import app.revanced.patcher.fingerprint
internal val audioFocusChangeListenerFingerprint = fingerprint {
strings(
"AudioFocus DUCK",
"AudioFocus loss; Will lower volume",
)
}
internal val audioFocusRequestBuilderFingerprint = fingerprint {
strings("Can't build an AudioFocusRequestCompat instance without a listener")
}

View File

@@ -0,0 +1,66 @@
package app.revanced.patches.youtube.misc.audiofocus
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/PauseOnAudioInterruptPatch;"
val pauseOnAudioInterruptPatch = bytecodePatch(
name = "Pause on audio interrupt",
description = "Adds an option to pause playback instead of lowering volume when other audio plays.",
) {
dependsOn(
sharedExtensionPatch,
settingsPatch,
addResourcesPatch,
)
compatibleWith(
"com.google.android.youtube"(
"20.14.43",
)
)
execute {
addResources("youtube", "misc.audiofocus.pauseOnAudioInterruptPatch")
PreferenceScreen.MISC.addPreferences(
SwitchPreference("revanced_pause_on_audio_interrupt"),
)
// Hook the builder method that creates AudioFocusRequest.
// At the start, set the willPauseWhenDucked field (b) to true if setting is enabled.
val builderMethod = audioFocusRequestBuilderFingerprint.method
val builderClass = builderMethod.definingClass
builderMethod.addInstructionsWithLabels(
0,
"""
invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->shouldPauseOnAudioInterrupt()Z
move-result v0
if-eqz v0, :skip_override
const/4 v0, 0x1
iput-boolean v0, p0, $builderClass->b:Z
""",
ExternalLabel("skip_override", builderMethod.getInstruction(0)),
)
// Also hook the audio focus change listener as a backup.
audioFocusChangeListenerFingerprint.method.addInstructions(
0,
"""
invoke-static { p1 }, $EXTENSION_CLASS_DESCRIPTOR->overrideAudioFocusChange(I)I
move-result p1
"""
)
}
}

View File

@@ -1558,6 +1558,11 @@ Tap here to learn more about DeArrow"</string>
<string name="revanced_loop_video_button_toast_on">Loop video is on</string> <string name="revanced_loop_video_button_toast_on">Loop video is on</string>
<string name="revanced_loop_video_button_toast_off">Loop video is off</string> <string name="revanced_loop_video_button_toast_off">Loop video is off</string>
</patch> </patch>
<patch id="misc.audiofocus.pauseOnAudioInterruptPatch">
<string name="revanced_pause_on_audio_interrupt_title">Pause on audio interrupt</string>
<string name="revanced_pause_on_audio_interrupt_summary_on">Playback pauses when other audio plays (e.g. navigation)</string>
<string name="revanced_pause_on_audio_interrupt_summary_off">Volume lowers when other audio plays</string>
</patch>
<patch id="misc.dimensions.spoof.spoofDeviceDimensionsPatch"> <patch id="misc.dimensions.spoof.spoofDeviceDimensionsPatch">
<string name="revanced_spoof_device_dimensions_title">Spoof device dimensions</string> <string name="revanced_spoof_device_dimensions_title">Spoof device dimensions</string>
<string name="revanced_spoof_device_dimensions_summary_on">"Device dimensions spoofed <string name="revanced_spoof_device_dimensions_summary_on">"Device dimensions spoofed

View File

@@ -5,12 +5,9 @@ pluginManagement {
gradlePluginPortal() gradlePluginPortal()
google() google()
maven { maven {
name = "GitHubPackages" name = "githubPackages"
url = uri("https://maven.pkg.github.com/revanced/registry") url = uri("https://maven.pkg.github.com/revanced/registry")
credentials { credentials(PasswordCredentials::class)
username = providers.gradleProperty("gpr.user").getOrElse(System.getenv("GITHUB_ACTOR"))
password = providers.gradleProperty("gpr.key").getOrElse(System.getenv("GITHUB_TOKEN"))
}
} }
} }
} }