1
mirror of https://github.com/revanced/revanced-integrations synced 2025-11-21 18:35:37 +01:00

Compare commits

...

53 Commits

Author SHA1 Message Date
semantic-release-bot
5f1e35ae36 chore(release): 0.73.0 [skip ci]
# [0.73.0](https://github.com/revanced/revanced-integrations/compare/v0.72.0...v0.73.0) (2022-11-20)

### Features

* **youtube/general-ads:** block the separator by its identifier ([6ceff7c](6ceff7c9b3))
2022-11-20 01:53:33 +00:00
oSumAtrIX
6ceff7c9b3 feat(youtube/general-ads): block the separator by its identifier 2022-11-20 02:49:14 +01:00
semantic-release-bot
d9349d4e88 chore(release): 0.72.0 [skip ci]
# [0.72.0](https://github.com/revanced/revanced-integrations/compare/v0.71.0...v0.72.0) (2022-11-19)

### Bug Fixes

* check if filter string is empty ([6604030](66040302a9))
* **youtube/general-ads:** hide ads with buttons ([2c8b234](2c8b23426f))

### Features

* block rule of type `CustomBlockRule` ([571cf12](571cf12dca))
* **youtube/general-ads:** custom component filter ([72a3cd0](72a3cd0fac))
* **youtube/general-ads:** do not require to reload on general ads switch ([6272e4b](6272e4b467))
* **youtube/general-ads:** hide gray separators ([cf892de](cf892de4bb))
2022-11-19 22:36:35 +00:00
oSumAtrIX
b59ee31d57 refactor(youtube/general-ads): restructure class GeneralAdsPatch 2022-11-19 23:32:33 +01:00
oSumAtrIX
2c8b23426f fix(youtube/general-ads): hide ads with buttons 2022-11-19 23:30:48 +01:00
oSumAtrIX
72a3cd0fac feat(youtube/general-ads): custom component filter 2022-11-19 23:30:01 +01:00
oSumAtrIX
6272e4b467 feat(youtube/general-ads): do not require to reload on general ads switch 2022-11-19 23:29:09 +01:00
oSumAtrIX
cf892de4bb feat(youtube/general-ads): hide gray separators 2022-11-19 23:28:45 +01:00
oSumAtrIX
e978ed2c14 refactor: move Extensions.any to BlockRule.contains 2022-11-19 23:25:58 +01:00
oSumAtrIX
570f9eaba1 refactor: protect fields of Filter 2022-11-19 23:25:14 +01:00
oSumAtrIX
571cf12dca feat: block rule of type CustomBlockRule 2022-11-19 23:24:25 +01:00
oSumAtrIX
09c7605f1f refactor: omit unnecessary String.valueOf call 2022-11-19 23:23:09 +01:00
oSumAtrIX
66040302a9 fix: check if filter string is empty 2022-11-19 23:22:34 +01:00
oSumAtrIX
98b31c17b9 refactor(youtube/general-ads): remove unused imports 2022-11-19 22:41:30 +01:00
oSumAtrIX
c517c03e6f refactor(youtube/general-ads): remove unused class 2022-11-18 02:37:38 +01:00
semantic-release-bot
f10b202c93 chore(release): 0.71.0 [skip ci]
# [0.71.0](https://github.com/revanced/revanced-integrations/compare/v0.70.0...v0.71.0) (2022-11-15)

### Bug Fixes

* **youtube/general-ads:** do not force to restart on general ads switches ([0a90289](0a90289dc5))

### Features

* **youtube/general-ads:** hide chapter teaser under videos ([3fb337b](3fb337b856))
* **youtube/general-ads:** hide shorts in search ([d82b989](d82b9898a8))
2022-11-15 01:39:12 +00:00
oSumAtrIX
3fb337b856 feat(youtube/general-ads): hide chapter teaser under videos 2022-11-15 02:35:05 +01:00
oSumAtrIX
d82b9898a8 feat(youtube/general-ads): hide shorts in search 2022-11-15 02:35:05 +01:00
oSumAtrIX
0a90289dc5 fix(youtube/general-ads): do not force to restart on general ads switches 2022-11-15 02:35:04 +01:00
semantic-release-bot
dfd6e7fcce chore(release): 0.70.0 [skip ci]
# [0.70.0](https://github.com/revanced/revanced-integrations/compare/v0.69.2...v0.70.0) (2022-11-14)

### Bug Fixes

* **youtube/general-ads:** do not force to restart on general ads switches ([7f18520](7f18520646))

### Features

* **youtube/general-ads:** hide self sponsored cards ([e93ce3e](e93ce3eaa9))
2022-11-14 23:59:04 +00:00
oSumAtrIX
e93ce3eaa9 feat(youtube/general-ads): hide self sponsored cards 2022-11-15 00:53:12 +01:00
oSumAtrIX
695c59efd4 refactor(youtube): properly separate litho filter patches 2022-11-15 00:46:12 +01:00
oSumAtrIX
22bc4405cf refactor(youtube/general-ads): reformat code 2022-11-15 00:27:22 +01:00
oSumAtrIX
63ee425050 refactor(youtube/general-ads): remove unused setting 2022-11-15 00:27:01 +01:00
oSumAtrIX
7f18520646 fix(youtube/general-ads): do not force to restart on general ads switches 2022-11-15 00:26:41 +01:00
semantic-release-bot
d18bc1856b chore(release): 0.69.2 [skip ci]
## [0.69.2](https://github.com/revanced/revanced-integrations/compare/v0.69.1...v0.69.2) (2022-11-14)

### Bug Fixes

* **youtube/general-ads-patch:** revert reducing filter exclusions ([af86dd8](af86dd8ec6))
2022-11-14 21:05:21 +00:00
oSumAtrIX
af86dd8ec6 fix(youtube/general-ads-patch): revert reducing filter exclusions 2022-11-14 22:00:45 +01:00
semantic-release-bot
2ebadaf07f chore(release): 0.69.1 [skip ci]
## [0.69.1](https://github.com/revanced/revanced-integrations/compare/v0.69.0...v0.69.1) (2022-11-14)

### Bug Fixes

