Limit Fake Premium Option to v18.35.4 and higher

Won’t work on older versions, this was implemented to prevent the app from crashing.
This commit is contained in:
arichornlover 2024-04-29 21:54:47 -05:00 committed by GitHub
parent 971397e0fc
commit 28178722a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1003,7 +1003,31 @@ YTSettingsSectionItem *lowContrastModeButton = [%c(YTSettingsSectionItem)
SECTION_HEADER(LOC(@"MISCELLANEOUS"));
SWITCH_ITEM2(LOC(@"Adblock Workaround"), LOC(@"Uses stronger adblocking code. Can cause blank spots on homepage"), @"uYouAdBlockingWorkaround_enabled");
SWITCH_ITEM2(LOC(@"Fake Premium"), LOC(@"Uses Premium logo and creates fake buttons in the You tab"), @"youTabFakePremium_enabled");
YTSettingsSectionItem *fakePremium = [YTSettingsSectionItemClass
switchItemWithTitle:LOC(@"Fake Premium")
titleDescription:LOC(@"Uses Premium logo and creates fake buttons in the You tab")
accessibilityIdentifier:nil
switchOn:IS_ENABLED(@"youTabFakePremium_enabled")
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSComparisonResult result = [appVersion compare:@"18.35.4" options:NSNumericSearch];
if (result == NSOrderedAscending) {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Incompatible" message:[NSString stringWithFormat:@"Error: The \"You\" Tab doesn't exist in v%@. \nFake Premium is only available for app versions v18.35.4 and higher.", appVersion] preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alert addAction:okAction];
[settingsViewController presentViewController:alert animated:YES completion:nil];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"youTabFakePremium_enabled"];
return NO;
}
[settingsViewController reloadData];
SHOW_RELAUNCH_YT_SNACKBAR;
return YES;
}
settingItemId:0
];
[sectionItems addObject:fakePremium];
// 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");
SWITCH_ITEM2(LOC(@"ENABLE_YT_STARTUP_ANIMATION"), LOC(@"ENABLE_YT_STARTUP_ANIMATION_DESC"), @"ytStartupAnimation_enabled");