Skip to content

Commit

Permalink
Merge branch 'qnblackcat:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNightRider12 authored Sep 7, 2024
2 parents 73f77de + f399826 commit d3de95f
Show file tree
Hide file tree
Showing 27 changed files with 177 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "📹 أزرار التحكم على الطبقة فوق الفيديو";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/cz.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/el.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/he.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/hu.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "📹 動画コントロールのオーバーレイ設定";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "📹 비디오 재생 오버레이 설정";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/nl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/pt.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/ro.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "📹 Параметры элементов оверлея видеоплеера";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/tr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/vi.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/zh_cn.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "📹 视频播放器控制界面选项";

Expand Down
3 changes: 3 additions & 0 deletions Localizations/uYouPlus.bundle/zh_tw.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "📹 影片懸浮控制選項";

Expand Down
15 changes: 13 additions & 2 deletions Sources/uYouPlus.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@

// #import <YouTubeHeader/YTISectionListRenderer.h> // Hide search ads by @PoomSmart - https://github.com/PoomSmart/YouTube-X

// Replace YouTube's download with uYou's
#import <YouTubeHeader/ELMPBShowActionSheetCommand.h>
#import <YouTubeHeader/ELMPBElement.h>
#import <YouTubeHeader/ELMPBProperties.h>
#import <YouTubeHeader/ELMPBIdentifierProperties.h>
// #import <YouTubeHeader/YTMainAppControlsOverlayView.h>
@interface YTMainAppControlsOverlayView: UIView
- (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"]
Expand All @@ -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";
Expand Down Expand Up @@ -66,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
Expand Down
45 changes: 43 additions & 2 deletions Sources/uYouPlus.xm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
}

%hook ASCollectionView

- (CGSize)sizeForElement:(ASCollectionElement *)element {
if ([self.accessibilityIdentifier isEqualToString:@"id.video.scrollable_action_bar"]) {
ASCellNode *node = [element node];
Expand All @@ -95,7 +94,6 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
}
return %orig;
}

%end

// Use stock iOS volume HUD
Expand All @@ -106,6 +104,46 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *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];
// 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];
}
return;
}
}
}
%orig;
}
%end

# pragma mark - Video control overlay options

%hook YTMainAppControlsOverlayView
Expand Down Expand Up @@ -421,4 +459,7 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
if (![allKeys containsObject:kGoogleSigninFix]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kGoogleSigninFix];
}
if (![allKeys containsObject:kReplaceYTDownloadWithuYou]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kReplaceYTDownloadWithuYou];
}
}
1 change: 1 addition & 0 deletions Sources/uYouPlusPatches.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import <YouTubeHeader/YTCommonColorPalette.h>
#import <YouTubeHeader/GOODialogView.h>
#import "uYouPlus.h"

@interface YTSingleVideoController : NSObject
Expand Down
53 changes: 53 additions & 0 deletions Sources/uYouPlusPatches.xm
Original file line number Diff line number Diff line change
Expand Up @@ -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, *)) {
Expand Down
Loading

0 comments on commit d3de95f

Please sign in to comment.