Skip to content

Commit a9a0b1b

Browse files
committed
SDK-1106 remove file IO from initialize
1 parent f731020 commit a9a0b1b

File tree

2 files changed

+0
-75
lines changed

2 files changed

+0
-75
lines changed

Branch-SDK/BNCPreferenceHelper.m

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -872,50 +872,12 @@ - (NSInteger)readIntegerFromDefaults:(NSString *)key {
872872

873873
#pragma mark - Preferences File URL
874874

875-
+ (NSString *)prefsFile_deprecated {
876-
NSString * path =
877-
[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)
878-
firstObject]
879-
stringByAppendingPathComponent:BRANCH_PREFS_FILE];
880-
return path;
881-
}
882-
883875
+ (NSURL* _Nonnull) URLForPrefsFile {
884876
NSURL *URL = BNCURLForBranchDirectory();
885877
URL = [URL URLByAppendingPathComponent:BRANCH_PREFS_FILE isDirectory:NO];
886878
return URL;
887879
}
888880

889-
+ (void) moveOldPrefsFile {
890-
NSString* oldPath = self.prefsFile_deprecated;
891-
NSURL *oldURL = (oldPath) ? [NSURL fileURLWithPath:self.prefsFile_deprecated] : nil;
892-
NSURL *newURL = [self URLForPrefsFile];
893-
894-
if (!oldURL || !newURL) { return; }
895-
896-
NSError *error = nil;
897-
[[NSFileManager defaultManager]
898-
moveItemAtURL:oldURL
899-
toURL:newURL
900-
error:&error];
901-
902-
if (error && error.code != NSFileNoSuchFileError) {
903-
if (error.code == NSFileWriteFileExistsError) {
904-
[[NSFileManager defaultManager]
905-
removeItemAtURL:oldURL
906-
error:&error];
907-
} else {
908-
BNCLogError([NSString stringWithFormat:@"Can't move prefs file: %@.", error]);
909-
}
910-
}
911-
}
912-
913-
+ (void) initialize {
914-
if (self == [BNCPreferenceHelper self]) {
915-
[self moveOldPrefsFile];
916-
}
917-
}
918-
919881
@end
920882

921883
#pragma mark - BNCURLForBranchDirectory

Branch-SDK/BNCServerRequestQueue.m

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -365,49 +365,12 @@ + (NSString *)exceptionString:(NSException *)exception {
365365
[exception.callStackSymbols componentsJoinedByString:@"\n\t"]];
366366
}
367367

368-
+ (NSString *)queueFile_deprecated {
369-
NSString *path =
370-
[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)
371-
firstObject]
372-
stringByAppendingPathComponent:BRANCH_QUEUE_FILE];
373-
return path;
374-
}
375-
376368
+ (NSURL* _Nonnull) URLForQueueFile {
377369
NSURL *URL = BNCURLForBranchDirectory();
378370
URL = [URL URLByAppendingPathComponent:BRANCH_QUEUE_FILE isDirectory:NO];
379371
return URL;
380372
}
381373

382-
+ (void) moveOldQueueFile {
383-
NSURL *oldURL = [NSURL fileURLWithPath:self.queueFile_deprecated];
384-
NSURL *newURL = [self URLForQueueFile];
385-
386-
if (!oldURL || !newURL) { return; }
387-
388-
NSError *error = nil;
389-
[[NSFileManager defaultManager]
390-
moveItemAtURL:oldURL
391-
toURL:newURL
392-
error:&error];
393-
394-
if (error && error.code != NSFileNoSuchFileError) {
395-
if (error.code == NSFileWriteFileExistsError) {
396-
[[NSFileManager defaultManager]
397-
removeItemAtURL:oldURL
398-
error:&error];
399-
} else {
400-
BNCLogError([NSString stringWithFormat:@"Failed to move the queue file: %@.", error]);
401-
}
402-
}
403-
}
404-
405-
+ (void) initialize {
406-
if (self == [BNCServerRequestQueue self]) {
407-
[self moveOldQueueFile];
408-
}
409-
}
410-
411374
#pragma mark - Shared Method
412375

413376
+ (id)getInstance {

0 commit comments

Comments
 (0)