mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-01-11 22:40:19 +00:00
Mimic the actual settings button
This commit is contained in:
parent
513a486523
commit
19e2bb2d73
1 changed files with 22 additions and 3 deletions
|
|
@ -64,6 +64,14 @@ NSBundle *tweakBundle = uYouPlusBundle();
|
|||
%hook YTRightNavigationButtons
|
||||
%property (retain, nonatomic) YTQTMButton *settingsButton;
|
||||
- (NSMutableArray *)buttons {
|
||||
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"uYouPlus" ofType:@"bundle"];
|
||||
NSString *buttonSettingsPath;
|
||||
if (tweakBundlePath) {
|
||||
NSBundle *tweakBundle = [NSBundle bundleWithPath:tweakBundlePath];
|
||||
buttonSettingsPath = [tweakBundle pathForResource:@"yt_outline_gear_24pt" ofType:@"png"];
|
||||
} else {
|
||||
buttonSettingsPath = ROOT_PATH_NS(@"/Library/Application Support/uYouPlus.bundle/UI/yt_outline_gear_24pt.png");
|
||||
}
|
||||
Class YTVersionUtilsClass = %c(YTVersionUtils);
|
||||
NSString *appVersion = [YTVersionUtilsClass performSelector:@selector(appVersion)];
|
||||
NSComparisonResult versionCheck = [appVersion compare:@"18.35.4" options:NSNumericSearch];
|
||||
|
|
@ -101,9 +109,20 @@ NSBundle *tweakBundle = uYouPlusBundle();
|
|||
}
|
||||
%new;
|
||||
- (void)settingsAction {
|
||||
UIViewController *settingsViewController = [self _viewControllerForAncestor];
|
||||
id settingsVC = [[%c(SettingsViewController) alloc] initWithStyle:UITableViewStyleGrouped];
|
||||
[settingsViewController presentViewController:settingsVC animated:YES completion:nil];
|
||||
Class YTNavigationControllerClass = %c(YTNavigationController);
|
||||
YTNavigationController *navigationController = [YTNavigationControllerClass sharedNavigationController];
|
||||
|
||||
Class YTApplicationSettingsEndpointRootClass = %c(YTApplicationSettingsEndpointRoot);
|
||||
id applicationSettingsEndpoint = [%c(YTApplicationSettingsEndpointRoot) applicationSettingsEndpoint];
|
||||
|
||||
Class YTIButtonRendererClass = %c(YTIButtonRenderer);
|
||||
id buttonRenderer = [%c(YTIButtonRenderer) new];
|
||||
|
||||
[buttonRenderer setIconType:SETTINGS];
|
||||
[buttonRenderer setNavigationEndpoint:applicationSettingsEndpoint];
|
||||
[buttonRenderer setAccessibilityLabel:@"Settings"];
|
||||
|
||||
[navigationController handleButtonRendererAction:buttonRenderer];
|
||||
}
|
||||
%end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue