From f535c919cac7f4373f7de38fbcb53ea73b3fc7b8 Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Tue, 25 Jun 2024 19:06:53 -0500 Subject: [PATCH] Exclude YTShareRequestViewController (uYouPlusPatches.xm) --- Sources/uYouPlusPatches.xm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Sources/uYouPlusPatches.xm b/Sources/uYouPlusPatches.xm index 53812dd..a3c2123 100644 --- a/Sources/uYouPlusPatches.xm +++ b/Sources/uYouPlusPatches.xm @@ -148,13 +148,30 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity) { /* -------------------- iPad Layout -------------------- */ +/* %hook YTShareRequestViewController - (id)initWithService:(id)_service parentResponder:(id)_parentResponder { // disable the default share sheet behavior and force the app to call [YTAccountScopedCommandRouter handleCommand] return NULL; } %end +*/ +%hook YTAccountScopedCommandRouter +- (BOOL)handleCommand:(id)command entry:(id)_entry fromView:(id)_fromView sender:(id)_sender completionBlock:(id)_completionBlock { + GPBExtensionDescriptor *shareEntityEndpointDescriptor = [%c(YTIShareEntityEndpoint) shareEntityEndpoint]; + if (![command hasExtension:shareEntityEndpointDescriptor]) + return %orig; + YTIShareEntityEndpoint *shareEntityEndpoint = [command getExtension:shareEntityEndpointDescriptor]; + if(!shareEntityEndpoint.hasSerializedShareEntity) + return %orig; + if (!showNativeShareSheet(shareEntityEndpoint.serializedShareEntity)) + return %orig; + return TRUE; +} +%end + +/* EXPERIMENTAL %hook YTAccountScopedCommandRouter - (BOOL)handleCommand:(id)command entry:(id)_entry fromView:(id)_fromView sender:(id)_sender completionBlock:(id)_completionBlock { GPBExtensionDescriptor *shareEntityEndpointDescriptor = [%c(YTIShareEntityEndpoint) shareEntityEndpoint]; @@ -170,7 +187,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity) { return TRUE; } %end - +*/ /* ------------------- iPhone Layout ------------------- */