diff --git a/Settings.xm b/Settings.xm index 16b82fb..293d3ed 100644 --- a/Settings.xm +++ b/Settings.xm @@ -1,5 +1,4 @@ // Settings.xm made by the @therealFoxster - #import "Tweaks/YouTubeHeader/YTSettingsViewController.h" #import "Tweaks/YouTubeHeader/YTSearchableSettingsViewController.h" #import "Tweaks/YouTubeHeader/YTSettingsSectionItem.h" @@ -17,9 +16,6 @@ #define SWITCH_ITEM2(t, d, k) [sectionItems addObject:[YTSettingsSectionItemClass switchItemWithTitle:t titleDescription:d accessibilityIdentifier:nil switchOn:IS_ENABLED(k) switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:k];SHOW_RELAUNCH_YT_SNACKBAR;return YES;} settingItemId:0 -static BOOL IsEnabled(NSString *key) { // Removing Later.. - return [[NSUserDefaults standardUserDefaults] boolForKey:key]; -} static int GetSelection(NSString *key) { return [[NSUserDefaults standardUserDefaults] integerForKey:key]; } @@ -292,7 +288,7 @@ extern NSBundle *uYouPlusBundle(); */ # pragma mark - VersionSpoofer - YTSettingsSectionItem *versionSpooferSection = [YTSettingsSectionItemClass itemWithTitle:@"Version Spoofer Picker" + YTSettingsSectionItem *versionSpooferSection = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Version Spoofer Picker") accessibilityIdentifier:nil detailTextBlock:^NSString *() { switch (appVersionSpoofer()) { @@ -1028,59 +1024,18 @@ extern NSBundle *uYouPlusBundle(); return YES; }]; -# pragma mark - UI - YTSettingsSectionItem *uiGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"UI Options") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { - NSArray *rows = @[ - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Fix LowContrastMode") - titleDescription:LOC(@"This will fix the LowContrastMode functionality by Spoofing to YouTube v17.38.10. App restart is required.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"fixLowContrastMode_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"fixLowContrastMode_enabled"]; - return YES; - } - settingItemId:0], + # pragma mark - UI interface options + SECTION_HEADER(LOC(@"UI Interface Options")); - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Disable Modern Buttons") - titleDescription:LOC(@"This will remove the new Modern / Chip Buttons in the YouTube App. but not all of them. App restart is required.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"disableModernButtons_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"disableModernButtons_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Disable Rounded Corners on Hints") - titleDescription:LOC(@"This will make the Hints in the App to not have Rounded Corners. App restart is required.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"disableRoundedHints_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"disableRoundedHints_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Disable Modern A/B Flags") - titleDescription:LOC(@"This will turn off any Modern Flag that was enabled by default. App restart is required.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"disableModernFlags_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"disableModernFlags_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Enable All Options Above (YTNoModernUI)") - titleDescription:LOC(@"When Enabled, this will enable the options above. App restart is required.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"ytNoModernUI_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"ytNoModernUI_enabled"]; - return YES; - } - settingItemId:0], + SWITCH_ITEM2(LOC(@"Fix LowContrastMode"), LOC(@"This will fix the LowContrastMode functionality by Spoofing to YouTube v17.38.10. App restart is required."), @"fixLowContrastMode_enabled"); + SWITCH_ITEM2(LOC(@"Disable Modern Buttons"), LOC(@"This will remove the new Modern / Chip Buttons in the YouTube App. but not all of them. App restart is required."), @"disableModernButtons_enabled"); + SWITCH_ITEM2(LOC(@"Disable Rounded Corners on Hints"), LOC(@"This will make the Hints in the App to not have Rounded Corners. App restart is required."), @"disableRoundedHints_enabled"); + SWITCH_ITEM2(LOC(@"Disable Modern A/B Flags"), LOC(@"This will turn off any Modern Flag that was enabled by default. App restart is required."), @"disableModernFlags_enabled"); + SWITCH_ITEM2(LOC(@"Enable All Options Above (YTNoModernUI)"), LOC(@"When Enabled, this will enable the options above. App restart is required."), @"ytNoModernUI_enabled"); +// (versionSpooferSection is missing below. without it, you can't select and spoof the app correctly.) +// SWITCH_ITEM2(LOC(@"Enable App Version Spoofer"), LOC(@"Enable this to use the Version Spoofer and select your perferred version below. App restart is required."), @"enableVersionSpoofer_enabled"); +/* Legacy Version (App Version Spoofer Option) [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Enable App Version Spoofer") titleDescription:LOC(@"Enable this to use the Version Spoofer and select your perferred version below. App restart is required.") accessibilityIdentifier:nil @@ -1095,197 +1050,29 @@ extern NSBundle *uYouPlusBundle(); return YES; }]; [sectionItems addObject:uiGroup]; - -# pragma mark - Miscellaneous - YTSettingsSectionItem *miscellaneousGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"MISCELLANEOUS") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { - NSArray *rows = @[ - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"YouTube Premium Logo") - titleDescription:LOC(@"Toggle this to use the official YouTube Premium Logo. App restart is required.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"premiumYouTubeLogo_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"premiumYouTubeLogo_enabled"]; - return YES; - } - settingItemId:0], - -/* - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Center YouTube Logo") - titleDescription:LOC(@"Toggle this to move the official YouTube Logo to the Center. App restart is required.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"centerYouTubeLogo_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"centerYouTubeLogo_enabled"]; - return YES; - } - settingItemId:0], */ - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Hide YouTube Logo") - titleDescription:LOC(@"Toggle this to hide the YouTube Logo in the YouTube App.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"hideYouTubeLogo_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideYouTubeLogo_enabled"]; - return YES; - } - settingItemId:0], + # pragma mark - Miscellaneous + SECTION_HEADER(LOC(@"MISCELLANEOUS")); - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"ENABLE_YT_STARTUP_ANIMATION") - titleDescription:LOC(@"ENABLE_YT_STARTUP_ANIMATION_DESC") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"ytStartupAnimation_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"ytStartupAnimation_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"CAST_CONFIRM") - titleDescription:LOC(@"CAST_CONFIRM_DESC") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"castConfirm_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"castConfirm_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"DISABLE_HINTS") - titleDescription:LOC(@"DISABLE_HINTS_DESC") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"disableHints_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"disableHints_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Stick Navigation Bar") - titleDescription:LOC(@"Enable to make the Navigation Bar stay on the App when scrolling.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"stickNavigationBar_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"stickNavigationBar_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Hide iSponsorBlock button in the Navigation bar") - titleDescription:LOC(@"") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"hideSponsorBlockButton_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideSponsorBlockButton_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"HIDE_CHIP_BAR") - titleDescription:LOC(@"HIDE_CHIP_BAR_DESC") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"hideChipBar_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideChipBar_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"HIDE_PLAY_NEXT_IN_QUEUE") - titleDescription:LOC(@"HIDE_PLAY_NEXT_IN_QUEUE_DESC") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"hidePlayNextInQueue_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hidePlayNextInQueue_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Hide Community Posts") - titleDescription:LOC(@"Hides the Community Posts. App restart is required.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"hideCommunityPosts_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideCommunityPosts_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Hide Header Links under channel profile") - titleDescription:LOC(@"Hides the Header Links under any channel profile.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"hideChannelHeaderLinks_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideChannelHeaderLinks_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Hide all videos under player") - titleDescription:LOC(@"Hides all videos below the player.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"noRelatedWatchNexts_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"noRelatedWatchNexts_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"IPHONE_LAYOUT") - titleDescription:LOC(@"IPHONE_LAYOUT_DESC") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"iPhoneLayout_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"iPhoneLayout_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"NEW_MINIPLAYER_STYLE") - titleDescription:LOC(@"NEW_MINIPLAYER_STYLE_DESC") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"bigYTMiniPlayer_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"bigYTMiniPlayer_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"YT_RE_EXPLORE") - titleDescription:LOC(@"YT_RE_EXPLORE_DESC") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"reExplore_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"reExplore_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"Hide Indicators") - titleDescription:LOC(@"Hides all Indicators that were in the App.") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"hideSubscriptionsNotificationBadge_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideSubscriptionsNotificationBadge_enabled"]; - return YES; - } - settingItemId:0], - - [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"ENABLE_FLEX") - titleDescription:LOC(@"ENABLE_FLEX_DESC") - accessibilityIdentifier:nil - switchOn:IsEnabled(@"flex_enabled") - switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { - [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"flex_enabled"]; - return YES; - } - settingItemId:0] - ]; - YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"MISCELLANEOUS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]]; - [settingsViewController pushViewController:picker]; - return YES; - }]; - [sectionItems addObject:miscellaneousGroup]; + SWITCH_ITEM(LOC(@"YouTube Premium Logo"), LOC(@"Toggle this to use the official YouTube Premium Logo. App restart is required.), @"premiumYouTubeLogo_enabled"); +// 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_ITEM(LOC(@"ENABLE_YT_STARTUP_ANIMATION"), LOC(@"ENABLE_YT_STARTUP_ANIMATION_DESC"), @"ytStartupAnimation_enabled"); + SWITCH_ITEM(LOC(@"CAST_CONFIRM"), LOC(@"CAST_CONFIRM_DESC"), @"castConfirm_enabled"); + SWITCH_ITEM(LOC(@"DISABLE_HINTS"), LOC(@"DISABLE_HINTS_DESC"), @"disableHints_enabled"); + SWITCH_ITEM(LOC(@"Stick Navigation Bar"), LOC(@"Enable to make the Navigation Bar stay on the App when scrolling."), @"stickNavigationBar_enabled"); + SWITCH_ITEM(LOC(@"Hide iSponsorBlock button in the Navigation bar"), LOC(@""), @"hideSponsorBlockButton_enabled"); + SWITCH_ITEM(LOC(@"HIDE_CHIP_BAR"), LOC(@"HIDE_CHIP_BAR_DESC"), @"hideChipBar_enabled"); + SWITCH_ITEM(LOC(@"HIDE_PLAY_NEXT_IN_QUEUE"), LOC(@"HIDE_PLAY_NEXT_IN_QUEUE_DESC"), @"hidePlayNextInQueue_enabled"); + SWITCH_ITEM2(LOC(@"Hide Community Posts"), LOC(@"Hides the Community Posts. App restart is required."), @"hideCommunityPosts_enabled"); + SWITCH_ITEM2(LOC(@"Hide Header Links under channel profile"), LOC(@"Hides the Header Links under any channel profile."), @"hideChannelHeaderLinks_enabled"); + SWITCH_ITEM2(LOC(@"Hide all videos under player"), LOC(@"Hides all videos below the player."), @"noRelatedWatchNexts_enabled"); + SWITCH_ITEM2(LOC(@"IPHONE_LAYOUT"), LOC(@"IPHONE_LAYOUT_DESC"), @"iPhoneLayout_enabled"); + SWITCH_ITEM2(LOC(@"NEW_MINIPLAYER_STYLE"), LOC(@"NEW_MINIPLAYER_STYLE_DESC"), @"bigYTMiniPlayer_enabled"); + SWITCH_ITEM2(LOC(@"YT_RE_EXPLORE"), LOC(@"YT_RE_EXPLORE_DESC"), @"reExplore_enabled"); + SWITCH_ITEM2(LOC(@"Hide Indicators"), LOC(@"Hides all Indicators that were in the App."), @"hideSubscriptionsNotificationBadge_enabled"); + SWITCH_ITEM(LOC(@"ENABLE_FLEX"), LOC(@"ENABLE_FLEX_DESC"), @"flex_enabled"); [settingsViewController setSectionItems:sectionItems forCategory:uYouPlusSection title:@"uYouEnhanced" titleDescription:LOC(@"TITLE DESCRIPTION") headerHidden:YES]; }