Skip to content

Commit 6b94266

Browse files
committed
Merge pull request #544 from ParsePlatform/nlutsenko.persist.clearInstallation
Move private clearing of CurrentInstallation to use persistence groups.
2 parents e2fd688 + 24ba1f5 commit 6b94266

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

Parse/Internal/Installation/CurrentInstallationController/PFCurrentInstallationController.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern NSString *const PFCurrentInstallationPinName;
2727

2828
PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFCurrentInstallationController : NSObject <PFCurrentObjectControlling>
2929

30-
@property (nonatomic, weak, readonly) id<PFFileManagerProvider, PFInstallationIdentifierStoreProvider> commonDataSource;
30+
@property (nonatomic, weak, readonly) id<PFInstallationIdentifierStoreProvider> commonDataSource;
3131
@property (nonatomic, weak, readonly) id<PFObjectFilePersistenceControllerProvider> coreDataSource;
3232

3333
///--------------------------------------
@@ -36,11 +36,11 @@ PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFCurrentInstallationControlle
3636

3737
- (instancetype)init NS_UNAVAILABLE;
3838
- (instancetype)initWithStorageType:(PFCurrentObjectStorageType)dataStorageType
39-
commonDataSource:(id<PFFileManagerProvider, PFInstallationIdentifierStoreProvider>)commonDataSource
39+
commonDataSource:(id<PFInstallationIdentifierStoreProvider>)commonDataSource
4040
coreDataSource:(id<PFObjectFilePersistenceControllerProvider>)coreDataSource;
4141

4242
+ (instancetype)controllerWithStorageType:(PFCurrentObjectStorageType)dataStorageType
43-
commonDataSource:(id<PFFileManagerProvider, PFInstallationIdentifierStoreProvider>)commonDataSource
43+
commonDataSource:(id<PFInstallationIdentifierStoreProvider>)commonDataSource
4444
coreDataSource:(id<PFObjectFilePersistenceControllerProvider>)coreDataSource;
4545

4646
///--------------------------------------

Parse/Internal/Installation/CurrentInstallationController/PFCurrentInstallationController.m

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#import "BFTask+Private.h"
1313
#import "PFAsyncTaskQueue.h"
14-
#import "PFFileManager.h"
1514
#import "PFInstallationIdentifierStore.h"
1615
#import "PFInstallationPrivate.h"
1716
#import "PFMacros.h"
@@ -48,7 +47,7 @@ @implementation PFCurrentInstallationController
4847
///--------------------------------------
4948

5049
- (instancetype)initWithStorageType:(PFCurrentObjectStorageType)storageType
51-
commonDataSource:(id<PFFileManagerProvider, PFInstallationIdentifierStoreProvider>)commonDataSource
50+
commonDataSource:(id<PFInstallationIdentifierStoreProvider>)commonDataSource
5251
coreDataSource:(id<PFObjectFilePersistenceControllerProvider>)coreDataSource {
5352
self = [super init];
5453
if (!self) return nil;
@@ -64,7 +63,7 @@ - (instancetype)initWithStorageType:(PFCurrentObjectStorageType)storageType
6463
}
6564

6665
+ (instancetype)controllerWithStorageType:(PFCurrentObjectStorageType)storageType
67-
commonDataSource:(id<PFFileManagerProvider, PFInstallationIdentifierStoreProvider>)commonDataSource
66+
commonDataSource:(id<PFInstallationIdentifierStoreProvider>)commonDataSource
6867
coreDataSource:(id<PFObjectFilePersistenceControllerProvider>)coreDataSource {
6968
return [[self alloc] initWithStorageType:storageType
7069
commonDataSource:commonDataSource
@@ -183,8 +182,7 @@ - (BFTask *)clearCurrentInstallationAsync {
183182
[tasks addObject:unpinTask];
184183
}
185184

186-
NSString *path = [self.fileManager parseDataItemPathForPathComponent:PFCurrentInstallationFileName];
187-
BFTask *fileTask = [PFFileManager removeItemAtPathAsync:path];
185+
BFTask *fileTask = [self.coreDataSource.objectFilePersistenceController removePersistentObjectAsyncForKey:PFCurrentInstallationFileName];
188186
[tasks addObject:fileTask];
189187

190188
return [BFTask taskForCompletionOfAllTasks:tasks];
@@ -247,10 +245,6 @@ - (BFTask *)_saveCurrentInstallationToDiskAsync:(PFInstallation *)installation {
247245
#pragma mark - Accessors
248246
///--------------------------------------
249247

250-
- (PFFileManager *)fileManager {
251-
return self.commonDataSource.fileManager;
252-
}
253-
254248
- (PFObjectFilePersistenceController *)objectFilePersistenceController {
255249
return self.coreDataSource.objectFilePersistenceController;
256250
}

0 commit comments

Comments
 (0)