From f9518979448bf40f0a85ad88ac5971ade9343566 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 31 May 2023 12:57:02 +0400 Subject: [PATCH 01/11] fix(youtube/swipe-controls): require restart if settings are changed (#417) --- .../revanced/integrations/settings/SettingsEnum.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java index 6ead607e..1b7b91ee 100644 --- a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java +++ b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java @@ -158,15 +158,15 @@ public enum SettingsEnum { SWIPE_VOLUME("revanced_swipe_volume", BOOLEAN, TRUE), SWIPE_PRESS_TO_ENGAGE("revanced_swipe_press_to_engage", BOOLEAN, FALSE, true, parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)), - SWIPE_HAPTIC_FEEDBACK("revanced_swipe_haptic_feedback", BOOLEAN, TRUE, + SWIPE_HAPTIC_FEEDBACK("revanced_swipe_haptic_feedback", BOOLEAN, TRUE, true, parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)), - SWIPE_MAGNITUDE_THRESHOLD("revanced_swipe_threshold", INTEGER, 30, + SWIPE_MAGNITUDE_THRESHOLD("revanced_swipe_threshold", INTEGER, 30, true, parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)), - SWIPE_OVERLAY_BACKGROUND_ALPHA("revanced_swipe_overlay_background_alpha", INTEGER, 127, + SWIPE_OVERLAY_BACKGROUND_ALPHA("revanced_swipe_overlay_background_alpha", INTEGER, 127, true, parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)), - SWIPE_OVERLAY_TEXT_SIZE("revanced_swipe_text_overlay_size", INTEGER, 22, + SWIPE_OVERLAY_TEXT_SIZE("revanced_swipe_text_overlay_size", INTEGER, 22, true, parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)), - SWIPE_OVERLAY_TIMEOUT("revanced_swipe_overlay_timeout", LONG, 500L, + SWIPE_OVERLAY_TIMEOUT("revanced_swipe_overlay_timeout", LONG, 500L, true, parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)), // Debugging From 4c77e7f3f7d5f3082defcbedba13c8a177af939f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 31 May 2023 08:59:47 +0000 Subject: [PATCH 02/11] chore(release): 0.109.1-dev.1 [skip ci] ## [0.109.1-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.109.0...v0.109.1-dev.1) (2023-05-31) ### Bug Fixes * **youtube/swipe-controls:** require restart if settings are changed ([#417](https://github.com/revanced/revanced-integrations/issues/417)) ([f951897](https://github.com/revanced/revanced-integrations/commit/f9518979448bf40f0a85ad88ac5971ade9343566)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38181c59..e4a493a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.109.1-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.109.0...v0.109.1-dev.1) (2023-05-31) + + +### Bug Fixes + +* **youtube/swipe-controls:** require restart if settings are changed ([#417](https://github.com/revanced/revanced-integrations/issues/417)) ([f951897](https://github.com/revanced/revanced-integrations/commit/f9518979448bf40f0a85ad88ac5971ade9343566)) + # [0.109.0](https://github.com/revanced/revanced-integrations/compare/v0.108.0...v0.109.0) (2023-05-31) diff --git a/gradle.properties b/gradle.properties index 59351c69..a8a39ced 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.jvmargs = -Xmx2048m android.useAndroidX = true -version = 0.109.0 +version = 0.109.1-dev.1 From b5a71a843eaecaf9f2566d0b6a3c21422b14a44f Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Wed, 31 May 2023 23:46:26 +0200 Subject: [PATCH 03/11] feat(youtube/swipe-controls): add option to save and restore brightness --- .../integrations/settings/SettingsEnum.java | 2 ++ .../SwipeControlsConfigurationProvider.kt | 12 +++++++++++- .../swipecontrols/SwipeControlsHostActivity.kt | 13 +++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java index 1b7b91ee..e1d53fa2 100644 --- a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java +++ b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java @@ -168,6 +168,8 @@ public enum SettingsEnum { parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)), SWIPE_OVERLAY_TIMEOUT("revanced_swipe_overlay_timeout", LONG, 500L, true, parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)), + SWIPE_SAVE_AND_RESTORE_BRIGHTNESS("revanced_swipe_save_and_restore_brightness", BOOLEAN, TRUE, true, + parents(SWIPE_BRIGHTNESS, SWIPE_VOLUME)), // Debugging DEBUG("revanced_debug", BOOLEAN, FALSE), diff --git a/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsConfigurationProvider.kt b/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsConfigurationProvider.kt index ebb1fe59..69ad7417 100644 --- a/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsConfigurationProvider.kt +++ b/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsConfigurationProvider.kt @@ -45,7 +45,7 @@ class SwipeControlsConfigurationProvider( */ val overwriteVolumeKeyControls: Boolean get() = isFullscreenVideo && enableVolumeControls -//endregioin +//endregion //region gesture adjustments /** @@ -94,5 +94,15 @@ class SwipeControlsConfigurationProvider( val overlayForegroundColor: Int get() = Color.WHITE +//endregion + +//region behaviour + + /** + * should the brightness be saved and restored when exiting or entering fullscreen + */ + val shouldSaveAndRestoreBrightness: Boolean + get() = SettingsEnum.SWIPE_SAVE_AND_RESTORE_BRIGHTNESS.boolean + //endregion } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsHostActivity.kt b/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsHostActivity.kt index 4213102e..7a756b08 100644 --- a/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsHostActivity.kt +++ b/app/src/main/java/app/revanced/integrations/swipecontrols/SwipeControlsHostActivity.kt @@ -168,13 +168,14 @@ class SwipeControlsHostActivity : Activity() { * @param type the new player type */ private fun onPlayerTypeChanged(type: PlayerType) { - when (type) { - PlayerType.WATCH_WHILE_FULLSCREEN -> screen?.restore() - else -> { - screen?.save() - screen?.restoreDefaultBrightness() + if (config.shouldSaveAndRestoreBrightness) + when (type) { + PlayerType.WATCH_WHILE_FULLSCREEN -> screen?.restore() + else -> { + screen?.save() + screen?.restoreDefaultBrightness() + } } - } } /** From aa721253170890a35640b860be569932b8536345 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 1 Jun 2023 00:12:06 +0200 Subject: [PATCH 04/11] feat(youtube/hide-ads): hide mix playlists --- .../patches/components/AdsFilter.java | 48 +++++++++++++++++-- .../integrations/settings/SettingsEnum.java | 1 + 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/patches/components/AdsFilter.java b/app/src/main/java/app/revanced/integrations/patches/components/AdsFilter.java index e5e1af90..0d860631 100644 --- a/app/src/main/java/app/revanced/integrations/patches/components/AdsFilter.java +++ b/app/src/main/java/app/revanced/integrations/patches/components/AdsFilter.java @@ -1,7 +1,9 @@ package app.revanced.integrations.patches.components; +import android.os.Build; import android.view.View; +import androidx.annotation.RequiresApi; import app.revanced.integrations.settings.SettingsEnum; import app.revanced.integrations.utils.LogHelper; import app.revanced.integrations.utils.ReVancedUtils; @@ -12,6 +14,13 @@ public final class AdsFilter extends Filter { private final CustomFilterGroup custom; + // region Mix playlists + private final ByteArrayAsStringFilterGroup mixPlaylists; + private final ByteArrayAsStringFilterGroup imageHosting; + + // endregion + + @RequiresApi(api = Build.VERSION_CODES.N) public AdsFilter() { exceptions = new String[]{ "home_video_with_context", @@ -183,6 +192,21 @@ public final class AdsFilter extends Filter { "offer_module_root" ); + // region Mix playlists + + mixPlaylists = new ByteArrayAsStringFilterGroup( + SettingsEnum.HIDE_MIX_PLAYLISTS, + "&list=", + "YouTube Music" + ); + + imageHosting = new ByteArrayAsStringFilterGroup( + SettingsEnum.HIDE_MIX_PLAYLISTS, // Unused + "ggpht.com" + ); + + // endregion + this.pathFilterGroups.addAll( generalAds, buttonedAd, @@ -222,6 +246,18 @@ public final class AdsFilter extends Filter { ); } + private boolean isMixPlaylistFiltered(final byte[] _protobufBufferArray) { + if (!mixPlaylists.isEnabled()) return false; + + // Two checks are required to prevent false positives. + + // First check if the current buffer potentially contains a mix playlist. + if (!mixPlaylists.check(_protobufBufferArray).isFiltered()) return false; + + // Ensure that the buffer actually contains a mix playlist. + return imageHosting.check(_protobufBufferArray).isFiltered(); + } + @Override public boolean isFiltered(final String path, final String identifier, final byte[] _protobufBufferArray) { FilterResult result; @@ -230,10 +266,14 @@ public final class AdsFilter extends Filter { result = FilterResult.CUSTOM; else if (ReVancedUtils.containsAny(path, exceptions)) result = FilterResult.EXCEPTION; - else if (pathFilterGroups.contains(path) || identifierFilterGroups.contains(identifier)) - result = FilterResult.FILTERED; - else - result = FilterResult.UNFILTERED; + else { + var filtered = + pathFilterGroups.contains(path) || // Check if the path is filtered. + identifierFilterGroups.contains(identifier) || // Check if the identifier is filtered. + isMixPlaylistFiltered(_protobufBufferArray); // Check if the buffer contains a mix playlist. + + result = filtered ? FilterResult.FILTERED : FilterResult.UNFILTERED; + } LogHelper.printDebug(() -> String.format("%s (ID: %s): %s", result.message, identifier, path)); diff --git a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java index e1d53fa2..dfe5ba23 100644 --- a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java +++ b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java @@ -85,6 +85,7 @@ public enum SettingsEnum { HIDE_WEB_SEARCH_RESULTS("revanced_hide_web_search_results", BOOLEAN, TRUE), HIDE_QUICK_ACTIONS("revanced_hide_quick_actions", BOOLEAN, FALSE), HIDE_RELATED_VIDEOS("revanced_hide_related_videos", BOOLEAN, FALSE), + HIDE_MIX_PLAYLISTS("revanced_hide_mix_playlists", BOOLEAN, TRUE), // Action buttons HIDE_LIKE_DISLIKE_BUTTON("revanced_hide_like_dislike_button", BOOLEAN, FALSE), From 7eb209d8533f68cd344c331482b38bfcf4baca06 Mon Sep 17 00:00:00 2001 From: LagradOst <46196380+Blatzar@users.noreply.github.com> Date: Sun, 11 Jun 2023 23:18:56 +0000 Subject: [PATCH 05/11] feat(reddit): add `hide-promoted` patch (#419) Co-authored-by: oSumAtrIX --- .../patches/FilterPromotedLinksPatch.java | 26 +++++++++++++++++++ .../java/com/reddit/domain/model/ILink.java | 7 +++++ 2 files changed, 33 insertions(+) create mode 100644 app/src/main/java/app/revanced/reddit/patches/FilterPromotedLinksPatch.java create mode 100644 dummy/src/main/java/com/reddit/domain/model/ILink.java diff --git a/app/src/main/java/app/revanced/reddit/patches/FilterPromotedLinksPatch.java b/app/src/main/java/app/revanced/reddit/patches/FilterPromotedLinksPatch.java new file mode 100644 index 00000000..5c9d3207 --- /dev/null +++ b/app/src/main/java/app/revanced/reddit/patches/FilterPromotedLinksPatch.java @@ -0,0 +1,26 @@ +package app.revanced.reddit.patches; + +import com.reddit.domain.model.ILink; + +import java.util.ArrayList; +import java.util.List; + +public final class FilterPromotedLinksPatch { + /** + * Filters list from promoted links. + **/ + public static List filterChildren(final Iterable links) { + final List filteredList = new ArrayList<>(); + + for (Object item : links) { + if (!(item instanceof ILink)) continue; + + final var link = (ILink) item; + final var isPromotedAd = link.getPromoted(); + + if (!isPromotedAd) filteredList.add(item); + } + + return filteredList; + } +} diff --git a/dummy/src/main/java/com/reddit/domain/model/ILink.java b/dummy/src/main/java/com/reddit/domain/model/ILink.java new file mode 100644 index 00000000..f9cbb955 --- /dev/null +++ b/dummy/src/main/java/com/reddit/domain/model/ILink.java @@ -0,0 +1,7 @@ +package com.reddit.domain.model; + +public class ILink { + public boolean getPromoted() { + throw new UnsupportedOperationException("Stub"); + } +} From ccc93adae93457041174f2632437679dc47f0fab Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 12 Jun 2023 01:48:29 +0200 Subject: [PATCH 06/11] ci: remove unnecessary steps --- .github/workflows/release.yml | 38 ++++++++++++----------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07e719d4..324e0fc3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,28 +16,16 @@ jobs: name: Release runs-on: ubuntu-latest steps: - - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.11.0 - - name: Checkout - uses: actions/checkout@v3 - with: - # Make sure the release step uses its own credentials: - # https://github.com/cycjimmy/semantic-release-action#private-packages - persist-credentials: false - fetch-depth: 0 - - name: Set up JDK - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'zulu' - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: "18" - cache: 'npm' - - name: Setup semantic-release - run: npm install - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }} - run: npm exec semantic-release + - name: Checkout + uses: actions/checkout@v3 + with: + # Make sure the release step uses its own credentials: + # https://github.com/cycjimmy/semantic-release-action#private-packages + persist-credentials: false + fetch-depth: 0 + - name: Setup semantic-release + run: npm install + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }} + run: npm exec semantic-release From fd86684f735f08321b036bf336140efe130e0d57 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 12 Jun 2023 01:50:04 +0200 Subject: [PATCH 07/11] ci: build before running semantic-release --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 324e0fc3..8f31416c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,10 @@ jobs: # https://github.com/cycjimmy/semantic-release-action#private-packages persist-credentials: false fetch-depth: 0 + - name: Build with Gradle + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew clean --no-daemon - name: Setup semantic-release run: npm install - name: Release From 26b6d471018102806e2199bc0169f66ef03cb563 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 12 Jun 2023 01:51:08 +0200 Subject: [PATCH 08/11] refactor: remove comments --- build.gradle.kts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 823b6b3e..019e2126 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,3 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() @@ -7,9 +6,6 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:8.0.1") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20") - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } } From 0654c1b42eb2ec81d13ed92f6a357433017e4c02 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 12 Jun 2023 02:45:13 +0200 Subject: [PATCH 09/11] ci: set JAVA version for Gradle manually --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f31416c..5a39b5fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,8 @@ jobs: # https://github.com/cycjimmy/semantic-release-action#private-packages persist-credentials: false fetch-depth: 0 + - name: Setup Java + run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV - name: Build with Gradle env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From add120348a645fef1c53f32f53c7fc9103362354 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Mon, 12 Jun 2023 02:55:08 +0200 Subject: [PATCH 10/11] ci: add cache step --- .github/workflows/release.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a39b5fa..7562538a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,16 @@ jobs: # https://github.com/cycjimmy/semantic-release-action#private-packages persist-credentials: false fetch-depth: 0 + - name: Cache + uses: actions/cache@v3 + with: + path: | + ${{ runner.home }}/.gradle/caches + ${{ runner.home }}/.gradle/wrapper + .gradle + build + node_modules + key: ${{ runner.os }}-gradle-npm-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'package-lock.json') }} - name: Setup Java run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV - name: Build with Gradle From eb658298b86159e7fb0307b0f5d9bc04217aaf0d Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 12 Jun 2023 01:07:07 +0000 Subject: [PATCH 11/11] chore(release): 0.110.0-dev.1 [skip ci] # [0.110.0-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.109.1-dev.1...v0.110.0-dev.1) (2023-06-12) ### Features * **reddit:** add `hide-promoted` patch ([#419](https://github.com/revanced/revanced-integrations/issues/419)) ([7eb209d](https://github.com/revanced/revanced-integrations/commit/7eb209d8533f68cd344c331482b38bfcf4baca06)) * **youtube/hide-ads:** hide mix playlists ([aa72125](https://github.com/revanced/revanced-integrations/commit/aa721253170890a35640b860be569932b8536345)) * **youtube/swipe-controls:** add option to save and restore brightness ([b5a71a8](https://github.com/revanced/revanced-integrations/commit/b5a71a843eaecaf9f2566d0b6a3c21422b14a44f)) --- CHANGELOG.md | 9 +++++++++ gradle.properties | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4a493a5..d4359547 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# [0.110.0-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.109.1-dev.1...v0.110.0-dev.1) (2023-06-12) + + +### Features + +* **reddit:** add `hide-promoted` patch ([#419](https://github.com/revanced/revanced-integrations/issues/419)) ([7eb209d](https://github.com/revanced/revanced-integrations/commit/7eb209d8533f68cd344c331482b38bfcf4baca06)) +* **youtube/hide-ads:** hide mix playlists ([aa72125](https://github.com/revanced/revanced-integrations/commit/aa721253170890a35640b860be569932b8536345)) +* **youtube/swipe-controls:** add option to save and restore brightness ([b5a71a8](https://github.com/revanced/revanced-integrations/commit/b5a71a843eaecaf9f2566d0b6a3c21422b14a44f)) + ## [0.109.1-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.109.0...v0.109.1-dev.1) (2023-05-31) diff --git a/gradle.properties b/gradle.properties index a8a39ced..953afded 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.jvmargs = -Xmx2048m android.useAndroidX = true -version = 0.109.1-dev.1 +version = 0.110.0-dev.1