@@ -76,7 +76,6 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
76
76
}
77
77
78
78
%hook ASCollectionView
79
-
80
79
- (CGSize )sizeForElement:(ASCollectionElement *)element {
81
80
if ([self .accessibilityIdentifier isEqualToString: @" id.video.scrollable_action_bar" ]) {
82
81
ASCellNode *node = [element node ];
@@ -95,7 +94,6 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
95
94
}
96
95
return %orig ;
97
96
}
98
-
99
97
%end
100
98
101
99
// Use stock iOS volume HUD
@@ -106,6 +104,35 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
106
104
}
107
105
%end
108
106
107
+ // Replace YouTube's download with uYou's
108
+ YTMainAppControlsOverlayView *controlsOverlayView;
109
+ %hook YTMainAppControlsOverlayView
110
+ - (id )initWithDelegate:(id )arg1 {
111
+ controlsOverlayView = %orig ;
112
+ return controlsOverlayView;
113
+ }
114
+ %end
115
+ %hook YTElementsDefaultSheetController
116
+ + (void )showSheetController:(id )arg1 showCommand:(id )arg2 commandContext:(id )arg3 handler:(id )arg4 {
117
+ if (IS_ENABLED (kReplaceYTDownloadWithuYou ) && [arg2 isKindOfClass: %c (ELMPBShowActionSheetCommand)]) {
118
+ ELMPBShowActionSheetCommand *showCommand = (ELMPBShowActionSheetCommand *)arg2;
119
+ NSArray *listOptions = [showCommand listOptionArray ];
120
+ for (ELMPBElement *element in listOptions) {
121
+ ELMPBProperties *properties = [element properties ];
122
+ ELMPBIdentifierProperties *identifierProperties = [properties firstSubmessage ];
123
+ NSString *identifier = [identifierProperties identifier ];
124
+ if ([identifier containsString: @" offline_upsell_dialog" ]) {
125
+ if ([controlsOverlayView respondsToSelector: @selector (uYou )]) {
126
+ [controlsOverlayView uYou ];
127
+ }
128
+ return ;
129
+ }
130
+ }
131
+ }
132
+ %orig ;
133
+ }
134
+ %end
135
+
109
136
# pragma mark - Video control overlay options
110
137
111
138
%hook YTMainAppControlsOverlayView
@@ -421,4 +448,7 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
421
448
if (![allKeys containsObject: kGoogleSigninFix ]) {
422
449
[[NSUserDefaults standardUserDefaults ] setBool: YES forKey: kGoogleSigninFix ];
423
450
}
451
+ if (![allKeys containsObject: kReplaceYTDownloadWithuYou ]) {
452
+ [[NSUserDefaults standardUserDefaults ] setBool: YES forKey: kReplaceYTDownloadWithuYou ];
453
+ }
424
454
}
0 commit comments