fix crash on iPad cz i'm suck

This commit is contained in:
qnblackcat
2022-04-19 21:36:21 +07:00
parent 32bd36c423
commit 702406f87f
+35 -35
View File
@@ -61,17 +61,37 @@ BOOL bigYTMiniPlayer() {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hover_cards_enabled"]; [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hover_cards_enabled"];
return YES; return YES;
}; };
[sectionItems insertObject:hoverCardItem atIndex:statsForNerdsIndex + 2]; [sectionItems insertObject:hoverCardItem atIndex:statsForNerdsIndex + 1];
// //
YTSettingsSectionItem *Oleditem = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"OLED Dark mode (Experimental)" titleDescription:@"WARNING: You must set YouTube's appearance to Dark theme before enabling OLED dark mode (not tested on iPad yet). App restart is required."]; YTSettingsSectionItem *reExplore = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Replace Shorts tab with Explore tab (YTReExplore)" titleDescription:@"App restart is required."];
Oleditem.hasSwitch = YES; reExplore.hasSwitch = YES;
Oleditem.switchVisible = YES; reExplore.switchVisible = YES;
Oleditem.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"oled_enabled"]; reExplore.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"reExplore_enabled"];
Oleditem.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) { reExplore.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"oled_enabled"]; [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"reExplore_enabled"];
return YES; return YES;
}; };
[sectionItems insertObject:Oleditem atIndex:statsForNerdsIndex - 11]; [sectionItems insertObject:reExplore atIndex:statsForNerdsIndex + 2];
//
YTSettingsSectionItem *bigYTMiniPlayer = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Bigger miniplayer bar (BigYTMiniPlayer)" titleDescription:@"App restart is required."];
bigYTMiniPlayer.hasSwitch = YES;
bigYTMiniPlayer.switchVisible = YES;
bigYTMiniPlayer.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"bigYTMiniPlayer_enabled"];
bigYTMiniPlayer.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"bigYTMiniPlayer_enabled"];
return YES;
};
[sectionItems insertObject:bigYTMiniPlayer atIndex:statsForNerdsIndex + 2];
//
YTSettingsSectionItem *hideHUD = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Hide HUD Messages" titleDescription:@"Example: CC is turned on/off, Video loop is on,... App restart is required."];
hideHUD.hasSwitch = YES;
hideHUD.switchVisible = YES;
hideHUD.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"];
hideHUD.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideHUD_enabled"];
return YES;
};
[sectionItems insertObject:hideHUD atIndex:statsForNerdsIndex + 1];
// //
YTSettingsSectionItem *autoFUll = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Auto Full Screen (YTAutoFullScreen)" titleDescription:@"Autoplay videos at full screen."]; YTSettingsSectionItem *autoFUll = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Auto Full Screen (YTAutoFullScreen)" titleDescription:@"Autoplay videos at full screen."];
autoFUll.hasSwitch = YES; autoFUll.hasSwitch = YES;
@@ -83,35 +103,15 @@ BOOL bigYTMiniPlayer() {
}; };
[sectionItems insertObject:autoFUll atIndex:statsForNerdsIndex + 2]; [sectionItems insertObject:autoFUll atIndex:statsForNerdsIndex + 2];
// //
YTSettingsSectionItem *hideHUD = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Hide HUD Messages" titleDescription:@"Example: CC is turned on/off, Video loop is on,... App restart is required."]; YTSettingsSectionItem *Oleditem = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"OLED Dark mode (Experimental)" titleDescription:@"WARNING: You must set YouTube's appearance to Dark theme before enabling OLED dark mode (not tested on iPad yet). App restart is required."];
hideHUD.hasSwitch = YES; Oleditem.hasSwitch = YES;
hideHUD.switchVisible = YES; Oleditem.switchVisible = YES;
hideHUD.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"]; Oleditem.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"oled_enabled"];
hideHUD.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) { Oleditem.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideHUD_enabled"]; [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"oled_enabled"];
return YES; return YES;
}; };
[sectionItems insertObject:hideHUD atIndex:statsForNerdsIndex + 2]; [sectionItems insertObject:Oleditem atIndex:statsForNerdsIndex + 1];
//
YTSettingsSectionItem *reExplore = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Replace Shorts tab with Explore tab (YTReExplore)" titleDescription:@"App restart is required."];
reExplore.hasSwitch = YES;
reExplore.switchVisible = YES;
reExplore.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"reExplore_enabled"];
reExplore.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"reExplore_enabled"];
return YES;
};
[sectionItems insertObject:reExplore atIndex:statsForNerdsIndex + 4];
//
YTSettingsSectionItem *bigYTMiniPlayer = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Bigger miniplayer bar (BigYTMiniPlayer)" titleDescription:@"App restart is required."];
bigYTMiniPlayer.hasSwitch = YES;
bigYTMiniPlayer.switchVisible = YES;
bigYTMiniPlayer.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"bigYTMiniPlayer_enabled"];
bigYTMiniPlayer.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"bigYTMiniPlayer_enabled"];
return YES;
};
[sectionItems insertObject:bigYTMiniPlayer atIndex:statsForNerdsIndex + 4];
} }
} }
%orig; %orig;