Merge remote-tracking branch 'origin/main' into feat/disable-vert-fullscreen-gesture

This commit is contained in:
Bryce Hackel 2024-04-13 23:16:30 -07:00
commit eaa5cb0c56
No known key found for this signature in database
GPG key ID: F031960F08455E88
14 changed files with 77 additions and 65 deletions

View file

@ -24,5 +24,5 @@ The following versions of the uYouEnhanced Tweak are currently supported with se
| Developer(s) | Version | LTS Support | YT Version Supported | App Stability | uYou Functionality |
| ----------- | ------- | ----------- | -------------------- | ------------- | ------------------ |
| MiRO92(uYou) & arichornlover(uYouEnhanced) | [latest](https://github.com/arichornlover/uYouEnhanced/releases/latest) | ✅ | ✅ | Stable | Fully functional |
| MiRO92(uYou) & bhackel(uYouEnhanced-LTS) | [19.06.2-3.0.3 LTS](https://github.com/bhackel/uYouEnhanced/releases/tag/v19.06.2-3.0.3-(98)) | ✅ | ✅ | Stable, only provides version 19.06.2 of YouTube and uYou 3.0.3 | Crashes the app if the video is in fullscreen on an iPad, which would only happen if you installed the .ipa using a different sideloading/jailbreak tool. |
| MiRO92(uYou) & bhackel(uYouEnhanced-LTS) | [19.06.2-3.0.3 LTS](https://github.com/bhackel/uYouEnhanced/releases/tag/v19.06.2-3.0.3-(185)) | ✅ | ✅ | Stable, only provides version 19.06.2 of YouTube and uYou 3.0.3 | Crashes the app if the video is in fullscreen on an iPad, which would only happen if you installed the .ipa using a different sideloading/jailbreak tool. |
| MiRO92(uYou) & arichornlover(uYouEnhanced-LTS)| [16.42.3-2.1 LTS](https://github.com/arichornlover/uYouEnhanced/tree/main-16.42.3LTS) | Discontinued | ❌ | iOS 16+ compatibility issues, some features may not work properly. App will not work anymore, affecting versions v16.05.7-v17.32.2 as well. 💔 | uYou Video/Audio Downloading is offline (except uYouLocal). |

View file

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View file

@ -1,11 +1,11 @@
#import "AppIconOptionsController.h"
@interface AppIconOptionsController () <UICollectionViewDataSource, UICollectionViewDelegate>
@interface AppIconOptionsController () <UITableViewDataSource, UITableViewDelegate>
@property (strong, nonatomic) UICollectionView *collectionView;
@property (strong, nonatomic) UITableView *tableView;
@property (strong, nonatomic) UIImageView *iconPreview;
@property (strong, nonatomic) NSArray<NSString *> *appIcons;
@property (strong, nonatomic) NSString *selectedIconFile;
@property (assign, nonatomic) NSInteger selectedIconIndex;
@end
@ -14,13 +14,16 @@
- (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];
self.selectedIconIndex = 0;
self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
self.tableView.dataSource = self;
self.tableView.delegate = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(close)];
self.navigationItem.leftBarButtonItem = closeButton;
UIButton *defaultButton = [UIButton buttonWithType:UIButtonTypeSystem];
defaultButton.frame = CGRectMake(20, 100, 100, 40);
[defaultButton setTitle:@"Default" forState:UIControlStateNormal];
@ -28,11 +31,11 @@
[self.view addSubview:defaultButton];
UIButton *saveButton = [UIButton buttonWithType:UIButtonTypeSystem];
saveButton.frame = CGRectMake(150, 100, 100, 40);
saveButton.frame = CGRectMake(20, 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;
@ -42,72 +45,53 @@
NSBundle *bundle = [NSBundle bundleWithPath:path];
self.appIcons = [bundle pathsForResourcesOfType:@"png" inDirectory:@"AppIcons"];
if ([UIApplication sharedApplication].supportsAlternateIcons) {
} else {
if (![UIApplication sharedApplication].supportsAlternateIcons) {
NSLog(@"Alternate icons are not supported on this device.");
}
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(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];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
cell.textLabel.text = [self.appIcons[indexPath.row] lastPathComponent];
if (indexPath.row == self.selectedIconIndex) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
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)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
UITableViewCell *previousSelectedCell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.selectedIconIndex inSection:0]];
previousSelectedCell.accessoryType = UITableViewCellAccessoryNone;
self.selectedIconIndex = indexPath.row;
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
- (void)setDefaultIcon {
self.iconPreview.image = nil;
self.selectedIconFile = nil;
UIImage *selectedIconImage = [UIImage imageWithContentsOfFile:self.appIcons[self.selectedIconIndex]];
self.iconPreview.image = [self resizedImageWithImage:selectedIconImage];
}
- (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];
}
NSString *selectedIcon = self.appIcons[self.selectedIconIndex];
[[UIApplication sharedApplication] setAlternateIconName:selectedIcon completionHandler:^(NSError * _Nullable error){
if (error) {
NSLog(@"Error setting alternate icon: %@", error.localizedDescription);
[self showAlertWithTitle:@"Error" message:@"Failed to set alternate icon"];
} else {
NSLog(@"Alternate icon set successfully");
[self showAlertWithTitle:@"Success" message:@"Alternate icon set successfully"];
}
}];
}
- (UIImage *)resizedImageWithImage:(UIImage *)image {
@ -120,4 +104,17 @@
return resizedImage;
}
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message {
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alert addAction:okAction];
[self presentViewController:alert animated:YES completion:nil];
});
}
- (void)close {
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
@end

View file

@ -2,6 +2,7 @@
#import "RootOptionsController.h"
#import "ColourOptionsController.h"
#import "ColourOptionsController2.h"
#import "AppIconOptionsController.h"
#define VERSION_STRING [[NSString stringWithFormat:@"%@", @(OS_STRINGIFY(TWEAK_VERSION))] stringByReplacingOccurrencesOfString:@"\"" withString:@""]
#define SHOW_RELAUNCH_YT_SNACKBAR [[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:LOC(@"RESTART_YOUTUBE")]]
@ -78,6 +79,20 @@ extern NSBundle *uYouPlusBundle();
Class YTSettingsSectionItemClass = %c(YTSettingsSectionItem);
YTSettingsViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"];
# pragma mark - App Icon Customization
YTSettingsSectionItem *appIcon = [%c(YTSettingsSectionItem)
itemWithTitle:LOC(@"Change App Icon")
titleDescription:nil
accessibilityIdentifier:nil
detailTextBlock:nil
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
AppIconOptionsController *appIconController = [[AppIconOptionsController alloc] init];
[settingsViewController.navigationController pushViewController:appIconController animated:YES];
return YES;
}
];
[sectionItems addObject:appIcon];
# pragma mark - About
// SECTION_HEADER(LOC(@"ABOUT"));