From 09301e44ba9535fa98974bc05dd3bd4b5a549e46 Mon Sep 17 00:00:00 2001 From: Atul M Date: Wed, 18 Jan 2017 00:38:24 +0530 Subject: [PATCH] The shortcuts "Discoverability" menu shown while pressing Cmd will not be shown if Cmd is assigned any modifer mappings in keyboard screen --- Blink/SpaceController.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Blink/SpaceController.m b/Blink/SpaceController.m index 5443e4f4e..a004f3e62 100644 --- a/Blink/SpaceController.m +++ b/Blink/SpaceController.m @@ -34,7 +34,7 @@ #import "SmartKeysController.h" #import "TermController.h" #import "ScreenController.h" - +#import "BKDefaults.h" @interface SpaceController () @@ -57,6 +57,7 @@ @implementation SpaceController { MBProgressHUD *_hud; NSMutableArray *_kbdCommands; + NSMutableArray *_kbdCommandsWithoutDiscoverability; } #pragma mark Setup @@ -437,6 +438,10 @@ - (void)terminalHangup:(TermController *)control - (NSArray *)keyCommands { + NSMutableDictionary *kbMapping = [NSMutableDictionary dictionaryWithDictionary:[BKDefaults keyboardMapping]]; + if([kbMapping objectForKey:@"⌘ Cmd"] && ![[kbMapping objectForKey:@"⌘ Cmd"]isEqualToString:@"None"]){ + return _kbdCommandsWithoutDiscoverability; + } return _kbdCommands; } @@ -478,6 +483,13 @@ - (void)setKbdCommands [_kbdCommands addObject:cmd]; } + + for (UIKeyCommand *command in _kbdCommands) { + UIKeyCommand *commandWithoutDiscoverability = [command copy]; + commandWithoutDiscoverability.discoverabilityTitle = nil; + [_kbdCommandsWithoutDiscoverability addObject:commandWithoutDiscoverability]; + } + } - (void)otherScreen:(UIKeyCommand *)cmd