Move patches to Patches.xm
This commit is contained in:
@@ -26,7 +26,7 @@ TWEAK_NAME = uYouPlus
|
|||||||
DISPLAY_NAME = YouTube
|
DISPLAY_NAME = YouTube
|
||||||
BUNDLE_ID = com.google.ios.youtube
|
BUNDLE_ID = com.google.ios.youtube
|
||||||
|
|
||||||
$(TWEAK_NAME)_FILES = Sources/uYouPlus.xm Sources/Settings.xm
|
$(TWEAK_NAME)_FILES = Sources/uYouPlus.xm Sources/Settings.xm Sources/Patches.xm
|
||||||
$(TWEAK_NAME)_FRAMEWORKS = UIKit Security
|
$(TWEAK_NAME)_FRAMEWORKS = UIKit Security
|
||||||
$(TWEAK_NAME)_CFLAGS = -fobjc-arc -DTWEAK_VERSION=\"$(PACKAGE_VERSION)\"
|
$(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 $(THEOS_OBJ_DIR)/DontEatMyContent.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
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
#import "uYouPlus.h"
|
||||||
|
|
||||||
|
# pragma mark - YouTube patches
|
||||||
|
|
||||||
|
// Fix Google Sign in by @PoomSmart and @level3tjg (qnblackcat/uYouPlus#684)
|
||||||
|
%hook NSBundle
|
||||||
|
- (NSDictionary *)infoDictionary {
|
||||||
|
NSMutableDictionary *info = %orig.mutableCopy;
|
||||||
|
NSString *altBundleIdentifier = info[@"ALTBundleIdentifier"];
|
||||||
|
if (altBundleIdentifier) info[@"CFBundleIdentifier"] = altBundleIdentifier;
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
// Workaround for MiRO92/uYou-for-YouTube#12, qnblackcat/uYouPlus#263
|
||||||
|
%hook YTDataUtils
|
||||||
|
+ (NSMutableDictionary *)spamSignalsDictionary {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
+ (NSMutableDictionary *)spamSignalsDictionaryWithoutIDFA {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
%hook YTHotConfig
|
||||||
|
- (BOOL)disableAfmaIdfaCollection { return NO; }
|
||||||
|
%end
|
||||||
|
|
||||||
|
// https://github.com/PoomSmart/YouTube-X/blob/1e62b68e9027fcb849a75f54a402a530385f2a51/Tweak.x#L27
|
||||||
|
// %hook YTAdsInnerTubeContextDecorator
|
||||||
|
// - (void)decorateContext:(id)context {}
|
||||||
|
// %end
|
||||||
|
|
||||||
|
# pragma mark - uYou patches
|
||||||
|
|
||||||
|
// Workaround for qnblackcat/uYouPlus#10
|
||||||
|
%hook UIViewController
|
||||||
|
- (UITraitCollection *)traitCollection {
|
||||||
|
@try {
|
||||||
|
return %orig;
|
||||||
|
} @catch(NSException *e) {
|
||||||
|
return [UITraitCollection currentTraitCollection];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
// Prevent uYou player bar from showing when not playing downloaded media
|
||||||
|
%hook PlayerManager
|
||||||
|
- (void)pause {
|
||||||
|
if (isnan([self progress]))
|
||||||
|
return;
|
||||||
|
%orig;
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
// Workaround for issue #54
|
||||||
|
%hook YTMainAppVideoPlayerOverlayViewController
|
||||||
|
- (void)updateRelatedVideos {
|
||||||
|
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"relatedVideosAtTheEndOfYTVideos"] == NO) {}
|
||||||
|
else { return %orig; }
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
// iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224
|
||||||
|
%group iOS16
|
||||||
|
%hook OBPrivacyLinkButton
|
||||||
|
%new
|
||||||
|
- (instancetype)initWithCaption:(NSString *)caption
|
||||||
|
buttonText:(NSString *)buttonText
|
||||||
|
image:(UIImage *)image
|
||||||
|
imageSize:(CGSize)imageSize
|
||||||
|
useLargeIcon:(BOOL)useLargeIcon {
|
||||||
|
return [self initWithCaption:caption
|
||||||
|
buttonText:buttonText
|
||||||
|
image:image
|
||||||
|
imageSize:imageSize
|
||||||
|
useLargeIcon:useLargeIcon
|
||||||
|
displayLanguage:[NSLocale currentLocale].languageCode];
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
%end
|
||||||
|
|
||||||
|
// Fix streched artwork in uYou's player view - https://github.com/MiRO92/uYou-for-YouTube/issues/287
|
||||||
|
%hook ArtworkImageView
|
||||||
|
- (id)imageView {
|
||||||
|
UIImageView * imageView = %orig;
|
||||||
|
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||||
|
// Make artwork a bit bigger
|
||||||
|
UIView *artworkImageView = imageView.superview;
|
||||||
|
if (artworkImageView != nil && !artworkImageView.translatesAutoresizingMaskIntoConstraints) {
|
||||||
|
[artworkImageView.leftAnchor constraintEqualToAnchor:artworkImageView.superview.leftAnchor constant:16].active = YES;
|
||||||
|
[artworkImageView.rightAnchor constraintEqualToAnchor:artworkImageView.superview.rightAnchor constant:-16].active = YES;
|
||||||
|
}
|
||||||
|
return imageView;
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
%ctor {
|
||||||
|
%init;
|
||||||
|
if (@available(iOS 16, *)) {
|
||||||
|
%init(iOS16);
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-101
@@ -29,55 +29,9 @@ static BOOL oldDarkTheme() {
|
|||||||
return ([[NSUserDefaults standardUserDefaults] integerForKey:@"appTheme"] == 2);
|
return ([[NSUserDefaults standardUserDefaults] integerForKey:@"appTheme"] == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
# pragma mark - Tweaks
|
||||||
# pragma mark - uYou's patches
|
|
||||||
// Workaround for qnblackcat/uYouPlus#10
|
|
||||||
%hook UIViewController
|
|
||||||
- (UITraitCollection *)traitCollection {
|
|
||||||
@try {
|
|
||||||
return %orig;
|
|
||||||
} @catch(NSException *e) {
|
|
||||||
return [UITraitCollection currentTraitCollection];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
%end
|
|
||||||
|
|
||||||
// Prevent uYou player bar from showing when not playing downloaded media
|
|
||||||
%hook PlayerManager
|
|
||||||
- (void)pause {
|
|
||||||
if (isnan([self progress]))
|
|
||||||
return;
|
|
||||||
%orig;
|
|
||||||
}
|
|
||||||
%end
|
|
||||||
|
|
||||||
// Workaround for issue #54
|
|
||||||
%hook YTMainAppVideoPlayerOverlayViewController
|
|
||||||
- (void)updateRelatedVideos {
|
|
||||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"relatedVideosAtTheEndOfYTVideos"] == NO) {}
|
|
||||||
else { return %orig; }
|
|
||||||
}
|
|
||||||
%end
|
|
||||||
|
|
||||||
// iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224
|
|
||||||
%group iOS16
|
|
||||||
%hook OBPrivacyLinkButton
|
|
||||||
%new
|
|
||||||
- (instancetype)initWithCaption:(NSString *)caption
|
|
||||||
buttonText:(NSString *)buttonText
|
|
||||||
image:(UIImage *)image
|
|
||||||
imageSize:(CGSize)imageSize
|
|
||||||
useLargeIcon:(BOOL)useLargeIcon {
|
|
||||||
return [self initWithCaption:caption
|
|
||||||
buttonText:buttonText
|
|
||||||
image:image
|
|
||||||
imageSize:imageSize
|
|
||||||
useLargeIcon:useLargeIcon
|
|
||||||
displayLanguage:[NSLocale currentLocale].languageCode];
|
|
||||||
}
|
|
||||||
%end
|
|
||||||
%end
|
|
||||||
|
|
||||||
|
// FLEX
|
||||||
%hook YTAppDelegate
|
%hook YTAppDelegate
|
||||||
- (BOOL)application:(UIApplication *)application
|
- (BOOL)application:(UIApplication *)application
|
||||||
didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions {
|
didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions {
|
||||||
@@ -97,26 +51,6 @@ static BOOL oldDarkTheme() {
|
|||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
||||||
# pragma mark - YouTube's patches
|
|
||||||
// Workaround for MiRO92/uYou-for-YouTube#12, qnblackcat/uYouPlus#263
|
|
||||||
%hook YTDataUtils
|
|
||||||
+ (NSMutableDictionary *)spamSignalsDictionary {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
+ (NSMutableDictionary *)spamSignalsDictionaryWithoutIDFA {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
%end
|
|
||||||
|
|
||||||
%hook YTHotConfig
|
|
||||||
- (BOOL)disableAfmaIdfaCollection { return NO; }
|
|
||||||
%end
|
|
||||||
|
|
||||||
// https://github.com/PoomSmart/YouTube-X/blob/1e62b68e9027fcb849a75f54a402a530385f2a51/Tweak.x#L27
|
|
||||||
// %hook YTAdsInnerTubeContextDecorator
|
|
||||||
// - (void)decorateContext:(id)context {}
|
|
||||||
// %end
|
|
||||||
|
|
||||||
// Hide YouTube annoying banner in Home page? - @MiRO92 - YTNoShorts: https://github.com/MiRO92/YTNoShorts
|
// Hide YouTube annoying banner in Home page? - @MiRO92 - YTNoShorts: https://github.com/MiRO92/YTNoShorts
|
||||||
%hook YTAsyncCollectionView
|
%hook YTAsyncCollectionView
|
||||||
- (id)cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
- (id)cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
@@ -137,29 +71,6 @@ static BOOL oldDarkTheme() {
|
|||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
||||||
// Fix streched artwork in uYou's player view
|
|
||||||
%hook ArtworkImageView
|
|
||||||
- (id)imageView {
|
|
||||||
UIImageView * imageView = %orig;
|
|
||||||
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
||||||
// Make artwork a bit bigger
|
|
||||||
UIView *artworkImageView = imageView.superview;
|
|
||||||
if (artworkImageView != nil && !artworkImageView.translatesAutoresizingMaskIntoConstraints) {
|
|
||||||
[artworkImageView.leftAnchor constraintEqualToAnchor:artworkImageView.superview.leftAnchor constant:16].active = YES;
|
|
||||||
[artworkImageView.rightAnchor constraintEqualToAnchor:artworkImageView.superview.rightAnchor constant:-16].active = YES;
|
|
||||||
}
|
|
||||||
return imageView;
|
|
||||||
}
|
|
||||||
%end
|
|
||||||
|
|
||||||
// Remove “Play next in queue” from the menu (@PoomSmart) - qnblackcat/uYouPlus#1138
|
|
||||||
%hook YTMenuItemVisibilityHandler
|
|
||||||
- (BOOL)shouldShowServiceItemRenderer:(YTIMenuConditionalServiceItemRenderer *)renderer {
|
|
||||||
return IsEnabled(@"hidePlayNextInQueue_enabled") && renderer.icon.iconType == 251 ? NO : %orig;
|
|
||||||
}
|
|
||||||
%end
|
|
||||||
|
|
||||||
# pragma mark - Tweaks
|
|
||||||
// IAmYouTube - https://github.com/PoomSmart/IAmYouTube/
|
// IAmYouTube - https://github.com/PoomSmart/IAmYouTube/
|
||||||
%hook YTVersionUtils
|
%hook YTVersionUtils
|
||||||
+ (NSString *)appName { return YT_NAME; }
|
+ (NSString *)appName { return YT_NAME; }
|
||||||
@@ -221,13 +132,6 @@ static BOOL oldDarkTheme() {
|
|||||||
return YT_NAME;
|
return YT_NAME;
|
||||||
return %orig;
|
return %orig;
|
||||||
}
|
}
|
||||||
// Fix Google Sign in by @PoomSmart and @level3tjg (qnblackcat/uYouPlus#684)
|
|
||||||
- (NSDictionary *)infoDictionary {
|
|
||||||
NSMutableDictionary *info = %orig.mutableCopy;
|
|
||||||
NSString *altBundleIdentifier = info[@"ALTBundleIdentifier"];
|
|
||||||
if (altBundleIdentifier) info[@"CFBundleIdentifier"] = altBundleIdentifier;
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
%end
|
%end
|
||||||
|
|
||||||
// YTMiniPlayerEnabler: https://github.com/level3tjg/YTMiniplayerEnabler/
|
// YTMiniPlayerEnabler: https://github.com/level3tjg/YTMiniplayerEnabler/
|
||||||
@@ -454,6 +358,7 @@ static void replaceTab(YTIGuideResponse *response) {
|
|||||||
%end
|
%end
|
||||||
|
|
||||||
# pragma mark - uYouPlus
|
# pragma mark - uYouPlus
|
||||||
|
|
||||||
// Video Player Options
|
// Video Player Options
|
||||||
// Skips content warning before playing *some videos - @PoomSmart
|
// Skips content warning before playing *some videos - @PoomSmart
|
||||||
%hook YTPlayabilityResolutionUserActionUIController
|
%hook YTPlayabilityResolutionUserActionUIController
|
||||||
@@ -979,9 +884,6 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
|
|||||||
// dlopen([[NSString stringWithFormat:@"%@/Frameworks/uYou.dylib", [[NSBundle mainBundle] bundlePath]] UTF8String], RTLD_LAZY);
|
// dlopen([[NSString stringWithFormat:@"%@/Frameworks/uYou.dylib", [[NSBundle mainBundle] bundlePath]] UTF8String], RTLD_LAZY);
|
||||||
|
|
||||||
%init;
|
%init;
|
||||||
if (@available(iOS 16, *)) {
|
|
||||||
%init(iOS16);
|
|
||||||
}
|
|
||||||
if (IsEnabled(@"reExplore_enabled")) {
|
if (IsEnabled(@"reExplore_enabled")) {
|
||||||
%init(gReExplore);
|
%init(gReExplore);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user