summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2018-01-29 15:35:41 -0500
committerJoel Fischer <joeljfischer@gmail.com>2018-01-29 15:35:41 -0500
commitd85cc6297ca432d503139b51e313fedbb68aed9c (patch)
treed234c4d7a2310be64c64102205632bd3e314e08f
parent61113a5352ff89c5f2f1dd788a75513ead62004f (diff)
downloadsdl_ios-d85cc6297ca432d503139b51e313fedbb68aed9c.tar.gz
Remove public property and observe non-public in testsbugs/issue_827_listfiles_workaround
-rw-r--r--SmartDeviceLink/SDLFileManager.h5
-rw-r--r--SmartDeviceLink/SDLFileManager.m12
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLFileManagerSpec.m3
3 files changed, 6 insertions, 14 deletions
diff --git a/SmartDeviceLink/SDLFileManager.h b/SmartDeviceLink/SDLFileManager.h
index 41612cea4..720e95044 100644
--- a/SmartDeviceLink/SDLFileManager.h
+++ b/SmartDeviceLink/SDLFileManager.h
@@ -32,11 +32,6 @@ typedef void (^SDLFileManagerStartupCompletionHandler)(BOOL success, NSError *__
@property (copy, nonatomic, readonly) NSSet<SDLFileName *> *remoteFileNames;
/**
- A set of all names of files uploaded this session (and this session only)
- */
-@property (copy, nonatomic, readonly) NSSet<SDLFileName *> *uploadedEphemeralFileNames;
-
-/**
* The number of bytes still available for files for this app.
*/
@property (assign, nonatomic, readonly) NSUInteger bytesAvailable;
diff --git a/SmartDeviceLink/SDLFileManager.m b/SmartDeviceLink/SDLFileManager.m
index f50f887f7..8942ec2d7 100644
--- a/SmartDeviceLink/SDLFileManager.m
+++ b/SmartDeviceLink/SDLFileManager.m
@@ -46,7 +46,7 @@ SDLFileManagerState *const SDLFileManagerStateStartupError = @"StartupError";
// Local state
@property (strong, nonatomic) NSOperationQueue *transactionQueue;
@property (strong, nonatomic) NSMutableDictionary<SDLFileName *, NSOperation *> *uploadsInProgress;
-@property (strong, nonatomic) NSMutableSet<SDLFileName *> *mutableUploadedEphemeralFileNames;
+@property (strong, nonatomic) NSMutableSet<SDLFileName *> *uploadedEphemeralFileNames;
@property (strong, nonatomic) SDLStateMachine *stateMachine;
@property (copy, nonatomic, nullable) SDLFileManagerStartupCompletionHandler startupCompletionHandler;
@@ -72,7 +72,7 @@ SDLFileManagerState *const SDLFileManagerStateStartupError = @"StartupError";
_transactionQueue.name = @"SDLFileManager Transaction Queue";
_transactionQueue.maxConcurrentOperationCount = 1;
_uploadsInProgress = [[NSMutableDictionary alloc] init];
- _mutableUploadedEphemeralFileNames = [[NSMutableSet<SDLFileName *> alloc] init];
+ _uploadedEphemeralFileNames = [[NSMutableSet<SDLFileName *> alloc] init];
_stateMachine = [[SDLStateMachine alloc] initWithTarget:self initialState:SDLFileManagerStateShutdown states:[self.class sdl_stateTransitionDictionary]];
@@ -103,10 +103,6 @@ SDLFileManagerState *const SDLFileManagerStateStartupError = @"StartupError";
return [NSSet setWithSet:self.mutableRemoteFileNames];
}
-- (NSSet<SDLFileName *> *)uploadedEphemeralFileNames {
- return [NSSet setWithSet:self.mutableUploadedEphemeralFileNames];
-}
-
- (NSString *)currentState {
return self.stateMachine.currentState;
}
@@ -279,7 +275,7 @@ SDLFileManagerState *const SDLFileManagerStateStartupError = @"StartupError";
dispatch_group_enter(uploadFilesTask);
// HAX: [#827](https://github.com/smartdevicelink/sdl_ios/issues/827) Older versions of Core had a bug where list files would cache incorrectly. This led to attempted uploads failing due to the system thinking they were already there when they were not.
- if (!file.persistent && [self.remoteFileNames containsObject:file.name] && ![self.mutableUploadedEphemeralFileNames containsObject:file.name]) {
+ if (!file.persistent && [self.remoteFileNames containsObject:file.name] && ![self.uploadedEphemeralFileNames containsObject:file.name]) {
file.overwrite = true;
}
@@ -394,7 +390,7 @@ SDLFileManagerState *const SDLFileManagerStateStartupError = @"StartupError";
}
if (success) {
[weakSelf.mutableRemoteFileNames addObject:fileName];
- [weakSelf.mutableUploadedEphemeralFileNames addObject:fileName];
+ [weakSelf.uploadedEphemeralFileNames addObject:fileName];
}
if (uploadCompletion != nil) {
uploadCompletion(success, bytesAvailable, error);
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLFileManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLFileManagerSpec.m
index 8f66302b7..8a7a0db78 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLFileManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLFileManagerSpec.m
@@ -25,11 +25,12 @@ SDLFileManagerState *const SDLFileManagerStateReady = @"Ready";
@interface SDLFileManager ()
@property (strong, nonatomic) NSOperationQueue *transactionQueue;
+@property (strong, nonatomic) NSMutableSet<SDLFileName *> *uploadedEphemeralFileNames;
@end
QuickSpecBegin(SDLFileManagerSpec)
-fdescribe(@"SDLFileManager", ^{
+describe(@"SDLFileManager", ^{
__block TestConnectionManager *testConnectionManager = nil;
__block SDLFileManager *testFileManager = nil;
__block NSUInteger initialSpaceAvailable = 250;