mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-04-21 11:52:00 +00:00
Update uYouPlusPatches.xm
This commit is contained in:
parent
829b0c7d6b
commit
1b3a422a61
1 changed files with 7 additions and 12 deletions
|
|
@ -110,7 +110,7 @@ static inline NSString* extractIdWithFormat(GPBUnknownFieldSet *fields, NSIntege
|
||||||
NSString *id = [[NSString alloc] initWithData:[idField.lengthDelimitedList firstObject] encoding:NSUTF8StringEncoding];
|
NSString *id = [[NSString alloc] initWithData:[idField.lengthDelimitedList firstObject] encoding:NSUTF8StringEncoding];
|
||||||
return [NSString stringWithFormat:format, id];
|
return [NSString stringWithFormat:format, id];
|
||||||
}
|
}
|
||||||
static BOOL showNativeShareSheet(NSString *serializedShareEntity) {
|
static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *sourceView) {
|
||||||
GPBMessage *shareEntity = [%c(GPBMessage) deserializeFromString:serializedShareEntity];
|
GPBMessage *shareEntity = [%c(GPBMessage) deserializeFromString:serializedShareEntity];
|
||||||
GPBUnknownFieldSet *fields = shareEntity.unknownFields;
|
GPBUnknownFieldSet *fields = shareEntity.unknownFields;
|
||||||
NSString *shareUrl;
|
NSString *shareUrl;
|
||||||
|
|
@ -148,14 +148,11 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity) {
|
||||||
|
|
||||||
if (activityViewController.popoverPresentationController) {
|
if (activityViewController.popoverPresentationController) {
|
||||||
activityViewController.popoverPresentationController.sourceView = topViewController.view;
|
activityViewController.popoverPresentationController.sourceView = topViewController.view;
|
||||||
|
activityViewController.popoverPresentationController.sourceRect = [sourceView convertRect:sourceView.bounds toView:topViewController.view];
|
||||||
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
|
|
||||||
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
|
|
||||||
|
|
||||||
activityViewController.popoverPresentationController.sourceRect = CGRectMake(screenWidth / 2.0, screenHeight, 0, 0);
|
|
||||||
activityViewController.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[topViewController presentViewController:activityViewController animated:YES completion:nil];
|
[topViewController presentViewController:activityViewController animated:YES completion:nil];
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,7 +166,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity) {
|
||||||
YTIShareEntityEndpoint *shareEntityEndpoint = [self.command getExtension:shareEntityEndpointDescriptor];
|
YTIShareEntityEndpoint *shareEntityEndpoint = [self.command getExtension:shareEntityEndpointDescriptor];
|
||||||
if (!shareEntityEndpoint.hasSerializedShareEntity)
|
if (!shareEntityEndpoint.hasSerializedShareEntity)
|
||||||
return %orig;
|
return %orig;
|
||||||
if (!showNativeShareSheet(shareEntityEndpoint.serializedShareEntity))
|
if (!showNativeShareSheet(shareEntityEndpoint.serializedShareEntity, self.fromView))
|
||||||
return %orig;
|
return %orig;
|
||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
@ -177,7 +174,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity) {
|
||||||
/* ------------------- iPhone Layout ------------------- */
|
/* ------------------- iPhone Layout ------------------- */
|
||||||
|
|
||||||
%hook ELMPBShowActionSheetCommand
|
%hook ELMPBShowActionSheetCommand
|
||||||
- (void)executeWithCommandContext:(id)_context handler:(id)_handler {
|
- (void)executeWithCommandContext:(ELMCommandContext*)context handler:(id)_handler {
|
||||||
if (!self.hasOnAppear)
|
if (!self.hasOnAppear)
|
||||||
return %orig;
|
return %orig;
|
||||||
GPBExtensionDescriptor *innertubeCommandDescriptor = [%c(YTIInnertubeCommandExtensionRoot) innertubeCommand];
|
GPBExtensionDescriptor *innertubeCommandDescriptor = [%c(YTIInnertubeCommandExtensionRoot) innertubeCommand];
|
||||||
|
|
@ -190,7 +187,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity) {
|
||||||
YTIUpdateShareSheetCommand *updateShareSheetCommand = [innertubeCommand getExtension:updateShareSheetCommandDescriptor];
|
YTIUpdateShareSheetCommand *updateShareSheetCommand = [innertubeCommand getExtension:updateShareSheetCommandDescriptor];
|
||||||
if (!updateShareSheetCommand.hasSerializedShareEntity)
|
if (!updateShareSheetCommand.hasSerializedShareEntity)
|
||||||
return %orig;
|
return %orig;
|
||||||
if (!showNativeShareSheet(updateShareSheetCommand.serializedShareEntity))
|
if (!showNativeShareSheet(updateShareSheetCommand.serializedShareEntity, context.context.fromView))
|
||||||
return %orig;
|
return %orig;
|
||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
@ -351,6 +348,4 @@ static void refreshUYouAppearance() {
|
||||||
|
|
||||||
// Disable uYou's playback speed controls (prevent crash on video playback https://github.com/therealFoxster/uYouPlus/issues/2#issuecomment-1894912963)
|
// Disable uYou's playback speed controls (prevent crash on video playback https://github.com/therealFoxster/uYouPlus/issues/2#issuecomment-1894912963)
|
||||||
// [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"showPlaybackRate"];
|
// [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"showPlaybackRate"];
|
||||||
// Disable uYou's adblock
|
|
||||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"removeYouTubeAds"];
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue