diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2016-08-25 10:52:45 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2016-08-25 10:52:45 -0400 |
commit | 487f3ba67e272078787565977c9398ea71833532 (patch) | |
tree | 6b0077f881e70d817c11fd9e63c096530d14c669 /SmartDeviceLink/SDLDeleteFileOperation.m | |
parent | 83160c60607e4534092bdc8c5e6170455bf2244e (diff) | |
download | sdl_ios-487f3ba67e272078787565977c9398ea71833532.tar.gz |
Shift some file operation code to a superclass
* Fix a few strong / weak block bugs
Diffstat (limited to 'SmartDeviceLink/SDLDeleteFileOperation.m')
-rw-r--r-- | SmartDeviceLink/SDLDeleteFileOperation.m | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/SmartDeviceLink/SDLDeleteFileOperation.m b/SmartDeviceLink/SDLDeleteFileOperation.m index 1f61e254e..3515525fc 100644 --- a/SmartDeviceLink/SDLDeleteFileOperation.m +++ b/SmartDeviceLink/SDLDeleteFileOperation.m @@ -25,10 +25,7 @@ NS_ASSUME_NONNULL_BEGIN @end -@implementation SDLDeleteFileOperation { - BOOL executing; - BOOL finished; -} +@implementation SDLDeleteFileOperation - (instancetype)initWithFileName:(NSString *)fileName connectionManager:(id<SDLConnectionManagerType>)connectionManager completionHandler:(nullable SDLFileManagerDeleteCompletion)completionHandler { self = [super init]; @@ -44,17 +41,7 @@ NS_ASSUME_NONNULL_BEGIN } - (void)start { - if (self.isCancelled) { - [self willChangeValueForKey:@"isFinished"]; - finished = YES; - [self didChangeValueForKey:@"isFinished"]; - - return; - } - - [self willChangeValueForKey:@"isExecuting"]; - executing = YES; - [self didChangeValueForKey:@"isExecuting"]; + [super start]; [self sdl_deleteFile]; } @@ -75,33 +62,13 @@ NS_ASSUME_NONNULL_BEGIN weakself.completionHandler(success, bytesAvailable, error); } - [self sdl_finishOperation]; + [weakself finishOperation]; }]; } -- (void)sdl_finishOperation { - [self willChangeValueForKey:@"isExecuting"]; - [self willChangeValueForKey:@"isFinished"]; - executing = NO; - finished = YES; - [self didChangeValueForKey:@"isFinished"]; - [self didChangeValueForKey:@"isExecuting"]; -} #pragma mark Property Overrides -- (BOOL)isAsynchronous { - return YES; -} - -- (BOOL)isExecuting { - return executing; -} - -- (BOOL)isFinished { - return finished; -} - - (nullable NSString *)name { return self.fileName; } |