chore: merge branch `dev` to `main` (#413)

This commit is contained in:
oSumAtrIX 2023-05-31 10:33:38 +02:00 committed by GitHub
commit 1c3d0bed32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 159 additions and 31 deletions

View File

@ -1,3 +1,59 @@
# [0.109.0-dev.6](https://github.com/revanced/revanced-integrations/compare/v0.109.0-dev.5...v0.109.0-dev.6) (2023-05-29)
### Features
* **youtube/hide-ads:** hide new type of ad ([2592508](https://github.com/revanced/revanced-integrations/commit/25925085adbfc9b36918ecc4da55d76215db74ef))
# [0.109.0-dev.5](https://github.com/revanced/revanced-integrations/compare/v0.109.0-dev.4...v0.109.0-dev.5) (2023-05-28)
### Bug Fixes
* **youtube/hide-shorts-components:** hide new type of Shorts in feed ([f13a993](https://github.com/revanced/revanced-integrations/commit/f13a99351c82682d982b0d430a2ae2d57a5fe148))
# [0.109.0-dev.4](https://github.com/revanced/revanced-integrations/compare/v0.109.0-dev.3...v0.109.0-dev.4) (2023-05-27)
### Features
* **youtube/hide-shorts-components:** hide channel bar & sound button ([1714700](https://github.com/revanced/revanced-integrations/commit/1714700fb18d58123672bdc501f9caa77788af4f))
# [0.109.0-dev.3](https://github.com/revanced/revanced-integrations/compare/v0.109.0-dev.2...v0.109.0-dev.3) (2023-05-27)
### Features
* **youtube/hide-seekbar:** more fine grained hiding of seekbar ([#409](https://github.com/revanced/revanced-integrations/issues/409)) ([40def9e](https://github.com/revanced/revanced-integrations/commit/40def9e036129e9f70549db5fd219f18618e931d))
# [0.109.0-dev.2](https://github.com/revanced/revanced-integrations/compare/v0.109.0-dev.1...v0.109.0-dev.2) (2023-05-27)
### Features
* **youtube/hide-shorts-components:** hide shorts info panel ([#415](https://github.com/revanced/revanced-integrations/issues/415)) ([f5df201](https://github.com/revanced/revanced-integrations/commit/f5df20134c376c351b5d7d9881c45876463734f9))
# [0.109.0-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.108.1-dev.2...v0.109.0-dev.1) (2023-05-26)
### Features
* **remove-screen-capture-restriction:** remove app constraint ([#411](https://github.com/revanced/revanced-integrations/issues/411)) ([31251f0](https://github.com/revanced/revanced-integrations/commit/31251f0214b6d37a9407975a23dbdd43e3cad611))
## [0.108.1-dev.2](https://github.com/revanced/revanced-integrations/compare/v0.108.1-dev.1...v0.108.1-dev.2) (2023-05-26)
### Bug Fixes
* **youtube/downloads:** rename patch to `external-downloads` ([#414](https://github.com/revanced/revanced-integrations/issues/414)) ([b3c7e7f](https://github.com/revanced/revanced-integrations/commit/b3c7e7f63828d299199f80d09c1349de22d8d198))
## [0.108.1-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.108.0...v0.108.1-dev.1) (2023-05-25)
### Bug Fixes
* **youtube/hide-player-buttons:** fix previous/next button showing if previous video exists ([#412](https://github.com/revanced/revanced-integrations/issues/412)) ([60f25a2](https://github.com/revanced/revanced-integrations/commit/60f25a2af0bee0301bb84ac69b586343485003bb))
# [0.108.0](https://github.com/revanced/revanced-integrations/compare/v0.107.0...v0.108.0) (2023-05-24)

View File

@ -0,0 +1,21 @@
package app.revanced.all.screencapture.removerestriction;
import android.media.AudioAttributes;
import android.os.Build;
import androidx.annotation.RequiresApi;
public final class RemoveScreencaptureRestrictionPatch {
// Member of AudioAttributes.Builder
@RequiresApi(api = Build.VERSION_CODES.Q)
public static AudioAttributes.Builder setAllowedCapturePolicy(final AudioAttributes.Builder builder, final int capturePolicy) {
builder.setAllowedCapturePolicy(AudioAttributes.ALLOW_CAPTURE_BY_ALL);
return builder;
}
// Member of AudioManager static class
public static void setAllowedCapturePolicy(final int capturePolicy) {
// Ignore request
}
}

View File

@ -1,11 +1,16 @@
package app.revanced.integrations.patches;
import app.revanced.integrations.settings.SettingsEnum;
public final class HidePlayerButtonsPatch {
public static boolean hideButtons() {
return SettingsEnum.HIDE_PLAYER_BUTTONS.getBoolean();
/**
* Injection point.
*/
public static boolean previousOrNextButtonIsVisible(boolean previousOrNextButtonVisible) {
if (SettingsEnum.HIDE_PLAYER_BUTTONS.getBoolean()) {
return false;
}
return previousOrNextButtonVisible;
}
}

View File

@ -168,6 +168,7 @@ public final class AdsFilter extends Filter {
"text_image_button_layout",
"primetime_promo",
"product_details",
"carousel_headered_layout",
"full_width_portrait_image_layout",
"brand_video_shelf"
);

View File

@ -20,6 +20,11 @@ public final class ShortsFilter extends Filter {
"reel_channel_bar"
);
private final StringFilterGroup infoPanel = new StringFilterGroup(
SettingsEnum.HIDE_SHORTS_INFO_PANEL,
"shorts_info_panel_overview"
);
public ShortsFilter() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return;
@ -38,23 +43,38 @@ public final class ShortsFilter extends Filter {
"sponsor_button"
);
final var soundButton = new StringFilterGroup(
SettingsEnum.HIDE_SHORTS_SOUND_BUTTON,
"reel_pivot_button"
);
final var channelBar = new StringFilterGroup(
SettingsEnum.HIDE_SHORTS_CHANNEL_BAR,
"reel_channel_bar"
);
final var shorts = new StringFilterGroup(
SettingsEnum.HIDE_SHORTS,
"shorts_shelf",
"inline_shorts",
"shorts_grid"
"shorts_grid",
"shorts_video_cell"
);
this.pathFilterGroups.addAll(joinButton, subscribeButton);
this.pathFilterGroups.addAll(joinButton, subscribeButton, soundButton, channelBar);
this.identifierFilterGroups.addAll(shorts, thanksButton);
}
@Override
boolean isFiltered(final String path, final String identifier, final byte[] protobufBufferArray) {
boolean isFiltered(final String path, final String identifier,
final byte[] protobufBufferArray) {
// Filter the path only when reelChannelBar is visible.
if (reelChannelBar.check(path).isFiltered())
if (this.pathFilterGroups.contains(path)) return true;
// Shorts info panel path appears outside of reelChannelBar path.
if (infoPanel.isEnabled() && infoPanel.check(path).isFiltered()) return true;
return this.identifierFilterGroups.contains(identifier);
}

View File

@ -22,7 +22,7 @@ public class ProgressBarDrawable extends Drawable {
@Override
public void draw(@NonNull Canvas canvas) {
if (SettingsEnum.HIDE_SEEKBAR.getBoolean()) {
if (SettingsEnum.HIDE_SEEKBAR_THUMBNAIL.getBoolean()) {
return;
}
paint.setColor(SeekbarColorPatch.getCustomSeekbarColor());

View File

@ -51,12 +51,31 @@ public final class SeekbarColorPatch {
return customSeekbarColor;
}
/**
* Injection point.
*
* Overrides color when seekbar is clicked, and all Litho components that use the YouTube seekbar color.
* Overrides all Litho components that use the YouTube seekbar color.
* Used only for the video thumbnails seekbar.
*
* If {@link SettingsEnum#HIDE_SEEKBAR_THUMBNAIL} is enabled, this returns a fully transparent color.
*/
public static int getSeekbarColorOverride(int colorValue) {
public static int getLithoColor(int colorValue) {
if (colorValue == ORIGINAL_SEEKBAR_COLOR) {
if (SettingsEnum.HIDE_SEEKBAR_THUMBNAIL.getBoolean()) {
return 0x00000000;
}
return getSeekbarColorValue(ORIGINAL_SEEKBAR_COLOR);
}
return colorValue;
}
/**
* Injection point.
*
* Overrides color when video player seekbar is clicked.
*/
public static int getVideoPlayerSeekbarClickedColor(int colorValue) {
return colorValue == ORIGINAL_SEEKBAR_COLOR
? getSeekbarColorValue(ORIGINAL_SEEKBAR_COLOR)
: colorValue;
@ -65,18 +84,20 @@ public final class SeekbarColorPatch {
/**
* Injection point.
*
* If {@link SettingsEnum#HIDE_SEEKBAR} is enabled, this returns a fully transparent color.
*
* Otherwise the original color is changed to the custom seekbar color, while retaining
* Overrides color used for the video player seekbar.
*/
public static int getVideoPlayerSeekbarColor(int originalColor) {
return getSeekbarColorValue(originalColor);
}
/**
* Color parameter is changed to the custom seekbar color, while retaining
* the brightness and alpha changes of the parameter value compared to the original seekbar color.
*/
public static int getSeekbarColorValue(int originalColor) {
private static int getSeekbarColorValue(int originalColor) {
try {
if (SettingsEnum.HIDE_SEEKBAR.getBoolean()) {
return 0x00000000;
}
if (customSeekbarColor == ORIGINAL_SEEKBAR_COLOR) {
return originalColor; // Nothing to do
return originalColor; // nothing to do
}
final int alphaDifference = Color.alpha(originalColor) - Color.alpha(ORIGINAL_SEEKBAR_COLOR);

View File

@ -32,7 +32,7 @@ import java.util.Objects;
public enum SettingsEnum {
// External downloader
EXTERNAL_DOWNLOADER("revanced_external_downloader", BOOLEAN, TRUE),
EXTERNAL_DOWNLOADER("revanced_external_downloader", BOOLEAN, FALSE),
EXTERNAL_DOWNLOADER_PACKAGE_NAME("revanced_external_downloader_name", STRING,
"org.schabi.newpipe" /* NewPipe */, parents(EXTERNAL_DOWNLOADER)),
@ -116,6 +116,7 @@ public enum SettingsEnum {
HIDE_PLAYER_OVERLAY("revanced_hide_player_overlay", BOOLEAN, FALSE, true),
HIDE_PREVIEW_COMMENT("revanced_hide_preview_comment", BOOLEAN, FALSE, true),
HIDE_SEEKBAR("revanced_hide_seekbar", BOOLEAN, FALSE, true),
HIDE_SEEKBAR_THUMBNAIL("revanced_hide_seekbar_thumbnail", BOOLEAN, FALSE, true),
HIDE_HOME_BUTTON("revanced_hide_home_button", BOOLEAN, FALSE, true),
HIDE_SHORTS_BUTTON("revanced_hide_shorts_button", BOOLEAN, TRUE, true),
HIDE_SUBSCRIPTIONS_BUTTON("revanced_hide_subscriptions_button", BOOLEAN, FALSE, true),
@ -132,12 +133,15 @@ public enum SettingsEnum {
HIDE_FILTER_BAR_FEED_IN_FEED("revanced_hide_filter_bar_feed_in_feed", BOOLEAN, FALSE, true),
HIDE_FILTER_BAR_FEED_IN_SEARCH("revanced_hide_filter_bar_feed_in_search", BOOLEAN, FALSE, true),
HIDE_FILTER_BAR_FEED_IN_RELATED_VIDEOS("revanced_hide_filter_bar_feed_in_related_videos", BOOLEAN, FALSE, true),
HIDE_SHORTS_JOIN_BUTTON("revanced_hide_shorts_join_button", BOOLEAN, FALSE),
HIDE_SHORTS_JOIN_BUTTON("revanced_hide_shorts_join_button", BOOLEAN, TRUE),
HIDE_SHORTS_SUBSCRIBE_BUTTON("revanced_hide_shorts_subscribe_button", BOOLEAN, FALSE),
HIDE_SHORTS_THANKS_BUTTON("revanced_hide_shorts_thanks_button", BOOLEAN, FALSE),
HIDE_SHORTS_THANKS_BUTTON("revanced_hide_shorts_thanks_button", BOOLEAN, TRUE),
HIDE_SHORTS_COMMENTS_BUTTON("revanced_hide_shorts_comments_button", BOOLEAN, FALSE),
HIDE_SHORTS_REMIX_BUTTON("revanced_hide_shorts_remix_button", BOOLEAN, FALSE),
HIDE_SHORTS_REMIX_BUTTON("revanced_hide_shorts_remix_button", BOOLEAN, TRUE),
HIDE_SHORTS_SHARE_BUTTON("revanced_hide_shorts_share_button", BOOLEAN, FALSE),
HIDE_SHORTS_INFO_PANEL("revanced_hide_shorts_info_panel", BOOLEAN, TRUE),
HIDE_SHORTS_SOUND_BUTTON("revanced_hide_shorts_sound_button", BOOLEAN, FALSE),
HIDE_SHORTS_CHANNEL_BAR("revanced_hide_shorts_channel_bar", BOOLEAN, FALSE),
HIDE_SHORTS_NAVIGATION_BAR("revanced_hide_shorts_navigation_bar", BOOLEAN, TRUE, true),
HIDE_SHORTS("revanced_hide_shorts", BOOLEAN, FALSE, true),

View File

@ -13,16 +13,16 @@ import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.utils.StringRef;
public class DownloadButton extends BottomControlButton {
public class ExternalDownloadButton extends BottomControlButton {
@Nullable
private static DownloadButton instance;
private static ExternalDownloadButton instance;
public DownloadButton(ViewGroup viewGroup) {
public ExternalDownloadButton(ViewGroup viewGroup) {
super(
viewGroup,
"download_button",
"external_download_button",
SettingsEnum.EXTERNAL_DOWNLOADER,
DownloadButton::onDownloadClick,
ExternalDownloadButton::onDownloadClick,
null
);
}
@ -32,7 +32,7 @@ public class DownloadButton extends BottomControlButton {
*/
public static void initializeButton(View view) {
try {
instance = new DownloadButton((ViewGroup) view);
instance = new ExternalDownloadButton((ViewGroup) view);
} catch (Exception ex) {
LogHelper.printException(() -> "initializeButton failure", ex);
}
@ -46,7 +46,7 @@ public class DownloadButton extends BottomControlButton {
}
private static void onDownloadClick(View view) {
LogHelper.printDebug(() -> "Download button clicked");
LogHelper.printDebug(() -> "External download button clicked");
final var context = view.getContext();
var downloaderPackageName = SettingsEnum.EXTERNAL_DOWNLOADER_PACKAGE_NAME.getString();
@ -55,12 +55,12 @@ public class DownloadButton extends BottomControlButton {
try {
packageEnabled = context.getPackageManager().getApplicationInfo(downloaderPackageName, 0).enabled;
} catch (PackageManager.NameNotFoundException error) {
LogHelper.printDebug(() -> "Downloader could not be found: " + error);
LogHelper.printDebug(() -> "External downloader could not be found: " + error);
}
// If the package is not installed, show the toast
if (!packageEnabled) {
ReVancedUtils.showToastLong(downloaderPackageName + " " + StringRef.str("downloader_not_installed_warning"));
ReVancedUtils.showToastLong(downloaderPackageName + " " + StringRef.str("external_downloader_not_installed_warning"));
return;
}

View File

@ -1,3 +1,3 @@
org.gradle.jvmargs = -Xmx2048m
android.useAndroidX = true
version = 0.108.0
version = 0.109.0-dev.6