* **youtube/theme:** revert comment box background color hook ([#210](https://github.com/revanced/revanced-integrations/issues/210)) ([197f003](197f0034a1))
2022-11-14 15:13:51 +00:00
oSumAtrIX
197f0034a1 fix(youtube/theme): revert comment box background color hook (#210)
This reverts commit f8cb38e57a.
2022-11-14 16:10:15 +01:00
semantic-release-bot
06c5a9b2b8 chore(release): 0.69.0 [skip ci]
# [0.69.0](https://github.com/revanced/revanced-integrations/compare/v0.68.3...v0.69.0) (2022-11-14)

### Features

* **youtube/theme:** color explore drawer background ([#203](https://github.com/revanced/revanced-integrations/issues/203)) ([cb40408](cb404086ad))
2022-11-14 14:56:06 +00:00
OxrxL
cb404086ad feat(youtube/theme): color explore drawer background (#203)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-11-14 15:51:51 +01:00
semantic-release-bot
18192ac73e chore(release): 0.68.3 [skip ci]
## [0.68.3](https://github.com/revanced/revanced-integrations/compare/v0.68.2...v0.68.3) (2022-11-13)

### Bug Fixes

* **youtube/general-ads-patch:** exclude playlists wrapper from filtering ([#206](https://github.com/revanced/revanced-integrations/issues/206)) ([e357ac6](e357ac664b))
2022-11-13 22:20:39 +00:00
OxrxL
e357ac664b fix(youtube/general-ads-patch): exclude playlists wrapper from filtering (#206) 2022-11-13 23:17:00 +01:00
semantic-release-bot
2f2a595c89 chore(release): 0.68.2 [skip ci]
## [0.68.2](https://github.com/revanced/revanced-integrations/compare/v0.68.1...v0.68.2) (2022-11-13)

### Performance Improvements

* **youtube/general-ads-patch:** reduce amount of components to filter ([#204](https://github.com/revanced/revanced-integrations/issues/204)) ([502feaf](502feaf444))
2022-11-13 19:19:12 +00:00
OxrxL
502feaf444 perf(youtube/general-ads-patch): reduce amount of components to filter (#204) 2022-11-13 20:15:49 +01:00
semantic-release-bot
b4e03412ee chore(release): 0.68.1 [skip ci]
## [0.68.1](https://github.com/revanced/revanced-integrations/compare/v0.68.0...v0.68.1) (2022-11-13)

### Bug Fixes

* **youtube/theme:** return correct color value ([#202](https://github.com/revanced/revanced-integrations/issues/202)) ([f8cb38e](f8cb38e57a))
2022-11-13 03:50:43 +00:00
OxrxL
f8cb38e57a fix(youtube/theme): return correct color value (#202) 2022-11-13 04:46:57 +01:00
semantic-release-bot
9e5e81875a chore(release): 0.68.0 [skip ci]
# [0.68.0](https://github.com/revanced/revanced-integrations/compare/v0.67.2...v0.68.0) (2022-11-09)

### Features

* **youtube:** `open-links-directly` patch ([#201](https://github.com/revanced/revanced-integrations/issues/201)) ([c3c1656](c3c16563ea))
2022-11-09 20:46:31 +00:00
johnconner122
c3c16563ea feat(youtube): open-links-directly patch (#201) 2022-11-09 21:42:24 +01:00
semantic-release-bot
302b57d8f0 chore(release): 0.67.2 [skip ci]
## [0.67.2](https://github.com/revanced/revanced-integrations/compare/v0.67.1...v0.67.2) (2022-11-08)

### Bug Fixes

* **youtube/hide-endscreen-cards:** restore functionality ([#200](https://github.com/revanced/revanced-integrations/issues/200)) ([d866558](d86655874b))
2022-11-08 17:11:07 +00:00
OxrxL
d86655874b fix(youtube/hide-endscreen-cards): restore functionality (#200)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-11-08 18:07:30 +01:00
semantic-release-bot
cc2bab4e39 chore(release): 0.67.1 [skip ci]
## [0.67.1](https://github.com/revanced/revanced-integrations/compare/v0.67.0...v0.67.1) (2022-11-07)

### Bug Fixes

* **youtube/hide-info-cards:** remove initial popup of info-cards ([#199](https://github.com/revanced/revanced-integrations/issues/199)) ([85971bc](85971bcd5e))
2022-11-07 23:15:52 +00:00
OxrxL
85971bcd5e fix(youtube/hide-info-cards): remove initial popup of info-cards (#199)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-11-08 00:11:49 +01:00
semantic-release-bot
f475c28f3d chore(release): 0.67.0 [skip ci]
# [0.67.0](https://github.com/revanced/revanced-integrations/compare/v0.66.0...v0.67.0) (2022-11-05)

### Bug Fixes

* **fix-playback:** seek to maximum end ([fd69010](fd69010def))
* remove left over not existing code references ([ac81695](ac81695747))

### Features

* **video-information:** hook video time ([6aa0ca9](6aa0ca9556))
2022-11-05 23:04:19 +00:00
oSumAtrIX
ac81695747 fix: remove left over not existing code references 2022-11-06 00:00:54 +01:00
Nico Mexis
3427f885fb build: update workflow actions (#198) [skip ci] 2022-11-05 15:25:38 +01:00
oSumAtrIX
9bdac3356d refactor: move classes to correct packages & name them properly 2022-11-05 06:25:19 +01:00
oSumAtrIX
fd69010def fix(fix-playback): seek to maximum end 2022-11-05 06:24:32 +01:00
oSumAtrIX
6aa0ca9556 feat(video-information): hook video time 2022-11-05 06:24:07 +01:00
oSumAtrIX
98eaf9c3f2 refactor: remove unused classes 2022-11-05 03:19:09 +01:00
oSumAtrIX
8e36da0b19 refactor(youtube/general-ads): fix settings enum name 2022-11-05 02:53:33 +01:00
semantic-release-bot
1433b34c7e chore(release): 0.66.0 [skip ci]
# [0.66.0](https://github.com/revanced/revanced-integrations/compare/v0.65.0...v0.66.0) (2022-11-01)

### Features

* **youtube:** bump patches compatibility to v17.43.36 ([#194](https://github.com/revanced/revanced-integrations/issues/194)) ([6da66be](6da66be067))
2022-11-01 17:47:41 +00:00
OxrxL
6da66be067 feat(youtube): bump patches compatibility to v17.43.36 (#194) 2022-11-01 18:44:13 +01:00
45 changed files with 465 additions and 1503 deletions

View File

@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Repo
@@ -27,7 +27,7 @@ jobs:
java-version: '11'
distribution: 'zulu'
- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Build with Gradle

View File

@@ -1,3 +1,134 @@
# [0.73.0](https://github.com/revanced/revanced-integrations/compare/v0.72.0...v0.73.0) (2022-11-20)
### Features
* **youtube/general-ads:** block the separator by its identifier ([6ceff7c](https://github.com/revanced/revanced-integrations/commit/6ceff7c9b36570d115db7df4fdc20c76d5935dc3))
# [0.72.0](https://github.com/revanced/revanced-integrations/compare/v0.71.0...v0.72.0) (2022-11-19)
### Bug Fixes
* check if filter string is empty ([6604030](https://github.com/revanced/revanced-integrations/commit/66040302a9370db2d511aeaa9cb3c9f4c7ad122b))
* **youtube/general-ads:** hide ads with buttons ([2c8b234](https://github.com/revanced/revanced-integrations/commit/2c8b23426f88111646cd0513517feff7a65a7c13))
### Features
* block rule of type `CustomBlockRule` ([571cf12](https://github.com/revanced/revanced-integrations/commit/571cf12dcad405994b41f5fc41fec96fdc71c9b9))
* **youtube/general-ads:** custom component filter ([72a3cd0](https://github.com/revanced/revanced-integrations/commit/72a3cd0fac095e7bfe0c3e18ab908ece8780b0db))
* **youtube/general-ads:** do not require to reload on general ads switch ([6272e4b](https://github.com/revanced/revanced-integrations/commit/6272e4b46727c547261f8cc31c3dacb57424d5f7))
* **youtube/general-ads:** hide gray separators ([cf892de](https://github.com/revanced/revanced-integrations/commit/cf892de4bb9758543e26a3554146047f8351dfb4))
# [0.71.0](https://github.com/revanced/revanced-integrations/compare/v0.70.0...v0.71.0) (2022-11-15)
### Bug Fixes
* **youtube/general-ads:** do not force to restart on general ads switches ([0a90289](https://github.com/revanced/revanced-integrations/commit/0a90289dc59e8bedfc90d62a27b46d406520ead5))
### Features
* **youtube/general-ads:** hide chapter teaser under videos ([3fb337b](https://github.com/revanced/revanced-integrations/commit/3fb337b856033965881e2c93fb43b5a34f48ee93))
* **youtube/general-ads:** hide shorts in search ([d82b989](https://github.com/revanced/revanced-integrations/commit/d82b9898a850d3e1c5163461341dbe1b34199250))
# [0.70.0](https://github.com/revanced/revanced-integrations/compare/v0.69.2...v0.70.0) (2022-11-14)
### Bug Fixes
* **youtube/general-ads:** do not force to restart on general ads switches ([7f18520](https://github.com/revanced/revanced-integrations/commit/7f1852064695f3281e31e8f7c6d9f8801751c400))
### Features
* **youtube/general-ads:** hide self sponsored cards ([e93ce3e](https://github.com/revanced/revanced-integrations/commit/e93ce3eaa92930688da770555be9d18de84e594e))
## [0.69.2](https://github.com/revanced/revanced-integrations/compare/v0.69.1...v0.69.2) (2022-11-14)
### Bug Fixes
* **youtube/general-ads-patch:** revert reducing filter exclusions ([af86dd8](https://github.com/revanced/revanced-integrations/commit/af86dd8ec6084be7f42de1edaa14501d2c0a2eb7))
## [0.69.1](https://github.com/revanced/revanced-integrations/compare/v0.69.0...v0.69.1) (2022-11-14)
### Bug Fixes
* **youtube/theme:** revert comment box background color hook ([#210](https://github.com/revanced/revanced-integrations/issues/210)) ([197f003](https://github.com/revanced/revanced-integrations/commit/197f0034a18d3ed796f9a2076aca9659987ed2ed))
# [0.69.0](https://github.com/revanced/revanced-integrations/compare/v0.68.3...v0.69.0) (2022-11-14)
### Features
* **youtube/theme:** color explore drawer background ([#203](https://github.com/revanced/revanced-integrations/issues/203)) ([cb40408](https://github.com/revanced/revanced-integrations/commit/cb404086ad7b74a4280ccfaaed49e1edafe6eaf8))
## [0.68.3](https://github.com/revanced/revanced-integrations/compare/v0.68.2...v0.68.3) (2022-11-13)
### Bug Fixes
* **youtube/general-ads-patch:** exclude playlists wrapper from filtering ([#206](https://github.com/revanced/revanced-integrations/issues/206)) ([e357ac6](https://github.com/revanced/revanced-integrations/commit/e357ac664b920a348bc8e98fc2b2a11e40045353))
## [0.68.2](https://github.com/revanced/revanced-integrations/compare/v0.68.1...v0.68.2) (2022-11-13)
### Performance Improvements
* **youtube/general-ads-patch:** reduce amount of components to filter ([#204](https://github.com/revanced/revanced-integrations/issues/204)) ([502feaf](https://github.com/revanced/revanced-integrations/commit/502feaf4448bf0442f852fbb8fdcb639239664db))
## [0.68.1](https://github.com/revanced/revanced-integrations/compare/v0.68.0...v0.68.1) (2022-11-13)
### Bug Fixes
* **youtube/theme:** return correct color value ([#202](https://github.com/revanced/revanced-integrations/issues/202)) ([f8cb38e](https://github.com/revanced/revanced-integrations/commit/f8cb38e57a531b8e358c66e7c9e2f4fb6ccbcb2e))
# [0.68.0](https://github.com/revanced/revanced-integrations/compare/v0.67.2...v0.68.0) (2022-11-09)
### Features
* **youtube:** `open-links-directly` patch ([#201](https://github.com/revanced/revanced-integrations/issues/201)) ([c3c1656](https://github.com/revanced/revanced-integrations/commit/c3c16563ea4e55234b8dea24732ce5e53bb562c8))
## [0.67.2](https://github.com/revanced/revanced-integrations/compare/v0.67.1...v0.67.2) (2022-11-08)
### Bug Fixes
* **youtube/hide-endscreen-cards:** restore functionality ([#200](https://github.com/revanced/revanced-integrations/issues/200)) ([d866558](https://github.com/revanced/revanced-integrations/commit/d86655874ba37c380c3dfefad0380a728ea5e74f))
## [0.67.1](https://github.com/revanced/revanced-integrations/compare/v0.67.0...v0.67.1) (2022-11-07)
### Bug Fixes
* **youtube/hide-info-cards:** remove initial popup of info-cards ([#199](https://github.com/revanced/revanced-integrations/issues/199)) ([85971bc](https://github.com/revanced/revanced-integrations/commit/85971bcd5e25e05d565e7d18d97b672363113ded))
# [0.67.0](https://github.com/revanced/revanced-integrations/compare/v0.66.0...v0.67.0) (2022-11-05)
### Bug Fixes
* **fix-playback:** seek to maximum end ([fd69010](https://github.com/revanced/revanced-integrations/commit/fd69010defdf9a459dd93173208ecc3867037ad9))
* remove left over not existing code references ([ac81695](https://github.com/revanced/revanced-integrations/commit/ac81695747ca932f16fdfc34774325154d9893ab))
### Features
* **video-information:** hook video time ([6aa0ca9](https://github.com/revanced/revanced-integrations/commit/6aa0ca95568fe3cbee50c28342448259892112d8))
# [0.66.0](https://github.com/revanced/revanced-integrations/compare/v0.65.0...v0.66.0) (2022-11-01)
### Features
* **youtube:** bump patches compatibility to v17.43.36 ([#194](https://github.com/revanced/revanced-integrations/issues/194)) ([6da66be](https://github.com/revanced/revanced-integrations/commit/6da66be067fdfe0db376925ecf5c96aa01162a2c))
# [0.65.0](https://github.com/revanced/revanced-integrations/compare/v0.64.1...v0.65.0) (2022-11-01)

View File

@@ -8,8 +8,6 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toolbar;
import app.revanced.integrations.patches.HideShortsButtonPatch;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper;
public class AdRemoverAPI {

View File

@@ -1,33 +1,37 @@
package app.revanced.integrations.patches;
import java.util.Timer;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper;
public final class FixPlaybackPatch {
private static Thread currentThread = null;
public static void newVideoLoaded(final String _videoId) {
private static String videoId;
public static void newVideoLoaded(final String videoId) {
if (!SettingsEnum.FIX_PLAYBACK.getBoolean()) return;
if (videoId.equals(FixPlaybackPatch.videoId)) return;
else FixPlaybackPatch.videoId = videoId;
if (currentThread != null) {
currentThread.interrupt();
}
currentThread = new Thread(() -> {
while (true) {
var currentVideoLength = PlayerControllerPatch.getCurrentVideoLength();
if (currentVideoLength > 1) {
PlayerControllerPatch.seekTo(currentVideoLength);
PlayerControllerPatch.seekTo(1);
return;
}
try {
while (true) {
var currentVideoTime = VideoInformation.getVideoTime();
if (currentVideoTime > -1) {
VideoInformation.seekTo(Integer.MAX_VALUE);
VideoInformation.seekTo(currentVideoTime);
return;
}
try {
Thread.sleep(10);
} catch (InterruptedException e) {
LogHelper.debug(FixPlaybackPatch.class, "Thread was interrupted");
}
} catch (InterruptedException e) {
LogHelper.debug(FixPlaybackPatch.class, "Thread was interrupted");
}
});

View File

@@ -4,7 +4,9 @@ import app.revanced.integrations.settings.SettingsEnum;
public class HideEmailAddressPatch {
//Used by app.revanced.patches.youtube.layout.personalinformation.patch.HideEmailAddressPatch
public static boolean hideEmailAddress() {
return SettingsEnum.HIDE_EMAIL_ADDRESS.getBoolean();
public static int hideEmailAddress(int originalValue) {
if (SettingsEnum.HIDE_EMAIL_ADDRESS.getBoolean())
return 8;
return originalValue;
}
}

View File

@@ -0,0 +1,13 @@
package app.revanced.integrations.patches;
import android.view.View;
import app.revanced.integrations.settings.SettingsEnum;
public class HideEndscreenCardsPatch {
//Used by app.revanced.patches.youtube.layout.hideendscreencards.bytecode.patch.HideEndscreenCardsPatch
public static void hideEndscreen(View view) {
if (!SettingsEnum.HIDE_ENDSCREEN_CARDS.getBoolean()) return;
view.setVisibility(View.GONE);
}
}

View File

@@ -1,20 +0,0 @@
package app.revanced.integrations.patches;
import android.view.View;
import app.revanced.integrations.adremover.AdRemoverAPI;
import app.revanced.integrations.settings.SettingsEnum;
public class HideHomeAdsPatch {
/**
* Used by package app.revanced.extensions.Extensions
*
* @param view
*/
public static void HideHomeAds(View view) {
if (!SettingsEnum.HOME_ADS_REMOVAL.getBoolean()) return;
AdRemoverAPI.HideViewWithLayout1dp(view);
}
}

View File

@@ -1,14 +0,0 @@
package app.revanced.integrations.patches;
import android.view.View;
import app.revanced.integrations.settings.SettingsEnum;
public class HideInfoCardSuggestionsPatch {
public static void hideInfoCardSuggestions(View view) {
if (!SettingsEnum.INFO_CARDS_SHOWN.getBoolean()) {
view.setVisibility(View.GONE);
}
}
}

View File

@@ -0,0 +1,16 @@
package app.revanced.integrations.patches;
import android.view.View;
import app.revanced.integrations.settings.SettingsEnum;
public class HideInfocardsPatch {
public static void hideInfocardsIncognito(View view) {
if (!SettingsEnum.HIDE_INFO_CARDS.getBoolean()) return;
view.setVisibility(View.GONE);
}
public static boolean hideInfocardsMethodCall() {
return SettingsEnum.HIDE_INFO_CARDS.getBoolean();
}
}

View File

@@ -13,6 +13,7 @@ public class LithoThemePatch {
};
private static final int[] DARKCONSTANTS = {
-14145496, // explore drawer background
-14606047, // comments chip background
-15198184, // music related results panel background
-15790321, // comments chip background (new layout)

View File

@@ -0,0 +1,18 @@
package app.revanced.integrations.patches;
import java.net.URLDecoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import app.revanced.integrations.settings.SettingsEnum;
public class OpenLinksDirectlyPatch {
public static String parseRedirectUri(String uri) {
if (SettingsEnum.OPEN_LINKS_DIRECTLY.getBoolean()) {
Matcher matcher = Pattern.compile("&q=(http.+?)&v=").matcher(uri);
return matcher.find() ? URLDecoder.decode(matcher.group(1)) : uri;
}
return uri;
}
}

View File

@@ -9,14 +9,17 @@ import java.lang.reflect.Method;
import app.revanced.integrations.utils.LogHelper;
/**
* Hooking class for the player controller.
* Hooking class for the current playing video.
*/
public final class PlayerControllerPatch {
public final class VideoInformation {
private static final String SEEK_METHOD_NAME = "seekTo";
private static WeakReference<Object> playerController;
private static Method seekMethod;
private static long videoLength = 1;
private static long videoTime = -1;
/**
* Hook into PlayerController.onCreate() method.
@@ -26,26 +29,36 @@ public final class PlayerControllerPatch {
public static void playerController_onCreateHook(final Object thisRef) {
playerController = new WeakReference<>(thisRef);
videoLength = 1;
videoTime = -1;
try {
seekMethod = thisRef.getClass().getMethod(SEEK_METHOD_NAME, Long.TYPE);
seekMethod.setAccessible(true);
} catch (NoSuchMethodException ex) {
LogHelper.debug(PlayerControllerPatch.class, "Failed to initialize: " + ex.getMessage());
LogHelper.debug(VideoInformation.class, "Failed to initialize: " + ex.getMessage());
}
}
/**
* Set the current video length.
* Set the video length.
*
* @param length The length of the video in milliseconds.
*/
public static void setCurrentVideoLength(final long length) {
LogHelper.debug(PlayerControllerPatch.class, "Setting current video length to " + length);
public static void setVideoLength(final long length) {
LogHelper.debug(VideoInformation.class, "Setting current video length to " + length);
videoLength = length;
}
/**
* Set the video time.
*
* @param time The time of the video in milliseconds.
*/
public static void setVideoTime(final long time) {
LogHelper.debug(VideoInformation.class, "Current video time " + time);
videoTime = time;
}
/**
* Seek on the current video.
*
@@ -54,15 +67,15 @@ public final class PlayerControllerPatch {
public static void seekTo(final long millisecond) {
new Handler(Looper.getMainLooper()).post(() -> {
if (seekMethod == null) {
LogHelper.debug(PlayerControllerPatch.class, "seekMethod was null");
LogHelper.debug(VideoInformation.class, "seekMethod was null");
return;
}
try {
LogHelper.debug(PlayerControllerPatch.class, "Seeking to " + millisecond);
LogHelper.debug(VideoInformation.class, "Seeking to " + millisecond);
seekMethod.invoke(playerController.get(), millisecond);
} catch (Exception ex) {
LogHelper.debug(PlayerControllerPatch.class, "Failed to seek: " + ex.getMessage());
LogHelper.debug(VideoInformation.class, "Failed to seek: " + ex.getMessage());
}
});
}
@@ -70,9 +83,18 @@ public final class PlayerControllerPatch {
/**
* Get the length of the current video playing.
*
* @return The length of the video in milliseconds.
* @return The length of the video in milliseconds. 1 if not set yet.
*/
public static long getCurrentVideoLength() {
return videoLength;
return videoLength;
}
/**
* Get the time of the current video playing.
*
* @return The time of the video in milliseconds. -1 if not set yet.
*/
public static long getVideoTime() {
return videoTime;
}
}

View File

@@ -1,4 +1,4 @@
package app.revanced.integrations.patches;
package app.revanced.integrations.patches.playback.quality;
import android.view.View;
import android.view.ViewGroup;

View File

@@ -1,4 +1,4 @@
package app.revanced.integrations.patches;
package app.revanced.integrations.patches.playback.quality;
import android.content.Context;
import android.net.ConnectivityManager;
@@ -15,7 +15,7 @@ import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.utils.SharedPrefHelper;
public class VideoQualityPatch {
public class RememberVideoQualityPatch {
public static int selectedQuality1 = -2;
private static Boolean newVideo = false;
@@ -27,22 +27,22 @@ public class VideoQualityPatch {
try {
SharedPrefHelper.saveString(context, SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "wifi_quality", defaultQuality + "");
} catch (Exception ex) {
LogHelper.printException(VideoQualityPatch.class, "Failed to change default WI-FI quality:" + ex);
LogHelper.printException(RememberVideoQualityPatch.class, "Failed to change default WI-FI quality:" + ex);
Toast.makeText(context, "Failed to change default WI-FI quality:", Toast.LENGTH_SHORT).show();
}
LogHelper.debug(VideoQualityPatch.class, "Changing default Wi-Fi quality to: " + defaultQuality);
LogHelper.debug(RememberVideoQualityPatch.class, "Changing default Wi-Fi quality to: " + defaultQuality);
Toast.makeText(context, "Changing default Wi-Fi quality to: " + defaultQuality, Toast.LENGTH_SHORT).show();
} else if (isConnectedMobile(context)) {
try {
SharedPrefHelper.saveString(context, SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "mobile_quality", defaultQuality + "");
} catch (Exception ex) {
LogHelper.debug(VideoQualityPatch.class, "Failed to change default mobile data quality" + ex);
LogHelper.debug(RememberVideoQualityPatch.class, "Failed to change default mobile data quality" + ex);
Toast.makeText(context, "Failed to change default mobile data quality", Toast.LENGTH_SHORT).show();
}
LogHelper.debug(VideoQualityPatch.class, "Changing default mobile data quality to:" + defaultQuality);
LogHelper.debug(RememberVideoQualityPatch.class, "Changing default mobile data quality to:" + defaultQuality);
Toast.makeText(context, "Changing default mobile data quality to:" + defaultQuality, Toast.LENGTH_SHORT).show();
} else {
LogHelper.debug(VideoQualityPatch.class, "No internet connection.");
LogHelper.debug(RememberVideoQualityPatch.class, "No internet connection.");
Toast.makeText(context, "No internet connection.", Toast.LENGTH_SHORT).show();
}
userChangedQuality = false;
@@ -76,34 +76,34 @@ public class VideoQualityPatch {
int selectedQuality2 = qualities.length - selectedQuality1 + 1;
index++;
if (selectedQuality2 == index) {
LogHelper.debug(VideoQualityPatch.class, "Quality index is: " + index + " and corresponding value is: " + convertedQuality);
LogHelper.debug(RememberVideoQualityPatch.class, "Quality index is: " + index + " and corresponding value is: " + convertedQuality);
changeDefaultQuality(convertedQuality);
return selectedQuality2;
}
}
}
newVideo = false;
LogHelper.debug(VideoQualityPatch.class, "Quality: " + quality);
LogHelper.debug(RememberVideoQualityPatch.class, "Quality: " + quality);
Context context = ReVancedUtils.getContext();
if (context == null) {
LogHelper.printException(VideoQualityPatch.class, "Context is null or settings not initialized, returning quality: " + quality);
LogHelper.printException(RememberVideoQualityPatch.class, "Context is null or settings not initialized, returning quality: " + quality);
return quality;
}
if (isConnectedWifi(context)) {
preferredQuality = SharedPrefHelper.getInt(context, SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "wifi_quality", -2);
LogHelper.debug(VideoQualityPatch.class, "Wi-Fi connection detected, preferred quality: " + preferredQuality);
LogHelper.debug(RememberVideoQualityPatch.class, "Wi-Fi connection detected, preferred quality: " + preferredQuality);
} else if (isConnectedMobile(context)) {
preferredQuality = SharedPrefHelper.getInt(context, SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "mobile_quality", -2);
LogHelper.debug(VideoQualityPatch.class, "Mobile data connection detected, preferred quality: " + preferredQuality);
LogHelper.debug(RememberVideoQualityPatch.class, "Mobile data connection detected, preferred quality: " + preferredQuality);
} else {
LogHelper.debug(VideoQualityPatch.class, "No Internet connection!");
LogHelper.debug(RememberVideoQualityPatch.class, "No Internet connection!");
return quality;
}
if (preferredQuality == -2) {
return quality;
}
for (int streamQuality2 : iStreamQualities) {
LogHelper.debug(VideoQualityPatch.class, "Quality at index " + index + ": " + streamQuality2);
LogHelper.debug(RememberVideoQualityPatch.class, "Quality at index " + index + ": " + streamQuality2);
index++;
}
for (Integer iStreamQuality : iStreamQualities) {
@@ -116,16 +116,16 @@ public class VideoQualityPatch {
return quality;
}
int qualityIndex = iStreamQualities.indexOf(quality);
LogHelper.debug(VideoQualityPatch.class, "Index of quality " + quality + " is " + qualityIndex);
LogHelper.debug(RememberVideoQualityPatch.class, "Index of quality " + quality + " is " + qualityIndex);
try {
Class<?> cl = qInterface.getClass();
Method m = cl.getMethod(qIndexMethod, Integer.TYPE);
LogHelper.debug(VideoQualityPatch.class, "Method is: " + qIndexMethod);
LogHelper.debug(RememberVideoQualityPatch.class, "Method is: " + qIndexMethod);
m.invoke(qInterface, iStreamQualities.get(qualityIndex));
LogHelper.debug(VideoQualityPatch.class, "Quality changed to: " + qualityIndex);
LogHelper.debug(RememberVideoQualityPatch.class, "Quality changed to: " + qualityIndex);
return qualityIndex;
} catch (Exception ex) {
LogHelper.printException(VideoQualityPatch.class, "Failed to set quality", ex);
LogHelper.printException(RememberVideoQualityPatch.class, "Failed to set quality", ex);
Toast.makeText(context, "Failed to set quality", Toast.LENGTH_SHORT).show();
return qualityIndex;
}

View File

@@ -0,0 +1,5 @@
package app.revanced.integrations.patches.playback.speed;
public class CustomVideoSpeedPatch {
public static final float[] videoSpeeds = { 0, 0 }; // Values are useless as they are being overridden by the respective patch
}

View File

@@ -1,4 +1,4 @@
package app.revanced.integrations.whitelist.requests;
package app.revanced.integrations.requests;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -18,9 +18,9 @@ public class Requester {
String url = apiUrl + route.compile(params).getCompiledRoute();
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestMethod(route.getMethod().name());
if (route != WhitelistRoutes.GET_CHANNEL_DETAILS) {
connection.setRequestProperty("User-agent", System.getProperty("http.agent") + ";vanced");
}
// TODO: change the user agent string
connection.setRequestProperty("User-agent", System.getProperty("http.agent") + ";vanced");
return connection;
}

View File

@@ -1,4 +1,4 @@
package app.revanced.integrations.whitelist.requests;
package app.revanced.integrations.requests;
public class Route {
private final String route;

View File

@@ -1,8 +1,5 @@
package app.revanced.integrations.returnyoutubedislike;
import static app.revanced.integrations.videoplayer.VideoInformation.currentVideoId;
import static app.revanced.integrations.videoplayer.VideoInformation.dislikeCount;
import android.content.Context;
import android.icu.text.CompactDecimalFormat;
import android.os.Build;
@@ -19,6 +16,9 @@ import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.utils.SharedPrefHelper;
public class ReturnYouTubeDislike {
private static String currentVideoId;
public static Integer dislikeCount;
private static boolean isEnabled;
private static boolean segmentedButton;
@@ -74,6 +74,8 @@ public class ReturnYouTubeDislike {
dislikeCount = null;
if (!isEnabled) return;
currentVideoId = videoId;
try {
if (_dislikeFetchThread != null && _dislikeFetchThread.getState() != Thread.State.TERMINATED) {
LogHelper.debug(ReturnYouTubeDislike.class, "Interrupting the thread. Current state " + _dislikeFetchThread.getState());

View File

@@ -1,7 +1,6 @@
package app.revanced.integrations.returnyoutubedislike.requests;
import static app.revanced.integrations.videoplayer.VideoInformation.dislikeCount;
import static app.revanced.integrations.whitelist.requests.Requester.parseJson;
import static app.revanced.integrations.requests.Requester.parseJson;
import org.json.JSONObject;
@@ -11,10 +10,11 @@ import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.nio.charset.StandardCharsets;
import app.revanced.integrations.returnyoutubedislike.ReturnYouTubeDislike;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.returnyoutubedislike.Registration;
import app.revanced.integrations.whitelist.requests.Requester;
import app.revanced.integrations.whitelist.requests.Route;
import app.revanced.integrations.requests.Requester;
import app.revanced.integrations.requests.Route;
public class ReturnYouTubeDislikeApi {
private static final String RYD_API_URL = "https://returnyoutubedislikeapi.com/";
@@ -29,14 +29,13 @@ public class ReturnYouTubeDislikeApi {
connection.setConnectTimeout(1000);
if (connection.getResponseCode() == 200) {
JSONObject json = getJSONObject(connection);
dislikeCount = json.getInt("dislikes");
LogHelper.debug(ReturnYouTubeDislikeApi.class, "dislikes fetched - " + dislikeCount);
ReturnYouTubeDislike.dislikeCount = json.getInt("dislikes");
LogHelper.debug(ReturnYouTubeDislikeApi.class, "dislikes fetched - " + ReturnYouTubeDislike.dislikeCount);
} else {
LogHelper.debug(ReturnYouTubeDislikeApi.class, "dislikes fetch response was " + connection.getResponseCode());
}
connection.disconnect();
} catch (Exception ex) {
dislikeCount = null;
LogHelper.printException(ReturnYouTubeDislikeApi.class, "Failed to fetch dislikes", ex);
}
}

View File

@@ -1,9 +1,9 @@
package app.revanced.integrations.returnyoutubedislike.requests;
import static app.revanced.integrations.whitelist.requests.Route.Method.GET;
import static app.revanced.integrations.whitelist.requests.Route.Method.POST;
import static app.revanced.integrations.requests.Route.Method.GET;
import static app.revanced.integrations.requests.Route.Method.POST;
import app.revanced.integrations.whitelist.requests.Route;
import app.revanced.integrations.requests.Route;
public class ReturnYouTubeDislikeRoutes {
public static final Route SEND_VOTE = new Route(POST, "interact/vote");

View File

@@ -1,7 +1,6 @@
package app.revanced.integrations.settings;
import android.content.Context;
import android.os.Environment;
import android.util.Log;
import java.util.ArrayList;
@@ -27,24 +26,28 @@ public enum SettingsEnum {
ENABLE_WHITELIST("revanced_whitelist_ads_enabled", false, ReturnType.BOOLEAN),
// Ad settings
ADREMOVER_CUSTOM("revanced_adremover_custom_removal", "", ReturnType.STRING, false),
HOME_ADS_REMOVAL("revanced_home_ads_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_CUSTOM_ENABLED("revanced_adremover_custom_enabled", false, ReturnType.BOOLEAN),
ADREMOVER_CUSTOM_REMOVAL("revanced_adremover_custom_strings", "", ReturnType.STRING, true),
VIDEO_ADS_REMOVAL("revanced_video_ads_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_GENERAL_ADS_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_MERCHANDISE_REMOVAL("revanced_adremover_merchandise", true, ReturnType.BOOLEAN, true),
ADREMOVER_COMMUNITY_POSTS_REMOVAL("revanced_adremover_community_posts_removal", false, ReturnType.BOOLEAN, true),
ADREMOVER_COMPACT_BANNER_REMOVAL("revanced_adremover_compact_banner_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_MOVIE_REMOVAL("revanced_adremover_movie", true, ReturnType.BOOLEAN, true),
ADREMOVER_FEED_SURVEY_REMOVAL("revanced_adremover_feed_survey", true, ReturnType.BOOLEAN, true),
ADREMOVER_SHORTS_SHELF_REMOVAL("revanced_adremover_shorts_shelf", true, ReturnType.BOOLEAN, true),
ADREMOVER_COMMUNITY_GUIDELINES_REMOVAL("revanced_adremover_community_guidelines", true, ReturnType.BOOLEAN, true),
ADREMOVER_EMERGENCY_BOX_REMOVAL("revanced_adremover_emergency_box_removal", true, ReturnType.BOOLEAN, true),
ADREMOVER_INFO_PANEL_REMOVAL("revanced_adremover_info_panel", true, ReturnType.BOOLEAN, true),
ADREMOVER_MEDICAL_PANEL_REMOVAL("revanced_adremover_medical_panel", true, ReturnType.BOOLEAN, true),
ADREMOVER_PAID_CONTECT_REMOVAL("revanced_adremover_paid_content", true, ReturnType.BOOLEAN, true),
ADREMOVER_SUGGESTIONS_REMOVAL("revanced_adremover_hide_suggestions", true, ReturnType.BOOLEAN, true),
ADREMOVER_HIDE_LATEST_POSTS("revanced_adremover_hide_latest_posts", true, ReturnType.BOOLEAN, true),
ADREMOVER_HIDE_CHANNEL_GUIDELINES("revanced_adremover_hide_channel_guidelines", true, ReturnType.BOOLEAN, true),
ADREMOVER_GENERAL_ADS_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN),
ADREMOVER_MERCHANDISE_REMOVAL("revanced_adremover_merchandise", true, ReturnType.BOOLEAN),
ADREMOVER_COMMUNITY_POSTS_REMOVAL("revanced_adremover_community_posts_removal", false, ReturnType.BOOLEAN),
ADREMOVER_COMPACT_BANNER_REMOVAL("revanced_adremover_compact_banner_removal", true, ReturnType.BOOLEAN),
ADREMOVER_MOVIE_REMOVAL("revanced_adremover_movie", true, ReturnType.BOOLEAN),
ADREMOVER_FEED_SURVEY_REMOVAL("revanced_adremover_feed_survey", true, ReturnType.BOOLEAN),
ADREMOVER_SHORTS_REMOVAL("revanced_adremover_shorts", true, ReturnType.BOOLEAN),
ADREMOVER_COMMUNITY_GUIDELINES_REMOVAL("revanced_adremover_community_guidelines", true, ReturnType.BOOLEAN),
ADREMOVER_EMERGENCY_BOX_REMOVAL("revanced_adremover_emergency_box_removal", true, ReturnType.BOOLEAN),
ADREMOVER_INFO_PANEL_REMOVAL("revanced_adremover_info_panel", true, ReturnType.BOOLEAN),
ADREMOVER_MEDICAL_PANEL_REMOVAL("revanced_adremover_medical_panel", true, ReturnType.BOOLEAN),
ADREMOVER_PAID_CONTENT_REMOVAL("revanced_adremover_paid_content", true, ReturnType.BOOLEAN),
ADREMOVER_SUGGESTIONS_REMOVAL("revanced_adremover_hide_suggestions", true, ReturnType.BOOLEAN),
ADREMOVER_HIDE_LATEST_POSTS("revanced_adremover_hide_latest_posts", true, ReturnType.BOOLEAN),
ADREMOVER_HIDE_CHANNEL_GUIDELINES("revanced_adremover_hide_channel_guidelines", true, ReturnType.BOOLEAN),
ADREMOVER_SELF_SPONSOR_REMOVAL("revanced_adremover_self_sponsor", true, ReturnType.BOOLEAN),
ADREMOVER_CHAPTER_TEASER_REMOVAL("revanced_adremover_chapter_teaser", true, ReturnType.BOOLEAN),
ADREMOVER_BUTTONED_REMOVAL("revanced_adremover_buttoned", true, ReturnType.BOOLEAN),
ADREMOVER_GRAY_SEPARATOR("revanced_adremover_separator", true, ReturnType.BOOLEAN),
// Action buttons
HIDE_LIKE_BUTTON("revanced_like_button", false, ReturnType.BOOLEAN, false),
@@ -56,8 +59,9 @@ public enum SettingsEnum {
// Layout settings
REEL_BUTTON_SHOWN("revanced_reel_button_enabled", false, ReturnType.BOOLEAN, true),
INFO_CARDS_SHOWN("revanced_info_cards_enabled", false, ReturnType.BOOLEAN),
HIDE_INFO_CARDS("revanced_hide_infocards", true, ReturnType.BOOLEAN),
BRANDING_SHOWN("revanced_branding_watermark_enabled", false, ReturnType.BOOLEAN),
HIDE_ENDSCREEN_CARDS("revanced_hide_endscreen_cards", true, ReturnType.BOOLEAN),
CAST_BUTTON_SHOWN("revanced_cast_button_enabled", false, ReturnType.BOOLEAN, true),
AUTOPLAY_BUTTON_SHOWN("revanced_autoplay_button_enabled", false, ReturnType.BOOLEAN, true),
USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", false, ReturnType.BOOLEAN, true),
@@ -86,6 +90,7 @@ public enum SettingsEnum {
USE_HDR_AUTO_BRIGHTNESS("revanced_pref_hdr_autobrightness", true, ReturnType.BOOLEAN),
TAP_SEEKING_ENABLED("revanced_enable_tap_seeking", true, ReturnType.BOOLEAN),
ENABLE_MINIMIZED_PLAYBACK("revanced_enable_minimized_playback", true, ReturnType.BOOLEAN),
OPEN_LINKS_DIRECTLY("revanced_uri_redirect", true, ReturnType.BOOLEAN, true),
// Swipe controls
ENABLE_SWIPE_BRIGHTNESS("revanced_enable_swipe_brightness", true, ReturnType.BOOLEAN),

View File

@@ -26,9 +26,6 @@ import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.utils.SharedPrefHelper;
import app.revanced.integrations.videoplayer.AutoRepeat;
import app.revanced.integrations.videoplayer.Copy;
import app.revanced.integrations.videoplayer.CopyWithTimeStamp;
import app.revanced.integrations.videoplayer.DownloadButton;
public class ReVancedSettingsFragment extends PreferenceFragment {
@@ -53,11 +50,6 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
if (pref instanceof SwitchPreference) {
SwitchPreference switchPref = (SwitchPreference) pref;
setting.setValue(switchPref.isChecked());
if (setting == SettingsEnum.PREFERRED_AUTO_REPEAT) {
AutoRepeat.changeSelected(setting.getBoolean(), true);
}
} else if (pref instanceof EditTextPreference) {
EditTextPreference editPref = (EditTextPreference) pref;
Object value = null;
@@ -85,7 +77,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
try {
String value = sharedPreferences.getString(setting.getPath(), setting.getDefaultValue() + "");
listPref.setDefaultValue(value);
listPref.setSummary(videoSpeedEntries[listPref.findIndexOfValue(String.valueOf(value))]);
listPref.setSummary(videoSpeedEntries[listPref.findIndexOfValue(value)]);
SettingsEnum.PREFERRED_VIDEO_SPEED.saveValue(value);
} catch (Throwable th) {
LogHelper.printException(ReVancedSettingsFragment.class, "Error setting value of speed" + th);
@@ -94,11 +86,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
LogHelper.printException(ReVancedSettingsFragment.class, "No valid setting found: " + setting.toString());
}
if ("pref_copy_video_url_timestamp_button_list".equals(str)) {
CopyWithTimeStamp.refreshShouldBeShown();
} else if ("pref_copy_video_url_button_list".equals(str)) {
Copy.refreshShouldBeShown();
} else if ("pref_download_button_list".equals(str)) {
if ("pref_download_button_list".equals(str)) {
DownloadButton.refreshShouldBeShown();
}
} else {

View File

@@ -27,7 +27,6 @@ import java.lang.ref.WeakReference;
import java.text.DecimalFormat;
import java.util.ArrayList;
import app.revanced.integrations.whitelist.WhitelistType;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.sponsorblock.SponsorBlockSettings;
import app.revanced.integrations.sponsorblock.SponsorBlockUtils;
@@ -267,25 +266,6 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
screen.addPreference(preference);
}
{
Preference preference = new SwitchPreference(context);
preference.setTitle(str("general_whitelisting"));
preference.setSummary(str("general_whitelisting_sum"));
preference.setKey(WhitelistType.SPONSORBLOCK.getPreferenceEnabledName());
preferencesToDisableWhenSBDisabled.add(preference);
screen.addPreference(preference);
}
{
Preference preference = new SwitchPreference(context);
preference.setTitle(str("general_browser_button"));
preference.setSummary(str("general_browser_button_sum"));
preference.setKey(SettingsEnum.SB_SHOW_BROWSER_BUTTON.getPath());
preference.setDefaultValue(SettingsEnum.SB_SHOW_BROWSER_BUTTON.getDefaultValue());
preferencesToDisableWhenSBDisabled.add(preference);
screen.addPreference(preference);
}
{
EditTextPreference preference = new EditTextPreference(context);
preference.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);

View File

@@ -19,14 +19,12 @@ import java.util.Arrays;
import java.util.Timer;
import java.util.TimerTask;
import app.revanced.integrations.patches.PlayerControllerPatch;
import app.revanced.integrations.patches.VideoInformation;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.sponsorblock.objects.SponsorSegment;
import app.revanced.integrations.sponsorblock.requests.SBRequester;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.videoplayer.VideoInformation;
import app.revanced.integrations.whitelist.Whitelist;
@SuppressLint({"LongLogTag"})
public class PlayerController {
@@ -86,7 +84,6 @@ public class PlayerController {
*/
public static void initialize(Object _o) {
lastKnownVideoTime = 0;
VideoInformation.lastKnownVideoTime = 0;
SkipSegmentView.hide();
NewSegmentHelperLayout.hide();
}
@@ -94,7 +91,7 @@ public class PlayerController {
public static void executeDownloadSegments(String videoId) {
videoHasSegments = false;
timeWithoutSegments = "";
if (Whitelist.isChannelSBWhitelisted() || shorts_playing) {
if (shorts_playing) {
return;
}
SponsorSegment[] segments = SBRequester.getSegments(videoId);
@@ -105,21 +102,18 @@ public class PlayerController {
}
sponsorSegmentsOfCurrentVideo = segments;
// new Handler(Looper.getMainLooper()).post(findAndSkipSegmentRunnable);
// new Handler(Looper.getMainLooper()).post(findAndSkipSegmentRunnable);
}
/**
* Called when it's time to update the UI with new second, about once per second, only when playing, also in background
*/
public static void setCurrentVideoTime(long millis) {
public static void setVideoTime(long millis) {
LogHelper.debug(PlayerController.class, "setCurrentVideoTime: current video time: " + millis);
VideoInformation.lastKnownVideoTime = millis;
if (!SettingsEnum.SB_ENABLED.getBoolean()) return;
lastKnownVideoTime = millis;
if (millis <= 0) return;
//findAndSkipSegment(false);
if (millis == PlayerControllerPatch.getCurrentVideoLength()) {
if (millis == VideoInformation.getCurrentVideoLength()) {
SponsorBlockUtils.hideShieldButton();
SponsorBlockUtils.hideVoteButton();
return;
@@ -145,7 +139,6 @@ public class PlayerController {
public void run() {
skipSponsorTask = null;
lastKnownVideoTime = segment.start + 1;
VideoInformation.lastKnownVideoTime = lastKnownVideoTime;
new Handler(Looper.getMainLooper()).post(findAndSkipSegmentRunnable);
}
};
@@ -192,23 +185,19 @@ public class PlayerController {
}).start();
}
/**
* Called very high frequency (once every about 100ms), also in background. It sometimes triggers when a video is paused (couple times in the row with the same value)
*/
public static void setCurrentVideoTimeHighPrecision(final long millis) {
if ((millis < lastKnownVideoTime && lastKnownVideoTime >= PlayerControllerPatch.getCurrentVideoLength()) || millis == 0) {
public static void setHighPrecisionVideoTime(final long millis) {
if ((millis < lastKnownVideoTime && lastKnownVideoTime >= VideoInformation.getCurrentVideoLength()) || millis == 0) {
SponsorBlockUtils.showShieldButton(); // skipping from end to the video will show the buttons again
SponsorBlockUtils.showVoteButton();
}
if (lastKnownVideoTime > 0) {
lastKnownVideoTime = millis;
VideoInformation.lastKnownVideoTime = lastKnownVideoTime;
} else
setCurrentVideoTime(millis);
setVideoTime(millis);
}
public static long getCurrentVideoLength() {
return PlayerControllerPatch.getCurrentVideoLength();
return VideoInformation.getCurrentVideoLength();
}
public static long getLastKnownVideoTime() {
@@ -302,7 +291,7 @@ public class PlayerController {
final float absoluteLeft = sponsorBarLeft;
final float absoluteRight = sponsorBarRight;
final float tmp1 = 1f / (float) PlayerControllerPatch.getCurrentVideoLength() * (absoluteRight - absoluteLeft);
final float tmp1 = 1f / (float) VideoInformation.getCurrentVideoLength() * (absoluteRight - absoluteLeft);
for (SponsorSegment segment : sponsorSegmentsOfCurrentVideo) {
float left = segment.start * tmp1 + absoluteLeft;
float right = segment.end * tmp1 + absoluteLeft;
@@ -336,8 +325,7 @@ public class PlayerController {
try {
LogHelper.debug(PlayerController.class, "Skipping to millis=" + finalMillisecond);
lastKnownVideoTime = finalMillisecond;
VideoInformation.lastKnownVideoTime = lastKnownVideoTime;
PlayerControllerPatch.seekTo(finalMillisecond);
VideoInformation.seekTo(finalMillisecond);
} catch (Exception e) {
LogHelper.printException(PlayerController.class, "Cannot skip to millisecond", e);
}

View File

@@ -1,51 +0,0 @@
package app.revanced.integrations.sponsorblock.player;
import android.content.Context;
import android.widget.Toast;
import static app.revanced.integrations.sponsorblock.StringRef.str;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.videoplayer.VideoInformation;
public class VideoHelpers {
public static void copyVideoUrlToClipboard() {
generateVideoUrl(false);
}
public static void copyVideoUrlWithTimeStampToClipboard() {
generateVideoUrl(true);
}
private static void generateVideoUrl(boolean appendTimeStamp) {
try {
String videoId = VideoInformation.currentVideoId;
if (videoId == null || videoId.isEmpty()) {
LogHelper.debug(VideoHelpers.class, "VideoId was empty");
return;
}
String videoUrl = String.format("https://youtu.be/%s", videoId);
if (appendTimeStamp) {
long videoTime = VideoInformation.lastKnownVideoTime;
videoUrl += String.format("?t=%s", (videoTime / 1000));
}
LogHelper.debug(VideoHelpers.class, "Video URL: " + videoUrl);
setClipboard(ReVancedUtils.getContext(), videoUrl);
Toast.makeText(ReVancedUtils.getContext(), str("share_copy_url_success"), Toast.LENGTH_SHORT).show();
} catch (Exception ex) {
LogHelper.printException(VideoHelpers.class, "Couldn't generate video url", ex);
}
}
private static void setClipboard(Context context, String text) {
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
android.content.ClipData clip = android.content.ClipData.newPlainText("link", text);
clipboard.setPrimaryClip(clip);
}
}

View File

@@ -1,69 +0,0 @@
package app.revanced.integrations.sponsorblock.player.ui;
import static app.revanced.integrations.videoplayer.VideoInformation.currentVideoId;
import static app.revanced.integrations.sponsorblock.StringRef.str;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.videoplayer.VideoInformation;
import app.revanced.integrations.whitelist.Whitelist;
import app.revanced.integrations.whitelist.WhitelistType;
import app.revanced.integrations.whitelist.requests.WhitelistRequester;
import app.revanced.integrations.utils.SharedPrefHelper;
import app.revanced.integrations.utils.ReVancedUtils;
public class AdButton extends SlimButton {
public AdButton(Context context, ViewGroup container) {
super(context, container, SlimButton.SLIM_METADATA_BUTTON_ID,
SharedPrefHelper.getBoolean(context, SharedPrefHelper.SharedPrefNames.YOUTUBE, WhitelistType.ADS.getPreferenceEnabledName(), false));
initialize();
}
private void initialize() {
this.button_icon.setImageResource(ReVancedUtils.getIdentifier("revanced_yt_ad_button", "drawable"));
this.button_text.setText(str("action_ads"));
changeEnabled(Whitelist.shouldShowAds());
}
public void changeEnabled(boolean enabled) {
LogHelper.debug(AdButton.class, "changeEnabled " + enabled);
this.button_icon.setEnabled(enabled);
}
@Override
public void onClick(View view) {
this.view.setEnabled(false);
if (this.button_icon.isEnabled()) {
removeFromWhitelist();
return;
}
//this.button_icon.setEnabled(!this.button_icon.isEnabled());
addToWhiteList(this.view, this.button_icon);
}
private void removeFromWhitelist() {
try {
Whitelist.removeFromWhitelist(WhitelistType.ADS, this.context, VideoInformation.channelName);
changeEnabled(false);
} catch (Exception ex) {
LogHelper.printException(AdButton.class, "Failed to remove from whitelist", ex);
return;
}
this.view.setEnabled(true);
}
private void addToWhiteList(View view, ImageView buttonIcon) {
new Thread(() -> {
LogHelper.debug(AdButton.class, "Fetching channelId for " + currentVideoId);
WhitelistRequester.addChannelToWhitelist(WhitelistType.ADS, view, buttonIcon, this.context);
}).start();
}
}

View File

@@ -1,28 +0,0 @@
package app.revanced.integrations.sponsorblock.player.ui;
import static app.revanced.integrations.sponsorblock.StringRef.str;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import app.revanced.integrations.sponsorblock.player.VideoHelpers;
import app.revanced.integrations.utils.ReVancedUtils;
public class CopyButton extends SlimButton {
public CopyButton(Context context, ViewGroup container) {
super(context, container, SlimButton.SLIM_METADATA_BUTTON_ID, ButtonVisibility.isVisibleInContainer(context, "pref_copy_video_url_button_list"));
initialize();
}
private void initialize() {
this.button_icon.setImageResource(ReVancedUtils.getIdentifier("revanced_yt_copy_icon", "drawable"));
this.button_text.setText(str("action_copy"));
}
@Override
public void onClick(View view) {
VideoHelpers.copyVideoUrlToClipboard();
}
}

View File

@@ -1,28 +0,0 @@
package app.revanced.integrations.sponsorblock.player.ui;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import app.revanced.integrations.sponsorblock.player.VideoHelpers;
import app.revanced.integrations.utils.ReVancedUtils;
import static app.revanced.integrations.sponsorblock.StringRef.str;
public class CopyWithTimestamp extends SlimButton {
public CopyWithTimestamp(Context context, ViewGroup container) {
super(context, container, SlimButton.SLIM_METADATA_BUTTON_ID, ButtonVisibility.isVisibleInContainer(context, "pref_copy_video_url_timestamp_button_list"));
initialize();
}
private void initialize() {
this.button_icon.setImageResource(ReVancedUtils.getIdentifier("revanced_yt_copy_icon_with_time", "drawable"));
this.button_text.setText(str("action_tcopy"));
}
@Override
public void onClick(View view) {
VideoHelpers.copyVideoUrlWithTimeStampToClipboard();
}
}

View File

@@ -1,37 +0,0 @@
package app.revanced.integrations.sponsorblock.player.ui;
import static app.revanced.integrations.sponsorblock.StringRef.str;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.view.ViewGroup;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.videoplayer.VideoInformation;
import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.sponsorblock.SponsorBlockUtils;
public class SBBrowserButton extends SlimButton {
private static final String BROWSER_URL = "https://sb.ltn.fi/video/";
public SBBrowserButton(Context context, ViewGroup container) {
super(context, container, SLIM_METADATA_BUTTON_ID,
SponsorBlockUtils.isSBButtonEnabled(context, SettingsEnum.SB_SHOW_BROWSER_BUTTON.getPath()));
initialize();
}
private void initialize() {
this.button_icon.setImageResource(ReVancedUtils.getIdentifier("revanced_sb_browser", "drawable"));
this.button_text.setText(str("action_browser"));
}
@Override
public void onClick(View v) {
Uri uri = Uri.parse(BROWSER_URL + VideoInformation.currentVideoId);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(intent);
}
}

View File

@@ -1,69 +0,0 @@
package app.revanced.integrations.sponsorblock.player.ui;
import static app.revanced.integrations.videoplayer.VideoInformation.currentVideoId;
import static app.revanced.integrations.sponsorblock.StringRef.str;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.videoplayer.VideoInformation;
import app.revanced.integrations.whitelist.Whitelist;
import app.revanced.integrations.whitelist.WhitelistType;
import app.revanced.integrations.whitelist.requests.WhitelistRequester;
import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.sponsorblock.SponsorBlockUtils;
public class SBWhitelistButton extends SlimButton {
public SBWhitelistButton(Context context, ViewGroup container) {
super(context, container, SlimButton.SLIM_METADATA_BUTTON_ID,
SponsorBlockUtils.isSBButtonEnabled(context, WhitelistType.SPONSORBLOCK.getPreferenceEnabledName()));
initialize();
}
private void initialize() {
this.button_icon.setImageResource(ReVancedUtils.getIdentifier("revanced_yt_sb_button", "drawable"));
this.button_text.setText(str("action_segments"));
changeEnabled(Whitelist.isChannelSBWhitelisted());
}
public void changeEnabled(boolean enabled) {
LogHelper.debug(SBWhitelistButton.class, "changeEnabled " + enabled);
this.button_icon.setEnabled(!enabled); // enabled == true -> strikethrough (no segments), enabled == false -> clear (segments)
}
@Override
public void onClick(View view) {
this.view.setEnabled(false);
if (Whitelist.isChannelSBWhitelisted()) {
removeFromWhitelist();
return;
}
//this.button_icon.setEnabled(!this.button_icon.isEnabled());
addToWhiteList(this.view, this.button_icon);
}
private void removeFromWhitelist() {
try {
Whitelist.removeFromWhitelist(WhitelistType.SPONSORBLOCK, this.context, VideoInformation.channelName);
changeEnabled(false);
} catch (Exception ex) {
LogHelper.printException(SBWhitelistButton.class, "Failed to remove from whitelist", ex);
return;
}
this.view.setEnabled(true);
}
private void addToWhiteList(View view, ImageView buttonIcon) {
new Thread(() -> {
LogHelper.debug(SBWhitelistButton.class, "Fetching channelId for " + currentVideoId);
WhitelistRequester.addChannelToWhitelist(WhitelistType.SPONSORBLOCK, view, buttonIcon, this.context);
}).start();
}
}

View File

@@ -1,134 +0,0 @@
package app.revanced.integrations.sponsorblock.player.ui;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.AttributeSet;
import android.view.ViewGroup;
import com.google.android.apps.youtube.app.ui.SlimMetadataScrollableButtonContainerLayout;
import app.revanced.integrations.whitelist.Whitelist;
import app.revanced.integrations.whitelist.WhitelistType;
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.SharedPrefHelper;
import app.revanced.integrations.utils.ReVancedUtils;
public class SlimButtonContainer extends SlimMetadataScrollableButtonContainerLayout {
private ViewGroup container;
private CopyButton copyButton;
private CopyWithTimestamp copyWithTimestampButton;
public static AdButton adBlockButton;
public static SBWhitelistButton sbWhitelistButton;
private SBBrowserButton sbBrowserButton;
private final Context context;
SharedPreferences.OnSharedPreferenceChangeListener listener;
public SlimButtonContainer(Context context) {
super(context);
this.context = context;
this.initialize(context);
}
public SlimButtonContainer(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
this.initialize(context);
}
public SlimButtonContainer(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
this.initialize(context);
}
public void initialize(Context context) {
try {
container = this.findViewById(ReVancedUtils.getIdentifier("button_container_vanced", "id"));
if (container == null)
throw new Exception("Unable to initialize the button container because the button_container_vanced couldn't be found");
copyButton = new CopyButton(context, this);
copyWithTimestampButton = new CopyWithTimestamp(context, this);
adBlockButton = new AdButton(context, this);
sbWhitelistButton = new SBWhitelistButton(context, this);
sbBrowserButton = new SBBrowserButton(context, this);
new SponsorBlockVoting(context, this);
addSharedPrefsChangeListener();
} catch (Exception ex) {
LogHelper.printException(SlimButtonContainer.class, "Unable to initialize the button container", ex);
}
}
private void addSharedPrefsChangeListener() {
listener = (sharedPreferences, key) -> {
try {
LogHelper.debug(SlimButtonContainer.class, String.format("SharedPreference changed with key %s", key));
if ("pref_copy_video_url_button_list".equals(key) && copyButton != null) {
copyButton.setVisible(ButtonVisibility.isVisibleInContainer(context, "pref_copy_video_url_button_list"));
return;
}
if ("pref_copy_video_url_timestamp_button_list".equals(key) && copyWithTimestampButton != null) {
copyWithTimestampButton.setVisible(ButtonVisibility.isVisibleInContainer(context, "pref_copy_video_url_timestamp_button_list"));
return;
}
if (SettingsEnum.SB_ENABLED.getPath().equals(key)) {
if (sbWhitelistButton != null) {
if (SettingsEnum.SB_ENABLED.getBoolean()) {
toggleWhitelistButton();
} else {
Whitelist.setEnabled(WhitelistType.SPONSORBLOCK, false);
sbWhitelistButton.setVisible(false);
}
}
if (sbBrowserButton != null) {
if (SettingsEnum.SB_ENABLED.getBoolean()) {
toggleBrowserButton();
} else {
sbBrowserButton.setVisible(false);
}
}
}
if (SettingsEnum.SB_SHOW_BROWSER_BUTTON.getPath().equals(key) && sbBrowserButton != null) {
toggleBrowserButton();
return;
}
WhitelistType whitelistAds = WhitelistType.ADS;
String adsEnabledPreferenceName = whitelistAds.getPreferenceEnabledName();
if (adsEnabledPreferenceName.equals(key) && adBlockButton != null) {
boolean enabled = SharedPrefHelper.getBoolean(context, SharedPrefHelper.SharedPrefNames.YOUTUBE, adsEnabledPreferenceName, false);
Whitelist.setEnabled(whitelistAds, enabled);
adBlockButton.setVisible(enabled);
return;
}
if (WhitelistType.SPONSORBLOCK.getPreferenceEnabledName().equals(key) && sbWhitelistButton != null) {
toggleWhitelistButton();
return;
}
} catch (Exception ex) {
LogHelper.printException(SlimButtonContainer.class, "Error handling shared preference change", ex);
}
};
context.getSharedPreferences(WhitelistType.ADS.getSharedPreferencesName().getName(), Context.MODE_PRIVATE)
.registerOnSharedPreferenceChangeListener(listener);
context.getSharedPreferences(WhitelistType.SPONSORBLOCK.getSharedPreferencesName().getName(), Context.MODE_PRIVATE)
.registerOnSharedPreferenceChangeListener(listener);
}
private void toggleWhitelistButton() {
WhitelistType whitelistSB = WhitelistType.SPONSORBLOCK;
String sbEnabledPreferenceName = whitelistSB.getPreferenceEnabledName();
boolean enabled = SharedPrefHelper.getBoolean(context, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, sbEnabledPreferenceName, false);
Whitelist.setEnabled(whitelistSB, enabled);
sbWhitelistButton.setVisible(enabled);
}
private void toggleBrowserButton() {
sbBrowserButton.setVisible(SettingsEnum.SB_SHOW_BROWSER_BUTTON.getBoolean());
}
}

Some files were not shown because too many files have changed in this diff Show More