Use <YTResponder> as a way to call settings

This commit is contained in:
arichornlover 2024-06-25 21:11:05 -05:00 committed by GitHub
parent 498f5bd3b7
commit ca7e5e40fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -99,15 +99,14 @@ NSBundle *tweakBundle = uYouPlusBundle();
return retVal;
}
%new;
- (void)settingsAction {
Class YTApplicationSettingsEndpointRootClass = NSClassFromString(@"YTIApplicationSettingsEndpointRoot");
id applicationSettingsEndpoint = [%c(YTApplicationSettingsEndpointRootClass) applicationSettingsEndpoint];
- (void)settingsAction {
UIViewController *settingsViewController = [self _viewControllerForAncestor];
Class YTSettingsViewControllerClass = NSClassFromString(@"SettingsViewController");
id settingsVC = [[YTSettingsViewControllerClass alloc] initWithEndpoint:applicationSettingsEndpoint];
[settingsViewController presentViewController:settingsVC animated:YES completion:nil];
if ([settingsVC respondsToSelector:@selector(_parentResponder)]) {
id<YTResponder> parentResponder = [settingsVC performSelector:@selector(_parentResponder)];
[parentResponder triggerSettingsMenu];
}
}
%end