From 2846d418eefce96a0c6c583ccd303e7f4102e8c4 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Sun, 5 May 2024 13:08:51 -0700 Subject: [PATCH] Fix bugs --- Sources/uYouPlus.xm | 7 +++++++ Sources/uYouPlusSettings.xm | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index 4b2a569..f9e749e 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -341,6 +341,13 @@ BOOL isAd(YTIElementRenderer *self) { */ %new - (void)uYouEnhancedFakePremiumModel:(YTISectionListRenderer *)model { + // Don't do anything if the version is too low + Class YTVersionUtilsClass = %c(YTVersionUtils); + NSString *appVersion = [YTVersionUtilsClass performSelector:@selector(appVersion)]; + NSComparisonResult result = [appVersion compare:@"18.35.4" options:NSNumericSearch]; + if (result == NSOrderedAscending) { + return; + } NSUInteger yourVideosCellIndex = -1; NSMutableArray *overallContentsArray = model.contentsArray; // Check each item in the overall array - this represents the whole You page diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm index 5677187..17654a5 100644 --- a/Sources/uYouPlusSettings.xm +++ b/Sources/uYouPlusSettings.xm @@ -398,7 +398,7 @@ extern NSBundle *uYouPlusBundle(); [settingsViewController reloadData]; SHOW_RELAUNCH_YT_SNACKBAR; return YES; - }) + }); ); YTSettingsSectionItem *lowContrastModeButton = [%c(YTSettingsSectionItem) itemWithTitle:@"Low Contrast Mode Selector" @@ -1057,7 +1057,7 @@ extern NSBundle *uYouPlusBundle(); NSString *appVersion = [YTVersionUtilsClass performSelector:@selector(appVersion)]; // Alert if the version is partially incompatible and the toggle is being turned on NSComparisonResult result = [appVersion compare:@"18.35.4" options:NSNumericSearch]; - if (enabled && result == NSOrderedAscending) { + if (enable && result == NSOrderedAscending) { UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Incompatible" message:[NSString stringWithFormat:@"Warning: The \"You\" Tab doesn't exist in v%@.\nFake Logo will still work.", appVersion] preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; [alert addAction:okAction]; @@ -1068,7 +1068,7 @@ extern NSBundle *uYouPlusBundle(); [settingsViewController reloadData]; SHOW_RELAUNCH_YT_SNACKBAR; return YES; - }) + }); ); // SWITCH_ITEM(LOC(@"Center YouTube Logo"), LOC(@"Toggle this to move the official YouTube Logo to the Center. App restart is required."), @"centerYouTubeLogo_enabled"); SWITCH_ITEM(LOC(@"Hide YouTube Logo"), LOC(@"Toggle this to hide the YouTube Logo in the YouTube App."), @"hideYouTubeLogo_enabled");