Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
chore: Merge branch dev to main (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Sep 30, 2024
2 parents f49d634 + a55269d commit 9b57082
Show file tree
Hide file tree
Showing 17 changed files with 310 additions and 161 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# [1.15.0-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.15.0-dev.1...v1.15.0-dev.2) (2024-09-29)


### Features

* **YouTube - Hide Shorts components:** Add `Hide save music`, `Hide stickers` ([#703](https://github.com/ReVanced/revanced-integrations/issues/703)) ([a87456e](https://github.com/ReVanced/revanced-integrations/commit/a87456e49995e2ed5f4788e71db8f2387bc241f9))

# [1.15.0-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.14.3-dev.2...v1.15.0-dev.1) (2024-09-29)


### Features

* **YouTube - Disable precise seeking gesture:** Hide "pull up" label that shows up when swiping ([#696](https://github.com/ReVanced/revanced-integrations/issues/696)) ([0b9afd0](https://github.com/ReVanced/revanced-integrations/commit/0b9afd022dbf622478bb931124ac41a969610c64))

## [1.14.3-dev.2](https://github.com/ReVanced/revanced-integrations/compare/v1.14.3-dev.1...v1.14.3-dev.2) (2024-09-26)


### Bug Fixes

* **YouTube - Check watch history domain name resolution:** Do not show warning if network connection is flaky ([#702](https://github.com/ReVanced/revanced-integrations/issues/702)) ([80482df](https://github.com/ReVanced/revanced-integrations/commit/80482df3fae05cd5bd9e3b430022f07cf118565c))

## [1.14.3-dev.1](https://github.com/ReVanced/revanced-integrations/compare/v1.14.2...v1.14.3-dev.1) (2024-09-23)


### Bug Fixes

* **YouTube:** Show video chapter titles without clipping when overlay buttons are enabled ([#699](https://github.com/ReVanced/revanced-integrations/issues/699)) ([325cc17](https://github.com/ReVanced/revanced-integrations/commit/325cc179001bb79366f4ed6a5f84f717fbff66b6))

## [1.14.2](https://github.com/ReVanced/revanced-integrations/compare/v1.14.1...v1.14.2) (2024-09-23)


Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/app/revanced/integrations/shared/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,10 @@ public static boolean containsNumber(@NonNull CharSequence text) {
}

/**
* Ignore this class. It must be public to satisfy Android requirement.
* Ignore this class. It must be public to satisfy Android requirements.
*/
@SuppressWarnings("deprecation")
public static class DialogFragmentWrapper extends DialogFragment {
public static final class DialogFragmentWrapper extends DialogFragment {

private Dialog dialog;
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
private static final String SINKHOLE_IPV4 = "0.0.0.0";
private static final String SINKHOLE_IPV6 = "::";

/** @noinspection SameParameterValue */
private static boolean domainResolvesToValidIP(String host) {
try {
InetAddress address = InetAddress.getByName(host);
Expand Down Expand Up @@ -50,7 +49,16 @@ public static void checkDnsResolver(Activity context) {

Utils.runOnBackgroundThread(() -> {
try {
if (domainResolvesToValidIP(HISTORY_TRACKING_ENDPOINT)) {
// If the user has a flaky DNS server, or they just lost internet connectivity
// and the isNetworkConnected() check has not detected it yet (it can take a few
// seconds after losing connection), then the history tracking endpoint will
// show a resolving error but it's actually an internet connection problem.
//
// Prevent this false positive by verify youtube.com resolves.
// If youtube.com does not resolve, then it's not a watch history domain resolving error
// because the entire app will not work since no domains are resolving.
if (domainResolvesToValidIP(HISTORY_TRACKING_ENDPOINT)
|| !domainResolvesToValidIP("youtube.com")) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
package app.revanced.integrations.youtube.patches;

import android.view.MotionEvent;
import android.view.VelocityTracker;

import app.revanced.integrations.youtube.settings.Settings;

@SuppressWarnings("unused")
public final class DisablePreciseSeekingGesturePatch {
/**
* Disables the gesture that is used to seek precisely.
* @param tracker The velocity tracker that is used to determine the gesture.
* @param event The motion event that is used to determine the gesture.
*/
public static void disableGesture(VelocityTracker tracker, MotionEvent event) {
if (Settings.DISABLE_PRECISE_SEEKING_GESTURE.get()) return;

tracker.addMovement(event);
public static boolean isGestureDisabled() {
return Settings.DISABLE_PRECISE_SEEKING_GESTURE.get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package app.revanced.integrations.youtube.patches;

import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ImageView;

import app.revanced.integrations.shared.Logger;

@SuppressWarnings("unused")
public class PlayerControlsPatch {
/**
* Injection point.
*/
public static void setFullscreenCloseButton(ImageView imageButton) {
// Add a global listener, since the protected method
// View#onVisibilityChanged() does not have any call backs.
imageButton.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
int lastVisibility = View.VISIBLE;

@Override
public void onGlobalLayout() {
try {
final int visibility = imageButton.getVisibility();
if (lastVisibility != visibility) {
lastVisibility = visibility;

Logger.printDebug(() -> "fullscreen button visibility: "
+ (visibility == View.VISIBLE ? "VISIBLE" :
visibility == View.GONE ? "GONE" : "INVISIBLE"));

fullscreenButtonVisibilityChanged(visibility == View.VISIBLE);
}
} catch (Exception ex) {
Logger.printDebug(() -> "OnGlobalLayoutListener failure", ex);
}
}
});
}

// noinspection EmptyMethod
public static void fullscreenButtonVisibilityChanged(boolean isVisible) {
// Code added during patching.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,8 @@ public LayoutComponentsFilter() {
);

// The player audio track button does the exact same function as the audio track flyout menu option.
// But if the copy url button is shown, these button clashes and the the audio button does not work.
// Previously this was a setting to show/hide the player button.
// But it was decided it's simpler to always hide this button because:
// - it doesn't work with copy video url feature
// - the button is rare
// - always hiding makes the ReVanced settings simpler and easier to understand
// - nobody is going to notice the redundant button is always hidden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ public ShortsFilter() {
"shorts_info_panel_overview"
);

StringFilterGroup stickers = new StringFilterGroup(
Settings.HIDE_SHORTS_STICKERS,
"stickers_layer.eml"
);

joinButton = new StringFilterGroup(
Settings.HIDE_SHORTS_JOIN_BUTTON,
"sponsor_button"
Expand Down Expand Up @@ -140,7 +145,7 @@ public ShortsFilter() {
addPathCallbacks(
shortsCompactFeedVideoPath, suggestedAction, actionBar, joinButton, subscribeButton,
paidPromotionButton, pausedOverlayButtons, channelBar, fullVideoLinkLabel, videoTitle,
reelSoundMetadata, soundButton, infoPanel
reelSoundMetadata, soundButton, infoPanel, stickers
);

//
Expand Down Expand Up @@ -193,7 +198,13 @@ public ShortsFilter() {
),
new ByteArrayFilterGroup(
Settings.HIDE_SHORTS_SAVE_SOUND_BUTTON,
"yt_outline_list_add_"
"yt_outline_bookmark_",
// 'Save sound' button. It seems this has been removed and only 'Save music' is used.
// Still hide this in case it's still present.
"yt_outline_list_add_",
// 'Use this sound' button. It seems this has been removed and only 'Save music' is used.
// Still hide this in case it's still present.
"yt_outline_camera_"
),
new ByteArrayFilterGroup(
Settings.HIDE_SHORTS_SEARCH_SUGGESTIONS,
Expand All @@ -202,10 +213,6 @@ public ShortsFilter() {
new ByteArrayFilterGroup(
Settings.HIDE_SHORTS_SUPER_THANKS_BUTTON,
"yt_outline_dollar_sign_heart_"
),
new ByteArrayFilterGroup(
Settings.HIDE_SHORTS_USE_THIS_SOUND_BUTTON,
"yt_outline_camera_"
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,9 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_SHORTS_SHOP_BUTTON = new BooleanSetting("revanced_hide_shorts_shop_button", TRUE);
public static final BooleanSetting HIDE_SHORTS_TAGGED_PRODUCTS = new BooleanSetting("revanced_hide_shorts_tagged_products", TRUE);
public static final BooleanSetting HIDE_SHORTS_LOCATION_LABEL = new BooleanSetting("revanced_hide_shorts_location_label", FALSE);
// Save sound to playlist and Search suggestions may have been A/B tests that were abandoned by YT, and it's not clear if these are still used.
public static final BooleanSetting HIDE_SHORTS_SAVE_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_save_sound_button", FALSE);
public static final BooleanSetting HIDE_SHORTS_USE_THIS_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_use_this_sound_button", TRUE);
public static final BooleanSetting HIDE_SHORTS_SAVE_SOUND_BUTTON = new BooleanSetting("revanced_hide_shorts_save_sound_button", TRUE);
public static final BooleanSetting HIDE_SHORTS_SEARCH_SUGGESTIONS = new BooleanSetting("revanced_hide_shorts_search_suggestions", FALSE);
public static final BooleanSetting HIDE_SHORTS_STICKERS = new BooleanSetting("revanced_hide_shorts_stickers", TRUE);
public static final BooleanSetting HIDE_SHORTS_SUPER_THANKS_BUTTON = new BooleanSetting("revanced_hide_shorts_super_thanks_button", TRUE);
public static final BooleanSetting HIDE_SHORTS_LIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_like_button", FALSE);
public static final BooleanSetting HIDE_SHORTS_DISLIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_dislike_button", FALSE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import app.revanced.integrations.youtube.settings.Settings;
import app.revanced.integrations.shared.Logger;
import app.revanced.integrations.shared.Utils;
import app.revanced.integrations.youtube.videoplayer.BottomControlButton;
import app.revanced.integrations.youtube.videoplayer.PlayerControlButton;

// Edit: This should be a subclass of PlayerControlButton
public class CreateSegmentButtonController {
private static WeakReference<ImageView> buttonReference = new WeakReference<>(null);
private static boolean isShowing;
Expand All @@ -27,35 +28,38 @@ public static void initialize(View youtubeControlsLayout) {
ImageView imageView = Objects.requireNonNull(youtubeControlsLayout.findViewById(
getResourceIdentifier("revanced_sb_create_segment_button", "id")));
imageView.setVisibility(View.GONE);
imageView.setOnClickListener(v -> {
SponsorBlockViewController.toggleNewSegmentLayoutVisibility();
});
imageView.setOnClickListener(v -> SponsorBlockViewController.toggleNewSegmentLayoutVisibility());

buttonReference = new WeakReference<>(imageView);
} catch (Exception ex) {
Logger.printException(() -> "initialize failure", ex);
}
}

public static void changeVisibilityImmediate(boolean visible) {
changeVisibility(visible, true);
}

/**
* injection point
*/
public static void changeVisibilityNegatedImmediate(boolean visible) {
changeVisibility(!visible, true);
public static void changeVisibilityImmediate(boolean visible) {
if (visible) {
// Fix button flickering, by pushing this call to the back of
// the main thread and letting other layout code run first.
Utils.runOnMainThread(() -> setVisibility(true, false));
} else {
setVisibility(false, false);
}
}

/**
* injection point
*/
public static void changeVisibility(boolean visible) {
changeVisibility(visible, false);
public static void changeVisibility(boolean visible, boolean animated) {
// Ignore this call, otherwise with full screen thumbnails the buttons are visible while seeking.
if (visible && !animated) return;

setVisibility(visible, animated);
}

public static void changeVisibility(boolean visible, boolean immediate) {
private static void setVisibility(boolean visible, boolean animated) {
try {
if (isShowing == visible) return;
isShowing = visible;
Expand All @@ -68,17 +72,17 @@ public static void changeVisibility(boolean visible, boolean immediate) {
if (!shouldBeShown()) {
return;
}
if (!immediate) {
iView.startAnimation(BottomControlButton.getButtonFadeIn());
if (animated) {
iView.startAnimation(PlayerControlButton.getButtonFadeIn());
}
iView.setVisibility(View.VISIBLE);
return;
}

if (iView.getVisibility() == View.VISIBLE) {
iView.clearAnimation();
if (!immediate) {
iView.startAnimation(BottomControlButton.getButtonFadeOut());
if (animated) {
iView.startAnimation(PlayerControlButton.getButtonFadeOut());
}
iView.setVisibility(View.GONE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
import app.revanced.integrations.youtube.sponsorblock.SponsorBlockUtils;
import app.revanced.integrations.shared.Logger;
import app.revanced.integrations.shared.Utils;
import app.revanced.integrations.youtube.videoplayer.BottomControlButton;
import app.revanced.integrations.youtube.videoplayer.PlayerControlButton;

// Edit: This should be a subclass of PlayerControlButton
public class VotingButtonController {
private static WeakReference<ImageView> buttonReference = new WeakReference<>(null);
private static boolean isShowing;
Expand All @@ -29,35 +30,41 @@ public static void initialize(View youtubeControlsLayout) {
ImageView imageView = Objects.requireNonNull(youtubeControlsLayout.findViewById(
getResourceIdentifier("revanced_sb_voting_button", "id")));
imageView.setVisibility(View.GONE);
imageView.setOnClickListener(v -> {
SponsorBlockUtils.onVotingClicked(v.getContext());
});
imageView.setOnClickListener(v -> SponsorBlockUtils.onVotingClicked(v.getContext()));

buttonReference = new WeakReference<>(imageView);
} catch (Exception ex) {
Logger.printException(() -> "Unable to set RelativeLayout", ex);
Logger.printException(() -> "initialize failure", ex);
}
}

/**
* injection point
*/
public static void changeVisibilityImmediate(boolean visible) {
changeVisibility(visible, true);
if (visible) {
// Fix button flickering, by pushing this call to the back of
// the main thread and letting other layout code run first.
Utils.runOnMainThread(() -> setVisibility(true, false));
} else {
setVisibility(false, false);
}
}

/**
* injection point
*/
public static void changeVisibilityNegatedImmediate(boolean visible) {
changeVisibility(!visible, true);
public static void changeVisibility(boolean visible, boolean animated) {
// Ignore this call, otherwise with full screen thumbnails the buttons are visible while seeking.
if (visible && !animated) return;

setVisibility(visible, animated);
}

/**
* injection point
*/
public static void changeVisibility(boolean visible) {
changeVisibility(visible, false);
}

public static void changeVisibility(boolean visible, boolean immediate) {
private static void setVisibility(boolean visible, boolean animated) {
try {
if (isShowing == visible) return;
isShowing = visible;
Expand All @@ -70,17 +77,17 @@ public static void changeVisibility(boolean visible, boolean immediate) {
if (!shouldBeShown()) {
return;
}
if (!immediate) {
iView.startAnimation(BottomControlButton.getButtonFadeIn());
if (animated) {
iView.startAnimation(PlayerControlButton.getButtonFadeIn());
}
iView.setVisibility(View.VISIBLE);
return;
}

if (iView.getVisibility() == View.VISIBLE) {
iView.clearAnimation();
if (!immediate) {
iView.startAnimation(BottomControlButton.getButtonFadeOut());
if (animated) {
iView.startAnimation(PlayerControlButton.getButtonFadeOut());
}
iView.setVisibility(View.GONE);
}
Expand Down
Loading

0 comments on commit 9b57082

Please sign in to comment.