diff options
author | NicoleYarroch <nicole@livio.io> | 2019-08-13 10:59:56 -0400 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2019-08-13 10:59:56 -0400 |
commit | cb39a65213d7e9cf22c0fd216adf8e3de0bc1778 (patch) | |
tree | 45682a70e69fac94828d34996a9d7de5c0e5b233 /SmartDeviceLink/SDLChoiceSetManager.m | |
parent | 1cd9f24a49c6fb9a492ca489c33453278d5bb21b (diff) | |
download | sdl_ios-cb39a65213d7e9cf22c0fd216adf8e3de0bc1778.tar.gz |
Present and dismiss keyboard now take cancelID
Diffstat (limited to 'SmartDeviceLink/SDLChoiceSetManager.m')
-rw-r--r-- | SmartDeviceLink/SDLChoiceSetManager.m | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/SmartDeviceLink/SDLChoiceSetManager.m b/SmartDeviceLink/SDLChoiceSetManager.m index b2a170c6e..e90dd7aca 100644 --- a/SmartDeviceLink/SDLChoiceSetManager.m +++ b/SmartDeviceLink/SDLChoiceSetManager.m @@ -330,7 +330,11 @@ UInt16 const ChoiceCellCancelIdMin = 1; } - (void)presentKeyboardWithInitialText:(NSString *)initialText delegate:(id<SDLKeyboardDelegate>)delegate { - if (![self.currentState isEqualToString:SDLChoiceManagerStateReady]) { return; } + [self presentKeyboardWithInitialText:initialText keyboardDelegate:delegate]; +} + +- (nullable NSNumber<SDLInt> *)presentKeyboardWithInitialText:(NSString *)initialText keyboardDelegate:(id<SDLKeyboardDelegate>)delegate { + if (![self.currentState isEqualToString:SDLChoiceManagerStateReady]) { return nil; } if (self.pendingPresentationSet != nil) { [self.pendingPresentOperation cancel]; @@ -338,11 +342,13 @@ UInt16 const ChoiceCellCancelIdMin = 1; } // Present a keyboard with the choice set that we used to test VR's optional state - self.pendingPresentOperation = [[SDLPresentKeyboardOperation alloc] initWithConnectionManager:self.connectionManager keyboardProperties:self.keyboardConfiguration initialText:initialText keyboardDelegate:delegate cancelID:self.nextCancelId++]; + UInt16 keyboardCancelId = self.nextCancelId++; + self.pendingPresentOperation = [[SDLPresentKeyboardOperation alloc] initWithConnectionManager:self.connectionManager keyboardProperties:self.keyboardConfiguration initialText:initialText keyboardDelegate:delegate cancelID:keyboardCancelId]; [self.transactionQueue addOperation:self.pendingPresentOperation]; + return @(keyboardCancelId); } -- (void)dismissKeyboard { +- (void)dismissKeyboardWithCancelID:(NSNumber<SDLInt> *)cancelID { if ([SDLGlobals.sharedGlobals.rpcVersion isLessThanVersion:[[SDLVersion alloc] initWithMajor:6 minor:0 patch:0]]) { SDLLogE(@"Canceling a keyboard is not supported on this head unit"); return; @@ -352,7 +358,7 @@ UInt16 const ChoiceCellCancelIdMin = 1; if (![op isKindOfClass:SDLPresentKeyboardOperation.class]) { continue; } SDLPresentKeyboardOperation *keyboardOperation = (SDLPresentKeyboardOperation *)op; - [keyboardOperation dismissKeyboard]; + [keyboardOperation dismissKeyboardWithCancelID:cancelID]; } } |