Skip to content

Commit aa5e163

Browse files
committed
Merge branch 'master' of github.com:fullstackreact/react-native-firestack
* 'master' of github.com:fullstackreact/react-native-firestack: Fix Default app has already been configured Fix enablePersistence should be called before any access to FIRDatabase
2 parents 5105ba0 + 7b3277c commit aa5e163

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ios/Firestack/Firestack.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ - (FIRApp *) firebaseApp
239239

240240
// if (!self.configured) {
241241

242-
[FIRApp configureWithOptions:finalOptions];
242+
if ([FIRApp defaultApp] == NULL) {
243+
[FIRApp configureWithOptions:finalOptions];
244+
}
243245
[Firestack initializeFirestack:self];
244246
callback(@[[NSNull null], props]);
245247
}

ios/Firestack/FirestackDatabase.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ @implementation FirestackDatabase
240240
RCT_EXPORT_METHOD(enablePersistence:(BOOL) enable
241241
callback:(RCTResponseSenderBlock) callback)
242242
{
243-
[FIRDatabase database].persistenceEnabled = enable;
243+
244+
BOOL isEnabled = [FIRDatabase database].persistenceEnabled;
245+
if ( isEnabled != enable) {
246+
[FIRDatabase database].persistenceEnabled = enable;
247+
}
244248
callback(@[[NSNull null], @{
245249
@"result": @"success"
246250
}]);

0 commit comments

Comments
 (0)