Merge branch 'main' into uYouPlus-sync

This commit is contained in:
Bryce Hackel 2024-04-08 23:32:26 -04:00
commit 4d5e945d18
No known key found for this signature in database
GPG key ID: F031960F08455E88
13 changed files with 219 additions and 43 deletions

View file

@ -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

2
.gitmodules vendored
View file

@ -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

View file

@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>
@interface AppIconOptionsController : UIViewController
@end

View file

@ -0,0 +1,123 @@
#import "AppIconOptionsController.h"
@interface AppIconOptionsController () <UICollectionViewDataSource, UICollectionViewDelegate>
@property (strong, nonatomic) UICollectionView *collectionView;
@property (strong, nonatomic) UIImageView *iconPreview;
@property (strong, nonatomic) NSArray<NSString *> *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

View file

@ -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];
}

View file

@ -8,26 +8,28 @@
#import <substrate.h>
#import <rootless.h>
#import "uYouPlusThemes.h"
#import <YouTubeHeader/YTAppDelegate.h>
#import <YouTubeHeader/YTIMenuConditionalServiceItemRenderer.h>
#import <YouTubeHeader/YTVideoQualitySwitchOriginalController.h>
#import <YouTubeHeader/YTIGuideResponse.h>
#import <YouTubeHeader/YTIGuideResponseSupportedRenderers.h>
#import <YouTubeHeader/YTIPivotBarSupportedRenderers.h>
#import <YouTubeHeader/YTIPivotBarItemRenderer.h>
#import <YouTubeHeader/YTIBrowseRequest.h>
#import <YouTubeHeader/YTIButtonRenderer.h>
#import <YouTubeHeader/YTIElementRenderer.h>
#import <YouTubeHeader/YTISectionListRenderer.h>
#import <YouTubeHeader/YTWatchNextResultsViewController.h>
#import <YouTubeHeader/YTPlayerOverlay.h>
#import <YouTubeHeader/YTPlayerOverlayProvider.h>
#import <YouTubeHeader/YTReelWatchPlaybackOverlayView.h>
#import <YouTubeHeader/YTInlinePlayerBarContainerView.h>
#import <YouTubeHeader/YTInnerTubeCollectionViewController.h>
#import <YouTubeHeader/YTPivotBarItemView.h>
#import <YouTubeHeader/YTCollectionViewCell.h>
#import "uYouPlusThemes.h" // Hide "Buy Super Thanks" banner (_ASDisplayView)
#import <YoutubeHeader/YTAppDelegate.h> // Activate FLEX
#import <YoutubeHeader/YTIMenuConditionalServiceItemRenderer.h>
#import <YoutubeHeader/YTIPlayerBarDecorationModel.h>
#import <YoutubeHeader/YTPlayerBarRectangleDecorationView.h>
#import <YoutubeHeader/YTVideoQualitySwitchOriginalController.h>
#import <YoutubeHeader/YTIGuideResponse.h>
#import <YoutubeHeader/YTIGuideResponseSupportedRenderers.h>
#import <YoutubeHeader/YTIPivotBarSupportedRenderers.h>
#import <YoutubeHeader/YTIPivotBarItemRenderer.h>
#import <YoutubeHeader/YTIBrowseRequest.h>
#import <YoutubeHeader/YTIButtonRenderer.h>
#import <YoutubeHeader/YTIElementRenderer.h>
#import <YoutubeHeader/YTISectionListRenderer.h>
#import <YoutubeHeader/YTWatchNextResultsViewController.h>
#import <YoutubeHeader/YTPlayerOverlay.h>
#import <YoutubeHeader/YTPlayerOverlayProvider.h>
#import <YoutubeHeader/YTReelWatchPlaybackOverlayView.h>
#import <YoutubeHeader/YTInlinePlayerBarContainerView.h>
#import <YoutubeHeader/YTInnerTubeCollectionViewController.h>
#import <YoutubeHeader/YTPivotBarItemView.h>
#import <YoutubeHeader/YTCollectionViewCell.h>
// Hide buttons under the video player by @PoomSmart
#import <YouTubeHeader/ASCollectionElement.h>
@ -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

View file

@ -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

View file

@ -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;

View file

@ -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

@ -1 +1 @@
Subproject commit d2aec88d3e8c300983592d4e54f55eccad12c50d
Subproject commit 8d90af33a8ace8f1e0adbaa863aed5da9a835fc4

@ -1 +1 @@
Subproject commit d983151bcb0d86dc3cae17c8ffcc87661457ea5e
Subproject commit e5f3cb2f3612332ae5c75ebcd7f25eb507b60750

@ -1 +1 @@
Subproject commit a2a753975962e51cb834ff8f86759593dac58eb4
Subproject commit 591fe9dc1dcfbd4591b391fe5b25301beea5e5b7

@ -1 +1 @@
Subproject commit 9b6d8db494969546691e143aa1a1c4cbfbdcea03
Subproject commit 304ec97e4cc9060a80f9128b713243c92a3215d9