mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-01-11 22:40:19 +00:00
Update uYouPlusPatches.xm
This commit is contained in:
parent
88f821d348
commit
ba125c3c33
1 changed files with 58 additions and 0 deletions
|
|
@ -163,6 +163,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *source
|
|||
|
||||
/* -------------------- iPad Layout -------------------- */
|
||||
|
||||
%group gYouTubeNativeShare // YouTube Native Share Option - 0.2.3 - Supports YouTube v17.33.2-v19.34.2
|
||||
%hook YTAccountScopedCommandResponderEvent
|
||||
- (void)send {
|
||||
GPBExtensionDescriptor *shareEntityEndpointDescriptor = [%c(YTIShareEntityEndpoint) shareEntityEndpoint];
|
||||
|
|
@ -197,6 +198,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *source
|
|||
return %orig;
|
||||
}
|
||||
%end
|
||||
%end
|
||||
|
||||
//
|
||||
|
||||
|
|
@ -335,11 +337,67 @@ static void refreshUYouAppearance() {
|
|||
- (void)beginEnlargeAnimation {}
|
||||
%end
|
||||
|
||||
%hook GOODialogView
|
||||
- (id)imageView {
|
||||
UIImageView *imageView = %orig;
|
||||
|
||||
if ([[self titleLabel].text containsString:@"uYou\n"]) {
|
||||
// // Invert uYou logo in download dialog if dark mode is enabled
|
||||
// if ([[NSUserDefaults standardUserDefaults] integerForKey:@"page_style"] == 0)
|
||||
// return imageView;
|
||||
// // https://gist.github.com/coryalder/3113a43734f5e0e4b497
|
||||
// UIImage *image = [imageView image];
|
||||
// CIImage *ciImage = [[CIImage alloc] initWithImage:image];
|
||||
// CIFilter *filter = [CIFilter filterWithName:@"CIColorInvert"];
|
||||
// [filter setDefaults];
|
||||
// [filter setValue:ciImage forKey:kCIInputImageKey];
|
||||
// CIContext *context = [CIContext contextWithOptions:nil];
|
||||
// CIImage *output = [filter outputImage];
|
||||
// CGImageRef cgImage = [context createCGImage:output fromRect:[output extent]];
|
||||
// UIImage *icon = [UIImage imageWithCGImage:cgImage];
|
||||
// CGImageRelease(cgImage);
|
||||
|
||||
// Load icon_clipped.png from uYouBundle.bundle
|
||||
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"uYouBundle" ofType:@"bundle"];
|
||||
NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];
|
||||
NSString *iconPath = [bundle pathForResource:@"icon_clipped" ofType:@"png"];
|
||||
UIImage *icon = [UIImage imageWithContentsOfFile:iconPath];
|
||||
[imageView setImage:icon];
|
||||
|
||||
// Resize image to 30x30
|
||||
// https://stackoverflow.com/a/2658801/19227228
|
||||
CGSize size = CGSizeMake(30, 30);
|
||||
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
|
||||
[icon drawInRect:CGRectMake(0, 0, size.width, size.height)];
|
||||
UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
[imageView setImage:resizedImage];
|
||||
}
|
||||
|
||||
return imageView;
|
||||
}
|
||||
// Increase space between uYou label and video title
|
||||
- (id)titleLabel {
|
||||
UILabel *titleLabel = %orig;
|
||||
if ([titleLabel.text containsString:@"uYou\n"] &&
|
||||
![titleLabel.text containsString:@"uYou\n\n"]
|
||||
) {
|
||||
NSString *text = [titleLabel.text stringByReplacingOccurrencesOfString:@"uYou\n" withString:@"uYou\n\n"];
|
||||
[titleLabel setText:text];
|
||||
}
|
||||
return titleLabel;
|
||||
}
|
||||
%end
|
||||
|
||||
%ctor {
|
||||
%init;
|
||||
if (IS_ENABLED(@"googleSignInPatch_enabled")) {
|
||||
%init(gGoogleSignInPatch);
|
||||
}
|
||||
if (IS_ENABLED(@"youtubeNativeShare_enabled")) {
|
||||
%init(gYouTubeNativeShare);
|
||||
}
|
||||
// if (@available(iOS 16, *)) {
|
||||
// %init(iOS16);
|
||||
// }
|
||||
|
|
|
|||
Loading…
Reference in a new issue