Skip to content

Commit

Permalink
Updated fallbacks fetching logic
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jul 15, 2024
1 parent 4ae334a commit 1d880c8
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,20 @@ - (QONFallbackObject * _Nullable)obtainFallbackData {
NSData *fileData = [NSData dataWithContentsOfFile:pathToFile];

if (!fileData) {
return nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = paths.firstObject;

if (documentsPath) {
NSString *filePath = [documentsPath stringByAppendingPathComponent:kFallbacksFileName];

if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
fileData = [NSData dataWithContentsOfFile:filePath];
} else {
return nil;
}
} else {
return nil;
}
}

NSDictionary *resultMap = [NSJSONSerialization JSONObjectWithData:fileData options:kNilOptions error:nil];
Expand Down

0 comments on commit 1d880c8

Please sign in to comment.