@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
|
@@ -21,6 +21,8 @@ import static io.invertase.firebase.common.RCTConvertFirebase.readableMapToWrita
|
|
|
21
21
|
import static io.invertase.firebase.database.ReactNativeFirebaseDatabaseCommon.*;
|
|
22
22
|
import static io.invertase.firebase.database.UniversalFirebaseDatabaseCommon.getDatabaseForApp;
|
|
23
23
|
|
|
24
|
+
import androidx.annotation.CallSuper;
|
|
25
|
+
import com.facebook.fbreact.specs.NativeRNFBTurboDatabaseQuerySpec;
|
|
24
26
|
import com.facebook.react.bridge.*;
|
|
25
27
|
import com.google.android.gms.tasks.Tasks;
|
|
26
28
|
import com.google.firebase.database.*;
|
|
@@ -33,15 +35,17 @@ import java.util.Objects;
|
|
|
33
35
|
import javax.annotation.Nonnull;
|
|
34
36
|
import javax.annotation.Nullable;
|
|
35
37
|
|
|
36
|
-
public class
|
|
37
|
-
private
|
|
38
|
+
public class NativeRNFBTurboDatabaseQuery extends NativeRNFBTurboDatabaseQuerySpec {
|
|
39
|
+
private final DatabaseTurboModuleSupport turboSupport =
|
|
40
|
+
new DatabaseTurboModuleSupport("RNFBDatabaseQuery");
|
|
38
41
|
private HashMap<String, ReactNativeFirebaseDatabaseQuery> queryMap = new HashMap<>();
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
super(reactContext
|
|
43
|
+
public NativeRNFBTurboDatabaseQuery(ReactApplicationContext reactContext) {
|
|
44
|
+
super(reactContext);
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
@Override
|
|
48
|
+
@CallSuper
|
|
45
49
|
public void invalidate() {
|
|
46
50
|
Iterator refIterator = queryMap.entrySet().iterator();
|
|
47
51
|
while (refIterator.hasNext()) {
|
|
@@ -49,31 +53,18 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
49
53
|
ReactNativeFirebaseDatabaseQuery databaseQuery =
|
|
50
54
|
(ReactNativeFirebaseDatabaseQuery) pair.getValue();
|
|
51
55
|
databaseQuery.removeAllEventListeners();
|
|
52
|
-
refIterator.remove();
|
|
56
|
+
refIterator.remove();
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
turboSupport.invalidate();
|
|
55
60
|
super.invalidate();
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
/**
|
|
59
|
-
* Returns an uncached ReactNativeFirebaseDatabaseQuery instance, used when no cleanup is needed
|
|
60
|
-
* (e.g. once).
|
|
61
|
-
*
|
|
62
|
-
* @param reference
|
|
63
|
-
* @param modifiers
|
|
64
|
-
*/
|
|
65
63
|
private ReactNativeFirebaseDatabaseQuery getDatabaseQueryInstance(
|
|
66
64
|
DatabaseReference reference, ReadableArray modifiers) {
|
|
67
65
|
return new ReactNativeFirebaseDatabaseQuery(reference, modifiers);
|
|
68
66
|
}
|
|
69
67
|
|
|
70
|
-
/**
|
|
71
|
-
* Caches a ReactNativeFirebaseDatabaseQuery instance from the query key and caches it for later
|
|
72
|
-
* use (e.g. on/off)
|
|
73
|
-
*
|
|
74
|
-
* @param reference
|
|
75
|
-
* @param modifiers
|
|
76
|
-
*/
|
|
77
68
|
private ReactNativeFirebaseDatabaseQuery getDatabaseQueryInstance(
|
|
78
69
|
String key, DatabaseReference reference, ReadableArray modifiers) {
|
|
79
70
|
ReactNativeFirebaseDatabaseQuery cachedDatabaseQuery = queryMap.get(key);
|
|
@@ -89,12 +80,6 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
89
80
|
return databaseQuery;
|
|
90
81
|
}
|
|
91
82
|
|
|
92
|
-
/**
|
|
93
|
-
* ref().once('value')
|
|
94
|
-
*
|
|
95
|
-
* @param databaseQuery
|
|
96
|
-
* @param promise
|
|
97
|
-
*/
|
|
98
83
|
private void addOnceValueEventListener(
|
|
99
84
|
ReactNativeFirebaseDatabaseQuery databaseQuery, Promise promise) {
|
|
100
85
|
ValueEventListener onceValueEventListener =
|
|
@@ -102,17 +87,18 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
102
87
|
@Override
|
|
103
88
|
public void onDataChange(@Nonnull DataSnapshot dataSnapshot) {
|
|
104
89
|
try {
|
|
105
|
-
Tasks.call(getExecutor(), () -> snapshotToMap(dataSnapshot))
|
|
90
|
+
Tasks.call(turboSupport.getExecutor(), () -> snapshotToMap(dataSnapshot))
|
|
106
91
|
.addOnCompleteListener(
|
|
107
92
|
task -> {
|
|
108
93
|
if (task.isSuccessful()) {
|
|
109
94
|
promise.resolve(task.getResult());
|
|
110
95
|
} else {
|
|
111
|
-
rejectPromiseWithExceptionMap(
|
|
96
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(
|
|
97
|
+
promise, task.getException());
|
|
112
98
|
}
|
|
113
99
|
});
|
|
114
100
|
} catch (java.util.concurrent.RejectedExecutionException e) {
|
|
115
|
-
rejectPromiseWithExceptionMap(promise, e);
|
|
101
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(promise, e);
|
|
116
102
|
}
|
|
117
103
|
}
|
|
118
104
|
|
|
@@ -128,13 +114,6 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
128
114
|
databaseQuery.addSingleValueEventListener(onceValueEventListener);
|
|
129
115
|
}
|
|
130
116
|
|
|
131
|
-
/**
|
|
132
|
-
* ref().once('child_*') handler
|
|
133
|
-
*
|
|
134
|
-
* @param eventType
|
|
135
|
-
* @param databaseQuery
|
|
136
|
-
* @param promise
|
|
137
|
-
*/
|
|
138
117
|
private void addChildOnceEventListener(
|
|
139
118
|
String eventType, ReactNativeFirebaseDatabaseQuery databaseQuery, Promise promise) {
|
|
140
119
|
ChildEventListener childEventListener =
|
|
@@ -145,18 +124,19 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
145
124
|
databaseQuery.removeEventListener(this);
|
|
146
125
|
try {
|
|
147
126
|
Tasks.call(
|
|
148
|
-
getExecutor(),
|
|
127
|
+
turboSupport.getExecutor(),
|
|
149
128
|
() -> snapshotWithPreviousChildToMap(dataSnapshot, previousChildName))
|
|
150
129
|
.addOnCompleteListener(
|
|
151
130
|
task -> {
|
|
152
131
|
if (task.isSuccessful()) {
|
|
153
132
|
promise.resolve(task.getResult());
|
|
154
133
|
} else {
|
|
155
|
-
rejectPromiseWithExceptionMap(
|
|
134
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(
|
|
135
|
+
promise, task.getException());
|
|
156
136
|
}
|
|
157
137
|
});
|
|
158
138
|
} catch (java.util.concurrent.RejectedExecutionException e) {
|
|
159
|
-
rejectPromiseWithExceptionMap(promise, e);
|
|
139
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(promise, e);
|
|
160
140
|
}
|
|
161
141
|
}
|
|
162
142
|
}
|
|
@@ -167,18 +147,19 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
167
147
|
databaseQuery.removeEventListener(this);
|
|
168
148
|
try {
|
|
169
149
|
Tasks.call(
|
|
170
|
-
getExecutor(),
|
|
150
|
+
turboSupport.getExecutor(),
|
|
171
151
|
() -> snapshotWithPreviousChildToMap(dataSnapshot, previousChildName))
|
|
172
152
|
.addOnCompleteListener(
|
|
173
153
|
task -> {
|
|
174
154
|
if (task.isSuccessful()) {
|
|
175
155
|
promise.resolve(task.getResult());
|
|
176
156
|
} else {
|
|
177
|
-
rejectPromiseWithExceptionMap(
|
|
157
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(
|
|
158
|
+
promise, task.getException());
|
|
178
159
|
}
|
|
179
160
|
});
|
|
180
161
|
} catch (java.util.concurrent.RejectedExecutionException e) {
|
|
181
|
-
rejectPromiseWithExceptionMap(promise, e);
|
|
162
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(promise, e);
|
|
182
163
|
}
|
|
183
164
|
}
|
|
184
165
|
}
|
|
@@ -188,17 +169,20 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
188
169
|
if ("child_removed".equals(eventType)) {
|
|
189
170
|
databaseQuery.removeEventListener(this);
|
|
190
171
|
try {
|
|
191
|
-
Tasks.call(
|
|
172
|
+
Tasks.call(
|
|
173
|
+
turboSupport.getExecutor(),
|
|
174
|
+
() -> snapshotWithPreviousChildToMap(dataSnapshot, null))
|
|
192
175
|
.addOnCompleteListener(
|
|
193
176
|
task -> {
|
|
194
177
|
if (task.isSuccessful()) {
|
|
195
178
|
promise.resolve(task.getResult());
|
|
196
179
|
} else {
|
|
197
|
-
rejectPromiseWithExceptionMap(
|
|
180
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(
|
|
181
|
+
promise, task.getException());
|
|
198
182
|
}
|
|
199
183
|
});
|
|
200
184
|
} catch (java.util.concurrent.RejectedExecutionException e) {
|
|
201
|
-
rejectPromiseWithExceptionMap(promise, e);
|
|
185
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(promise, e);
|
|
202
186
|
}
|
|
203
187
|
}
|
|
204
188
|
}
|
|
@@ -209,18 +193,19 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
209
193
|
databaseQuery.removeEventListener(this);
|
|
210
194
|
try {
|
|
211
195
|
Tasks.call(
|
|
212
|
-
getExecutor(),
|
|
196
|
+
turboSupport.getExecutor(),
|
|
213
197
|
() -> snapshotWithPreviousChildToMap(dataSnapshot, previousChildName))
|
|
214
198
|
.addOnCompleteListener(
|
|
215
199
|
task -> {
|
|
216
200
|
if (task.isSuccessful()) {
|
|
217
201
|
promise.resolve(task.getResult());
|
|
218
202
|
} else {
|
|
219
|
-
rejectPromiseWithExceptionMap(
|
|
203
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(
|
|
204
|
+
promise, task.getException());
|
|
220
205
|
}
|
|
221
206
|
});
|
|
222
207
|
} catch (java.util.concurrent.RejectedExecutionException e) {
|
|
223
|
-
rejectPromiseWithExceptionMap(promise, e);
|
|
208
|
+
ReactNativeFirebaseModule.rejectPromiseWithExceptionMap(promise, e);
|
|
224
209
|
}
|
|
225
210
|
}
|
|
226
211
|
}
|
|
@@ -238,13 +223,6 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
238
223
|
databaseQuery.addSingleChildEventListener(childEventListener);
|
|
239
224
|
}
|
|
240
225
|
|
|
241
|
-
/**
|
|
242
|
-
* ref().on('value') handler
|
|
243
|
-
*
|
|
244
|
-
* @param key
|
|
245
|
-
* @param databaseQuery
|
|
246
|
-
* @param registration
|
|
247
|
-
*/
|
|
248
226
|
private void addValueEventListener(
|
|
249
227
|
String key, ReactNativeFirebaseDatabaseQuery databaseQuery, ReadableMap registration) {
|
|
250
228
|
final String eventRegistrationKey = registration.getString("eventRegistrationKey");
|
|
@@ -321,13 +299,6 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
321
299
|
}
|
|
322
300
|
}
|
|
323
301
|
|
|
324
|
-
/**
|
|
325
|
-
* Handles value/child update events.
|
|
326
|
-
*
|
|
327
|
-
* @param eventType
|
|
328
|
-
* @param dataSnapshot
|
|
329
|
-
* @param previousChildName
|
|
330
|
-
*/
|
|
331
302
|
private void handleDatabaseEvent(
|
|
332
303
|
final String key,
|
|
333
304
|
final String eventType,
|
|
@@ -337,7 +308,7 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
337
308
|
final String eventRegistrationKey = registration.getString("eventRegistrationKey");
|
|
338
309
|
try {
|
|
339
310
|
Tasks.call(
|
|
340
|
-
getTransactionalExecutor(eventRegistrationKey),
|
|
311
|
+
turboSupport.getTransactionalExecutor(eventRegistrationKey),
|
|
341
312
|
() -> {
|
|
342
313
|
if (eventType.equals("value")) {
|
|
343
314
|
return snapshotToMap(dataSnapshot);
|
|
@@ -346,7 +317,7 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
346
317
|
}
|
|
347
318
|
})
|
|
348
319
|
.addOnCompleteListener(
|
|
349
|
-
getExecutor(),
|
|
320
|
+
turboSupport.getExecutor(),
|
|
350
321
|
task -> {
|
|
351
322
|
if (task.isSuccessful()) {
|
|
352
323
|
WritableMap data = task.getResult();
|
|
@@ -366,16 +337,9 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
366
337
|
});
|
|
367
338
|
} catch (java.util.concurrent.RejectedExecutionException e) {
|
|
368
339
|
// Event arrived after module invalidation shut down an executor.
|
|
369
|
-
// Safe to drop when tearing down; no JS listener will consume the event.
|
|
370
340
|
}
|
|
371
341
|
}
|
|
372
342
|
|
|
373
|
-
/**
|
|
374
|
-
* Handles a database listener cancellation error.
|
|
375
|
-
*
|
|
376
|
-
* @param registration
|
|
377
|
-
* @param error
|
|
378
|
-
*/
|
|
379
343
|
private void handleDatabaseEventError(String key, ReadableMap registration, DatabaseError error) {
|
|
380
344
|
WritableMap event = Arguments.createMap();
|
|
381
345
|
UniversalDatabaseException databaseException =
|
|
@@ -395,17 +359,7 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
395
359
|
new ReactNativeFirebaseDatabaseEvent(ReactNativeFirebaseDatabaseEvent.EVENT_SYNC, event));
|
|
396
360
|
}
|
|
397
361
|
|
|
398
|
-
|
|
399
|
-
* ref().once('*')
|
|
400
|
-
*
|
|
401
|
-
* @param app
|
|
402
|
-
* @param dbURL
|
|
403
|
-
* @param path
|
|
404
|
-
* @param modifiers
|
|
405
|
-
* @param eventType
|
|
406
|
-
* @param promise
|
|
407
|
-
*/
|
|
408
|
-
@ReactMethod
|
|
362
|
+
@Override
|
|
409
363
|
public void once(
|
|
410
364
|
String app,
|
|
411
365
|
String dbURL,
|
|
@@ -422,14 +376,7 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
422
376
|
}
|
|
423
377
|
}
|
|
424
378
|
|
|
425
|
-
|
|
426
|
-
* ref().on('*')
|
|
427
|
-
*
|
|
428
|
-
* @param app
|
|
429
|
-
* @param dbURL
|
|
430
|
-
* @param props
|
|
431
|
-
*/
|
|
432
|
-
@ReactMethod
|
|
379
|
+
@Override
|
|
433
380
|
public void on(String app, String dbURL, ReadableMap props) {
|
|
434
381
|
String key = props.getString("key");
|
|
435
382
|
ReadableArray modifiers = props.getArray("modifiers");
|
|
@@ -447,14 +394,13 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
447
394
|
}
|
|
448
395
|
}
|
|
449
396
|
|
|
450
|
-
|
|
451
|
-
@ReactMethod
|
|
397
|
+
@Override
|
|
452
398
|
public void off(String queryKey, String eventRegistrationKey) {
|
|
453
399
|
ReactNativeFirebaseDatabaseQuery databaseQuery = queryMap.get(queryKey);
|
|
454
400
|
|
|
455
401
|
if (databaseQuery != null) {
|
|
456
402
|
databaseQuery.removeEventListener(eventRegistrationKey);
|
|
457
|
-
removeEventListeningExecutor(eventRegistrationKey);
|
|
403
|
+
turboSupport.removeEventListeningExecutor(eventRegistrationKey);
|
|
458
404
|
|
|
459
405
|
if (!databaseQuery.hasListeners()) {
|
|
460
406
|
queryMap.remove(queryKey);
|
|
@@ -462,27 +408,17 @@ public class ReactNativeFirebaseDatabaseQueryModule extends ReactNativeFirebaseM
|
|
|
462
408
|
}
|
|
463
409
|
}
|
|
464
410
|
|
|
465
|
-
|
|
466
|
-
* ref().keepSynced('*')
|
|
467
|
-
*
|
|
468
|
-
* @param app
|
|
469
|
-
* @param dbURL
|
|
470
|
-
* @param path
|
|
471
|
-
* @param modifiers
|
|
472
|
-
* @param bool
|
|
473
|
-
* @param promise
|
|
474
|
-
*/
|
|
475
|
-
@ReactMethod
|
|
411
|
+
@Override
|
|
476
412
|
public void keepSynced(
|
|
477
413
|
String app,
|
|
478
414
|
String dbURL,
|
|
479
415
|
String key,
|
|
480
416
|
String path,
|
|
481
417
|
ReadableArray modifiers,
|
|
482
|
-
|
|
418
|
+
boolean enabled,
|
|
483
419
|
Promise promise) {
|
|
484
420
|
DatabaseReference reference = getDatabaseForApp(app, dbURL).getReference(path);
|
|
485
|
-
getDatabaseQueryInstance(key, reference, modifiers).query.keepSynced(
|
|
421
|
+
getDatabaseQueryInstance(key, reference, modifiers).query.keepSynced(enabled);
|
|
486
422
|
promise.resolve(null);
|
|
487
423
|
}
|
|
488
424
|
}
|
|
@@ -20,29 +20,38 @@ package io.invertase.firebase.database;
|
|
|
20
20
|
import static io.invertase.firebase.common.RCTConvertFirebase.toHashMap;
|
|
21
21
|
import static io.invertase.firebase.database.ReactNativeFirebaseDatabaseCommon.rejectPromiseDatabaseException;
|
|
22
22
|
|
|
23
|
+
import androidx.annotation.CallSuper;
|
|
24
|
+
import com.facebook.fbreact.specs.NativeRNFBTurboDatabaseReferenceSpec;
|
|
23
25
|
import com.facebook.react.bridge.Promise;
|
|
24
26
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
25
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
26
27
|
import com.facebook.react.bridge.ReadableMap;
|
|
27
28
|
import com.google.android.gms.tasks.Tasks;
|
|
28
|
-
import io.invertase.firebase.common.ReactNativeFirebaseModule;
|
|
29
29
|
import java.util.Map;
|
|
30
30
|
|
|
31
|
-
public class
|
|
31
|
+
public class NativeRNFBTurboDatabaseReference extends NativeRNFBTurboDatabaseReferenceSpec {
|
|
32
32
|
private static final String SERVICE_NAME = "DatabaseReference";
|
|
33
33
|
private final UniversalFirebaseDatabaseReferenceModule module;
|
|
34
|
+
private final DatabaseTurboModuleSupport turboSupport =
|
|
35
|
+
new DatabaseTurboModuleSupport("RNFBDatabaseReference");
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
super(reactContext
|
|
37
|
+
public NativeRNFBTurboDatabaseReference(ReactApplicationContext reactContext) {
|
|
38
|
+
super(reactContext);
|
|
37
39
|
module = new UniversalFirebaseDatabaseReferenceModule(reactContext, SERVICE_NAME);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
@
|
|
42
|
+
@Override
|
|
43
|
+
@CallSuper
|
|
44
|
+
public void invalidate() {
|
|
45
|
+
turboSupport.invalidate();
|
|
46
|
+
super.invalidate();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Override
|
|
41
50
|
public void set(String app, String dbURL, String path, ReadableMap props, Promise promise) {
|
|
42
|
-
Tasks.call(getTransactionalExecutor(), () -> toHashMap(props).get("value"))
|
|
51
|
+
Tasks.call(turboSupport.getTransactionalExecutor(), () -> toHashMap(props).get("value"))
|
|
43
52
|
.onSuccessTask(aValue -> module.set(app, dbURL, path, aValue))
|
|
44
53
|
.addOnCompleteListener(
|
|
45
|
-
getTransactionalExecutor(),
|
|
54
|
+
turboSupport.getTransactionalExecutor(),
|
|
46
55
|
task -> {
|
|
47
56
|
if (task.isSuccessful()) {
|
|
48
57
|
promise.resolve(task.getResult());
|
|
@@ -53,12 +62,12 @@ public class ReactNativeFirebaseDatabaseReferenceModule extends ReactNativeFireb
|
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
@SuppressWarnings("unchecked")
|
|
56
|
-
@
|
|
65
|
+
@Override
|
|
57
66
|
public void update(String app, String dbURL, String path, ReadableMap props, Promise promise) {
|
|
58
|
-
Tasks.call(getTransactionalExecutor(), () -> toHashMap(props).get("values"))
|
|
67
|
+
Tasks.call(turboSupport.getTransactionalExecutor(), () -> toHashMap(props).get("values"))
|
|
59
68
|
.onSuccessTask(aMap -> module.update(app, dbURL, path, (Map<String, Object>) aMap))
|
|
60
69
|
.addOnCompleteListener(
|
|
61
|
-
getTransactionalExecutor(),
|
|
70
|
+
turboSupport.getTransactionalExecutor(),
|
|
62
71
|
task -> {
|
|
63
72
|
if (task.isSuccessful()) {
|
|
64
73
|
promise.resolve(task.getResult());
|
|
@@ -68,15 +77,15 @@ public class ReactNativeFirebaseDatabaseReferenceModule extends ReactNativeFireb
|
|
|
68
77
|
});
|
|
69
78
|
}
|
|
70
79
|
|
|
71
|
-
@
|
|
80
|
+
@Override
|
|
72
81
|
public void setWithPriority(
|
|
73
82
|
String app, String dbURL, String path, ReadableMap props, Promise promise) {
|
|
74
|
-
Tasks.call(getTransactionalExecutor(), () -> toHashMap(props))
|
|
83
|
+
Tasks.call(turboSupport.getTransactionalExecutor(), () -> toHashMap(props))
|
|
75
84
|
.onSuccessTask(
|
|
76
85
|
aMap ->
|
|
77
86
|
module.setWithPriority(app, dbURL, path, aMap.get("value"), aMap.get("priority")))
|
|
78
87
|
.addOnCompleteListener(
|
|
79
|
-
getTransactionalExecutor(),
|
|
88
|
+
turboSupport.getTransactionalExecutor(),
|
|
80
89
|
task -> {
|
|
81
90
|
if (task.isSuccessful()) {
|
|
82
91
|
promise.resolve(task.getResult());
|
|
@@ -86,13 +95,12 @@ public class ReactNativeFirebaseDatabaseReferenceModule extends ReactNativeFireb
|
|
|
86
95
|
});
|
|
87
96
|
}
|
|
88
97
|
|
|
89
|
-
@
|
|
98
|
+
@Override
|
|
90
99
|
public void remove(String app, String dbURL, String path, Promise promise) {
|
|
91
|
-
// continuation tasks not needed for this as no data
|
|
92
100
|
module
|
|
93
101
|
.remove(app, dbURL, path)
|
|
94
102
|
.addOnCompleteListener(
|
|
95
|
-
getTransactionalExecutor(),
|
|
103
|
+
turboSupport.getTransactionalExecutor(),
|
|
96
104
|
task -> {
|
|
97
105
|
if (task.isSuccessful()) {
|
|
98
106
|
promise.resolve(task.getResult());
|
|
@@ -102,14 +110,13 @@ public class ReactNativeFirebaseDatabaseReferenceModule extends ReactNativeFireb
|
|
|
102
110
|
});
|
|
103
111
|
}
|
|
104
112
|
|
|
105
|
-
@
|
|
113
|
+
@Override
|
|
106
114
|
public void setPriority(
|
|
107
115
|
String app, String dbURL, String path, ReadableMap props, Promise promise) {
|
|
108
|
-
// continuation tasks not needed for this as minimal data
|
|
109
116
|
module
|
|
110
117
|
.setPriority(app, dbURL, path, toHashMap(props).get("priority"))
|
|
111
118
|
.addOnCompleteListener(
|
|
112
|
-
getTransactionalExecutor(),
|
|
119
|
+
turboSupport.getTransactionalExecutor(),
|
|
113
120
|
task -> {
|
|
114
121
|
if (task.isSuccessful()) {
|
|
115
122
|
promise.resolve(task.getResult());
|
|
@@ -21,27 +21,44 @@ import static io.invertase.firebase.database.UniversalFirebaseDatabaseCommon.get
|
|
|
21
21
|
|
|
22
22
|
import android.os.AsyncTask;
|
|
23
23
|
import android.util.SparseArray;
|
|
24
|
+
import com.facebook.fbreact.specs.NativeRNFBTurboDatabaseTransactionSpec;
|
|
24
25
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
25
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
26
26
|
import com.facebook.react.bridge.ReadableMap;
|
|
27
27
|
import com.facebook.react.bridge.WritableMap;
|
|
28
28
|
import com.google.firebase.database.*;
|
|
29
29
|
import io.invertase.firebase.common.ReactNativeFirebaseEventEmitter;
|
|
30
|
-
import io.invertase.firebase.common.ReactNativeFirebaseModule;
|
|
31
30
|
import javax.annotation.Nonnull;
|
|
32
31
|
|
|
33
|
-
public class
|
|
32
|
+
public class NativeRNFBTurboDatabaseTransaction extends NativeRNFBTurboDatabaseTransactionSpec {
|
|
34
33
|
private static final String SERVICE_NAME = "DatabaseTransaction";
|
|
35
34
|
private static SparseArray<ReactNativeFirebaseDatabaseTransactionHandler> transactionHandlers =
|
|
36
35
|
new SparseArray<>();
|
|
36
|
+
private final DatabaseTurboModuleSupport turboSupport =
|
|
37
|
+
new DatabaseTurboModuleSupport("RNFBDatabaseTransaction");
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
super(reactContext
|
|
39
|
+
public NativeRNFBTurboDatabaseTransaction(ReactApplicationContext reactContext) {
|
|
40
|
+
super(reactContext);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
@
|
|
43
|
+
@Override
|
|
44
|
+
public void invalidate() {
|
|
45
|
+
for (int i = 0, size = transactionHandlers.size(); i < size; i++) {
|
|
46
|
+
int key = transactionHandlers.keyAt(i);
|
|
47
|
+
ReactNativeFirebaseDatabaseTransactionHandler transactionHandler =
|
|
48
|
+
transactionHandlers.get(key);
|
|
49
|
+
|
|
50
|
+
if (transactionHandler != null) {
|
|
51
|
+
transactionHandler.abort();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
transactionHandlers.clear();
|
|
56
|
+
turboSupport.invalidate();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
43
60
|
public void transactionStart(
|
|
44
|
-
String app, String dbURL, String path,
|
|
61
|
+
String app, String dbURL, String path, double transactionId, boolean applyLocally) {
|
|
45
62
|
AsyncTask.execute(
|
|
46
63
|
() -> {
|
|
47
64
|
DatabaseReference reference = getDatabaseForApp(app, dbURL).getReference(path);
|
|
@@ -52,12 +69,11 @@ public class ReactNativeFirebaseDatabaseTransactionModule extends ReactNativeFir
|
|
|
52
69
|
@Override
|
|
53
70
|
public Transaction.Result doTransaction(@Nonnull MutableData mutableData) {
|
|
54
71
|
final ReactNativeFirebaseDatabaseTransactionHandler transactionHandler =
|
|
55
|
-
new ReactNativeFirebaseDatabaseTransactionHandler(
|
|
56
|
-
|
|
72
|
+
new ReactNativeFirebaseDatabaseTransactionHandler(
|
|
73
|
+
(int) transactionId, app, dbURL);
|
|
74
|
+
transactionHandlers.put((int) transactionId, transactionHandler);
|
|
57
75
|
final WritableMap updatesMap = transactionHandler.createUpdateMap(mutableData);
|
|
58
76
|
|
|
59
|
-
// emit the updates to js using an async task
|
|
60
|
-
// otherwise it gets blocked by the lock await
|
|
61
77
|
AsyncTask.execute(
|
|
62
78
|
() -> {
|
|
63
79
|
ReactNativeFirebaseEventEmitter emitter =
|
|
@@ -68,10 +84,9 @@ public class ReactNativeFirebaseDatabaseTransactionModule extends ReactNativeFir
|
|
|
68
84
|
ReactNativeFirebaseTransactionEvent.EVENT_TRANSACTION,
|
|
69
85
|
updatesMap,
|
|
70
86
|
app,
|
|
71
|
-
transactionId));
|
|
87
|
+
(int) transactionId));
|
|
72
88
|
});
|
|
73
89
|
|
|
74
|
-
// wait for js to return the updates (js calls transactionTryCommit)
|
|
75
90
|
try {
|
|
76
91
|
transactionHandler.await();
|
|
77
92
|
} catch (InterruptedException e) {
|
|
@@ -95,7 +110,13 @@ public class ReactNativeFirebaseDatabaseTransactionModule extends ReactNativeFir
|
|
|
95
110
|
public void onComplete(
|
|
96
111
|
DatabaseError error, boolean committed, DataSnapshot snapshot) {
|
|
97
112
|
ReactNativeFirebaseDatabaseTransactionHandler transactionHandler =
|
|
98
|
-
transactionHandlers.get(transactionId);
|
|
113
|
+
transactionHandlers.get((int) transactionId);
|
|
114
|
+
|
|
115
|
+
if (transactionHandler == null) {
|
|
116
|
+
transactionHandlers.delete((int) transactionId);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
99
120
|
WritableMap resultMap =
|
|
100
121
|
transactionHandler.createResultMap(error, committed, snapshot);
|
|
101
122
|
|
|
@@ -107,19 +128,20 @@ public class ReactNativeFirebaseDatabaseTransactionModule extends ReactNativeFir
|
|
|
107
128
|
ReactNativeFirebaseTransactionEvent.EVENT_TRANSACTION,
|
|
108
129
|
resultMap,
|
|
109
130
|
app,
|
|
110
|
-
transactionId));
|
|
131
|
+
(int) transactionId));
|
|
111
132
|
|
|
112
|
-
transactionHandlers.delete(transactionId);
|
|
133
|
+
transactionHandlers.delete((int) transactionId);
|
|
113
134
|
}
|
|
114
135
|
},
|
|
115
136
|
applyLocally);
|
|
116
137
|
});
|
|
117
138
|
}
|
|
118
139
|
|
|
119
|
-
@
|
|
140
|
+
@Override
|
|
120
141
|
public void transactionTryCommit(
|
|
121
|
-
String app, String dbURL,
|
|
122
|
-
ReactNativeFirebaseDatabaseTransactionHandler handler =
|
|
142
|
+
String app, String dbURL, double transactionId, ReadableMap updates) {
|
|
143
|
+
ReactNativeFirebaseDatabaseTransactionHandler handler =
|
|
144
|
+
transactionHandlers.get((int) transactionId);
|
|
123
145
|
|
|
124
146
|
if (handler != null) {
|
|
125
147
|
handler.signalUpdateReceived(updates);
|
|
@@ -30,11 +30,11 @@ public class ReactNativeFirebaseDatabasePackage implements ReactPackage {
|
|
|
30
30
|
@Override
|
|
31
31
|
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
32
32
|
List<NativeModule> modules = new ArrayList<>();
|
|
33
|
-
modules.add(new
|
|
34
|
-
modules.add(new
|
|
35
|
-
modules.add(new
|
|
36
|
-
modules.add(new
|
|
37
|
-
modules.add(new
|
|
33
|
+
modules.add(new NativeRNFBTurboDatabase(reactContext));
|
|
34
|
+
modules.add(new NativeRNFBTurboDatabaseReference(reactContext));
|
|
35
|
+
modules.add(new NativeRNFBTurboDatabaseQuery(reactContext));
|
|
36
|
+
modules.add(new NativeRNFBTurboDatabaseOnDisconnect(reactContext));
|
|
37
|
+
modules.add(new NativeRNFBTurboDatabaseTransaction(reactContext));
|
|
38
38
|
return modules;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -81,6 +81,17 @@ public class ReactNativeFirebaseDatabaseTransactionHandler {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/** Abort the currently in progress transaction if any. */
|
|
85
|
+
void abort() {
|
|
86
|
+
lock.lock();
|
|
87
|
+
try {
|
|
88
|
+
abort = true;
|
|
89
|
+
condition.signalAll();
|
|
90
|
+
} finally {
|
|
91
|
+
lock.unlock();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
84
95
|
/** Wait for signalUpdateReceived to signal condition */
|
|
85
96
|
void await() throws InterruptedException {
|
|
86
97
|
lock.lock();
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.facebook.fbreact.specs;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.Promise;
|
|
17
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
21
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
22
|
+
import javax.annotation.Nonnull;
|
|
23
|
+
|
|
24
|
+
public abstract class NativeRNFBTurboDatabaseOnDisconnectSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
25
|
+
public static final String NAME = "NativeRNFBTurboDatabaseOnDisconnect";
|
|
26
|
+
|
|
27
|
+
public NativeRNFBTurboDatabaseOnDisconnectSpec(ReactApplicationContext reactContext) {
|
|
28
|
+
super(reactContext);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public @Nonnull String getName() {
|
|
33
|
+
return NAME;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@ReactMethod
|
|
37
|
+
@DoNotStrip
|
|
38
|
+
public abstract void onDisconnectCancel(String app, String dbURL, String path, Promise promise);
|
|
39
|
+
|
|
40
|
+
@ReactMethod
|
|
41
|
+
@DoNotStrip
|
|
42
|
+
public abstract void onDisconnectRemove(String app, String dbURL, String path, Promise promise);
|
|
43
|
+
|
|
44
|
+
@ReactMethod
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
public abstract void onDisconnectSet(String app, String dbURL, String path, ReadableMap props, Promise promise);
|
|
47
|
+
|
|
48
|
+
@ReactMethod
|
|
49
|
+
@DoNotStrip
|
|
50
|
+
public abstract void onDisconnectSetWithPriority(String app, String dbURL, String path, ReadableMap props, Promise promise);
|
|
51
|
+
|
|
52
|
+
@ReactMethod
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
public abstract void onDisconnectUpdate(String app, String dbURL, String path, ReadableMap props, Promise promise);
|
|
55
|
+
}
|