Refresh Branch

This commit is contained in:
arichornlover 2024-02-11 16:58:43 -06:00 committed by GitHub
parent dbc8c08db1
commit 60cf95ca4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 4830 additions and 200 deletions

View file

@ -5,4 +5,4 @@
@end
@interface YTWatchMiniBarView : UIView
@end
@end

View file

@ -28,4 +28,4 @@
if (IS_ENABLED(@"bigYTMiniPlayer_enabled") && (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad)) {
%init(BigYTMiniPlayer);
}
}
}

View file

@ -0,0 +1,6 @@
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface ColourOptionsController : UIColorPickerViewController <UIColorPickerViewControllerDelegate>
@end

View file

@ -0,0 +1,77 @@
#import "ColourOptionsController.h"
#import "../uYouPlus.h"
@interface ColourOptionsController ()
- (void)coloursView;
@end
@implementation ColourOptionsController
- (void)loadView {
[super loadView];
[self coloursView];
self.title = @"Theme Custom Color";
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(close)];
self.navigationItem.rightBarButtonItem = closeButton;
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(save)];
self.navigationItem.rightBarButtonItem = saveButton;
UIBarButtonItem *resetButton = [[UIBarButtonItem alloc] initWithTitle:@"Reset" style:UIBarButtonItemStylePlain target:self action:@selector(reset)];
self.navigationItem.leftBarButtonItem = resetButton;
self.supportsAlpha = NO;
NSData *colorData = [[NSUserDefaults standardUserDefaults] objectForKey:@"kCustomThemeColor"];
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:colorData error:nil];
[unarchiver setRequiresSecureCoding:NO];
UIColor *color = [unarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
self.selectedColor = color;
}
- (void)coloursView {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
self.view.backgroundColor = [UIColor colorWithRed:0.949 green:0.949 blue:0.969 alpha:1.0];
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor]}];
self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
}
else {
self.view.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
}
}
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
[self coloursView];
}
@end
@implementation ColourOptionsController(Privates)
- (void)close {
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
- (void)save {
NSData *colorData = [NSKeyedArchiver archivedDataWithRootObject:self.selectedColor requiringSecureCoding:nil error:nil];
[[NSUserDefaults standardUserDefaults] setObject:colorData forKey:@"kCustomThemeColor"];
[[NSUserDefaults standardUserDefaults] synchronize];
UIAlertController *alertSaved = [UIAlertController alertControllerWithTitle:@"Color Saved" message:nil preferredStyle:UIAlertControllerStyleAlert];
[alertSaved addAction:[UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}]];
[self presentViewController:alertSaved animated:YES completion:nil];
}
- (void)reset {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"kCustomThemeColor"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end

View file

@ -0,0 +1,6 @@
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface ColourOptionsController2 : UIColorPickerViewController <UIColorPickerViewControllerDelegate>
@end

View file

@ -0,0 +1,77 @@
#import "ColourOptionsController2.h"
#import "../uYouPlus.h"
@interface ColourOptionsController2 ()
- (void)coloursView;
@end
@implementation ColourOptionsController2
- (void)loadView {
[super loadView];
[self coloursView];
self.title = @"Custom Text/Etc. Color";
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(close)];
self.navigationItem.rightBarButtonItem = closeButton;
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(save)];
self.navigationItem.rightBarButtonItem = saveButton;
UIBarButtonItem *resetButton = [[UIBarButtonItem alloc] initWithTitle:@"Reset" style:UIBarButtonItemStylePlain target:self action:@selector(reset)];
self.navigationItem.leftBarButtonItem = resetButton;
self.supportsAlpha = NO;
NSData *lcmColorData = [[NSUserDefaults standardUserDefaults] objectForKey:@"kCustomUIColor"];
NSKeyedUnarchiver *lcmUnarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:lcmColorData error:nil];
[lcmUnarchiver setRequiresSecureCoding:NO];
UIColor *color = [lcmUnarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
self.selectedColor = color;
}
- (void)coloursView {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
self.view.backgroundColor = [UIColor colorWithRed:0.949 green:0.949 blue:0.969 alpha:1.0];
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor]}];
self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
}
else {
self.view.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
}
}
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
[self coloursView];
}
@end
@implementation ColourOptionsController2(Privates)
- (void)close {
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
- (void)save {
NSData *lcmColorData = [NSKeyedArchiver archivedDataWithRootObject:self.selectedColor requiringSecureCoding:nil error:nil];
[[NSUserDefaults standardUserDefaults] setObject:lcmColorData forKey:@"kCustomUIColor"];
[[NSUserDefaults standardUserDefaults] synchronize];
UIAlertController *alertSaved = [UIAlertController alertControllerWithTitle:@"Color Saved" message:nil preferredStyle:UIAlertControllerStyleAlert];
[alertSaved addAction:[UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}]];
[self presentViewController:alertSaved animated:YES completion:nil];
}
- (void)reset {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"kCustomUIColor"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end

7
Sources/Extractor.h Normal file
View file

@ -0,0 +1,7 @@
// Extractor.h was made by @LillieH1000 from https://www.github.com/LillieH1000/YouTube-Reborn
#import <Foundation/Foundation.h>
@interface Extractor : NSObject
+ (NSDictionary *)youtubePlayerRequest :(NSString *)client :(NSString *)videoID;
@end

44
Sources/Extractor.xm Normal file
View file

@ -0,0 +1,44 @@
// Extractor.xm was made by @LillieH1000 from https://www.github.com/LillieH1000/YouTube-Reborn
#import "Extractor.h"
@implementation Extractor
+ (NSDictionary *)youtubePlayerRequest :(NSString *)client :(NSString *)videoID {
NSLocale *locale = [NSLocale currentLocale];
NSString *countryCode = [locale objectForKey:NSLocaleCountryCode];
NSURL *requestURL;
if ([client isEqual:@"android"]) {
requestURL = [NSURL URLWithString:@"https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&prettyPrint=false"];
} else if ([client isEqual:@"ios"]) {
requestURL = [NSURL URLWithString:@"https://www.youtube.com/youtubei/v1/player?key=AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc&prettyPrint=false"];
}
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
if ([client isEqual:@"android"]) {
[request setValue:@"com.google.android.youtube/17.31.35 (Linux; U; Android 11) gzip" forHTTPHeaderField:@"User-Agent"];
NSString *jsonBody = [NSString stringWithFormat:@"{\"context\":{\"client\":{\"hl\":\"en\",\"gl\":\"%@\",\"clientName\":\"ANDROID\",\"clientVersion\":\"17.31.35\",\"androidSdkVersion\":30,\"playbackContext\":{\"contentPlaybackContext\":{\"vis\":0,\"splay\":false,\"autoCaptionsDefaultOn\":false,\"autonavState\":\"STATE_OFF\",\"signatureTimestamp\":\"sts\",\"html5Preference\":\"HTML5_PREF_WANTS\",\"lactMilliseconds\":\"-1\"}}}},\"contentCheckOk\":true,\"racyCheckOk\":true,\"videoId\":\"%@\"}", countryCode, videoID];
[request setHTTPBody:[jsonBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]];
} else if ([client isEqual:@"ios"]) {
[request setValue:@"com.google.ios.youtube/17.33.2 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)" forHTTPHeaderField:@"User-Agent"];
NSString *jsonBody = [NSString stringWithFormat:@"{\"context\":{\"client\":{\"hl\":\"en\",\"gl\":\"%@\",\"clientName\":\"IOS\",\"clientVersion\":\"17.33.2\",\"deviceModel\":\"iPhone14,3\",\"playbackContext\":{\"contentPlaybackContext\":{\"vis\":0,\"splay\":false,\"autoCaptionsDefaultOn\":false,\"autonavState\":\"STATE_OFF\",\"signatureTimestamp\":\"sts\",\"html5Preference\":\"HTML5_PREF_WANTS\",\"lactMilliseconds\":\"-1\"}}}},\"contentCheckOk\":true,\"racyCheckOk\":true,\"videoId\":\"%@\"}", countryCode, videoID];
[request setHTTPBody:[jsonBody dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]];
}
__block NSData *requestData;
__block BOOL requestFinished = NO;
[[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
requestData = data;
requestFinished = YES;
}] resume];
while (!requestFinished) {
[NSThread sleepForTimeInterval:0.02];
}
return [NSJSONSerialization JSONObjectWithData:requestData options:0 error:nil];
}
@end

