@react-native-firebase/database 26.0.0 → 26.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/RNFBDatabase.podspec +2 -1
  3. package/dist/module/version.js +1 -1
  4. package/dist/typescript/lib/index.d.ts +1 -1
  5. package/dist/typescript/lib/version.d.ts +1 -1
  6. package/ios/RNFBDatabase/RNFBDatabaseCommon.h +13 -6
  7. package/ios/RNFBDatabase/RNFBDatabaseCommon.m +2 -10
  8. package/ios/RNFBDatabase/RNFBDatabaseConstants.h +25 -0
  9. package/ios/RNFBDatabase/RNFBDatabaseModule.mm +14 -24
  10. package/ios/RNFBDatabase/RNFBDatabaseModuleHelper.h +39 -0
  11. package/ios/RNFBDatabase/RNFBDatabaseModuleHelper.m +64 -0
  12. package/ios/RNFBDatabase/RNFBDatabaseOnDisconnectHelper.h +59 -0
  13. package/ios/RNFBDatabase/RNFBDatabaseOnDisconnectHelper.m +136 -0
  14. package/ios/RNFBDatabase/RNFBDatabaseOnDisconnectModule.mm +35 -71
  15. package/ios/RNFBDatabase/RNFBDatabaseQuery.h +11 -0
  16. package/ios/RNFBDatabase/RNFBDatabaseQueryHelper.h +49 -0
  17. package/ios/RNFBDatabase/RNFBDatabaseQueryHelper.m +240 -0
  18. package/ios/RNFBDatabase/RNFBDatabaseQueryModule.h +5 -1
  19. package/ios/RNFBDatabase/RNFBDatabaseQueryModule.mm +25 -181
  20. package/ios/RNFBDatabase/RNFBDatabaseQueue.h +29 -0
  21. package/ios/RNFBDatabase/RNFBDatabaseQueue.m +31 -0
  22. package/ios/RNFBDatabase/RNFBDatabaseReferenceHelper.h +59 -0
  23. package/ios/RNFBDatabase/RNFBDatabaseReferenceHelper.m +136 -0
  24. package/ios/RNFBDatabase/RNFBDatabaseReferenceModule.mm +32 -70
  25. package/ios/RNFBDatabase/RNFBDatabaseTransactionHelper.h +38 -0
  26. package/ios/RNFBDatabase/RNFBDatabaseTransactionHelper.m +173 -0
  27. package/ios/RNFBDatabase/RNFBDatabaseTransactionModule.h +0 -1
  28. package/ios/RNFBDatabase/RNFBDatabaseTransactionModule.mm +17 -127
  29. package/lib/version.ts +1 -1
  30. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [26.1.0](https://github.com/invertase/react-native-firebase/compare/v26.0.0...v26.1.0) (2026-08-03)
7
+
8
+ ### Features
9
+
10
+ - **ios:** add SPM dependency resolution support alongside CocoaPods ([#8933](https://github.com/invertase/react-native-firebase/issues/8933)) ([44a7a9a](https://github.com/invertase/react-native-firebase/commit/44a7a9ae7b404f412e9766c0417f1df8fa971a0b))
11
+
6
12
  ## [26.0.0](https://github.com/invertase/react-native-firebase/compare/v25.1.0...v26.0.0) (2026-07-29)
7
13
 
8
14
  ### ⚠ BREAKING CHANGES
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require_relative '../app/firebase_spm'
2
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
3
4
  appPackage = JSON.parse(File.read(File.join('..', 'app', 'package.json')))
4
5
 
@@ -57,7 +58,7 @@ Pod::Spec.new do |s|
57
58
  end
58
59
 
59
60
  # Firebase dependencies
60
- s.dependency 'Firebase/Database', firebase_sdk_version
61
+ firebase_dependency(s, firebase_sdk_version, ['FirebaseDatabase'], 'Firebase/Database')
61
62
 
62
63
  if defined?($RNFirebaseAsStaticFramework)
63
64
  Pod::UI.puts "#{s.name}: Using overridden static_framework value of '#{$RNFirebaseAsStaticFramework}'"
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
 
3
3
  // Generated by genversion.
4
- export const version = '26.0.0';
4
+ export const version = '26.1.0';
5
5
  //# sourceMappingURL=version.js.map
@@ -1,7 +1,7 @@
1
1
  import type { FirebaseApp } from '@react-native-firebase/app';
2
2
  import './types/internal';
3
3
  import type { Database, DatabaseReference, EmulatorMockTokenOptions } from './types/database';
4
- export declare const SDK_VERSION = "26.0.0";
4
+ export declare const SDK_VERSION = "26.1.0";
5
5
  export declare function getDatabase(app?: FirebaseApp, url?: string): Database;
6
6
  export declare function connectDatabaseEmulator(db: Database, host: string, port: number, options?: {
7
7
  mockUserToken?: EmulatorMockTokenOptions | string;
@@ -1,2 +1,2 @@
1
- export declare const version = "26.0.0";
1
+ export declare const version = "26.1.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -15,15 +15,26 @@
15
15
  *
16
16
  */
17
17
 
18
+ #if __has_include(<Firebase/Firebase.h>)
18
19
  #import <Firebase/Firebase.h>
20
+ #elif __has_include(<FirebaseDatabase/FirebaseDatabase-Swift.h>)
21
+ // SPM: the declared product is the thin Swift wrapper `FirebaseDatabase`
22
+ // (which depends on `FirebaseDatabaseInternal`, not exposed to us directly).
23
+ // Its generated ObjC interface header is what's importable here.
24
+ #import <FirebaseCore/FirebaseCore.h>
25
+ #import <FirebaseDatabase/FirebaseDatabase-Swift.h>
26
+ #else
27
+ @import FirebaseCore;
28
+ @import FirebaseDatabaseInternal;
29
+ #endif
19
30
  #import <React/RCTBridgeModule.h>
20
31
 
32
+ #import "RNFBDatabaseConstants.h"
33
+
21
34
  @interface RNFBDatabaseCommon : NSObject
22
35
 
23
36
  + (FIRDatabase *)getDatabaseForApp:(FIRApp *)firebaseApp dbURL:(NSString *)dbURL;
24
37
 
25
- + (dispatch_queue_t)getDispatchQueue;
26
-
27
38
  + (void)setDatabaseConfig:(FIRDatabase *)firDatabase dbURL:(NSString *)dbURL;
28
39
 
29
40
  + (FIRDatabaseReference *)getReferenceForDatabase:(FIRDatabase *)firebaseDatabase
@@ -49,7 +60,3 @@
49
60
  + (NSMutableArray *)getSnapshotChildKeys:(FIRDataSnapshot *)dataSnapshot;
50
61
 
51
62
  @end
52
-
53
- extern NSString *const DATABASE_PERSISTENCE_ENABLED;
54
- extern NSString *const DATABASE_LOGGING_ENABLED;
55
- extern NSString *const DATABASE_PERSISTENCE_CACHE_SIZE;
@@ -17,6 +17,7 @@
17
17
 
18
18
  #import "RNFBDatabaseCommon.h"
19
19
  #import "RNFBApp/RNFBSharedUtils.h"
20
+ #import "RNFBDatabaseQueue.h"
20
21
  #import "RNFBPreferences.h"
21
22
 
22
23
  static __strong NSMutableDictionary *references;
@@ -36,15 +37,6 @@ NSString *const childKeysKey = @"childKeys";
36
37
  configSettingsLock = [NSMutableDictionary dictionary];
37
38
  }
38
39
 
39
- + (dispatch_queue_t)getDispatchQueue {
40
- static dispatch_once_t once;
41
- __strong static dispatch_queue_t sharedInstance;
42
- dispatch_once(&once, ^{
43
- sharedInstance = dispatch_queue_create("io.invertase.firebase.database", DISPATCH_QUEUE_SERIAL);
44
- });
45
- return sharedInstance;
46
- }
47
-
48
40
  + (FIRDatabase *)getDatabaseForApp:(FIRApp *)firebaseApp dbURL:(NSString *)dbURL {
49
41
  FIRDatabase *firDatabase;
50
42
 
@@ -75,7 +67,7 @@ NSString *const childKeysKey = @"childKeys";
75
67
  RNFBPreferences *preferences = [RNFBPreferences shared];
76
68
 
77
69
  @try {
78
- firDatabase.callbackQueue = [RNFBDatabaseCommon getDispatchQueue];
70
+ firDatabase.callbackQueue = [RNFBDatabaseQueue getDispatchQueue];
79
71
  // Persistence enabled
80
72
  BOOL *persistenceEnabled = (BOOL *)[preferences getBooleanValue:DATABASE_PERSISTENCE_ENABLED
81
73
  defaultValue:false];
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ #import <Foundation/Foundation.h>
19
+
20
+ // Deliberately Firebase-free (see RNFBDatabaseQueue.h) so Objective-C++
21
+ // (.mm) modules can reference these preference keys without importing
22
+ // Firebase Database headers. Defined in RNFBDatabaseCommon.m.
23
+ extern NSString *const DATABASE_PERSISTENCE_ENABLED;
24
+ extern NSString *const DATABASE_LOGGING_ENABLED;
25
+ extern NSString *const DATABASE_PERSISTENCE_CACHE_SIZE;
@@ -15,16 +15,22 @@
15
15
  *
16
16
  */
17
17
 
18
- #import <Firebase/Firebase.h>
19
18
  #import <React/RCTUtils.h>
20
19
 
21
- #import "RNFBApp/RCTConvert+FIRApp.h"
22
- #import "RNFBDatabaseCommon.h"
20
+ #import "RNFBDatabaseConstants.h"
23
21
  #import "RNFBDatabaseModule.h"
22
+ #import "RNFBDatabaseModuleHelper.h"
23
+ #import "RNFBDatabaseQueue.h"
24
24
  #import "RNFBDatabaseTurboModules.h"
25
25
  #import "RNFBPreferences.h"
26
26
 
27
- static __strong NSMutableDictionary *emulatorSettings;
27
+ // NOTE: This module deliberately never imports Firebase Database headers -
28
+ // `FirebaseDatabase` is a Swift-only SPM product, and `@import` for
29
+ // Swift-only products cannot be used from Objective-C++ (.mm) files when
30
+ // C++ modules are disabled (required for compatibility with React Native's
31
+ // JSI headers). All Firebase Database calls are delegated to the plain
32
+ // Objective-C `RNFBDatabaseModuleHelper`. See docs/ios-spm.mdx and
33
+ // okf-bundle/ios-spm-native-imports.md for details.
28
34
 
29
35
  @interface RNFBDatabaseModule () <NativeRNFBTurboDatabaseSpec, RCTBridgeModule>
30
36
  @end
@@ -45,41 +51,25 @@ RCT_EXPORT_MODULE(NativeRNFBTurboDatabase);
45
51
  }
46
52
 
47
53
  - (dispatch_queue_t)methodQueue {
48
- return [RNFBDatabaseCommon getDispatchQueue];
54
+ return [RNFBDatabaseQueue getDispatchQueue];
49
55
  }
50
56
 
51
57
  #pragma mark -
52
58
  #pragma mark Firebase Database
53
59
 
54
60
  - (void)goOnline:(NSString *)app dbURL:(NSString *)dbURL {
55
- FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
56
- [[RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL] goOnline];
61
+ [RNFBDatabaseModuleHelper goOnline:app dbURL:dbURL];
57
62
  }
58
63
 
59
64
  - (void)goOffline:(NSString *)app dbURL:(NSString *)dbURL {
60
- FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
61
- [[RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL] goOffline];
65
+ [RNFBDatabaseModuleHelper goOffline:app dbURL:dbURL];
62
66
  }
63
67
 
64
68
  - (void)useEmulator:(NSString *)app
65
69
  dbURL:(NSString *)dbURL
66
70
  host:(NSString *)host
67
71
  port:(double)port {
68
- FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
69
- if (emulatorSettings == nil) {
70
- emulatorSettings = [NSMutableDictionary dictionary];
71
- }
72
-
73
- NSMutableString *configKey = [firebaseApp.name mutableCopy];
74
- if (dbURL != nil && dbURL.length > 0) {
75
- [configKey appendString:dbURL];
76
- }
77
-
78
- if (!emulatorSettings[configKey]) {
79
- [[RNFBDatabaseCommon getDatabaseForApp:firebaseApp
80
- dbURL:dbURL] useEmulatorWithHost:host port:(NSInteger)port];
81
- emulatorSettings[configKey] = @YES;
82
- }
72
+ [RNFBDatabaseModuleHelper useEmulator:app dbURL:dbURL host:host port:(NSInteger)port];
83
73
  }
84
74
 
85
75
  - (void)setPersistenceEnabled:(NSString *)app dbURL:(NSString *)dbURL enabled:(BOOL)enabled {
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ #import <Foundation/Foundation.h>
19
+
20
+ // Plain Objective-C helper (see docs/ios-spm.mdx and
21
+ // okf-bundle/ios-spm-native-imports.md) that owns every call touching
22
+ // `FIRDatabase`/`FIRDatabaseReference` for the main database module. This
23
+ // keeps `RNFBDatabaseModule.mm` free of Firebase Database imports, which is
24
+ // required because `FirebaseDatabase` is a Swift-only SPM product and
25
+ // `@import` for Swift-only products is unusable from Objective-C++ (.mm)
26
+ // files when C++ modules are disabled (required by React Native's JSI
27
+ // headers).
28
+ @interface RNFBDatabaseModuleHelper : NSObject
29
+
30
+ + (void)goOnline:(NSString *)app dbURL:(NSString *)dbURL;
31
+
32
+ + (void)goOffline:(NSString *)app dbURL:(NSString *)dbURL;
33
+
34
+ + (void)useEmulator:(NSString *)app
35
+ dbURL:(NSString *)dbURL
36
+ host:(NSString *)host
37
+ port:(NSInteger)port;
38
+
39
+ @end
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ #if __has_include(<Firebase/Firebase.h>)
19
+ #import <Firebase/Firebase.h>
20
+ #else
21
+ @import FirebaseCore;
22
+ @import FirebaseDatabaseInternal;
23
+ #endif
24
+
25
+ #import "RNFBApp/RCTConvert+FIRApp.h"
26
+ #import "RNFBDatabaseCommon.h"
27
+ #import "RNFBDatabaseModuleHelper.h"
28
+
29
+ static __strong NSMutableDictionary *emulatorSettings;
30
+
31
+ @implementation RNFBDatabaseModuleHelper
32
+
33
+ + (void)goOnline:(NSString *)app dbURL:(NSString *)dbURL {
34
+ FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
35
+ [[RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL] goOnline];
36
+ }
37
+
38
+ + (void)goOffline:(NSString *)app dbURL:(NSString *)dbURL {
39
+ FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
40
+ [[RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL] goOffline];
41
+ }
42
+
43
+ + (void)useEmulator:(NSString *)app
44
+ dbURL:(NSString *)dbURL
45
+ host:(NSString *)host
46
+ port:(NSInteger)port {
47
+ FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
48
+ if (emulatorSettings == nil) {
49
+ emulatorSettings = [NSMutableDictionary dictionary];
50
+ }
51
+
52
+ NSMutableString *configKey = [firebaseApp.name mutableCopy];
53
+ if (dbURL != nil && dbURL.length > 0) {
54
+ [configKey appendString:dbURL];
55
+ }
56
+
57
+ if (!emulatorSettings[configKey]) {
58
+ [[RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL] useEmulatorWithHost:host
59
+ port:port];
60
+ emulatorSettings[configKey] = @YES;
61
+ }
62
+ }
63
+
64
+ @end
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ #import <Foundation/Foundation.h>
19
+ #import <React/RCTBridgeModule.h>
20
+
21
+ // See RNFBDatabaseModuleHelper.h for rationale: plain Objective-C helper
22
+ // that owns all `onDisconnect*` `FIRDatabaseReference` calls for
23
+ // RNFBDatabaseOnDisconnectModule.
24
+ @interface RNFBDatabaseOnDisconnectHelper : NSObject
25
+
26
+ + (void)onDisconnectCancel:(NSString *)app
27
+ dbURL:(NSString *)dbURL
28
+ path:(NSString *)path
29
+ resolve:(RCTPromiseResolveBlock)resolve
30
+ reject:(RCTPromiseRejectBlock)reject;
31
+
32
+ + (void)onDisconnectRemove:(NSString *)app
33
+ dbURL:(NSString *)dbURL
34
+ path:(NSString *)path
35
+ resolve:(RCTPromiseResolveBlock)resolve
36
+ reject:(RCTPromiseRejectBlock)reject;
37
+
38
+ + (void)onDisconnectSet:(NSString *)app
39
+ dbURL:(NSString *)dbURL
40
+ path:(NSString *)path
41
+ props:(NSDictionary *)props
42
+ resolve:(RCTPromiseResolveBlock)resolve
43
+ reject:(RCTPromiseRejectBlock)reject;
44
+
45
+ + (void)onDisconnectSetWithPriority:(NSString *)app
46
+ dbURL:(NSString *)dbURL
47
+ path:(NSString *)path
48
+ props:(NSDictionary *)props
49
+ resolve:(RCTPromiseResolveBlock)resolve
50
+ reject:(RCTPromiseRejectBlock)reject;
51
+
52
+ + (void)onDisconnectUpdate:(NSString *)app
53
+ dbURL:(NSString *)dbURL
54
+ path:(NSString *)path
55
+ props:(NSDictionary *)props
56
+ resolve:(RCTPromiseResolveBlock)resolve
57
+ reject:(RCTPromiseRejectBlock)reject;
58
+
59
+ @end
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Copyright (c) 2016-present Invertase Limited & Contributors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this library except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ #if __has_include(<Firebase/Firebase.h>)
19
+ #import <Firebase/Firebase.h>
20
+ #else
21
+ @import FirebaseCore;
22
+ @import FirebaseDatabaseInternal;
23
+ #endif
24
+
25
+ #import "RNFBApp/RCTConvert+FIRApp.h"
26
+ #import "RNFBDatabaseCommon.h"
27
+ #import "RNFBDatabaseOnDisconnectHelper.h"
28
+
29
+ @implementation RNFBDatabaseOnDisconnectHelper
30
+
31
+ + (void)onDisconnectCancel:(NSString *)app
32
+ dbURL:(NSString *)dbURL
33
+ path:(NSString *)path
34
+ resolve:(RCTPromiseResolveBlock)resolve
35
+ reject:(RCTPromiseRejectBlock)reject {
36
+ FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
37
+ FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
38
+ FIRDatabaseReference *firDatabaseReference =
39
+ [RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
40
+
41
+ [firDatabaseReference
42
+ cancelDisconnectOperationsWithCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) {
43
+ if (error != nil) {
44
+ [RNFBDatabaseCommon promiseRejectDatabaseException:reject error:error];
45
+ } else {
46
+ resolve([NSNull null]);
47
+ }
48
+ }];
49
+ }
50
+
51
+ + (void)onDisconnectRemove:(NSString *)app
52
+ dbURL:(NSString *)dbURL
53
+ path:(NSString *)path
54
+ resolve:(RCTPromiseResolveBlock)resolve
55
+ reject:(RCTPromiseRejectBlock)reject {
56
+ FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
57
+ FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
58
+ FIRDatabaseReference *firDatabaseReference =
59
+ [RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
60
+
61
+ [firDatabaseReference
62
+ onDisconnectRemoveValueWithCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) {
63
+ if (error != nil) {
64
+ [RNFBDatabaseCommon promiseRejectDatabaseException:reject error:error];
65
+ } else {
66
+ resolve([NSNull null]);
67
+ }
68
+ }];
69
+ }
70
+
71
+ + (void)onDisconnectSet:(NSString *)app
72
+ dbURL:(NSString *)dbURL
73
+ path:(NSString *)path
74
+ props:(NSDictionary *)props
75
+ resolve:(RCTPromiseResolveBlock)resolve
76
+ reject:(RCTPromiseRejectBlock)reject {
77
+ FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
78
+ FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
79
+ FIRDatabaseReference *firDatabaseReference =
80
+ [RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
81
+
82
+ [firDatabaseReference onDisconnectSetValue:[props valueForKey:@"value"]
83
+ withCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) {
84
+ if (error != nil) {
85
+ [RNFBDatabaseCommon promiseRejectDatabaseException:reject error:error];
86
+ } else {
87
+ resolve([NSNull null]);
88
+ }
89
+ }];
90
+ }
91
+
92
+ + (void)onDisconnectSetWithPriority:(NSString *)app
93
+ dbURL:(NSString *)dbURL
94
+ path:(NSString *)path
95
+ props:(NSDictionary *)props
96
+ resolve:(RCTPromiseResolveBlock)resolve
97
+ reject:(RCTPromiseRejectBlock)reject {
98
+ FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
99
+ FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
100
+ FIRDatabaseReference *firDatabaseReference =
101
+ [RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
102
+
103
+ [firDatabaseReference onDisconnectSetValue:[props valueForKey:@"value"]
104
+ andPriority:[props valueForKey:@"priority"]
105
+ withCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) {
106
+ if (error != nil) {
107
+ [RNFBDatabaseCommon promiseRejectDatabaseException:reject error:error];
108
+ } else {
109
+ resolve([NSNull null]);
110
+ }
111
+ }];
112
+ }
113
+
114
+ + (void)onDisconnectUpdate:(NSString *)app
115
+ dbURL:(NSString *)dbURL
116
+ path:(NSString *)path
117
+ props:(NSDictionary *)props
118
+ resolve:(RCTPromiseResolveBlock)resolve
119
+ reject:(RCTPromiseRejectBlock)reject {
120
+ FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
121
+ FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
122
+ FIRDatabaseReference *firDatabaseReference =
123
+ [RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
124
+
125
+ [firDatabaseReference onDisconnectUpdateChildValues:[props valueForKey:@"values"]
126
+ withCompletionBlock:^(NSError *error, FIRDatabaseReference *ref) {
127
+ if (error != nil) {
128
+ [RNFBDatabaseCommon promiseRejectDatabaseException:reject
129
+ error:error];
130
+ } else {
131
+ resolve([NSNull null]);
132
+ }
133
+ }];
134
+ }
135
+
136
+ @end