diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index bd965c8..c2609b9 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -36,6 +36,8 @@ jobs: git add . git submodule update --init --recursive --remote Tweaks/YTABConfig git add . + git submodule update --init --recursive --remote Tweaks/YTClassicVideoQuality + git add . git submodule update --init --recursive --remote Tweaks/YTUHD git add . git submodule update --init --recursive --remote Tweaks/YTVideoOverlay diff --git a/.gitmodules b/.gitmodules index bec1095..2b0e99b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -52,7 +52,7 @@ url = https://github.com/PoomSmart/IAmYouTube.git [submodule "Tweaks/YTClassicVideoQuality"] path = Tweaks/YTClassicVideoQuality - url = https://github.com/PoomSmart/YTClassicVideoQuality.git + url = https://github.com/arichornloverALT/YTClassicVideoQuality.git [submodule "Tweaks/NoYTPremium"] path = Tweaks/NoYTPremium url = https://github.com/PoomSmart/NoYTPremium.git diff --git a/Sources/AppIconOptionsController.h b/Sources/AppIconOptionsController.h new file mode 100644 index 0000000..7272db7 --- /dev/null +++ b/Sources/AppIconOptionsController.h @@ -0,0 +1,5 @@ +#import + +@interface AppIconOptionsController : UIViewController + +@end diff --git a/Sources/AppIconOptionsController.m b/Sources/AppIconOptionsController.m new file mode 100644 index 0000000..ea65b9a --- /dev/null +++ b/Sources/AppIconOptionsController.m @@ -0,0 +1,123 @@ +#import "AppIconOptionsController.h" + +@interface AppIconOptionsController () + +@property (strong, nonatomic) UICollectionView *collectionView; +@property (strong, nonatomic) UIImageView *iconPreview; +@property (strong, nonatomic) NSArray *appIcons; +@property (strong, nonatomic) NSString *selectedIconFile; + +@end + +@implementation AppIconOptionsController + +- (void)viewDidLoad { + [super viewDidLoad]; + + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + self.collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout]; + self.collectionView.dataSource = self; + self.collectionView.delegate = self; + [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"Cell"]; + [self.view addSubview:self.collectionView]; + + UIButton *defaultButton = [UIButton buttonWithType:UIButtonTypeSystem]; + defaultButton.frame = CGRectMake(20, 100, 100, 40); + [defaultButton setTitle:@"Default" forState:UIControlStateNormal]; + [defaultButton addTarget:self action:@selector(setDefaultIcon) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:defaultButton]; + + UIButton *saveButton = [UIButton buttonWithType:UIButtonTypeSystem]; + saveButton.frame = CGRectMake(150, 100, 100, 40); + [saveButton setTitle:@"Save" forState:UIControlStateNormal]; + [saveButton addTarget:self action:@selector(saveIcon) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:saveButton]; + + self.iconPreview = [[UIImageView alloc] initWithFrame:CGRectMake(20, 150, 60, 60)]; + self.iconPreview.layer.cornerRadius = 10.0; + self.iconPreview.clipsToBounds = YES; + [self.view addSubview:self.iconPreview]; + + NSString *path = [[NSBundle mainBundle] pathForResource:@"uYouPlus" ofType:@"bundle"]; + NSBundle *bundle = [NSBundle bundleWithPath:path]; + self.appIcons = [bundle pathsForResourcesOfType:@"png" inDirectory:@"AppIcons"]; + + if ([UIApplication sharedApplication].supportsAlternateIcons) { + } else { + NSLog(@"Alternate icons are not supported on this device."); + } +} + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.appIcons.count; +} + +- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath]; + + UIImage *appIconImage = [UIImage imageWithContentsOfFile:self.appIcons[indexPath.row]]; + UIImage *resizedIconImage = [self resizedImageWithImage:appIconImage]; + + UIImageView *imageView = [[UIImageView alloc] initWithImage:resizedIconImage]; + imageView.contentMode = UIViewContentModeScaleAspectFit; + imageView.frame = cell.contentView.bounds; + imageView.layer.cornerRadius = 10.0; + imageView.clipsToBounds = YES; + [cell.contentView addSubview:imageView]; + + return cell; +} + +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + self.selectedIconFile = self.appIcons[indexPath.row]; + UIImage *selectedIconImage = [UIImage imageWithContentsOfFile:self.selectedIconFile]; + UIImage *resizedSelectedIconImage = [self resizedImageWithImage:selectedIconImage]; + self.iconPreview.image = resizedSelectedIconImage; +} + +- (void)setDefaultIcon { + self.iconPreview.image = nil; + self.selectedIconFile = nil; +} + +- (void)saveIcon { + if (self.selectedIconFile) { + [[UIApplication sharedApplication] setAlternateIconName:[self.selectedIconFile.lastPathComponent stringByDeletingPathExtension] completionHandler:^(NSError * _Nullable error){ + if (error) { + NSLog(@"Error setting alternate icon: %@", error.localizedDescription); + dispatch_async(dispatch_get_main_queue(), ^{ + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Error" message:@"Failed to set alternate icon" preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; + [alert addAction:okAction]; + [self presentViewController:alert animated:YES completion:nil]; + }); + } else { + NSLog(@"Alternate icon set successfully"); + dispatch_async(dispatch_get_main_queue(), ^{ + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Success" message:@"Alternate icon set successfully" preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; + [alert addAction:okAction]; + [self presentViewController:alert animated:YES completion:nil]; + }); + } + }]; + } else { + NSLog(@"No icon selected to save"); + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"No Icon Selected" message:@"Please select an icon before saving" preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; + [alert addAction:okAction]; + [self presentViewController:alert animated:YES completion:nil]; + } +} + +- (UIImage *)resizedImageWithImage:(UIImage *)image { + CGFloat scale = [UIScreen mainScreen].scale; + CGSize newSize = CGSizeMake(image.size.width / scale, image.size.height / scale); + UIGraphicsBeginImageContextWithOptions(newSize, NO, scale); + [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)]; + UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return resizedImage; +} + +@end diff --git a/Sources/RootOptionsController.m b/Sources/RootOptionsController.m index d62533a..436a6a8 100644 --- a/Sources/RootOptionsController.m +++ b/Sources/RootOptionsController.m @@ -1,6 +1,7 @@ #import "RootOptionsController.h" #import "ColourOptionsController.h" #import "ColourOptionsController2.h" +#import "AppIconOptionsController.h" @interface RootOptionsController () @end @@ -14,6 +15,9 @@ UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)]; self.navigationItem.leftBarButtonItem = doneButton; + + UIBarButtonItem *appIconButton = [[UIBarButtonItem alloc] initWithTitle:@"App Icon" style:UIBarButtonItemStylePlain target:self action:@selector(showAppIconOptions)]; + self.navigationItem.rightBarButtonItem = appIconButton; UITableViewStyle style; if (@available(iOS 13, *)) { @@ -164,6 +168,19 @@ @implementation RootOptionsController (Privates) +- (void)showAppIconOptions { + if (@available(iOS 15.0, *)) { + AppIconOptionsController *appIconOptionsController = [[AppIconOptionsController alloc] init]; + UINavigationController *appIconOptionsNavController = [[UINavigationController alloc] initWithRootViewController:appIconOptionsController]; + [self presentViewController:appIconOptionsNavController animated:YES completion:nil]; + } else { + NSString *systemVersion = [[UIDevice currentDevice] systemVersion]; + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Incompatible" message:[NSString stringWithFormat:@"Changing app icons is only available on iOS 15 and later.\nYour Device is currently using iOS %@.", systemVersion] preferredStyle:UIAlertControllerStyleAlert]; + [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]]; + [self presentViewController:alert animated:YES completion:nil]; + } +} + - (void)done { [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; } diff --git a/Sources/uYouPlus.h b/Sources/uYouPlus.h index ecc45ca..d9f4630 100644 --- a/Sources/uYouPlus.h +++ b/Sources/uYouPlus.h @@ -8,26 +8,28 @@ #import #import -#import "uYouPlusThemes.h" -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import +#import "uYouPlusThemes.h" // Hide "Buy Super Thanks" banner (_ASDisplayView) +#import // Activate FLEX +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import // Hide buttons under the video player by @PoomSmart #import @@ -44,7 +46,7 @@ #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 +#define LOWCONTRASTMODE_CUTOFF_VERSION @"17.38.10" // LowContrastMode (v17.33.2-17.38.10) // IAmYouTube @interface SSOConfiguration : NSObject @@ -87,6 +89,9 @@ @interface YTTransportControlsButtonView : UIView @end +@interface YTFullscreenActionsView : UIView +@end + @interface _ASCollectionViewCell : UICollectionViewCell - (id)node; @end diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index c26a9bb..d7dbc1d 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -550,20 +550,27 @@ BOOL isAd(YTIElementRenderer *self) { } %end -// Hide Fullscreen Actions buttons - @bhackel +// Hide Fullscreen Actions buttons - @bhackel & @arichornlover %group hideFullscreenActions - %hook YTMainAppVideoPlayerOverlayViewController - - (BOOL)isFullscreenActionsEnabled { - // This didn't work on its own - weird - return IS_ENABLED(@"hideFullscreenActions_enabled") ? NO : %orig; +%hook YTMainAppVideoPlayerOverlayViewController +- (BOOL)isFullscreenActionsEnabled { +// This didn't work on its own - weird + return IS_ENABLED(@"hideFullscreenActions_enabled") ? NO : %orig; +} +%end +%hook YTFullscreenActionsView +- (BOOL)enabled { + // Attempt 2 + return IS_ENABLED(@"hideFullscreenActions_enabled") ? NO : %orig; +} +- (void)removeFromSuperview { + // Attempt 3 + if (IS_ENABLED(@"hideFullscreenActions_enabled")) { + [self removeFromSuperview]; } - %end - %hook YTFullscreenActionsView - - (BOOL)enabled { - // Attempt 2 - return IS_ENABLED(@"hideFullscreenActions_enabled") ? NO : %orig; - } - %end +%orig; +} +%end %end # pragma mark - uYouPlus @@ -779,15 +786,28 @@ BOOL isAd(YTIElementRenderer *self) { // Bring back the Red Progress Bar and Gray Buffer Progress %group gRedProgressBar -%hook YTInlinePlayerBarContainerView +%hook YTSegmentableInlinePlayerBarView +- (void)setBufferedProgressBarColor:(id)arg1 { + [UIColor colorWithRed:1.00 green:1.00 blue:1.00 alpha:0.50]; +} +%end + +%hook YTInlinePlayerBarContainerView // Red Progress Bar - Old (Compatible for v17.33.2-v19.10.7) - (id)quietProgressBarColor { return [UIColor redColor]; } %end -%hook YTSegmentableInlinePlayerBarView -- (void)setBufferedProgressBarColor:(id)arg1 { - [UIColor colorWithRed:1.00 green:1.00 blue:1.00 alpha:0.50]; +%hook YTPlayerBarRectangleDecorationView // Red Progress Bar - New (Compatible for v19.10.7-latest) +- (void)drawRectangleDecorationWithSideMasks:(CGRect)rect { + if (IS_ENABLED(@"redProgressBar_enabled")) { + YTIPlayerBarDecorationModel *model = [self valueForKey:@"_model"]; + int overlayMode = model.playingState.overlayMode; + model.playingState.overlayMode = 1; + %orig; + model.playingState.overlayMode = overlayMode; + } else + %orig; } %end %end diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm index 236e3fb..33d3916 100644 --- a/Sources/uYouPlusSettings.xm +++ b/Sources/uYouPlusSettings.xm @@ -318,7 +318,9 @@ YTSettingsSectionItem *lowContrastMode = [YTSettingsSectionItemClass return NO; } } - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"lowContrastMode_enabled"]; + if (IS_ENABLED(@"fixLowContrastMode_enabled")) { + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"lowContrastMode_enabled"]; + } [settingsViewController reloadData]; SHOW_RELAUNCH_YT_SNACKBAR; return YES; diff --git a/Sources/update-submodules-template.txt b/Sources/update-submodules-template.txt index 07df787..ccb8526 100644 --- a/Sources/update-submodules-template.txt +++ b/Sources/update-submodules-template.txt @@ -56,6 +56,8 @@ jobs: git add . git submodule update --init --recursive --remote Tweaks/YTABConfig git add . + git submodule update --init --recursive --remote Tweaks/YTClassicVideoQuality + git add . git submodule update --init --recursive --remote Tweaks/YTUHD git add . git submodule update --init --recursive --remote Tweaks/YTVideoOverlay diff --git a/Tweaks/Return-YouTube-Dislikes b/Tweaks/Return-YouTube-Dislikes index d2aec88..8d90af3 160000 --- a/Tweaks/Return-YouTube-Dislikes +++ b/Tweaks/Return-YouTube-Dislikes @@ -1 +1 @@ -Subproject commit d2aec88d3e8c300983592d4e54f55eccad12c50d +Subproject commit 8d90af33a8ace8f1e0adbaa863aed5da9a835fc4 diff --git a/Tweaks/YTClassicVideoQuality b/Tweaks/YTClassicVideoQuality index d983151..e5f3cb2 160000 --- a/Tweaks/YTClassicVideoQuality +++ b/Tweaks/YTClassicVideoQuality @@ -1 +1 @@ -Subproject commit d983151bcb0d86dc3cae17c8ffcc87661457ea5e +Subproject commit e5f3cb2f3612332ae5c75ebcd7f25eb507b60750 diff --git a/Tweaks/YouTubeHeader b/Tweaks/YouTubeHeader index a2a7539..591fe9d 160000 --- a/Tweaks/YouTubeHeader +++ b/Tweaks/YouTubeHeader @@ -1 +1 @@ -Subproject commit a2a753975962e51cb834ff8f86759593dac58eb4 +Subproject commit 591fe9dc1dcfbd4591b391fe5b25301beea5e5b7 diff --git a/Tweaks/iSponsorBlock b/Tweaks/iSponsorBlock index 9b6d8db..304ec97 160000 --- a/Tweaks/iSponsorBlock +++ b/Tweaks/iSponsorBlock @@ -1 +1 @@ -Subproject commit 9b6d8db494969546691e143aa1a1c4cbfbdcea03 +Subproject commit 304ec97e4cc9060a80f9128b713243c92a3215d9