592
Sources/LowContrastMode.xm Normal file
View file

@ -0,0 +1,592 @@
#import "uYouPlus.h"
//
static int contrastMode() {
return [[NSUserDefaults standardUserDefaults] integerForKey:@"lcm"];
}
static BOOL lowContrastMode() {
return IS_ENABLED(@"lowContrastMode_enabled") && contrastMode() == 0;
}
static BOOL customContrastMode() {
return IS_ENABLED(@"lowContrastMode_enabled") && contrastMode() == 1;
}
UIColor *lcmHexColor;
%group gLowContrastMode // Low Contrast Mode v1.5.1 (Compatible with only YouTube v16.05.7-v17.38.10)
%hook UIColor
+ (UIColor *)whiteColor { // Dark Theme Color
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)lightTextColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)lightGrayColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)ychGrey7 {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)skt_chipBackgroundColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)placeholderTextColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)systemLightGrayColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)systemExtraLightGrayColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)labelColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)secondaryLabelColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)tertiaryLabelColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
+ (UIColor *)quaternaryLabelColor {
return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00];
}
%end
%hook YTCommonColorPalette
- (UIColor *)textPrimary {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
}
- (UIColor *)textSecondary {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
}
- (UIColor *)overlayTextPrimary {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
}
- (UIColor *)overlayTextSecondary {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
}
- (UIColor *)iconActive {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
}
- (UIColor *)iconActiveOther {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
}
- (UIColor *)brandIconActive {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
}
- (UIColor *)staticBrandWhite {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
}
- (UIColor *)overlayIconActiveOther {
return self.pageStyle == 1 ? [UIColor whiteColor] : %orig;
}
- (UIColor *)overlayIconInactive {
return self.pageStyle == 1 ? [[UIColor whiteColor] colorWithAlphaComponent:0.7] : %orig;
}
- (UIColor *)overlayIconDisabled {
return self.pageStyle == 1 ? [[UIColor whiteColor] colorWithAlphaComponent:0.3] : %orig;
}
- (UIColor *)overlayFilledButtonActive {
return self.pageStyle == 1 ? [[UIColor whiteColor] colorWithAlphaComponent:0.2] : %orig;
}
%end
%hook YTColor
+ (BOOL)darkerPaletteTextColorEnabled {
return NO;
}
+ (UIColor *)white1 {
return [UIColor whiteColor];
}
+ (UIColor *)white2 {
return [UIColor whiteColor];
}
+ (UIColor *)white3 {
return [UIColor whiteColor];
}
+ (UIColor *)white4 {
return [UIColor whiteColor];
}
+ (UIColor *)white5 {
return [UIColor whiteColor];
}
+ (UIColor *)grey1 {
return [UIColor whiteColor];
}
+ (UIColor *)grey2 {
return [UIColor whiteColor];
}
%end
%hook QTMColorGroup
- (UIColor *)tint100 {
return [UIColor whiteColor];
}
- (UIColor *)tint300 {
return [UIColor whiteColor];
}
- (UIColor *)tint500 {
return [UIColor whiteColor];
}
- (UIColor *)tint700 {
return [UIColor whiteColor];
}
- (UIColor *)accent200 {
return [UIColor whiteColor];
}
- (UIColor *)accent400 {
return [UIColor whiteColor];
}
- (UIColor *)accentColor {
return [UIColor whiteColor];
}
- (UIColor *)brightAccentColor {
return [UIColor whiteColor];
}
- (UIColor *)regularColor {
return [UIColor whiteColor];
}
- (UIColor *)darkerColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColor {
return [UIColor whiteColor];
}
- (UIColor *)lightBodyTextColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnRegularColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnLighterColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnDarkerColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnAccentColor {
return [UIColor whiteColor];
}
- (UIColor *)buttonBackgroundColor {
return [UIColor whiteColor];
}
%end
%hook YCHLiveChatLabel
- (NSAttributedString *)attributedText {
NSAttributedString *originalAttributedString = %orig;
NSMutableAttributedString *modifiedAttributedString = [originalAttributedString mutableCopy];
[modifiedAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, modifiedAttributedString.length)];
return modifiedAttributedString;
}
%end
%hook YTQTMButton
- (void)setImage:(UIImage *)image {
UIImage *currentImage = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self setTintColor:[UIColor whiteColor]];
%orig(currentImage);
}
%end
%hook UIExtendedSRGColorSpace
- (void)setTextColor:(UIColor *)textColor {
textColor = [[UIColor whiteColor] colorWithAlphaComponent:0.9];
%orig();
}
%end
%hook UIExtendedSRGBColorSpace
- (void)setTextColor:(UIColor *)textColor {
textColor = [[UIColor whiteColor] colorWithAlphaComponent:1.0];
%orig();
}
%end
%hook UIExtendedGrayColorSpace
- (void)setTextColor:(UIColor *)textColor {
textColor = [[UIColor whiteColor] colorWithAlphaComponent:1.0];
%orig();
}
%end
%hook VideoTitleLabel
- (void)setTextColor:(UIColor *)textColor {
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UILabel
+ (void)load {
@autoreleasepool {
[[UILabel appearance] setTextColor:[UIColor whiteColor]];
}
}
- (void)setTextColor:(UIColor *)textColor {
%log;
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UITextField
- (void)setTextColor:(UIColor *)textColor {
%log;
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UITextView
- (void)setTextColor:(UIColor *)textColor {
%log;
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UISearchBar
- (void)setTextColor:(UIColor *)textColor {
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UISegmentedControl
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
%orig(modifiedAttributes, state);
}
%end
%hook UIButton
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state {
color = [UIColor whiteColor];
%orig(color, state);
}
%end
%hook UIBarButtonItem
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
%orig(modifiedAttributes, state);
}
%end
%hook NSAttributedString
- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSAttributedStringKey, id> *)attrs {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attrs];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
return %orig(str, modifiedAttributes);
}
%end
%hook CATextLayer
- (void)setTextColor:(CGColorRef)textColor {
%orig([UIColor whiteColor].CGColor);
}
%end
%hook ASTextNode
- (NSAttributedString *)attributedString {
NSAttributedString *originalAttributedString = %orig;
NSMutableAttributedString *newAttributedString = [originalAttributedString mutableCopy];
[newAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, newAttributedString.length)];
return newAttributedString;
}
%end
%hook ASTextFieldNode
- (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]);
}
%end
%hook ASTextView
- (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]);
}
%end
%hook ASButtonNode
- (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]);
}
%end
%end
%group gCustomContrastMode // Custom Contrast Mode (Hex Color)
%hook UIColor
+ (UIColor *)whiteColor {
return lcmHexColor;
}
+ (UIColor *)lightTextColor {
return lcmHexColor;
}
+ (UIColor *)lightGrayColor {
return lcmHexColor;
}
+ (UIColor *)ychGrey7 {
return lcmHexColor;
}
+ (UIColor *)skt_chipBackgroundColor {
return lcmHexColor;
}
+ (UIColor *)placeholderTextColor {
return lcmHexColor;
}
+ (UIColor *)systemLightGrayColor {
return lcmHexColor;
}
+ (UIColor *)systemExtraLightGrayColor {
return lcmHexColor;
}
+ (UIColor *)labelColor {
return lcmHexColor;
}
+ (UIColor *)secondaryLabelColor {
return lcmHexColor;
}
+ (UIColor *)tertiaryLabelColor {
return lcmHexColor;
}
+ (UIColor *)quaternaryLabelColor {
return lcmHexColor;
}
%end
%hook YTCommonColorPalette
- (UIColor *)textPrimary {
return self.pageStyle == 1 ? lcmHexColor : %orig;
}
- (UIColor *)textSecondary {
return self.pageStyle == 1 ? lcmHexColor : %orig;
}
- (UIColor *)overlayTextPrimary {
return self.pageStyle == 1 ? lcmHexColor : %orig;
}
- (UIColor *)overlayTextSecondary {
return self.pageStyle == 1 ? lcmHexColor : %orig;
}
- (UIColor *)iconActive {
return self.pageStyle == 1 ? lcmHexColor : %orig;
}
- (UIColor *)iconActiveOther {
return self.pageStyle == 1 ? lcmHexColor : %orig;
}
- (UIColor *)brandIconActive {
return self.pageStyle == 1 ? lcmHexColor : %orig;
}
- (UIColor *)staticBrandWhite {
return self.pageStyle == 1 ? lcmHexColor : %orig;
}
- (UIColor *)overlayIconActiveOther {
return self.pageStyle == 1 ? lcmHexColor : %orig;
}
- (UIColor *)overlayIconInactive {
return self.pageStyle == 1 ? [lcmHexColor colorWithAlphaComponent:0.7] : %orig;
}
- (UIColor *)overlayIconDisabled {
return self.pageStyle == 1 ? [lcmHexColor colorWithAlphaComponent:0.3] : %orig;
}
- (UIColor *)overlayFilledButtonActive {
return self.pageStyle == 1 ? [lcmHexColor colorWithAlphaComponent:0.2] : %orig;
}
%end
%hook YTColor
+ (BOOL)darkerPaletteTextColorEnabled {
return NO;
}
+ (UIColor *)white1 {
return lcmHexColor;
}
+ (UIColor *)white2 {
return lcmHexColor;
}
+ (UIColor *)white3 {
return lcmHexColor;
}
+ (UIColor *)white4 {
return lcmHexColor;
}
+ (UIColor *)white5 {
return lcmHexColor;
}
+ (UIColor *)grey1 {
return lcmHexColor;
}
+ (UIColor *)grey2 {
return lcmHexColor;
}
%end
%hook QTMColorGroup
- (UIColor *)tint100 {
return [UIColor whiteColor];
}
- (UIColor *)tint300 {
return [UIColor whiteColor];
}
- (UIColor *)tint500 {
return [UIColor whiteColor];
}
- (UIColor *)tint700 {
return [UIColor whiteColor];
}
- (UIColor *)accent200 {
return [UIColor whiteColor];
}
- (UIColor *)accent400 {
return [UIColor whiteColor];
}
- (UIColor *)accentColor {
return [UIColor whiteColor];
}
- (UIColor *)brightAccentColor {
return [UIColor whiteColor];
}
- (UIColor *)regularColor {
return [UIColor whiteColor];
}
- (UIColor *)darkerColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColor {
return [UIColor whiteColor];
}
- (UIColor *)lightBodyTextColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnRegularColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnLighterColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnDarkerColor {
return [UIColor whiteColor];
}
- (UIColor *)bodyTextColorOnAccentColor {
return [UIColor whiteColor];
}
- (UIColor *)buttonBackgroundColor {
return [UIColor whiteColor];
}
%end
%hook YTQTMButton
- (void)setImage:(UIImage *)image {
UIImage *currentImage = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self setTintColor:[UIColor whiteColor]];
%orig(currentImage);
}
%end
%hook UIExtendedSRGColorSpace
- (void)setTextColor:(UIColor *)textColor {
textColor = [[UIColor whiteColor] colorWithAlphaComponent:0.9];
%orig();
}
%end
%hook UIExtendedSRGBColorSpace
- (void)setTextColor:(UIColor *)textColor {
textColor = [[UIColor whiteColor] colorWithAlphaComponent:1.0];
%orig();
}
%end
%hook UIExtendedGrayColorSpace
- (void)setTextColor:(UIColor *)textColor {
textColor = [[UIColor whiteColor] colorWithAlphaComponent:1.0];
%orig();
}
%end
%hook VideoTitleLabel
- (void)setTextColor:(UIColor *)textColor {
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UILabel
+ (void)load {
@autoreleasepool {
[[UILabel appearance] setTextColor:[UIColor whiteColor]];
}
}
- (void)setTextColor:(UIColor *)textColor {
%log;
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UITextField
- (void)setTextColor:(UIColor *)textColor {
%log;
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UITextView
- (void)setTextColor:(UIColor *)textColor {
%log;
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UISearchBar
- (void)setTextColor:(UIColor *)textColor {
textColor = [UIColor whiteColor];
%orig(textColor);
}
%end
%hook UISegmentedControl
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
%orig(modifiedAttributes, state);
}
%end
%hook UIButton
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state {
color = [UIColor whiteColor];
%orig(color, state);
}
%end
%hook UIBarButtonItem
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
%orig(modifiedAttributes, state);
}
%end
%hook NSAttributedString
- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSAttributedStringKey, id> *)attrs {
NSMutableDictionary *modifiedAttributes = [NSMutableDictionary dictionaryWithDictionary:attrs];
[modifiedAttributes setObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
return %orig(str, modifiedAttributes);
}
%end
%hook CATextLayer
- (void)setTextColor:(CGColorRef)textColor {
%orig([UIColor whiteColor].CGColor);
}
%end
%hook ASTextNode
- (NSAttributedString *)attributedString {
NSAttributedString *originalAttributedString = %orig;
NSMutableAttributedString *newAttributedString = [originalAttributedString mutableCopy];
[newAttributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, newAttributedString.length)];
return newAttributedString;
}
%end
%hook ASTextFieldNode
- (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]);
}
%end
%hook ASTextView
- (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]);
}
%end
%hook ASButtonNode
- (void)setTextColor:(UIColor *)textColor {
%orig([UIColor whiteColor]);
}
%end
%end
# pragma mark - ctor
%ctor {
%init;
if (lowContrastMode()) {
%init(gLowContrastMode);
}
if (customContrastMode()) {
NSData *lcmColorData = [[NSUserDefaults standardUserDefaults] objectForKey:@"kCustomUIColor"];
NSKeyedUnarchiver *lcmUnarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:lcmColorData error:nil];
[lcmUnarchiver setRequiresSecureCoding:NO];
NSString *lcmHexString = [lcmUnarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
if (lcmHexString != nil) {
lcmHexColor = [lcmUnarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
%init(gCustomContrastMode);
}
}
}

View file

@ -18,4 +18,4 @@ extern NSBundle *uYouPlusBundle();
return %orig;
}
}
%end
%end

