diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 3e4aed2..1f88a3b 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -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). | diff --git a/Localizations/uYouPlus.bundle/AppIcons/AppIcon1.png b/Localizations/uYouPlus.bundle/AppIcons/2007.png similarity index 100% rename from Localizations/uYouPlus.bundle/AppIcons/AppIcon1.png rename to Localizations/uYouPlus.bundle/AppIcons/2007.png diff --git a/Localizations/uYouPlus.bundle/AppIcons/AppIcon2.png b/Localizations/uYouPlus.bundle/AppIcons/2012.png similarity index 100% rename from Localizations/uYouPlus.bundle/AppIcons/AppIcon2.png rename to Localizations/uYouPlus.bundle/AppIcons/2012.png diff --git a/Localizations/uYouPlus.bundle/AppIcons/2012_blue.png b/Localizations/uYouPlus.bundle/AppIcons/2012_blue.png new file mode 100644 index 0000000..87573da Binary files /dev/null and b/Localizations/uYouPlus.bundle/AppIcons/2012_blue.png differ diff --git a/Localizations/uYouPlus.bundle/AppIcons/2013.png b/Localizations/uYouPlus.bundle/AppIcons/2013.png new file mode 100644 index 0000000..bb98018 Binary files /dev/null and b/Localizations/uYouPlus.bundle/AppIcons/2013.png differ diff --git a/Localizations/uYouPlus.bundle/AppIcons/2017_oero.png b/Localizations/uYouPlus.bundle/AppIcons/2017_oero.png new file mode 100644 index 0000000..e865024 Binary files /dev/null and b/Localizations/uYouPlus.bundle/AppIcons/2017_oero.png differ diff --git a/Localizations/uYouPlus.bundle/AppIcons/2017_outline.png b/Localizations/uYouPlus.bundle/AppIcons/2017_outline.png new file mode 100644 index 0000000..d57274f Binary files /dev/null and b/Localizations/uYouPlus.bundle/AppIcons/2017_outline.png differ diff --git a/Localizations/uYouPlus.bundle/AppIcons/Reborn_black.png b/Localizations/uYouPlus.bundle/AppIcons/Reborn_black.png new file mode 100644 index 0000000..3755131 Binary files /dev/null and b/Localizations/uYouPlus.bundle/AppIcons/Reborn_black.png differ diff --git a/Localizations/uYouPlus.bundle/AppIcons/Reborn_white.png b/Localizations/uYouPlus.bundle/AppIcons/Reborn_white.png new file mode 100644 index 0000000..eb43667 Binary files /dev/null and b/Localizations/uYouPlus.bundle/AppIcons/Reborn_white.png differ diff --git a/Localizations/uYouPlus.bundle/AppIcons/YTLitePlus.png b/Localizations/uYouPlus.bundle/AppIcons/YTLitePlus.png new file mode 100644 index 0000000..b5bd01d Binary files /dev/null and b/Localizations/uYouPlus.bundle/AppIcons/YTLitePlus.png differ diff --git a/Localizations/uYouPlus.bundle/AppIcons/uYou.png b/Localizations/uYouPlus.bundle/AppIcons/uYou.png new file mode 100644 index 0000000..65afe00 Binary files /dev/null and b/Localizations/uYouPlus.bundle/AppIcons/uYou.png differ diff --git a/Localizations/uYouPlus.bundle/AppIcons/uYouPlus.png b/Localizations/uYouPlus.bundle/AppIcons/uYouPlus.png new file mode 100644 index 0000000..71752a9 Binary files /dev/null and b/Localizations/uYouPlus.bundle/AppIcons/uYouPlus.png differ diff --git a/Sources/AppIconOptionsController.m b/Sources/AppIconOptionsController.m index ea65b9a..85cea3f 100644 --- a/Sources/AppIconOptionsController.m +++ b/Sources/AppIconOptionsController.m @@ -1,11 +1,11 @@ #import "AppIconOptionsController.h" -@interface AppIconOptionsController () +@interface AppIconOptionsController () -@property (strong, nonatomic) UICollectionView *collectionView; +@property (strong, nonatomic) UITableView *tableView; @property (strong, nonatomic) UIImageView *iconPreview; @property (strong, nonatomic) NSArray *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 diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm index 8fe122b..7c1ee6b 100644 --- a/Sources/uYouPlusSettings.xm +++ b/Sources/uYouPlusSettings.xm @@ -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"));