Skip to content

Commit

Permalink
Allow ios backup: Apply @tiltshift's patch
Browse files Browse the repository at this point in the history
This is being applied to @craftzdog's master v3.6.2 (commit 64ec364).

Here's the patch, a PR which has yet to be approved...
craftzdog#108
  • Loading branch information
chichilatte committed Aug 29, 2023
1 parent 64ec364 commit 4017960
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions ios/RNSqlite2.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,12 @@ -(void)pluginInitialize {
dbQueues = [NSMutableDictionary dictionaryWithCapacity:0];
NSString *dbDir = [self getDatabaseDir];

// create "NoCloud" if it doesn't exist
// create storage directory if it doesn't exist
[[NSFileManager defaultManager] createDirectoryAtPath: dbDir
withIntermediateDirectories: NO
attributes: nil
error: nil];
// make it non-syncable to iCloud
NSURL *url = [ NSURL fileURLWithPath: dbDir];
[url setResourceValue: [NSNumber numberWithBool: YES]
forKey: NSURLIsExcludedFromBackupKey
error: nil];

}

- (dispatch_queue_t)getDatabaseQueue:(NSString *)dbName {
Expand All @@ -53,8 +49,10 @@ - (dispatch_queue_t)getDatabaseQueue:(NSString *)dbName {
}

-(NSString*) getDatabaseDir {
NSString *libDir = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
return [libDir stringByAppendingPathComponent:@"NoCloud"];
NSString *appSupportDir = nil;
appSupportDir = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
NSString *appBundleID = [[NSBundle mainBundle] bundleIdentifier];
return [NSString stringWithFormat:@"%@/%@", appSupportDir, appBundleID];
}

-(id) getPathForDB:(NSString *)dbName {
Expand Down

0 comments on commit 4017960

Please sign in to comment.