View file

@ -42,4 +42,4 @@ static void replaceTab(YTIGuideResponse *response) {
if (IS_ENABLED(@"reExplore_enabled")) {
%init(YTReExplore);
}
}
}

View file

@ -6,39 +6,279 @@
#import <substrate.h>
#import <rootless.h>
#import "uYouPlusThemes.h" // Hide "Buy Super Thanks" banner (_ASDisplayView)
#import "../Tweaks/YouTubeHeader/YTAppDelegate.h" // Activate FLEX
#import "../Tweaks/YouTubeHeader/YTIMenuConditionalServiceItemRenderer.h"
// #import "../Tweaks/YouTubeHeader/YTISectionListRenderer.h" // Hide search ads by @PoomSmart - https://github.com/PoomSmart/YouTube-X
#import "Tweaks/YouTubeHeader/YTAppDelegate.h"
#import "Tweaks/YouTubeHeader/YTPlayerViewController.h"
#import "Tweaks/YouTubeHeader/YTQTMButton.h"
#import "Tweaks/YouTubeHeader/YTVideoQualitySwitchOriginalController.h"
#import "Tweaks/YouTubeHeader/YTPlayerViewController.h"
#import "Tweaks/YouTubeHeader/YTWatchController.h"
#import "Tweaks/YouTubeHeader/YTIGuideResponse.h"
#import "Tweaks/YouTubeHeader/YTIGuideResponseSupportedRenderers.h"
#import "Tweaks/YouTubeHeader/YTIPivotBarSupportedRenderers.h"
#import "Tweaks/YouTubeHeader/YTIPivotBarItemRenderer.h"
#import "Tweaks/YouTubeHeader/YTIPivotBarRenderer.h"
#import "Tweaks/YouTubeHeader/YTIBrowseRequest.h"
#import "Tweaks/YouTubeHeader/YTIButtonRenderer.h"
#import "Tweaks/YouTubeHeader/YTISectionListRenderer.h"
#import "Tweaks/YouTubeHeader/YTColorPalette.h"
#import "Tweaks/YouTubeHeader/YTCommonColorPalette.h"
#import "Tweaks/YouTubeHeader/YTSettingsSectionItemManager.h"
#import "Tweaks/YouTubeHeader/ASCollectionView.h"
#import "Tweaks/YouTubeHeader/YTPlayerOverlay.h"
#import "Tweaks/YouTubeHeader/YTPlayerOverlayProvider.h"
#import "Tweaks/YouTubeHeader/YTReelWatchPlaybackOverlayView.h"
#import "Tweaks/YouTubeHeader/YTReelPlayerBottomButton.h"
#import "Tweaks/YouTubeHeader/YTReelPlayerViewController.h"
#import "Tweaks/YouTubeHeader/YTIMenuConditionalServiceItemRenderer.h"
#import "Tweaks/YouTubeHeader/YTPivotBarItemView.h"
#import "Tweaks/YouTubeHeader/YTVideoWithContextNode.h" // YouTube-X
#import "Tweaks/YouTubeHeader/ELMCellNode.h" // YouTube-X
#import "Tweaks/YouTubeHeader/ELMNodeController.h" // YouTube-X
#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"]
#define YT_BUNDLE_ID @"com.google.ios.youtube"
#define YT_NAME @"YouTube"
#define DEFAULT_RATE 1.0f // YTSpeed
#define LOWCONTRASTMODE_CUTOFF_VERSION @"17.38.10" // LowContrastMode
@interface YTSingleVideoController ()
- (float)playbackRate;
- (void)setPlaybackRate:(float)arg1;
@end
@interface YTPlayerViewController ()
- (YTSingleVideoController *)activeVideo;
@end
// IAmYouTube
@interface SSOConfiguration : NSObject
@end
// uYouPlus
@interface YTHeaderLogoController : UIView
@property(readonly, nonatomic) long long pageStyle;
@end
@interface YTNavigationBarTitleView : UIView
@end
@interface YTChipCloudCell : UIView
@end
@interface YTPlayabilityResolutionUserActionUIController : NSObject // Skips content warning before playing *some videos - @PoomSmart
- (void)confirmAlertDidPressConfirm;
@end
@interface YTMainAppControlsOverlayView : UIView
@end
@interface YTTransportControlsButtonView : UIView
@end
@interface _ASCollectionViewCell : UICollectionViewCell
- (id)node;
@end
@interface YTAsyncCollectionView : UICollectionView
@end
@interface FRPSliderCell : UITableViewCell
@end
@interface boolSettingsVC : UIViewController
@end
@interface YTPlaybackButton : UIControl
@end
@interface PlayerManager : NSObject
- (float)progress;
@end
// Disable snap to chapter
@interface YTSegmentableInlinePlayerBarView
@property (nonatomic, assign, readwrite) BOOL enableSnapToChapter;
@end
// Hide autoplay switch / CC button
@interface YTMainAppControlsOverlayView : UIView
@interface YTPlaylistHeaderViewController: UIViewController
@property UIButton *downloadsButton;
@end
// Skips content warning before playing *some videos - @PoomSmart
@interface YTPlayabilityResolutionUserActionUIController : NSObject
- (void)confirmAlertDidPressConfirm;
@end
// Hide iSponsorBlock
// Buttons
@interface YTRightNavigationButtons : UIView
@property (nonatomic, readwrite, strong) UIView *sponsorBlockButton;
@property YTQTMButton *notificationButton;
@property YTQTMButton *sponsorBlockButton;
@end
// Hide YouTube annoying banner in Home page? - @MiRO92 - YTNoShorts: https://github.com/MiRO92/YTNoShorts
@interface _ASCollectionViewCell : UICollectionViewCell
- (id)node;
@interface YTISlimMetadataButtonSupportedRenderers : NSObject
- (id)slimButton_buttonRenderer;
- (id)slimMetadataButtonRenderer;
@end
@interface YTAsyncCollectionView : UICollectionView
- (void)removeShortsAndFeaturesAdsAtIndexPath:(NSIndexPath *)indexPath;
// YTSpeed
@interface YTVarispeedSwitchControllerOption : NSObject
- (id)initWithTitle:(id)title rate:(float)rate;
@end
@interface MLHAMQueuePlayer : NSObject
@property id playerEventCenter;
@property id delegate;
- (void)setRate:(float)rate;
- (void)internalSetRate;
@end
@interface MLPlayerStickySettings : NSObject
- (void)setRate:(float)rate;
@end
@interface MLPlayerEventCenter : NSObject
- (void)broadcastRateChange:(float)rate;
@end
@interface HAMPlayerInternal : NSObject
- (void)setRate:(float)rate;
@end
// iOS16 fix
@interface OBPrivacyLinkButton : UIButton
- (instancetype)initWithCaption:(NSString *)caption
buttonText:(NSString *)buttonText
image:(UIImage *)image
imageSize:(CGSize)imageSize
useLargeIcon:(BOOL)useLargeIcon
displayLanguage:(NSString *)displayLanguage;
@end
// Fix uYou's appearance not updating if the app is backgrounded
@interface DownloadsPagerVC : UIViewController
- (NSArray<UIViewController *> *)viewControllers;
- (void)updatePageStyles;
@end
@interface DownloadingVC : UIViewController
- (void)updatePageStyles;
- (UITableView *)tableView;
@end
@interface DownloadingCell : UITableViewCell
- (void)updatePageStyles;
@end
@interface DownloadedVC : UIViewController
- (void)updatePageStyles;
- (UITableView *)tableView;
@end
@interface DownloadedCell : UITableViewCell
- (void)updatePageStyles;
@end
@interface UILabel (uYou)
+ (id)_defaultColor;
@end
// YTAutoFullScreen
@interface YTPlayerViewController (YTAFS)
- (void)autoFullscreen;
// YTSpeed
@property id activeVideo;
@property float playbackRate;
- (void)singleVideo:(id)video playbackRateDidChange:(float)rate;
// uYouCrashFix
- (YTSingleVideoController *)activeVideo;
@end
// App Theme
@interface YTColor : NSObject
+ (UIColor *)white1;
+ (UIColor *)white2;
+ (UIColor *)white3;
+ (UIColor *)white4;
+ (UIColor *)white5;
+ (UIColor *)black0;
+ (UIColor *)black1;
+ (UIColor *)black2;
+ (UIColor *)black3;
+ (UIColor *)black4;
+ (UIColor *)blackPure;
+ (UIColor *)grey1;
+ (UIColor *)grey2;
+ (UIColor *)white1Alpha98;
+ (UIColor *)white1Alpha95;
@end
@interface YCHLiveChatView : UIView
@end
@interface YTFullscreenEngagementOverlayView : UIView
@end
@interface YTRelatedVideosView : UIView
@end
@interface YTTopAlignedView : UIView
@end
@interface ELMView : UIView
@end
@interface ASWAppSwitcherCollectionViewCell : UIView
@end
@interface ASScrollView : UIView
@end
@interface UIKeyboardLayoutStar : UIView
@end
@interface UIKeyboardDockView : UIView
@end
@interface _ASDisplayView : UIView
@end
@interface ELMContainerNode : NSObject
@end
@interface YTAutonavEndscreenView : UIView
@end
@interface YTPivotBarIndicatorView : UIView
@end
@interface YTCommentDetailHeaderCell : UIView
@end
@interface SponsorBlockSettingsController : UITableViewController
@end
@interface SponsorBlockViewController : UIViewController
@end
@interface UICandidateViewController : UIViewController
@end
@interface UIPredictionViewController : UIViewController
@end
@interface FRPreferences : UITableViewController
@end
@interface FRPSelectListTable : UITableViewController
@end
@interface settingsReorderTable : UIViewController
@property(nonatomic, strong) UITableView *tableView;
@end
// Snack bar
@interface YTHUDMessage : NSObject
+ (id)messageWithText:(id)text;
- (void)setAction:(id)action;
@end
@interface GOOHUDMessageAction : NSObject
- (void)setTitle:(NSString *)title;
- (void)setHandler:(void (^)(id))handler;
@end
@interface GOOHUDManagerInternal : NSObject
- (void)showMessageMainThread:(id)message;
+ (id)sharedInstance;
@end

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
#import "uYouPlusPatches.h"
#import "uYouPlus.h"
# pragma mark - YouTube patches
@ -26,6 +26,36 @@
- (BOOL)disableAfmaIdfaCollection { return NO; }
%end
// Reposition "Create" Tab to the Center in the Pivot Bar - qnblackcat/uYouPlus#107
/*
static void repositionCreateTab(YTIGuideResponse *response) {
NSMutableArray<YTIGuideResponseSupportedRenderers *> *renderers = [response itemsArray];
for (YTIGuideResponseSupportedRenderers *guideRenderers in renderers) {
YTIPivotBarRenderer *pivotBarRenderer = [guideRenderers pivotBarRenderer];
NSMutableArray<YTIPivotBarSupportedRenderers *> *items = [pivotBarRenderer itemsArray];
NSUInteger createIndex = [items indexOfObjectPassingTest:^BOOL(YTIPivotBarSupportedRenderers *renderers, NSUInteger idx, BOOL *stop) {
return [[[renderers pivotBarItemRenderer] pivotIdentifier] isEqualToString:@"FEuploads"];
}];
if (createIndex != NSNotFound) {
YTIPivotBarSupportedRenderers *createTab = [items objectAtIndex:createIndex];
[items removeObjectAtIndex:createIndex];
NSUInteger centerIndex = items.count / 2;
[items insertObject:createTab atIndex:centerIndex]; // Reposition the "Create" tab at the center
}
}
}
%hook YTGuideServiceCoordinator
- (void)handleResponse:(YTIGuideResponse *)response withCompletion:(id)completion {
repositionCreateTab(response);
%orig(response, completion);
}
- (void)handleResponse:(YTIGuideResponse *)response error:(id)error completion:(id)completion {
repositionCreateTab(response);
%orig(response, error, completion);
}
%end
*/
// https://github.com/PoomSmart/YouTube-X/blob/1e62b68e9027fcb849a75f54a402a530385f2a51/Tweak.x#L27
// %hook YTAdsInnerTubeContextDecorator
// - (void)decorateContext:(id)context {}
@ -173,17 +203,14 @@ static void refreshUYouAppearance() {
%end
// Prevent uYou's playback from colliding with YouTube's
%hook PlayerVC
- (void)close {
%orig;
[[%c(PlayerManager) sharedInstance] setSource:nil];
}
%end
BOOL isYTPlaybackActive = NO;
%hook HAMPlayerInternal
- (void)play { %orig; isYTPlaybackActive = YES; }
- (void)terminate { %orig; isYTPlaybackActive = NO; }
%end
%hook PlayerManager
- (void)play {
dispatch_async(dispatch_get_main_queue(), ^{
[[%c(PlayerManager) sharedInstance] pause];
});
if (isYTPlaybackActive) return;
%orig;
}
%end
@ -213,4 +240,4 @@ static void refreshUYouAppearance() {
// 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"];
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,12 +1,52 @@
#import "uYouPlusThemes.h"
#import "uYouPlus.h"
#define IS_DARK_APPEARANCE_ENABLED ([[NSUserDefaults standardUserDefaults] integerForKey:@"page_style"] == 1)
#define IS_OLD_DARK_THEME_SELECTED (APP_THEME_IDX == 1)
#define IS_OLED_DARK_THEME_SELECTED (APP_THEME_IDX == 2)
#define IS_CUSTOM_DARK_THEME_SELECTED (APP_THEME_IDX == 3)
# pragma mark - Old dark theme (lighter grey)
%group gOldDarkTheme
%hook YTCommonColorPalette
- (UIColor *)background1 {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)background2 {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)background3 {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)baseBackground {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)brandBackgroundSolid {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)brandBackgroundPrimary {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)brandBackgroundSecondary {
return self.pageStyle == 1 ? [[UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] colorWithAlphaComponent:0.9] : %orig;
}
- (UIColor *)raisedBackground {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)staticBrandBlack {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)generalBackgroundA {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)generalBackgroundB {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
- (UIColor *)menuBackground {
return self.pageStyle == 1 ? [UIColor colorWithRed:0.129 green:0.129 blue:0.129 alpha:1.0] : %orig;
}
%end
%hook YTColdConfig
- (BOOL)uiSystemsClientGlobalConfigUseDarkerPaletteBgColorForNative { return NO; }
- (BOOL)uiSystemsClientGlobalConfigUseDarkerPaletteTextColorForNative { return NO; }
@ -251,20 +291,46 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
// Others
%hook _ASDisplayView
- (void)layoutSubviews {
%orig;
if (IS_DARK_APPEARANCE_ENABLED) {
UIResponder *responder = [self nextResponder];
while (responder != nil) {
if ([responder isKindOfClass:NSClassFromString(@"YTActionSheetDialogViewController")]) {
self.backgroundColor = [UIColor blackColor];
}
if ([responder isKindOfClass:NSClassFromString(@"YTPanelLoadingStrategyViewController")]) {
self.backgroundColor = [UIColor blackColor];
}
if ([responder isKindOfClass:NSClassFromString(@"YTTabHeaderElementsViewController")]) {
self.backgroundColor = [UIColor blackColor];
}
if ([responder isKindOfClass:NSClassFromString(@"YTEditSheetControllerElementsContentViewController")]) {
self.backgroundColor = [UIColor blackColor];
}
responder = [responder nextResponder];
}
}
}
- (void)didMoveToWindow {
%orig;
if (IS_DARK_APPEARANCE_ENABLED) {
if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.backgroundColor = [UIColor clearColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"brand_promo.view"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.cvr"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.topic_channel_details"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.live_chat_text_message"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_thread"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.cancel.button"]) { self.superview.backgroundColor = [UIColor clearColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.filter_chip_bar"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.timed_comments_welcome"]) { self.superview.backgroundColor = self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.superview.backgroundColor = self.backgroundColor = [UIColor blackColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.comment_group_detail_container"]) { self.backgroundColor = [UIColor clearColor]; }
if ([self.accessibilityIdentifier hasPrefix:@"id.elements.components.overflow_menu_item_"]) { self.backgroundColor = [UIColor clearColor]; }
}
@ -301,6 +367,291 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
%end
%end
# pragma mark - Custom dark mode by BandarHL
UIColor *customHexColor;
%group gCustomTheme
%hook YTCommonColorPalette
- (UIColor *)baseBackground {
return self.pageStyle == 1 ? customHexColor : %orig;
}
- (UIColor *)brandBackgroundSolid {
return self.pageStyle == 1 ? customHexColor : %orig;
}
- (UIColor *)brandBackgroundPrimary {
return self.pageStyle == 1 ? customHexColor : %orig;
}
- (UIColor *)brandBackgroundSecondary {
return self.pageStyle == 1 ? [customHexColor colorWithAlphaComponent:0.9] : %orig;
}
- (UIColor *)raisedBackground {
return self.pageStyle == 1 ? customHexColor : %orig;
}
- (UIColor *)staticBrandBlack {
return self.pageStyle == 1 ? customHexColor : %orig;
}
- (UIColor *)generalBackgroundA {
return self.pageStyle == 1 ? customHexColor : %orig;
}
%end
// uYou settings
%hook UITableViewCell
- (void)_layoutSystemBackgroundView {
%orig;
UIView *systemBackgroundView = [self valueForKey:@"_systemBackgroundView"];
NSString *backgroundViewKey = class_getInstanceVariable(systemBackgroundView.class, "_colorView") ? @"_colorView" : @"_backgroundView";
((UIView *)[systemBackgroundView valueForKey:backgroundViewKey]).backgroundColor = customHexColor;
}
- (void)_layoutSystemBackgroundView:(BOOL)arg1 {
%orig;
((UIView *)[[self valueForKey:@"_systemBackgroundView"] valueForKey:@"_colorView"]).backgroundColor = customHexColor;
}
%end
%hook settingsReorderTable
- (void)viewDidLayoutSubviews {
%orig;
self.tableView.backgroundColor = customHexColor;
}
%end
%hook FRPSelectListTable
- (void)viewDidLayoutSubviews {
%orig;
self.tableView.backgroundColor = customHexColor;
}
%end
%hook FRPreferences
- (void)viewDidLayoutSubviews {
%orig;
self.tableView.backgroundColor = customHexColor;
}
%end
%hook YTInnerTubeCollectionViewController
- (UIColor *)backgroundColor:(NSInteger)pageStyle {
return pageStyle == 1 ? customHexColor : %orig;
}
%end
// Explore
%hook ASScrollView
- (void)didMoveToWindow {
%orig;
if (IS_DARK_APPEARANCE_ENABLED) {
self.backgroundColor = [UIColor clearColor];
}
}
%end
// Your videos
%hook ASCollectionView
- (void)didMoveToWindow {
%orig;
if (IS_DARK_APPEARANCE_ENABLED && [self.nextResponder isKindOfClass:%c(_ASDisplayView)]) {
self.superview.backgroundColor = customHexColor;
}
}
%end
// Sub menu?
%hook ELMView
- (void)didMoveToWindow {
%orig;
if (IS_DARK_APPEARANCE_ENABLED) {
// self.subviews[0].backgroundColor = [UIColor clearColor];
}
}
%end
// iSponsorBlock
%hook SponsorBlockSettingsController
- (void)viewDidLoad {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
%orig;
self.tableView.backgroundColor = customHexColor;
} else { return %orig; }
}
%end
%hook SponsorBlockViewController
- (void)viewDidLoad {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
%orig;
self.view.backgroundColor = customHexColor;
} else { return %orig; }
}
%end
// Search view
%hook YTSearchBarView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
}
%end
// History search view
%hook YTSearchBoxView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
}
%end
// Comment view
%hook YTCommentView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
}
%end
%hook YTCreateCommentAccessoryView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
}
%end
%hook YTCreateCommentTextView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
}
- (void)setTextColor:(UIColor *)color { // fix black text in #Shorts video's comment
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor whiteColor]) : %orig;
}
%end
%hook YTCommentDetailHeaderCell
- (void)didMoveToWindow {
%orig;
if (IS_DARK_APPEARANCE_ENABLED) {
// self.subviews[2].backgroundColor = customHexColor;
}
}
%end
%hook YTFormattedStringLabel // YT is werid...
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig([UIColor clearColor]) : %orig;
}
%end
// Live chat comment
%hook YCHLiveChatActionPanelView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
}
%end
%hook YTEmojiTextView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
}
%end
%hook YCHLiveChatView
- (void)didMoveToWindow {
%orig;
if (IS_DARK_APPEARANCE_ENABLED) {
// self.subviews[1].backgroundColor = customHexColor;
}
}
%end
%hook YTCollectionView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
}
%end
//
%hook YTBackstageCreateRepostDetailView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(customHexColor) : %orig;
}
%end
// Others
%hook _ASDisplayView
- (void)layoutSubviews {
%orig;
if (IS_DARK_APPEARANCE_ENABLED) {
UIResponder *responder = [self nextResponder];
while (responder != nil) {
if ([responder isKindOfClass:NSClassFromString(@"YTActionSheetDialogViewController")]) {
self.backgroundColor = customHexColor;
}
if ([responder isKindOfClass:NSClassFromString(@"YTPanelLoadingStrategyViewController")]) {
self.backgroundColor = customHexColor;
}
if ([responder isKindOfClass:NSClassFromString(@"YTTabHeaderElementsViewController")]) {
self.backgroundColor = customHexColor;
}
if ([responder isKindOfClass:NSClassFromString(@"YTEditSheetControllerElementsContentViewController")]) {
self.backgroundColor = customHexColor;
}
responder = [responder nextResponder];
}
}
}
- (void)didMoveToWindow {
%orig;
if (IS_DARK_APPEARANCE_ENABLED) {
if ([self.nextResponder isKindOfClass:%c(ASScrollView)]) { self.backgroundColor = [UIColor clearColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"brand_promo.view"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.cvr"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.topic_channel_details"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"eml.live_chat_text_message"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"rich_header"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_cell"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.comment_thread"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.ui.cancel.button"]) { self.superview.backgroundColor = [UIColor clearColor]; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.comment_composer"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.filter_chip_bar"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.video_list_entry"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.timed_comments_welcome"]) { self.superview.backgroundColor = self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.superview.backgroundColor = self.backgroundColor = customHexColor; }
if ([self.accessibilityIdentifier isEqualToString:@"id.comment.comment_group_detail_container"]) { self.backgroundColor = [UIColor clearColor]; }
if ([self.accessibilityIdentifier hasPrefix:@"id.elements.components.overflow_menu_item_"]) { self.backgroundColor = [UIColor clearColor]; }
}
}
%end
// Open link with...
%hook ASWAppSwitchingSheetHeaderView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(raisedColor) : %orig;
}
%end
%hook ASWAppSwitchingSheetFooterView
- (void)setBackgroundColor:(UIColor *)color {
return IS_DARK_APPEARANCE_ENABLED ? %orig(raisedColor) : %orig;
}
%end
%hook ASWAppSwitcherCollectionViewCell
- (void)didMoveToWindow {
%orig;
if (IS_DARK_APPEARANCE_ENABLED) {
self.backgroundColor = raisedColor;
// self.subviews[1].backgroundColor = raisedColor;
self.superview.backgroundColor = raisedColor;
}
}
%end
// Incompatibility with the new YT Dark theme
%hook YTColdConfig
- (BOOL)uiSystemsClientGlobalConfigUseDarkerPaletteBgColorForNative { return NO; }
%end
%end
# pragma mark - OLED keyboard by @ichitaso <3 - http://gist.github.com/ichitaso/935100fd53a26f18a9060f7195a1be0e
%group gOLEDKB
@ -347,4 +698,14 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
if (IS_ENABLED(@"oledKeyBoard_enabled")) {
%init(gOLEDKB);
}
}
if (IS_CUSTOM_DARK_THEME_SELECTED) {
NSData *colorData = [[NSUserDefaults standardUserDefaults] objectForKey:@"kCustomThemeColor"];
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:colorData error:nil];
[unarchiver setRequiresSecureCoding:NO];
NSString *hexString = [unarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
if (hexString != nil) {
customHexColor = [unarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
%init(gCustomTheme);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,90 @@
// Template for whenever I refresh the main branch. and even need to re-add the submodules afterwards.
name: Update Submodules
on:
workflow_dispatch:
jobs:
update-submodules:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4.1.1
- name: Set up Git
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
- name: Add uYouEnhanced submodules
run: |
git submodule add https://github.com/PoomSmart/FLEXing.git Tweaks/FLEXing
git submodule add https://github.com/dayanch96/uYouLocalization.git Tweaks/uYouLocalization
git submodule add https://github.com/arichorn/YTHoldForSpeed.git Tweaks/YTHoldForSpeed
git add .
git commit -m "added uYouEnhanced submodules"
git push origin
# - name: Update submodules
# run: |
# git submodule update --init --recursive --remote
# git add .
# git commit -m "updated submodules"
# git push origin
# continue-on-error: true
- name: Update submodules
run: |
git submodule update --init --recursive --remote Tweaks/Alderis
git add .
git submodule update --init --recursive --remote Tweaks/DontEatMyContent
git add .
git submodule update --init --recursive --remote Tweaks/YTHoldForSpeed
git add .
git submodule update --init --recursive --remote Tweaks/MrBeastify
git add .
git submodule update --init --recursive --remote Tweaks/PSHeader
git add .
git submodule update --init --recursive --remote Tweaks/Return-YouTube-Dislikes
git add .
git submodule update --init --recursive --remote Tweaks/uYouLocalization
git add .
git submodule update --init --recursive --remote Tweaks/YTABConfig
git add .
git submodule update --init --recursive --remote Tweaks/YTUHD
git add .
git submodule update --init --recursive --remote Tweaks/YTVideoOverlay
git add .
git submodule update --init --recursive --remote Tweaks/YouMute
git add .
git submodule update --init --recursive --remote Tweaks/YouPiP
git add .
git submodule update --init --recursive --remote Tweaks/YouQuality
git add .
git submodule update --init --recursive --remote Tweaks/YouTubeHeader
git add .
git submodule update --init --recursive --remote Tweaks/iSponsorBlock
git add .
git commit -m "updated submodules"
git push origin
continue-on-error: true
- name: Make .bundle files
run: |
cd Bundles
ln -s ../Tweaks/MrBeastify/layout/Library/Application\ Support/MrBeastify.bundle MrBeastify.bundle
ln -s ../Tweaks/uYouLocalization/layout/Library/Application\ Support/uYouLocalization.bundle uYouLocalization.bundle
ln -s ../Tweaks/YTHoldForSpeed/layout/Library/Application\ Support/YTHoldForSpeed.bundle YTHoldForSpeed.bundle
git add .
git commit -m "Added bundles"
git push origin
- name: Check exit code
run: |
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Submodule update failed with exit code $exit_code"
exit 1
fi