Skip to content

Commit

Permalink
Toggles that respect cancel action
Browse files Browse the repository at this point in the history
  • Loading branch information
PoomSmart committed Feb 22, 2024
1 parent 2fa7936 commit 756eaf2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TARGET := iphone:clang:latest:11.0
INSTALL_TARGET_PROCESSES = YouTube
ARCHS = arm64
PACKAGE_VERSION = 1.7.0
PACKAGE_VERSION = 1.7.1

include $(THEOS)/makefiles/common.mk

Expand Down
12 changes: 7 additions & 5 deletions Settings.x
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#import <YouTubeHeader/GOOHUDManagerInternal.h>
#import <YouTubeHeader/YTAlertView.h>
#import <YouTubeHeader/YTCommonUtils.h>
#import <YouTubeHeader/YTSettingsSectionItem.h>
#import <YouTubeHeader/YTSettingsSectionItemManager.h>
#import <YouTubeHeader/YTSettingsPickerViewController.h>
#import <YouTubeHeader/YTSettingsViewController.h>
#import <YouTubeHeader/YTSearchableSettingsViewController.h>
#import <YouTubeHeader/YTToastResponderEvent.h>
#import <YouTubeHeader/YTUIUtils.h>
#import <YouTubeHeader/YTVersionUtils.h>
#import <rootless.h>
Expand Down Expand Up @@ -181,7 +181,7 @@ static NSString *getCategory(char c, NSString *method) {
[alertView addTitle:LOC(@"COPY_TO_CLIPBOARD") withAction:^{
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = content;
[[%c(YTToastResponderEvent) eventWithMessage:LOC(@"COPIED_TO_CLIPBOARD") firstResponder:[self parentResponder]] send];
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:LOC(@"COPIED_TO_CLIPBOARD")]];
}];
updateAllKeys();
NSString *key = getKey(method, classKey);
Expand Down Expand Up @@ -294,7 +294,7 @@ static NSString *getCategory(char c, NSString *method) {
[content insertObject:INCLUDED_CLASSES atIndex:0];
[content insertObject:[NSString stringWithFormat:@"YTABConfig version: %@", @(OS_STRINGIFY(TWEAK_VERSION))] atIndex:0];
pasteboard.string = [content componentsJoinedByString:@"\n"];
[[%c(YTToastResponderEvent) eventWithMessage:LOC(@"COPIED_TO_CLIPBOARD") firstResponder:[self parentResponder]] send];
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:LOC(@"COPIED_TO_CLIPBOARD")]];
return YES;
}];
[sectionItems insertObject:copyAll atIndex:0];
Expand All @@ -319,7 +319,7 @@ static NSString *getCategory(char c, NSString *method) {
YTAlertView *alertView = [YTAlertViewClass confirmationDialogWithAction:^{
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = content;
[[%c(YTToastResponderEvent) eventWithMessage:LOC(@"COPIED_TO_CLIPBOARD") firstResponder:[self parentResponder]] send];
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:LOC(@"COPIED_TO_CLIPBOARD")]];
} actionTitle:LOC(@"COPY_TO_CLIPBOARD")];
alertView.title = LOC(@"MODIFIED_SETTINGS_TITLE");
alertView.subtitle = content;
Expand Down Expand Up @@ -362,6 +362,7 @@ static NSString *getCategory(char c, NSString *method) {
actionTitle:yesText
cancelAction:^{
[cell setSwitchOn:!enabled animated:YES];
[defaults setBool:!enabled forKey:GroupedKey];
}
cancelTitle:cancelText];
alertView.title = LOC(@"WARNING");
Expand Down Expand Up @@ -394,12 +395,13 @@ static NSString *getCategory(char c, NSString *method) {
actionTitle:yesText
cancelAction:^{
[cell setSwitchOn:!enabled animated:YES];
[defaults setBool:!enabled forKey:EnabledKey];
}
cancelTitle:cancelText];
alertView.title = LOC(@"WARNING");
alertView.subtitle = LOC(@"APPLY_DESC");
[alertView show];
return NO;
return YES;
}
settingItemId:0];
[sectionItems insertObject:master atIndex:0];
Expand Down

0 comments on commit 756eaf2

Please sign in to comment.