@react-native-firebase/database 25.1.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.
- package/CHANGELOG.md +21 -0
- package/RNFBDatabase.podspec +20 -7
- package/android/build.gradle +19 -0
- package/android/src/main/java/io/invertase/firebase/database/UniversalFirebaseDatabaseModule.java +4 -14
- package/android/src/reactnative/java/io/invertase/firebase/database/DatabaseTurboModuleSupport.java +56 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseModule.java → NativeRNFBTurboDatabase.java} +16 -36
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseOnDisconnectModule.java → NativeRNFBTurboDatabaseOnDisconnect.java} +19 -14
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseQueryModule.java → NativeRNFBTurboDatabaseQuery.java} +41 -105
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseReferenceModule.java → NativeRNFBTurboDatabaseReference.java} +27 -20
- package/android/src/reactnative/java/io/invertase/firebase/database/{ReactNativeFirebaseDatabaseTransactionModule.java → NativeRNFBTurboDatabaseTransaction.java} +41 -19
- package/android/src/reactnative/java/io/invertase/firebase/database/ReactNativeFirebaseDatabasePackage.java +5 -5
- package/android/src/reactnative/java/io/invertase/firebase/database/ReactNativeFirebaseDatabaseTransactionHandler.java +11 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseOnDisconnectSpec.java +55 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseQuerySpec.java +52 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseReferenceSpec.java +55 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseSpec.java +57 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboDatabaseTransactionSpec.java +42 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/CMakeLists.txt +36 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/RNFBDatabaseTurboModules-generated.cpp +182 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/RNFBDatabaseTurboModules.h +63 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/react/renderer/components/RNFBDatabaseTurboModules/RNFBDatabaseTurboModulesJSI-generated.cpp +257 -0
- package/android/src/reactnative/java/io/invertase/firebase/database/generated/jni/react/renderer/components/RNFBDatabaseTurboModules/RNFBDatabaseTurboModulesJSI.h +440 -0
- package/dist/module/DatabaseDataSnapshot.js +20 -6
- package/dist/module/DatabaseDataSnapshot.js.map +1 -1
- package/dist/module/DatabaseOnDisconnect.js.map +1 -1
- package/dist/module/DatabaseQuery.js +13 -16
- package/dist/module/DatabaseQuery.js.map +1 -1
- package/dist/module/DatabaseReference.js +16 -15
- package/dist/module/DatabaseReference.js.map +1 -1
- package/dist/module/DatabaseSyncTree.js +5 -4
- package/dist/module/DatabaseSyncTree.js.map +1 -1
- package/dist/module/DatabaseThenableReference.js +1 -2
- package/dist/module/DatabaseThenableReference.js.map +1 -1
- package/dist/module/index.js +210 -5
- package/dist/module/index.js.map +1 -1
- package/dist/module/modular/query.js +14 -15
- package/dist/module/modular/query.js.map +1 -1
- package/dist/module/modular/transaction.js +1 -2
- package/dist/module/modular/transaction.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/web/RNFBDatabaseModule.js +4 -8
- package/dist/module/web/RNFBDatabaseModule.js.map +1 -1
- package/dist/typescript/lib/DatabaseDataSnapshot.d.ts +9 -7
- package/dist/typescript/lib/DatabaseDataSnapshot.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseOnDisconnect.d.ts +3 -3
- package/dist/typescript/lib/DatabaseOnDisconnect.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseQuery.d.ts +18 -18
- package/dist/typescript/lib/DatabaseQuery.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseReference.d.ts +8 -8
- package/dist/typescript/lib/DatabaseReference.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseSyncTree.d.ts +2 -2
- package/dist/typescript/lib/DatabaseSyncTree.d.ts.map +1 -1
- package/dist/typescript/lib/DatabaseThenableReference.d.ts +8 -8
- package/dist/typescript/lib/DatabaseThenableReference.d.ts.map +1 -1
- package/dist/typescript/lib/index.d.ts +57 -4
- package/dist/typescript/lib/index.d.ts.map +1 -1
- package/dist/typescript/lib/modular/query.d.ts.map +1 -1
- package/dist/typescript/lib/modular/transaction.d.ts.map +1 -1
- package/dist/typescript/lib/types/database.d.ts +5 -5
- package/dist/typescript/lib/types/database.d.ts.map +1 -1
- package/dist/typescript/lib/types/internal.d.ts +32 -31
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/dist/typescript/lib/web/RNFBDatabaseModule.d.ts.map +1 -1
- package/ios/RNFBDatabase/RNFBDatabaseCommon.h +13 -6
- package/ios/RNFBDatabase/RNFBDatabaseCommon.m +2 -10
- package/ios/RNFBDatabase/RNFBDatabaseConstants.h +25 -0
- package/ios/RNFBDatabase/RNFBDatabaseModule.mm +90 -0
- package/ios/RNFBDatabase/RNFBDatabaseModuleHelper.h +39 -0
- package/ios/RNFBDatabase/RNFBDatabaseModuleHelper.m +64 -0
- package/ios/RNFBDatabase/RNFBDatabaseOnDisconnectHelper.h +59 -0
- package/ios/RNFBDatabase/{RNFBDatabaseOnDisconnectModule.m → RNFBDatabaseOnDisconnectHelper.m} +41 -47
- package/ios/RNFBDatabase/RNFBDatabaseOnDisconnectModule.mm +121 -0
- package/ios/RNFBDatabase/RNFBDatabaseQuery.h +11 -0
- package/ios/RNFBDatabase/RNFBDatabaseQueryHelper.h +49 -0
- package/ios/RNFBDatabase/{RNFBDatabaseQueryModule.m → RNFBDatabaseQueryHelper.m} +77 -91
- package/ios/RNFBDatabase/RNFBDatabaseQueryModule.h +5 -1
- package/ios/RNFBDatabase/RNFBDatabaseQueryModule.mm +105 -0
- package/ios/RNFBDatabase/RNFBDatabaseQueue.h +29 -0
- package/ios/RNFBDatabase/RNFBDatabaseQueue.m +31 -0
- package/ios/RNFBDatabase/RNFBDatabaseReferenceHelper.h +59 -0
- package/ios/RNFBDatabase/{RNFBDatabaseReferenceModule.m → RNFBDatabaseReferenceHelper.m} +42 -48
- package/ios/RNFBDatabase/RNFBDatabaseReferenceModule.mm +125 -0
- package/ios/RNFBDatabase/RNFBDatabaseTransactionHelper.h +38 -0
- package/ios/RNFBDatabase/{RNFBDatabaseTransactionModule.m → RNFBDatabaseTransactionHelper.m} +52 -51
- package/ios/RNFBDatabase/RNFBDatabaseTransactionModule.h +0 -1
- package/ios/RNFBDatabase/RNFBDatabaseTransactionModule.mm +86 -0
- package/ios/RNFBDatabase.xcodeproj/project.pbxproj +24 -24
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/ios/generated/RNFBDatabaseTurboModules/RNFBDatabaseTurboModules-generated.mm +254 -0
- package/ios/generated/RNFBDatabaseTurboModules/RNFBDatabaseTurboModules.h +264 -0
- package/ios/generated/RNFBDatabaseTurboModulesJSI-generated.cpp +257 -0
- package/ios/generated/RNFBDatabaseTurboModulesJSI.h +440 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/DatabaseDataSnapshot.ts +43 -38
- package/lib/DatabaseOnDisconnect.ts +3 -3
- package/lib/DatabaseQuery.ts +45 -77
- package/lib/DatabaseReference.ts +37 -66
- package/lib/DatabaseSyncTree.ts +8 -11
- package/lib/DatabaseThenableReference.ts +9 -17
- package/lib/index.ts +325 -6
- package/lib/modular/query.ts +14 -70
- package/lib/modular/transaction.ts +1 -4
- package/lib/types/database.ts +5 -5
- package/lib/types/internal.ts +31 -56
- package/lib/version.ts +1 -1
- package/lib/web/RNFBDatabaseModule.ts +6 -10
- package/package.json +26 -4
- package/react-native.config.js +10 -0
- package/specs/NativeRNFBTurboDatabase.ts +13 -0
- package/specs/NativeRNFBTurboDatabaseOnDisconnect.ts +18 -0
- package/specs/NativeRNFBTurboDatabaseQuery.ts +25 -0
- package/specs/NativeRNFBTurboDatabaseReference.ts +13 -0
- package/specs/NativeRNFBTurboDatabaseTransaction.ts +16 -0
- package/typedoc.json +1 -1
- package/dist/module/modular.js +0 -76
- package/dist/module/modular.js.map +0 -1
- package/dist/module/namespaced.js +0 -147
- package/dist/module/namespaced.js.map +0 -1
- package/dist/module/types/namespaced.js +0 -67
- package/dist/module/types/namespaced.js.map +0 -1
- package/dist/typescript/lib/modular.d.ts +0 -24
- package/dist/typescript/lib/modular.d.ts.map +0 -1
- package/dist/typescript/lib/namespaced.d.ts +0 -13
- package/dist/typescript/lib/namespaced.d.ts.map +0 -1
- package/dist/typescript/lib/types/namespaced.d.ts +0 -1230
- package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
- package/ios/RNFBDatabase/RNFBDatabaseModule.m +0 -100
- package/lib/modular.ts +0 -134
- package/lib/namespaced.ts +0 -253
- package/lib/types/namespaced.ts +0 -1366
|
@@ -0,0 +1,105 @@
|
|
|
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 <React/RCTUtils.h>
|
|
19
|
+
|
|
20
|
+
#import "RNFBDatabaseQueryHelper.h"
|
|
21
|
+
#import "RNFBDatabaseQueryModule.h"
|
|
22
|
+
#import "RNFBDatabaseQueue.h"
|
|
23
|
+
#import "RNFBDatabaseTurboModules.h"
|
|
24
|
+
|
|
25
|
+
// NOTE: This module deliberately never imports Firebase Database headers.
|
|
26
|
+
// See RNFBDatabaseModule.mm for rationale. All Firebase Database calls and
|
|
27
|
+
// query/listener bookkeeping live in the plain Objective-C
|
|
28
|
+
// `RNFBDatabaseQueryHelper`.
|
|
29
|
+
|
|
30
|
+
@interface RNFBDatabaseQueryModule () <NativeRNFBTurboDatabaseQuerySpec, RCTBridgeModule>
|
|
31
|
+
@end
|
|
32
|
+
|
|
33
|
+
@implementation RNFBDatabaseQueryModule
|
|
34
|
+
#pragma mark -
|
|
35
|
+
#pragma mark Module Setup
|
|
36
|
+
|
|
37
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
38
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
39
|
+
return std::make_shared<facebook::react::NativeRNFBTurboDatabaseQuerySpecJSI>(params);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
RCT_EXPORT_MODULE(NativeRNFBTurboDatabaseQuery);
|
|
43
|
+
|
|
44
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
45
|
+
return NO;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (dispatch_queue_t)methodQueue {
|
|
49
|
+
return [RNFBDatabaseQueue getDispatchQueue];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (void)dealloc {
|
|
53
|
+
[self invalidate];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (void)invalidate {
|
|
57
|
+
[RNFBDatabaseQueryHelper invalidate];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#pragma mark -
|
|
61
|
+
#pragma mark Firebase Database
|
|
62
|
+
|
|
63
|
+
- (void)once:(NSString *)app
|
|
64
|
+
dbURL:(NSString *)dbURL
|
|
65
|
+
path:(NSString *)path
|
|
66
|
+
modifiers:(NSArray *)modifiers
|
|
67
|
+
eventType:(NSString *)eventType
|
|
68
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
69
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
70
|
+
[RNFBDatabaseQueryHelper once:app
|
|
71
|
+
dbURL:dbURL
|
|
72
|
+
path:path
|
|
73
|
+
modifiers:modifiers
|
|
74
|
+
eventType:eventType
|
|
75
|
+
resolve:resolve
|
|
76
|
+
reject:reject];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
- (void)on:(NSString *)app dbURL:(NSString *)dbURL props:(NSDictionary *)props {
|
|
80
|
+
[RNFBDatabaseQueryHelper on:app dbURL:dbURL props:props];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
- (void)off:(NSString *)queryKey eventRegistrationKey:(NSString *)eventRegistrationKey {
|
|
84
|
+
[RNFBDatabaseQueryHelper off:queryKey eventRegistrationKey:eventRegistrationKey];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
- (void)keepSynced:(NSString *)app
|
|
88
|
+
dbURL:(NSString *)dbURL
|
|
89
|
+
key:(NSString *)key
|
|
90
|
+
path:(NSString *)path
|
|
91
|
+
modifiers:(NSArray *)modifiers
|
|
92
|
+
enabled:(BOOL)value
|
|
93
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
94
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
95
|
+
[RNFBDatabaseQueryHelper keepSynced:app
|
|
96
|
+
dbURL:dbURL
|
|
97
|
+
key:key
|
|
98
|
+
path:path
|
|
99
|
+
modifiers:modifiers
|
|
100
|
+
enabled:value
|
|
101
|
+
resolve:resolve
|
|
102
|
+
reject:reject];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@end
|
|
@@ -0,0 +1,29 @@
|
|
|
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: this header is imported by Objective-C++ (.mm)
|
|
21
|
+
// modules that must not pull in any Firebase Database headers directly (see
|
|
22
|
+
// RNFBDatabaseCommon.h for why). Keeping it isolated means the shared serial
|
|
23
|
+
// queue used as `methodQueue` can be obtained without ever importing
|
|
24
|
+
// Firebase from a .mm translation unit.
|
|
25
|
+
@interface RNFBDatabaseQueue : NSObject
|
|
26
|
+
|
|
27
|
+
+ (dispatch_queue_t)getDispatchQueue;
|
|
28
|
+
|
|
29
|
+
@end
|
|
@@ -0,0 +1,31 @@
|
|
|
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 "RNFBDatabaseQueue.h"
|
|
19
|
+
|
|
20
|
+
@implementation RNFBDatabaseQueue
|
|
21
|
+
|
|
22
|
+
+ (dispatch_queue_t)getDispatchQueue {
|
|
23
|
+
static dispatch_once_t once;
|
|
24
|
+
static dispatch_queue_t sharedInstance;
|
|
25
|
+
dispatch_once(&once, ^{
|
|
26
|
+
sharedInstance = dispatch_queue_create("io.invertase.firebase.database", DISPATCH_QUEUE_SERIAL);
|
|
27
|
+
});
|
|
28
|
+
return sharedInstance;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@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 `FIRDatabaseReference` calls for RNFBDatabaseReferenceModule.
|
|
23
|
+
@interface RNFBDatabaseReferenceHelper : NSObject
|
|
24
|
+
|
|
25
|
+
+ (void)set:(NSString *)app
|
|
26
|
+
dbURL:(NSString *)dbURL
|
|
27
|
+
path:(NSString *)path
|
|
28
|
+
props:(NSDictionary *)props
|
|
29
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
30
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
31
|
+
|
|
32
|
+
+ (void)update:(NSString *)app
|
|
33
|
+
dbURL:(NSString *)dbURL
|
|
34
|
+
path:(NSString *)path
|
|
35
|
+
props:(NSDictionary *)props
|
|
36
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
37
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
38
|
+
|
|
39
|
+
+ (void)setWithPriority:(NSString *)app
|
|
40
|
+
dbURL:(NSString *)dbURL
|
|
41
|
+
path:(NSString *)path
|
|
42
|
+
props:(NSDictionary *)props
|
|
43
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
44
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
45
|
+
|
|
46
|
+
+ (void)remove:(NSString *)app
|
|
47
|
+
dbURL:(NSString *)dbURL
|
|
48
|
+
path:(NSString *)path
|
|
49
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
50
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
51
|
+
|
|
52
|
+
+ (void)setPriority:(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
|
|
@@ -15,32 +15,26 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
#if __has_include(<Firebase/Firebase.h>)
|
|
18
19
|
#import <Firebase/Firebase.h>
|
|
19
|
-
#
|
|
20
|
+
#else
|
|
21
|
+
@import FirebaseCore;
|
|
22
|
+
@import FirebaseDatabaseInternal;
|
|
23
|
+
#endif
|
|
20
24
|
|
|
25
|
+
#import "RNFBApp/RCTConvert+FIRApp.h"
|
|
21
26
|
#import "RNFBDatabaseCommon.h"
|
|
22
|
-
#import "
|
|
27
|
+
#import "RNFBDatabaseReferenceHelper.h"
|
|
23
28
|
|
|
24
|
-
@implementation
|
|
25
|
-
#pragma mark -
|
|
26
|
-
#pragma mark Module Setup
|
|
29
|
+
@implementation RNFBDatabaseReferenceHelper
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
#pragma mark Firebase Database
|
|
36
|
-
|
|
37
|
-
RCT_EXPORT_METHOD(set
|
|
38
|
-
: (FIRApp *)firebaseApp
|
|
39
|
-
: (NSString *)dbURL
|
|
40
|
-
: (NSString *)path
|
|
41
|
-
: (NSDictionary *)props
|
|
42
|
-
: (RCTPromiseResolveBlock)resolve
|
|
43
|
-
: (RCTPromiseRejectBlock)reject) {
|
|
31
|
+
+ (void)set:(NSString *)app
|
|
32
|
+
dbURL:(NSString *)dbURL
|
|
33
|
+
path:(NSString *)path
|
|
34
|
+
props:(NSDictionary *)props
|
|
35
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
36
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
37
|
+
FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
|
|
44
38
|
FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
|
|
45
39
|
FIRDatabaseReference *firDatabaseReference =
|
|
46
40
|
[RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
|
|
@@ -55,13 +49,13 @@ RCT_EXPORT_METHOD(set
|
|
|
55
49
|
}];
|
|
56
50
|
}
|
|
57
51
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
+ (void)update:(NSString *)app
|
|
53
|
+
dbURL:(NSString *)dbURL
|
|
54
|
+
path:(NSString *)path
|
|
55
|
+
props:(NSDictionary *)props
|
|
56
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
57
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
58
|
+
FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
|
|
65
59
|
FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
|
|
66
60
|
FIRDatabaseReference *firDatabaseReference =
|
|
67
61
|
[RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
|
|
@@ -76,13 +70,13 @@ RCT_EXPORT_METHOD(update
|
|
|
76
70
|
}];
|
|
77
71
|
}
|
|
78
72
|
|
|
79
|
-
|
|
80
|
-
:
|
|
81
|
-
|
|
82
|
-
:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
+ (void)setWithPriority:(NSString *)app
|
|
74
|
+
dbURL:(NSString *)dbURL
|
|
75
|
+
path:(NSString *)path
|
|
76
|
+
props:(NSDictionary *)props
|
|
77
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
78
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
79
|
+
FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
|
|
86
80
|
FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
|
|
87
81
|
FIRDatabaseReference *firDatabaseReference =
|
|
88
82
|
[RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
|
|
@@ -98,12 +92,12 @@ RCT_EXPORT_METHOD(setWithPriority
|
|
|
98
92
|
}];
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
+ (void)remove:(NSString *)app
|
|
96
|
+
dbURL:(NSString *)dbURL
|
|
97
|
+
path:(NSString *)path
|
|
98
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
99
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
100
|
+
FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
|
|
107
101
|
FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
|
|
108
102
|
FIRDatabaseReference *firDatabaseReference =
|
|
109
103
|
[RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
|
|
@@ -118,13 +112,13 @@ RCT_EXPORT_METHOD(remove
|
|
|
118
112
|
}];
|
|
119
113
|
}
|
|
120
114
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
115
|
+
+ (void)setPriority:(NSString *)app
|
|
116
|
+
dbURL:(NSString *)dbURL
|
|
117
|
+
path:(NSString *)path
|
|
118
|
+
props:(NSDictionary *)props
|
|
119
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
120
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
121
|
+
FIRApp *firebaseApp = [RCTConvert firAppFromString:app];
|
|
128
122
|
FIRDatabase *firDatabase = [RNFBDatabaseCommon getDatabaseForApp:firebaseApp dbURL:dbURL];
|
|
129
123
|
FIRDatabaseReference *firDatabaseReference =
|
|
130
124
|
[RNFBDatabaseCommon getReferenceForDatabase:firDatabase path:path];
|
|
@@ -0,0 +1,125 @@
|
|
|
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 <React/RCTUtils.h>
|
|
19
|
+
|
|
20
|
+
#import "RNFBDatabaseQueue.h"
|
|
21
|
+
#import "RNFBDatabaseReferenceHelper.h"
|
|
22
|
+
#import "RNFBDatabaseReferenceModule.h"
|
|
23
|
+
#import "RNFBDatabaseTurboModules.h"
|
|
24
|
+
|
|
25
|
+
// NOTE: This module deliberately never imports Firebase Database headers.
|
|
26
|
+
// See RNFBDatabaseModule.mm for rationale. All Firebase Database calls are
|
|
27
|
+
// delegated to the plain Objective-C `RNFBDatabaseReferenceHelper`.
|
|
28
|
+
|
|
29
|
+
@interface RNFBDatabaseReferenceModule () <NativeRNFBTurboDatabaseReferenceSpec, RCTBridgeModule>
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
@implementation RNFBDatabaseReferenceModule
|
|
33
|
+
#pragma mark -
|
|
34
|
+
#pragma mark Module Setup
|
|
35
|
+
|
|
36
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
37
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
38
|
+
return std::make_shared<facebook::react::NativeRNFBTurboDatabaseReferenceSpecJSI>(params);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
RCT_EXPORT_MODULE(NativeRNFBTurboDatabaseReference);
|
|
42
|
+
|
|
43
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
44
|
+
return NO;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (dispatch_queue_t)methodQueue {
|
|
48
|
+
return [RNFBDatabaseQueue getDispatchQueue];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (void)dealloc {
|
|
52
|
+
[self invalidate];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (void)invalidate {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#pragma mark -
|
|
59
|
+
#pragma mark Firebase Database
|
|
60
|
+
|
|
61
|
+
- (void)set:(NSString *)app
|
|
62
|
+
dbURL:(NSString *)dbURL
|
|
63
|
+
path:(NSString *)path
|
|
64
|
+
props:(NSDictionary *)props
|
|
65
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
66
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
67
|
+
[RNFBDatabaseReferenceHelper set:app
|
|
68
|
+
dbURL:dbURL
|
|
69
|
+
path:path
|
|
70
|
+
props:props
|
|
71
|
+
resolve:resolve
|
|
72
|
+
reject:reject];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
- (void)update:(NSString *)app
|
|
76
|
+
dbURL:(NSString *)dbURL
|
|
77
|
+
path:(NSString *)path
|
|
78
|
+
props:(NSDictionary *)props
|
|
79
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
80
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
81
|
+
[RNFBDatabaseReferenceHelper update:app
|
|
82
|
+
dbURL:dbURL
|
|
83
|
+
path:path
|
|
84
|
+
props:props
|
|
85
|
+
resolve:resolve
|
|
86
|
+
reject:reject];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
- (void)setWithPriority:(NSString *)app
|
|
90
|
+
dbURL:(NSString *)dbURL
|
|
91
|
+
path:(NSString *)path
|
|
92
|
+
props:(NSDictionary *)props
|
|
93
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
94
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
95
|
+
[RNFBDatabaseReferenceHelper setWithPriority:app
|
|
96
|
+
dbURL:dbURL
|
|
97
|
+
path:path
|
|
98
|
+
props:props
|
|
99
|
+
resolve:resolve
|
|
100
|
+
reject:reject];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
- (void)remove:(NSString *)app
|
|
104
|
+
dbURL:(NSString *)dbURL
|
|
105
|
+
path:(NSString *)path
|
|
106
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
107
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
108
|
+
[RNFBDatabaseReferenceHelper remove:app dbURL:dbURL path:path resolve:resolve reject:reject];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
- (void)setPriority:(NSString *)app
|
|
112
|
+
dbURL:(NSString *)dbURL
|
|
113
|
+
path:(NSString *)path
|
|
114
|
+
props:(NSDictionary *)props
|
|
115
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
116
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
117
|
+
[RNFBDatabaseReferenceHelper setPriority:app
|
|
118
|
+
dbURL:dbURL
|
|
119
|
+
path:path
|
|
120
|
+
props:props
|
|
121
|
+
resolve:resolve
|
|
122
|
+
reject:reject];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@end
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
// See RNFBDatabaseModuleHelper.h for rationale: plain Objective-C helper
|
|
21
|
+
// that owns all `FIRDatabaseReference`/`FIRTransactionResult` calls and the
|
|
22
|
+
// pending-transaction bookkeeping for RNFBDatabaseTransactionModule.
|
|
23
|
+
@interface RNFBDatabaseTransactionHelper : NSObject
|
|
24
|
+
|
|
25
|
+
+ (void)transactionStart:(NSString *)app
|
|
26
|
+
dbURL:(NSString *)dbURL
|
|
27
|
+
path:(NSString *)path
|
|
28
|
+
transactionId:(double)transactionId
|
|
29
|
+
applyLocally:(BOOL)applyLocally;
|
|
30
|
+
|
|
31
|
+
+ (void)transactionTryCommit:(NSString *)app
|
|
32
|
+
dbURL:(NSString *)dbURL
|
|
33
|
+
transactionId:(double)transactionId
|
|
34
|
+
updates:(NSDictionary *)updates;
|
|
35
|
+
|
|
36
|
+
+ (void)invalidate;
|
|
37
|
+
|
|
38
|
+
@end
|