From 2899debb8211f89ef72d405a131873252e1e5335 Mon Sep 17 00:00:00 2001 From: qnblackcat Date: Fri, 23 Dec 2022 02:03:58 +0700 Subject: [PATCH] more Shorts options --- Settings.xm | 22 +++++++++++++++++++++- uYouPlus.xm | 16 ++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Settings.xm b/Settings.xm index a637335..312d4d7 100644 --- a/Settings.xm +++ b/Settings.xm @@ -244,7 +244,27 @@ extern NSBundle *uYouPlusBundle(); [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideShortsShareButton_enabled"]; return YES; } - settingItemId:0], + settingItemId:0], + + [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"HIDE_SUPER_THANKS") + titleDescription:LOC(@"HIDE_SUPER_THANKS_DESC") + accessibilityIdentifier:nil + switchOn:IsEnabled(@"hideBuySuperThanks_enabled") + switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"hideBuySuperThanks_enabled"]; + return YES; + } + settingItemId:0], + + [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"DISABLE_RESUME_TO_SHORTS") + titleDescription:LOC(@"DISABLE_RESUME_TO_SHORTS_DESC") + accessibilityIdentifier:nil + switchOn:IsEnabled(@"disableResumeToShorts") + switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"disableResumeToShorts"]; + return YES; + } + settingItemId:0], ]; YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"SHORTS_CONTROLS_OVERLAY_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]]; [settingsViewController pushViewController:picker]; diff --git a/uYouPlus.xm b/uYouPlus.xm index 82f406a..cb71919 100644 --- a/uYouPlus.xm +++ b/uYouPlus.xm @@ -1225,6 +1225,22 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha: } %end +%hook _ASDisplayView +- (void)layoutSubviews { + %orig; + if (IsEnabled(@"hideBuySuperThanks_enabled")) { + if ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.suggested_action"]) { self.hidden = YES; } + } +} +%end + +%hook YTColdConfig +- (BOOL)enableResumeToShorts { + if (IsEnabled(@"disableResumeToShorts")) { return NO; } + else { return %orig; } +} +%end + # pragma mark - ctor %ctor { %init;