dayanch96 / YTLite

A flexible enhancer for YouTube on iOS
445 stars 435 forks source link

Helpful Features for YTLite [Feature Request] #26

Closed arichornlover closed 7 months ago

arichornlover commented 1 year ago

I got some features that can be a pretty useful for YTLite!

// Hide the (Remix / Thanks / Download / Clip / Save) Buttons under the Video Player
%hook _ASDisplayView
- (void)layoutSubviews {
    %orig;
    BOOL hideRemixButton = kHideRemixButton;
    BOOL hideThanksButton = kHideThanksButton;
    BOOL hideAddToOfflineButton = kHideAddToOfflineButton;
    BOOL hideClipButton = kHideClipButton;
    BOOL hideSaveToPlaylistButton = kHideSaveToPlaylistButton;

    for (UIView *subview in self.subviews) {
        if ([subview.accessibilityIdentifier isEqualToString:@"id.video.remix.button"]) {
            subview.hidden = hideRemixButton;
        } else if ([subview.accessibilityLabel isEqualToString:@"Thanks"]) {
            subview.hidden = hideThanksButton;
        } else if ([subview.accessibilityIdentifier isEqualToString:@"id.ui.add_to.offline.button"]) {
            subview.hidden = hideAddToOfflineButton;
        } else if ([subview.accessibilityLabel isEqualToString:@"Clip"]) {
            subview.hidden = hideClipButton;
        } else if ([subview.accessibilityLabel isEqualToString:@"Save to playlist"]) {
            subview.hidden = hideSaveToPlaylistButton;
        }
    }
}
%end

⬆️ this code can hide the buttons under the video player but hold on. These will once again also include gaps just like how the option Hide Comment Section is.


%hook YTHeaderLogoController // Works on YouTube v16.05.7-v18.34.5
- (void)setPremiumLogo:(BOOL)isPremiumLogo {
    isPremiumLogo = YES;
    %orig;
}
- (BOOL)isPremiumLogo {
    return YES;
}
- (void)setTopbarLogoRenderer:(id)renderer {
}
%end

⬆️ this enables the YouTube Premium Logo on the YouTube App (this is won’t work with 18.35.4+ or later YouTube versions due to Navigation Bar Changes.)


%hook YTMainAppControlsOverlayView
- (void)layoutSubviews {
    %orig();
    MSHookIvar<YTTransportControlsButtonView *>(self, "_previousButtonView").backgroundColor = nil;
    MSHookIvar<YTTransportControlsButtonView *>(self, "_nextButtonView").backgroundColor = nil;
    MSHookIvar<YTTransportControlsButtonView *>(self, "_seekBackwardAccessibilityButtonView").backgroundColor = nil;
    MSHookIvar<YTTransportControlsButtonView *>(self, "_seekForwardAccessibilityButtonView").backgroundColor = nil;
    MSHookIvar<YTPlaybackButton *>(self, "_playPauseButton").backgroundColor = nil;
}
%end

⬆️ this code can hide the shadow overlay in the video player’s play/pause, previous, next, rewind & forward.


%hook YTMainAppControlsOverlayView
- (void)setShareButtonAvailable:(BOOL)arg1 {
    kEnableShareButton ? %orig(YES) : %orig(NO);
}
%end

⬆️ this can bring back the Share Button in the top right of the video player. IMG_1239

I’ll close this Issue if only if they’re not needed. 👍

dayanch96 commented 1 year ago

Hi. Sure, I’ll take a look today. Thanks!

arichornlover commented 10 months ago

And Dayanch, have this as a fix for the Watermarks

%hook YTMainAppVideoPlayerOverlayView

- (BOOL)isWatermarkEnabled {
    return NO;
}

%end

YouTube once again loves changing things.

edit: Something related to the YTAnnotationsViewController was changed on the newer yt versions.

arichornlover commented 9 months ago

Unrelated to the other stuff. Dayanch96, what do you think of this?

https://github.com/arichorn/uYouEnhanced/assets/78001398/f04ac266-3245-4b8e-bf2d-9631d19a7ae6

I’m currently working on to make the Menu from YouTube Reborn look better then what it currently has and this is the 1st beta of v5 of the tweak. And I’m telling you this to make sure I have permission to use those UIViewController headers from YTMusicUltimate

dayanch96 commented 9 months ago

Sure - feel free to use. There is nothing there other than what could be described in the Apple documentation

dayanch96 commented 7 months ago

Closing this issue since all we need is Comments under player and we have it in pull requests