From e92fe421fdafd4161c6351fa449af67a65221e85 Mon Sep 17 00:00:00 2001 From: therealFoxster Date: Mon, 2 Sep 2024 21:05:29 -0700 Subject: [PATCH 1/3] Replace YouTube's download with uYou's --- .../ar.lproj/Localizable.strings | 3 ++ .../cz.lproj/Localizable.strings | 3 ++ .../de.lproj/Localizable.strings | 3 ++ .../el.lproj/Localizable.strings | 3 ++ .../en.lproj/Localizable.strings | 3 ++ .../es.lproj/Localizable.strings | 3 ++ .../fr.lproj/Localizable.strings | 3 ++ .../he.lproj/Localizable.strings | 3 ++ .../hu.lproj/Localizable.strings | 3 ++ .../it.lproj/Localizable.strings | 3 ++ .../ja.lproj/Localizable.strings | 3 ++ .../ko.lproj/Localizable.strings | 3 ++ .../nl.lproj/Localizable.strings | 3 ++ .../pl.lproj/Localizable.strings | 3 ++ .../pt.lproj/Localizable.strings | 3 ++ .../ro.lproj/Localizable.strings | 3 ++ .../ru.lproj/Localizable.strings | 3 ++ .../template.lproj/Localizable.strings | 3 ++ .../tr.lproj/Localizable.strings | 3 ++ .../vi.lproj/Localizable.strings | 3 ++ .../zh_cn.lproj/Localizable.strings | 3 ++ .../zh_tw.lproj/Localizable.strings | 3 ++ Sources/uYouPlus.h | 11 ++++++ Sources/uYouPlus.xm | 34 +++++++++++++++++-- Sources/uYouPlusSettings.xm | 1 + 25 files changed, 110 insertions(+), 2 deletions(-) diff --git a/Localizations/uYouPlus.bundle/ar.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/ar.lproj/Localizable.strings index 39e79697b4..e43eb0b39d 100644 --- a/Localizations/uYouPlus.bundle/ar.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/ar.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "استخدام مؤشر تغيير الصوت الخاص بالنظام"; "STOCK_VOLUME_HUD_DESC" = "إظهار مؤشر تغيير الصوت الرسمي الخاص بـ iOS بدلاً من مؤشر يوتيوب"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 أزرار التحكم على الطبقة فوق الفيديو"; diff --git a/Localizations/uYouPlus.bundle/cz.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/cz.lproj/Localizable.strings index 1ec6deeed1..bc0d39373d 100644 --- a/Localizations/uYouPlus.bundle/cz.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/cz.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Use stock iOS volume HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video Controls Overlay Options"; diff --git a/Localizations/uYouPlus.bundle/de.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/de.lproj/Localizable.strings index 8cacaf9898..4217b4945a 100755 --- a/Localizations/uYouPlus.bundle/de.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/de.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Standard iOS Lautstärke HUD aktivieren"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video Controls Overlay Optionen"; diff --git a/Localizations/uYouPlus.bundle/el.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/el.lproj/Localizable.strings index a676da26c5..858dfd4afa 100644 --- a/Localizations/uYouPlus.bundle/el.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/el.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Use stock iOS volume HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video controls overlay options"; diff --git a/Localizations/uYouPlus.bundle/en.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/en.lproj/Localizable.strings index 296efc592c..3a62429f37 100644 --- a/Localizations/uYouPlus.bundle/en.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/en.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Use stock iOS volume HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video controls overlay options"; diff --git a/Localizations/uYouPlus.bundle/es.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/es.lproj/Localizable.strings index 682b4a033f..5e38161781 100644 --- a/Localizations/uYouPlus.bundle/es.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/es.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Utiliza el HUD de volumen de iOS"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Opciones de superposición de controles de vídeo"; diff --git a/Localizations/uYouPlus.bundle/fr.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/fr.lproj/Localizable.strings index 12daec535d..cabe9b97e9 100644 --- a/Localizations/uYouPlus.bundle/fr.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/fr.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Utiliser l'affichage iOS du volume par défaut"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Options de superposition des contrôles vidéo"; diff --git a/Localizations/uYouPlus.bundle/he.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/he.lproj/Localizable.strings index 14100595f9..bb35ac1332 100644 --- a/Localizations/uYouPlus.bundle/he.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/he.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Use stock iOS volume HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video controls overlay options"; diff --git a/Localizations/uYouPlus.bundle/hu.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/hu.lproj/Localizable.strings index 818bd8d364..65a93878a0 100644 --- a/Localizations/uYouPlus.bundle/hu.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/hu.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Use iOS stock volume HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video controls overlay options"; diff --git a/Localizations/uYouPlus.bundle/it.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/it.lproj/Localizable.strings index 7f0f61cff3..ff775080a9 100644 --- a/Localizations/uYouPlus.bundle/it.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/it.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Use iOS stock volume HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Opzioni Sovrimpressione (Overlay) Video"; diff --git a/Localizations/uYouPlus.bundle/ja.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/ja.lproj/Localizable.strings index 0ee8129dee..f66451a8de 100644 --- a/Localizations/uYouPlus.bundle/ja.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/ja.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "標準の音量HUDを利用する"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 動画コントロールのオーバーレイ設定"; diff --git a/Localizations/uYouPlus.bundle/ko.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/ko.lproj/Localizable.strings index 908712f67e..0441d594dc 100644 --- a/Localizations/uYouPlus.bundle/ko.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/ko.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "iOS 기본 음량 표시기 사용"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 비디오 재생 오버레이 설정"; diff --git a/Localizations/uYouPlus.bundle/nl.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/nl.lproj/Localizable.strings index 643c4cacf5..9e9f83925b 100644 --- a/Localizations/uYouPlus.bundle/nl.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/nl.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Use stock iOS volume HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video controls overlay options"; diff --git a/Localizations/uYouPlus.bundle/pl.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/pl.lproj/Localizable.strings index 26c87af082..6fc153a18a 100644 --- a/Localizations/uYouPlus.bundle/pl.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/pl.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Użyj systemowego paska głośności"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Opcje wyglądu odtwarzacza video"; diff --git a/Localizations/uYouPlus.bundle/pt.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/pt.lproj/Localizable.strings index 3ff40a3256..c25cac07df 100644 --- a/Localizations/uYouPlus.bundle/pt.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/pt.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Usar o HUD de volume padrão do iOS"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Opções de Sobreposição de Controles de Vídeo"; diff --git a/Localizations/uYouPlus.bundle/ro.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/ro.lproj/Localizable.strings index 08ce20071f..a22ecee10e 100644 --- a/Localizations/uYouPlus.bundle/ro.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/ro.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Use stock iOS volume HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video controls overlay options"; diff --git a/Localizations/uYouPlus.bundle/ru.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/ru.lproj/Localizable.strings index ea55e25f15..d003bf6d53 100644 --- a/Localizations/uYouPlus.bundle/ru.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/ru.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Использовать стоковый слайдер грмкости iOS"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Параметры элементов оверлея видеоплеера"; diff --git a/Localizations/uYouPlus.bundle/template.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/template.lproj/Localizable.strings index 8ed3d60a20..cd135c06a7 100644 --- a/Localizations/uYouPlus.bundle/template.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/template.lproj/Localizable.strings @@ -81,6 +81,9 @@ https://github.com/PoomSmart/Return-YouTube-Dislikes/tree/main/layout/Library/Ap "STOCK_VOLUME_HUD" = "Use stock iOS volume HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video controls overlay options"; diff --git a/Localizations/uYouPlus.bundle/tr.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/tr.lproj/Localizable.strings index 2082cacbd5..35b6c35bb2 100644 --- a/Localizations/uYouPlus.bundle/tr.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/tr.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Mevcut iOS baş yukarı göstergesi(HUD) alanını kullan"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Video Kontrolleri Kaplaması Seçenekleri"; diff --git a/Localizations/uYouPlus.bundle/vi.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/vi.lproj/Localizable.strings index df28932c5c..4c5d51f028 100644 --- a/Localizations/uYouPlus.bundle/vi.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/vi.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "Sử dụng thanh âm lượng mặc định của iOS"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 Tùy chọn hiển thị trong trình phát video"; diff --git a/Localizations/uYouPlus.bundle/zh_cn.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/zh_cn.lproj/Localizable.strings index 9e756bc1da..a61d3b431f 100644 --- a/Localizations/uYouPlus.bundle/zh_cn.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/zh_cn.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "使用 iOS 自带音量指示"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 视频播放器控制界面选项"; diff --git a/Localizations/uYouPlus.bundle/zh_tw.lproj/Localizable.strings b/Localizations/uYouPlus.bundle/zh_tw.lproj/Localizable.strings index 0ed81606f7..5c41e0af73 100644 --- a/Localizations/uYouPlus.bundle/zh_tw.lproj/Localizable.strings +++ b/Localizations/uYouPlus.bundle/zh_tw.lproj/Localizable.strings @@ -66,6 +66,9 @@ "STOCK_VOLUME_HUD" = "使用 iOS 內建的音量 HUD"; "STOCK_VOLUME_HUD_DESC" = ""; +"REPLACE_YT_DOWNLOAD_WITH_UYOU" = "Replace YouTube's download with uYou's"; +"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC" = ""; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "📹 影片懸浮控制選項"; diff --git a/Sources/uYouPlus.h b/Sources/uYouPlus.h index 5b2b4f5e83..0678774539 100644 --- a/Sources/uYouPlus.h +++ b/Sources/uYouPlus.h @@ -19,6 +19,16 @@ // #import // Hide search ads by @PoomSmart - https://github.com/PoomSmart/YouTube-X +// Replace YouTube's download with uYou's +#import +#import +#import +#import +#import +@interface YTMainAppControlsOverlayView(uYou) +- (void)uYou; +@end + #define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil] #define IS_ENABLED(k) [[NSUserDefaults standardUserDefaults] boolForKey:k] #define APP_THEME_IDX [[NSUserDefaults standardUserDefaults] integerForKey:@"appTheme"] @@ -36,6 +46,7 @@ static NSString *const kHideRemixButton = @"hideRemixButton_enabled"; static NSString *const kHideClipButton = @"hideClipButton_enabled"; static NSString *const kHideDownloadButton = @"hideDownloadButton_enabled"; static NSString *const kStockVolumeHUD = @"stockVolumeHUD_enabled"; +static NSString *const kReplaceYTDownloadWithuYou = @"kReplaceYTDownloadWithuYou_enabled"; // Video controls overlay static NSString *const kHideAutoplaySwitch = @"hideAutoplaySwitch_enabled"; static NSString *const kHideCC = @"hideCC_enabled"; diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index 0b305a60d7..8604c6c087 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -76,7 +76,6 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide } %hook ASCollectionView - - (CGSize)sizeForElement:(ASCollectionElement *)element { if ([self.accessibilityIdentifier isEqualToString:@"id.video.scrollable_action_bar"]) { ASCellNode *node = [element node]; @@ -95,7 +94,6 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide } return %orig; } - %end // Use stock iOS volume HUD @@ -106,6 +104,35 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide } %end +// Replace YouTube's download with uYou's +YTMainAppControlsOverlayView *controlsOverlayView; +%hook YTMainAppControlsOverlayView +- (id)initWithDelegate:(id)arg1 { + controlsOverlayView = %orig; + return controlsOverlayView; +} +%end +%hook YTElementsDefaultSheetController ++ (void)showSheetController:(id)arg1 showCommand:(id)arg2 commandContext:(id)arg3 handler:(id)arg4 { + if (IS_ENABLED(kReplaceYTDownloadWithuYou) && [arg2 isKindOfClass:%c(ELMPBShowActionSheetCommand)]) { + ELMPBShowActionSheetCommand *showCommand = (ELMPBShowActionSheetCommand *)arg2; + NSArray *listOptions = [showCommand listOptionArray]; + for (ELMPBElement *element in listOptions) { + ELMPBProperties *properties = [element properties]; + ELMPBIdentifierProperties *identifierProperties = [properties firstSubmessage]; + NSString *identifier = [identifierProperties identifier]; + if ([identifier containsString:@"offline_upsell_dialog"]) { + if ([controlsOverlayView respondsToSelector:@selector(uYou)]) { + [controlsOverlayView uYou]; + } + return; + } + } + } + %orig; +} +%end + # pragma mark - Video control overlay options %hook YTMainAppControlsOverlayView @@ -421,4 +448,7 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide if (![allKeys containsObject:kGoogleSigninFix]) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kGoogleSigninFix]; } + if (![allKeys containsObject:kReplaceYTDownloadWithuYou]) { + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kReplaceYTDownloadWithuYou]; + } } diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm index 9f47897a75..4db3b86ef8 100644 --- a/Sources/uYouPlusSettings.xm +++ b/Sources/uYouPlusSettings.xm @@ -295,6 +295,7 @@ extern NSBundle *uYouPlusBundle(); SWITCH(LOC(@"HIDE_CLIP_BUTTON"), LOC(@"HIDE_CLIP_BUTTON_DESC"), kHideClipButton); SWITCH(LOC(@"HIDE_DOWNLOAD_BUTTON"), LOC(@"HIDE_DOWNLOAD_BUTTON_DESC"), kHideDownloadButton); SWITCH(LOC(@"STOCK_VOLUME_HUD"), LOC(@"STOCK_VOLUME_HUD_DESC"), kStockVolumeHUD); + SWITCH(LOC(@"REPLACE_YT_DOWNLOAD_WITH_UYOU"), LOC(@"REPLACE_YT_DOWNLOAD_WITH_UYOU_DESC"), kReplaceYTDownloadWithuYou); # pragma mark - Video controls overlay options SECTION_HEADER(LOC(@"VIDEO_CONTROLS_OVERLAY_OPTIONS")); From 256abd683c68a271e9869c753b5342f20124d091 Mon Sep 17 00:00:00 2001 From: therealFoxster Date: Wed, 4 Sep 2024 07:07:42 -0700 Subject: [PATCH 2/3] uYou download dialog UI tweaks Use colored uYou logo for better contrast in dark mode Add space between uYou label and video title --- Sources/uYouPlus.h | 8 +++--- Sources/uYouPlusPatches.h | 1 + Sources/uYouPlusPatches.xm | 53 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/Sources/uYouPlus.h b/Sources/uYouPlus.h index 0678774539..f9ca166163 100644 --- a/Sources/uYouPlus.h +++ b/Sources/uYouPlus.h @@ -24,8 +24,8 @@ #import #import #import -#import -@interface YTMainAppControlsOverlayView(uYou) +// #import +@interface YTMainAppControlsOverlayView: UIView - (void)uYou; @end @@ -77,8 +77,8 @@ static NSString *const kFlex = @"flex_enabled"; @end // Hide autoplay switch / CC button -@interface YTMainAppControlsOverlayView : UIView -@end +// @interface YTMainAppControlsOverlayView : UIView +// @end // Skips content warning before playing *some videos - @PoomSmart @interface YTPlayabilityResolutionUserActionUIController : NSObject diff --git a/Sources/uYouPlusPatches.h b/Sources/uYouPlusPatches.h index 6eedec6b99..c976c8232e 100644 --- a/Sources/uYouPlusPatches.h +++ b/Sources/uYouPlusPatches.h @@ -1,4 +1,5 @@ #import +#import #import "uYouPlus.h" @interface YTSingleVideoController : NSObject diff --git a/Sources/uYouPlusPatches.xm b/Sources/uYouPlusPatches.xm index 5bf129884e..15900d57af 100644 --- a/Sources/uYouPlusPatches.xm +++ b/Sources/uYouPlusPatches.xm @@ -186,6 +186,59 @@ 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 (@available(iOS 16, *)) { From f39982628ea7ee5922696d0011846d0c6c661877 Mon Sep 17 00:00:00 2001 From: therealFoxster Date: Wed, 4 Sep 2024 20:34:11 -0700 Subject: [PATCH 3/3] Replace YouTube's download with uYou's (v19.20.2) --- Sources/uYouPlus.xm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index 8604c6c087..9e4099b08f 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -120,8 +120,19 @@ YTMainAppControlsOverlayView *controlsOverlayView; for (ELMPBElement *element in listOptions) { ELMPBProperties *properties = [element properties]; ELMPBIdentifierProperties *identifierProperties = [properties firstSubmessage]; - NSString *identifier = [identifierProperties identifier]; - if ([identifier containsString:@"offline_upsell_dialog"]) { + // 19.30.2 + if ([identifierProperties respondsToSelector:@selector(identifier)]) { + NSString *identifier = [identifierProperties identifier]; + if ([identifier containsString:@"offline_upsell_dialog"]) { + if ([controlsOverlayView respondsToSelector:@selector(uYou)]) { + [controlsOverlayView uYou]; + } + return; + } + } + // 19.20.2 + NSString *description = [identifierProperties description]; + if ([description containsString:@"offline_upsell_dialog"]) { if ([controlsOverlayView respondsToSelector:@selector(uYou)]) { [controlsOverlayView uYou]; }