Skip to content

Commit

Permalink
enable/disable ytdisablehighcontrasticons option
Browse files Browse the repository at this point in the history
  • Loading branch information
arichornlover authored Jul 21, 2022
1 parent e6163f2 commit a4ab7d3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Settings.xm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern BOOL hideShorts();
extern BOOL hidePreviousAndNextButton();
extern BOOL hidePaidPromotionCard();
extern BOOL hideNotificationButton();
extern BOOL ytDisableHighContrastIcons();

// Settings
%hook YTAppSettingsPresentationData
Expand All @@ -48,6 +49,15 @@ extern BOOL hideNotificationButton();
YTSettingsViewController *delegate = [self valueForKey:@"_dataDelegate"];
NSBundle *tweakBundle = CercubePlusBundle();

YTSettingsSectionItem *ytDisableHighContrastIcons = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Revert The High Contrast Icons (YTDisableHighContrastIcons)" titleDescription:@"App restart is required."];
ytDisableHighContrastIcons.hasSwitch = YES;
ytDisableHighContrastIcons.switchVisible = YES;
ytDisableHighContrastIcons.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"ytDisableHighContrastIcons_enabled"];
ytDisableHighContrastIcons.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"ytDisableHighContrastIcons_enabled"];
return YES;
};

YTSettingsSectionItem *hideNotificationButton = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"HIDE_NOTIFICATION_BUTTON") titleDescription:LOC(@"HIDE_NOTIFICATION_BUTTON_DESC")];
hideNotificationButton.hasSwitch = YES;
hideNotificationButton.switchVisible = YES;
Expand Down Expand Up @@ -219,7 +229,7 @@ extern BOOL hideNotificationButton();
return YES;
};

NSMutableArray <YTSettingsSectionItem *> *sectionItems = [NSMutableArray arrayWithArray:@[autoFull, ytMiniPlayer, hideAutoplaySwitch, hideCercubeButton, hideCercubePiP, hideCercubeDownload, hideCastButton, hideCC, hideHUD, hideHoverCard, hideNotificationButton, hideShorts, hidePaidPromotionCard, hidePreviousAndNextButton, hideWatermarks, bigYTMiniPlayer, oledDarkMode, oledKeyBoard, reExplore]];
NSMutableArray <YTSettingsSectionItem *> *sectionItems = [NSMutableArray arrayWithArray:@[autoFull, ytMiniPlayer, hideAutoplaySwitch, hideCercubeButton, hideCercubePiP, hideCercubeDownload, hideCastButton, hideCC, hideHUD, hideHoverCard, hideNotificationButton, hideShorts, hidePaidPromotionCard, hidePreviousAndNextButton, hideWatermarks, bigYTMiniPlayer, oledDarkMode, oledKeyBoard, reExplore, ytDisableHighContrastIcons]];
[delegate setSectionItems:sectionItems forCategory:CercubePlusSection title:@"CercubePlus" titleDescription:nil headerHidden:NO];
}

Expand All @@ -230,4 +240,4 @@ extern BOOL hideNotificationButton();
}
%orig;
}
%end
%end

0 comments on commit a4ab7d3

Please sign in to comment.