diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2019-09-19 10:34:09 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2019-09-19 10:34:09 -0400 |
commit | 9b89e4181960be51d02bb53739bfb3ecbe004069 (patch) | |
tree | c4f639180652f78e342e5e11152633f221f4c62f | |
parent | 616e7046c3cb5e3a96c7cafac9ae4f3e9ddfc6cc (diff) | |
download | sdl_ios-9b89e4181960be51d02bb53739bfb3ecbe004069.tar.gz |
Update SDLAsynchronousOperation subclasses to abort on start if they're cancelled
-rw-r--r-- | SmartDeviceLink/SDLAsynchronousRPCOperation.m | 10 | ||||
-rw-r--r-- | SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLCheckChoiceVROptionalOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDeleteChoicesOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLDeleteFileOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLListFilesOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLPreloadChoicesOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLPresentChoiceSetOperation.m | 6 | ||||
-rw-r--r-- | SmartDeviceLink/SDLPresentKeyboardOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSequentialRPCRequestOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSoftButtonReplaceOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSoftButtonTransitionOperation.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLUploadFileOperation.m | 1 |
13 files changed, 15 insertions, 12 deletions
diff --git a/SmartDeviceLink/SDLAsynchronousRPCOperation.m b/SmartDeviceLink/SDLAsynchronousRPCOperation.m index 4fe43a91e..ad169c8a9 100644 --- a/SmartDeviceLink/SDLAsynchronousRPCOperation.m +++ b/SmartDeviceLink/SDLAsynchronousRPCOperation.m @@ -21,18 +21,12 @@ NS_ASSUME_NONNULL_BEGIN @end -@implementation SDLAsynchronousRPCOperation { - BOOL executing; - BOOL finished; -} +@implementation SDLAsynchronousRPCOperation - (instancetype)init { self = [super init]; if (!self) { return nil; } - executing = NO; - finished = NO; - _operationId = [NSUUID UUID]; return self; @@ -49,6 +43,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } + [self sdl_sendRPC:self.rpc]; } diff --git a/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m b/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m index c77c80d52..92b157e8d 100644 --- a/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m +++ b/SmartDeviceLink/SDLAsynchronousRPCRequestOperation.m @@ -72,6 +72,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [self sdl_sendRequests]; } diff --git a/SmartDeviceLink/SDLCheckChoiceVROptionalOperation.m b/SmartDeviceLink/SDLCheckChoiceVROptionalOperation.m index abe323689..0615cb01a 100644 --- a/SmartDeviceLink/SDLCheckChoiceVROptionalOperation.m +++ b/SmartDeviceLink/SDLCheckChoiceVROptionalOperation.m @@ -38,6 +38,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [self sdl_sendTestChoices]; } diff --git a/SmartDeviceLink/SDLDeleteChoicesOperation.m b/SmartDeviceLink/SDLDeleteChoicesOperation.m index 7fd42a491..027c549dd 100644 --- a/SmartDeviceLink/SDLDeleteChoicesOperation.m +++ b/SmartDeviceLink/SDLDeleteChoicesOperation.m @@ -45,6 +45,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [self sdl_sendDeletions]; } diff --git a/SmartDeviceLink/SDLDeleteFileOperation.m b/SmartDeviceLink/SDLDeleteFileOperation.m index fa1de55f6..e7ce7e204 100644 --- a/SmartDeviceLink/SDLDeleteFileOperation.m +++ b/SmartDeviceLink/SDLDeleteFileOperation.m @@ -40,6 +40,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [self sdl_deleteFile]; } diff --git a/SmartDeviceLink/SDLListFilesOperation.m b/SmartDeviceLink/SDLListFilesOperation.m index 5e6ace166..cdfaca5f3 100644 --- a/SmartDeviceLink/SDLListFilesOperation.m +++ b/SmartDeviceLink/SDLListFilesOperation.m @@ -41,6 +41,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [self sdl_listFiles]; } diff --git a/SmartDeviceLink/SDLPreloadChoicesOperation.m b/SmartDeviceLink/SDLPreloadChoicesOperation.m index a2f83b5b7..d1eeeccf5 100644 --- a/SmartDeviceLink/SDLPreloadChoicesOperation.m +++ b/SmartDeviceLink/SDLPreloadChoicesOperation.m @@ -61,6 +61,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [self sdl_preloadCellArtworksWithCompletionHandler:^(NSError * _Nullable error) { self.internalError = error; diff --git a/SmartDeviceLink/SDLPresentChoiceSetOperation.m b/SmartDeviceLink/SDLPresentChoiceSetOperation.m index 9d60af3bf..3787fb996 100644 --- a/SmartDeviceLink/SDLPresentChoiceSetOperation.m +++ b/SmartDeviceLink/SDLPresentChoiceSetOperation.m @@ -92,6 +92,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_keyboardInputNotification:) name:SDLDidReceiveKeyboardInputNotification object:nil]; @@ -99,11 +100,6 @@ NS_ASSUME_NONNULL_BEGIN } - (void)sdl_start { - if (self.isCancelled) { - [self finishOperation]; - return; - } - // Check if we're using a keyboard (searchable) choice set and setup keyboard properties if we need to if (self.keyboardDelegate != nil && [self.keyboardDelegate respondsToSelector:@selector(customKeyboardConfiguration)]) { SDLKeyboardProperties *customProperties = self.keyboardDelegate.customKeyboardConfiguration; diff --git a/SmartDeviceLink/SDLPresentKeyboardOperation.m b/SmartDeviceLink/SDLPresentKeyboardOperation.m index 8136098ba..27d865ea5 100644 --- a/SmartDeviceLink/SDLPresentKeyboardOperation.m +++ b/SmartDeviceLink/SDLPresentKeyboardOperation.m @@ -59,6 +59,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_keyboardInputNotification:) name:SDLDidReceiveKeyboardInputNotification object:nil]; diff --git a/SmartDeviceLink/SDLSequentialRPCRequestOperation.m b/SmartDeviceLink/SDLSequentialRPCRequestOperation.m index 43b025947..96c44b82c 100644 --- a/SmartDeviceLink/SDLSequentialRPCRequestOperation.m +++ b/SmartDeviceLink/SDLSequentialRPCRequestOperation.m @@ -54,6 +54,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [self sdl_sendNextRequest]; } diff --git a/SmartDeviceLink/SDLSoftButtonReplaceOperation.m b/SmartDeviceLink/SDLSoftButtonReplaceOperation.m index c967e10a9..06ee8b5be 100644 --- a/SmartDeviceLink/SDLSoftButtonReplaceOperation.m +++ b/SmartDeviceLink/SDLSoftButtonReplaceOperation.m @@ -49,6 +49,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } // Check the state of our images if (![self sdl_supportsSoftButtonImages]) { diff --git a/SmartDeviceLink/SDLSoftButtonTransitionOperation.m b/SmartDeviceLink/SDLSoftButtonTransitionOperation.m index 862df6c5e..add03489c 100644 --- a/SmartDeviceLink/SDLSoftButtonTransitionOperation.m +++ b/SmartDeviceLink/SDLSoftButtonTransitionOperation.m @@ -44,6 +44,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [self sdl_sendNewSoftButtons]; } diff --git a/SmartDeviceLink/SDLUploadFileOperation.m b/SmartDeviceLink/SDLUploadFileOperation.m index f9edfe2f5..b87629b28 100644 --- a/SmartDeviceLink/SDLUploadFileOperation.m +++ b/SmartDeviceLink/SDLUploadFileOperation.m @@ -53,6 +53,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)start { [super start]; + if (self.isCancelled) { return; } [self sdl_sendFile:self.fileWrapper.file mtuSize:[[SDLGlobals sharedGlobals] mtuSizeForServiceType:SDLServiceTypeRPC] withCompletion:self.fileWrapper.completionHandler]; } |