mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-01-11 22:40:19 +00:00
Update DontEatMyContent (v1.0.6 -> v1.0.8)
This commit is contained in:
parent
63ab1ff6c8
commit
146ed16122
7 changed files with 7 additions and 248 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -39,3 +39,6 @@
|
|||
[submodule "Tweaks/RemoteLog"]
|
||||
path = Tweaks/RemoteLog
|
||||
url = https://github.com/Muirey03/RemoteLog
|
||||
[submodule "Tweaks/DontEatMyContent"]
|
||||
path = Tweaks/DontEatMyContent
|
||||
url = https://github.com/therealFoxster/DontEatMyContent
|
||||
|
|
|
|||
1
Bundles/DontEatMyContent.bundle
Symbolic link
1
Bundles/DontEatMyContent.bundle
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../Tweaks/DontEatMyContent/layout/Library/Application Support/DontEatMyContent.bundle
|
||||
32
Header.h
32
Header.h
|
|
@ -28,8 +28,6 @@
|
|||
#define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil]
|
||||
#define YT_BUNDLE_ID @"com.google.ios.youtube"
|
||||
#define YT_NAME @"YouTube"
|
||||
#define DEMC_UNSUPPORTED_DEVICES @[@"iPhone14,3", @"iPhone14,6", @"iPhone14,8"] // DontEatMycontent
|
||||
#define DEMC_THRESHOLD 1.99 // DontEatMycontent
|
||||
#define DEFAULT_RATE 2.0f // YTSpeed
|
||||
|
||||
// IAmYouTube
|
||||
|
|
@ -76,36 +74,6 @@
|
|||
@property UIButton *downloadsButton;
|
||||
@end
|
||||
|
||||
// DontEatMyContent
|
||||
BOOL DEMC_deviceIsSupported();
|
||||
void DEMC_activate();
|
||||
void DEMC_deactivate();
|
||||
void DEMC_centerRenderingView();
|
||||
|
||||
@interface YTPlayerView : UIView
|
||||
- (id)renderingView;
|
||||
@end
|
||||
|
||||
@interface YTMainAppVideoPlayerOverlayViewController : UIViewController
|
||||
- (BOOL)isFullscreen;
|
||||
@end
|
||||
|
||||
@interface HAMSBDLSampleBufferRenderingView : UIView
|
||||
@end
|
||||
|
||||
@interface MLHAMSBDLSampleBufferRenderingView : HAMSBDLSampleBufferRenderingView
|
||||
@end
|
||||
|
||||
@interface YTMainAppEngagementPanelViewController : UIViewController
|
||||
- (BOOL)isLandscapeEngagementPanel;
|
||||
- (BOOL)isPeekingSupported;
|
||||
@end
|
||||
|
||||
@interface YTEngagementPanelContainerViewController : UIViewController
|
||||
- (BOOL)isLandscapeEngagementPanel;
|
||||
- (BOOL)isPeekingSupported;
|
||||
@end
|
||||
|
||||
// YTSpeed
|
||||
@interface YTVarispeedSwitchControllerOption : NSObject
|
||||
- (id)initWithTitle:(id)title rate:(float)rate;
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -29,7 +29,7 @@ BUNDLE_ID = com.google.ios.youtube
|
|||
$(TWEAK_NAME)_FILES = uYouPlus.xm Settings.xm
|
||||
$(TWEAK_NAME)_FRAMEWORKS = UIKit Security
|
||||
$(TWEAK_NAME)_CFLAGS = -fobjc-arc -DTWEAK_VERSION=\"$(PACKAGE_VERSION)\"
|
||||
$(TWEAK_NAME)_INJECT_DYLIBS = Tweaks/uYou/Library/MobileSubstrate/DynamicLibraries/uYou.dylib $(THEOS_OBJ_DIR)/libFLEX.dylib $(THEOS_OBJ_DIR)/iSponsorBlock.dylib $(THEOS_OBJ_DIR)/YouPiP.dylib $(THEOS_OBJ_DIR)/YouTubeDislikesReturn.dylib $(THEOS_OBJ_DIR)/YTABConfig.dylib $(THEOS_OBJ_DIR)/YTUHD.dylib
|
||||
$(TWEAK_NAME)_INJECT_DYLIBS = Tweaks/uYou/Library/MobileSubstrate/DynamicLibraries/uYou.dylib $(THEOS_OBJ_DIR)/libFLEX.dylib $(THEOS_OBJ_DIR)/iSponsorBlock.dylib $(THEOS_OBJ_DIR)/YouPiP.dylib $(THEOS_OBJ_DIR)/YouTubeDislikesReturn.dylib $(THEOS_OBJ_DIR)/YTABConfig.dylib $(THEOS_OBJ_DIR)/YTUHD.dylib $(THEOS_OBJ_DIR)/DontEatMyContent.dylib
|
||||
$(TWEAK_NAME)_EMBED_LIBRARIES = $(THEOS_OBJ_DIR)/libcolorpicker.dylib
|
||||
$(TWEAK_NAME)_EMBED_FRAMEWORKS = $(_THEOS_LOCAL_DATA_DIR)/$(THEOS_OBJ_DIR_NAME)/install/Library/Frameworks/Alderis.framework
|
||||
$(TWEAK_NAME)_EMBED_BUNDLES = $(wildcard Bundles/*.bundle)
|
||||
|
|
@ -37,7 +37,7 @@ $(TWEAK_NAME)_EMBED_EXTENSIONS = $(wildcard Extensions/*.appex)
|
|||
|
||||
include $(THEOS)/makefiles/common.mk
|
||||
ifneq ($(JAILBROKEN),1)
|
||||
SUBPROJECTS += Tweaks/Alderis Tweaks/FLEXing/libflex Tweaks/iSponsorBlock Tweaks/Return-YouTube-Dislikes Tweaks/YouPiP Tweaks/YTABConfig Tweaks/YTUHD
|
||||
SUBPROJECTS += Tweaks/Alderis Tweaks/FLEXing/libflex Tweaks/iSponsorBlock Tweaks/Return-YouTube-Dislikes Tweaks/YouPiP Tweaks/YTABConfig Tweaks/YTUHD Tweaks/DontEatMyContent
|
||||
include $(THEOS_MAKE_PATH)/aggregate.mk
|
||||
endif
|
||||
include $(THEOS_MAKE_PATH)/tweak.mk
|
||||
|
|
|
|||
10
Settings.xm
10
Settings.xm
|
|
@ -218,16 +218,6 @@ extern NSBundle *uYouPlusBundle();
|
|||
return YES;
|
||||
}
|
||||
settingItemId:0],
|
||||
|
||||
[YTSettingsSectionItemClass switchItemWithTitle:LOC(@"DONT_EAT_MY_CONTENT")
|
||||
titleDescription:LOC(@"DONT_EAT_MY_CONTENT_DESC")
|
||||
accessibilityIdentifier:nil
|
||||
switchOn:IsEnabled(@"dontEatMyContent_enabled")
|
||||
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
|
||||
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"dontEatMyContent_enabled"];
|
||||
return YES;
|
||||
}
|
||||
settingItemId:0],
|
||||
];
|
||||
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"VIDEO_CONTROLS_OVERLAY_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]];
|
||||
[settingsViewController pushViewController:picker];
|
||||
|
|
|
|||
1
Tweaks/DontEatMyContent
Submodule
1
Tweaks/DontEatMyContent
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit ff8bfdfd273f139e6e49c4021e9a1f139eb9fee5
|
||||
204
uYouPlus.xm
204
uYouPlus.xm
|
|
@ -381,207 +381,6 @@ static void replaceTab(YTIGuideResponse *response) {
|
|||
%end
|
||||
%end
|
||||
|
||||
// DontEatMyContent - @therealFoxster: https://github.com/therealFoxster/DontEatMyContent
|
||||
static double videoAspectRatio = 16/9;
|
||||
static bool zoomedToFill = false;
|
||||
static bool engagementPanelIsVisible = false, removeEngagementPanelViewControllerWithIdentifierCalled = false;
|
||||
|
||||
static MLHAMSBDLSampleBufferRenderingView *renderingView;
|
||||
static NSLayoutConstraint *widthConstraint, *heightConstraint, *centerXConstraint, *centerYConstraint;
|
||||
|
||||
%group gDontEatMyContent
|
||||
|
||||
// Retrieve video aspect ratio
|
||||
%hook YTPlayerView
|
||||
- (void)setAspectRatio:(CGFloat)aspectRatio {
|
||||
%orig(aspectRatio);
|
||||
videoAspectRatio = aspectRatio;
|
||||
}
|
||||
%end
|
||||
|
||||
%hook YTPlayerViewController
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
YTPlayerView *playerView = [self playerView];
|
||||
UIView *renderingViewContainer = MSHookIvar<UIView *>(playerView, "_renderingViewContainer");
|
||||
renderingView = [playerView renderingView];
|
||||
|
||||
// Making renderingView a bit larger since constraining to safe area leaves a gap between the notch and video
|
||||
CGFloat constant = 22.0; // Tested on iPhone 13 mini & 14 Pro Max
|
||||
|
||||
widthConstraint = [renderingView.widthAnchor constraintEqualToAnchor:renderingViewContainer.safeAreaLayoutGuide.widthAnchor constant:constant];
|
||||
heightConstraint = [renderingView.heightAnchor constraintEqualToAnchor:renderingViewContainer.safeAreaLayoutGuide.heightAnchor constant:constant];
|
||||
centerXConstraint = [renderingView.centerXAnchor constraintEqualToAnchor:renderingViewContainer.centerXAnchor];
|
||||
centerYConstraint = [renderingView.centerYAnchor constraintEqualToAnchor:renderingViewContainer.centerYAnchor];
|
||||
|
||||
// playerView.backgroundColor = [UIColor blueColor];
|
||||
// renderingViewContainer.backgroundColor = [UIColor greenColor];
|
||||
// renderingView.backgroundColor = [UIColor redColor];
|
||||
|
||||
YTMainAppVideoPlayerOverlayViewController *activeVideoPlayerOverlay = [self activeVideoPlayerOverlay];
|
||||
|
||||
// Must check class since YTInlineMutedPlaybackPlayerOverlayViewController doesn't have -(BOOL)isFullscreen
|
||||
if ([NSStringFromClass([activeVideoPlayerOverlay class]) isEqualToString:@"YTMainAppVideoPlayerOverlayViewController"] // isKindOfClass doesn't work for some reason
|
||||
&& [activeVideoPlayerOverlay isFullscreen]) {
|
||||
if (!zoomedToFill && !engagementPanelIsVisible) DEMC_activate();
|
||||
} else {
|
||||
DEMC_centerRenderingView();
|
||||
}
|
||||
|
||||
%orig(animated);
|
||||
}
|
||||
- (void)didPressToggleFullscreen {
|
||||
%orig;
|
||||
if (![[self activeVideoPlayerOverlay] isFullscreen]) { // Entering full screen
|
||||
if (!zoomedToFill && !engagementPanelIsVisible) DEMC_activate();
|
||||
} else { // Exiting full screen
|
||||
DEMC_deactivate();
|
||||
}
|
||||
|
||||
%orig;
|
||||
}
|
||||
- (void)didSwipeToEnterFullscreen {
|
||||
%orig;
|
||||
if (!zoomedToFill && !engagementPanelIsVisible) DEMC_activate();
|
||||
}
|
||||
- (void)didSwipeToExitFullscreen {
|
||||
%orig;
|
||||
DEMC_deactivate();
|
||||
}
|
||||
// New video played
|
||||
-(void)playbackController:(id)playbackController didActivateVideo:(id)video withPlaybackData:(id)playbackData {
|
||||
%orig(playbackController, video, playbackData);
|
||||
if ([[self activeVideoPlayerOverlay] isFullscreen]) // New video played while in full screen (landscape)
|
||||
// Activate since new videos played in full screen aren't zoomed-to-fill by default
|
||||
// (i.e. the notch/Dynamic Island will cut into content when playing a new video in full screen)
|
||||
DEMC_activate();
|
||||
engagementPanelIsVisible = false;
|
||||
removeEngagementPanelViewControllerWithIdentifierCalled = false;
|
||||
}
|
||||
%end
|
||||
|
||||
// Pinch to zoom
|
||||
%hook YTVideoFreeZoomOverlayView
|
||||
- (void)didRecognizePinch:(UIPinchGestureRecognizer *)pinchGestureRecognizer {
|
||||
DEMC_deactivate();
|
||||
%orig(pinchGestureRecognizer);
|
||||
}
|
||||
// Detect zoom to fill
|
||||
- (void)showLabelForSnapState:(NSInteger)snapState {
|
||||
if (snapState == 0) { // Original
|
||||
zoomedToFill = false;
|
||||
DEMC_activate();
|
||||
} else if (snapState == 1) { // Zoomed to fill
|
||||
zoomedToFill = true;
|
||||
// No need to deactivate constraints as it's already done in -(void)didRecognizePinch:(UIPinchGestureRecognizer *)
|
||||
}
|
||||
%orig(snapState);
|
||||
}
|
||||
%end
|
||||
|
||||
// Mini bar dismiss
|
||||
%hook YTWatchMiniBarViewController
|
||||
- (void)dismissMiniBarWithVelocity:(CGFloat)velocity gestureType:(int)gestureType {
|
||||
%orig(velocity, gestureType);
|
||||
zoomedToFill = false; // Setting to false since YouTube undoes zoom-to-fill when mini bar is dismissed
|
||||
}
|
||||
- (void)dismissMiniBarWithVelocity:(CGFloat)velocity gestureType:(int)gestureType skipShouldDismissCheck:(BOOL)skipShouldDismissCheck {
|
||||
%orig(velocity, gestureType, skipShouldDismissCheck);
|
||||
zoomedToFill = false;
|
||||
}
|
||||
%end
|
||||
|
||||
%hook YTMainAppEngagementPanelViewController
|
||||
// Engagement panel (comment, description, etc.) about to show up
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
if ([self isPeekingSupported]) {
|
||||
// Shorts (only Shorts support peeking, I think)
|
||||
} else {
|
||||
// Everything else
|
||||
engagementPanelIsVisible = true;
|
||||
if ([self isLandscapeEngagementPanel]) {
|
||||
DEMC_deactivate();
|
||||
}
|
||||
}
|
||||
%orig(animated);
|
||||
}
|
||||
// Engagement panel about to dismiss
|
||||
// - (void)viewDidDisappear:(BOOL)animated { %orig; %log; } // Called too late & isn't reliable so sometimes constraints aren't activated even when engagement panel is closed
|
||||
%end
|
||||
|
||||
%hook YTEngagementPanelContainerViewController
|
||||
// Engagement panel about to dismiss
|
||||
- (void)notifyEngagementPanelContainerControllerWillHideFinalPanel { // Called in time but crashes if plays new video while in full screen causing engagement panel dismissal
|
||||
// Must check if engagement panel was dismissed because new video played
|
||||
// (i.e. if -(void)removeEngagementPanelViewControllerWithIdentifier:(id) was called prior)
|
||||
if (![self isPeekingSupported] && !removeEngagementPanelViewControllerWithIdentifierCalled) {
|
||||
engagementPanelIsVisible = false;
|
||||
if ([self isLandscapeEngagementPanel] && !zoomedToFill) {
|
||||
DEMC_activate();
|
||||
}
|
||||
}
|
||||
%orig;
|
||||
}
|
||||
- (void)removeEngagementPanelViewControllerWithIdentifier:(id)identifier {
|
||||
// Usually called when engagement panel is open & new video is played or mini bar is dismissed
|
||||
removeEngagementPanelViewControllerWithIdentifierCalled = true;
|
||||
%orig(identifier);
|
||||
}
|
||||
%end
|
||||
|
||||
%end// group gDontEatMyContent
|
||||
|
||||
BOOL DEMC_deviceIsSupported() {
|
||||
// Get device model identifier (e.g. iPhone14,4)
|
||||
// https://stackoverflow.com/a/11197770/19227228
|
||||
struct utsname systemInfo;
|
||||
uname(&systemInfo);
|
||||
NSString *deviceModelID = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
|
||||
|
||||
NSArray *unsupportedModelIDs = DEMC_UNSUPPORTED_DEVICES;
|
||||
for (NSString *identifier in unsupportedModelIDs) {
|
||||
if ([deviceModelID isEqualToString:identifier]) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
if ([deviceModelID containsString:@"iPhone"]) {
|
||||
if ([deviceModelID isEqualToString:@"iPhone13,1"]) {
|
||||
// iPhone 12 mini
|
||||
return YES;
|
||||
}
|
||||
NSString *modelNumber = [[deviceModelID stringByReplacingOccurrencesOfString:@"iPhone" withString:@""] stringByReplacingOccurrencesOfString:@"," withString:@"."];
|
||||
if ([modelNumber floatValue] >= 14.0) {
|
||||
// iPhone 13 series and newer
|
||||
return YES;
|
||||
} else return NO;
|
||||
} else return NO;
|
||||
}
|
||||
|
||||
void DEMC_activate() {
|
||||
if (videoAspectRatio < DEMC_THRESHOLD) {
|
||||
DEMC_deactivate();
|
||||
return;
|
||||
}
|
||||
// NSLog(@"activate");
|
||||
DEMC_centerRenderingView();
|
||||
renderingView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
widthConstraint.active = YES;
|
||||
heightConstraint.active = YES;
|
||||
}
|
||||
|
||||
void DEMC_deactivate() {
|
||||
// NSLog(@"deactivate");
|
||||
DEMC_centerRenderingView();
|
||||
renderingView.translatesAutoresizingMaskIntoConstraints = YES;
|
||||
widthConstraint.active = NO;
|
||||
heightConstraint.active = NO;
|
||||
}
|
||||
|
||||
void DEMC_centerRenderingView() {
|
||||
centerXConstraint.active = YES;
|
||||
centerYConstraint.active = YES;
|
||||
}
|
||||
|
||||
// YTSpeed - https://github.com/Lyvendia/YTSpeed
|
||||
%hook YTVarispeedSwitchController
|
||||
- (id)init {
|
||||
|
|
@ -1126,9 +925,6 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
|
|||
if (IsEnabled(@"bigYTMiniPlayer_enabled") && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) {
|
||||
%init(Main);
|
||||
}
|
||||
if (IsEnabled(@"dontEatMyContent_enabled") && DEMC_deviceIsSupported()) {
|
||||
%init(gDontEatMyContent);
|
||||
}
|
||||
if (IsEnabled(@"hidePreviousAndNextButton_enabled")) {
|
||||
%init(gHidePreviousAndNextButton);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue