@@ -40,12 +40,23 @@ @interface FIRCLSSettings ()
4040
4141@property (nonatomic ) BOOL isCacheKeyExpired;
4242
43+ @property (nonatomic ) dispatch_queue_t deletionQueue;
44+
4345@end
4446
4547@implementation FIRCLSSettings
4648
4749- (instancetype )initWithFileManager : (FIRCLSFileManager *)fileManager
4850 appIDModel : (FIRCLSApplicationIdentifierModel *)appIDModel {
51+ return
52+ [self initWithFileManager: fileManager
53+ appIDModel: appIDModel
54+ deletionQueue: dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0 )];
55+ }
56+
57+ - (instancetype )initWithFileManager : (FIRCLSFileManager *)fileManager
58+ appIDModel : (FIRCLSApplicationIdentifierModel *)appIDModel
59+ deletionQueue : (dispatch_queue_t )deletionQueue {
4960 self = [super init ];
5061 if (!self) {
5162 return nil ;
@@ -57,6 +68,8 @@ - (instancetype)initWithFileManager:(FIRCLSFileManager *)fileManager
5768 _settingsDictionary = nil ;
5869 _isCacheKeyExpired = NO ;
5970
71+ _deletionQueue = deletionQueue;
72+
6073 return self;
6174}
6275
@@ -190,19 +203,15 @@ - (NSDictionary *)loadCacheKey {
190203
191204- (void )deleteCachedSettings {
192205 __weak FIRCLSSettings *weakSelf = self;
193- #ifndef FIREBASE_IS_NIGHTLY_TESTING
194- dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0 ), ^{
195- #endif
206+ dispatch_async (_deletionQueue, ^{
196207 __strong FIRCLSSettings *strongSelf = weakSelf;
197208 if ([strongSelf.fileManager fileExistsAtPath: strongSelf.fileManager.settingsFilePath]) {
198209 [strongSelf.fileManager removeItemAtPath: strongSelf.fileManager.settingsFilePath];
199210 }
200211 if ([strongSelf.fileManager fileExistsAtPath: strongSelf.fileManager.settingsCacheKeyPath]) {
201212 [strongSelf.fileManager removeItemAtPath: strongSelf.fileManager.settingsCacheKeyPath];
202213 }
203- #ifndef FIREBASE_IS_NIGHTLY_TESTING
204214 });
205- #endif
206215
207216 @synchronized (self) {
208217 self.isCacheKeyExpired = YES ;
0 commit comments