@react-native-firebase/remote-config 25.1.0 → 26.0.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 +32 -0
- package/RNFBRemoteConfig.podspec +7 -6
- package/android/build.gradle +19 -0
- package/android/src/reactnative/java/io/invertase/firebase/config/{ReactNativeFirebaseConfigModule.java → NativeRNFBTurboConfig.java} +53 -40
- package/android/src/reactnative/java/io/invertase/firebase/config/ReactNativeFirebaseConfigPackage.java +1 -1
- package/android/src/reactnative/java/io/invertase/firebase/config/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboConfigSpec.java +115 -0
- package/android/src/reactnative/java/io/invertase/firebase/config/generated/jni/CMakeLists.txt +36 -0
- package/android/src/reactnative/java/io/invertase/firebase/config/generated/jni/RNFBRemoteConfigTurboModules-generated.cpp +98 -0
- package/android/src/reactnative/java/io/invertase/firebase/config/generated/jni/RNFBRemoteConfigTurboModules.h +31 -0
- package/android/src/reactnative/java/io/invertase/firebase/config/generated/jni/react/renderer/components/RNFBRemoteConfigTurboModules/RNFBRemoteConfigTurboModulesJSI-generated.cpp +110 -0
- package/android/src/reactnative/java/io/invertase/firebase/config/generated/jni/react/renderer/components/RNFBRemoteConfigTurboModules/RNFBRemoteConfigTurboModulesJSI.h +471 -0
- package/dist/module/index.js +499 -5
- package/dist/module/index.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/typescript/lib/index.d.ts +83 -5
- package/dist/typescript/lib/index.d.ts.map +1 -1
- package/dist/typescript/lib/types/internal.d.ts +25 -24
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/types/remote-config.d.ts +24 -3
- package/dist/typescript/lib/types/remote-config.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/ios/RNFBConfig/RNFBConfigModule.h +3 -2
- package/ios/RNFBConfig/{RNFBConfigModule.m → RNFBConfigModule.mm} +137 -93
- package/ios/RNFBConfig.xcodeproj/project.pbxproj +8 -8
- 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/RNFBRemoteConfigTurboModules/RNFBRemoteConfigTurboModules-generated.mm +121 -0
- package/ios/generated/RNFBRemoteConfigTurboModules/RNFBRemoteConfigTurboModules.h +172 -0
- package/ios/generated/RNFBRemoteConfigTurboModulesJSI-generated.cpp +110 -0
- package/ios/generated/RNFBRemoteConfigTurboModulesJSI.h +471 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/index.ts +683 -8
- package/lib/types/internal.ts +25 -44
- package/lib/types/remote-config.ts +28 -3
- package/lib/version.ts +1 -1
- package/package.json +23 -5
- package/react-native.config.js +10 -0
- package/specs/NativeRNFBTurboConfig.ts +60 -0
- package/typedoc.json +1 -1
- package/dist/module/modular.js +0 -155
- package/dist/module/modular.js.map +0 -1
- package/dist/module/namespaced.js +0 -400
- package/dist/module/namespaced.js.map +0 -1
- package/dist/module/types/namespaced.js +0 -24
- package/dist/module/types/namespaced.js.map +0 -1
- package/dist/typescript/lib/modular.d.ts +0 -76
- package/dist/typescript/lib/modular.d.ts.map +0 -1
- package/dist/typescript/lib/namespaced.d.ts +0 -11
- package/dist/typescript/lib/namespaced.d.ts.map +0 -1
- package/dist/typescript/lib/types/namespaced.d.ts +0 -124
- package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
- package/lib/modular.ts +0 -197
- package/lib/namespaced.ts +0 -552
- package/lib/types/namespaced.ts +0 -163
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
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.0.0](https://github.com/invertase/react-native-firebase/compare/v25.1.0...v26.0.0) (2026-07-29)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- logEvent, initializeAppCheck, and initializeFirestore return
|
|
11
|
+
synchronously; remove await and .then() chains on these APIs.
|
|
12
|
+
|
|
13
|
+
* Analytics: align logEvent return type with firebase-js-sdk sync void.
|
|
14
|
+
* App Check: align initializeAppCheck with sync AppCheck return.
|
|
15
|
+
* Firestore: align initializeFirestore with sync Firestore return.
|
|
16
|
+
* Firestore: export aggregateFieldEqual for aggregate query parity.
|
|
17
|
+
* Remote Config: accept RemoteConfigOptions in getRemoteConfig.
|
|
18
|
+
* Remote Config: document native FetchStatus literals as intentional drift.
|
|
19
|
+
* Docs: add firebase-js-sdk API parity improvements to v26 migration guide.
|
|
20
|
+
|
|
21
|
+
- **remote-config:** migrate remote-config to TurboModules
|
|
22
|
+
|
|
23
|
+
- refactor!(types): align modular APIs with firebase-js-sdk sync signatures ([b42d1f7](https://github.com/invertase/react-native-firebase/commit/b42d1f7dd2629184e26ab71936ab1d47878d0f64))
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
- **remote-config:** migrate remote-config to TurboModules ([1758b01](https://github.com/invertase/react-native-firebase/commit/1758b0134d941bad28dafce9c83bf390a06d9ff6))
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
- add codegen verify and spec-native parity tests ([49d9f1b](https://github.com/invertase/react-native-firebase/commit/49d9f1baba4fc83c1dd4983f582bbd7352d78809))
|
|
32
|
+
- add ResultT codegen type alias ([ff2d68f](https://github.com/invertase/react-native-firebase/commit/ff2d68ff8f73092f8ba3c75e007049dd31be822f))
|
|
33
|
+
- **firestore:** deep testing/refactoring pass ([24b3b67](https://github.com/invertase/react-native-firebase/commit/24b3b679d21c8b21f603e8add5a544a978138436))
|
|
34
|
+
- **ios:** set IPHONEOS_DEPLOYMENT_TARGET to 15.0, update platform support docs/conditionals ([#9108](https://github.com/invertase/react-native-firebase/issues/9108)) ([99d0899](https://github.com/invertase/react-native-firebase/commit/99d089908e3eec6155d73ecf05ff7274ad33c46e)), closes [#8882](https://github.com/invertase/react-native-firebase/issues/8882)
|
|
35
|
+
- **remote-config, ios:** ensure fetchActivate() match fetch() + activate() behavior ([#9095](https://github.com/invertase/react-native-firebase/issues/9095)) ([3bbfecc](https://github.com/invertase/react-native-firebase/commit/3bbfeccf60454a0d24394268f23f6ae08359d74e))
|
|
36
|
+
- **types:** align compare-types modular API with firebase-js-sdk ([5376e75](https://github.com/invertase/react-native-firebase/commit/5376e757f7dd7f7cffc9907c652d873d2403e23f))
|
|
37
|
+
|
|
6
38
|
## [25.1.0](https://github.com/invertase/react-native-firebase/compare/v25.0.1...v25.1.0) (2026-06-25)
|
|
7
39
|
|
|
8
40
|
**Note:** Version bump only for package @react-native-firebase/remote-config
|
package/RNFBRemoteConfig.podspec
CHANGED
|
@@ -28,15 +28,16 @@ Pod::Spec.new do |s|
|
|
|
28
28
|
s.ios.deployment_target = firebase_ios_target
|
|
29
29
|
s.macos.deployment_target = firebase_macos_target
|
|
30
30
|
s.tvos.deployment_target = firebase_tvos_target
|
|
31
|
-
s.source_files = 'ios/**/*.{h,m}'
|
|
31
|
+
s.source_files = 'ios/**/*.{h,m,mm,cpp}'
|
|
32
|
+
s.private_header_files = "ios/**/*.h"
|
|
33
|
+
s.exclude_files = 'ios/generated/RCTThirdPartyComponentsProvider.*', 'ios/generated/RCTAppDependencyProvider.*', 'ios/generated/RCTModuleProviders.*', 'ios/generated/RCTModulesConformingToProtocolsProvider.*', 'ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.*'
|
|
32
34
|
|
|
33
35
|
s.dependency 'RNFBApp'
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
s.dependency "React-Core"
|
|
37
|
+
install_modules_dependencies(s);
|
|
38
|
+
|
|
39
|
+
if defined?(ENV["RCT_NEW_ARCH_ENABLED"]) != nil && (ENV["RCT_NEW_ARCH_ENABLED"] == '0')
|
|
40
|
+
raise "#{s.name} requires New Architecture. Enable New Architecture to use this module"
|
|
40
41
|
end
|
|
41
42
|
|
|
42
43
|
if defined?($FirebaseSDKVersion)
|
package/android/build.gradle
CHANGED
|
@@ -79,6 +79,7 @@ android {
|
|
|
79
79
|
sourceSets {
|
|
80
80
|
main {
|
|
81
81
|
java.srcDirs = ['src/main/java', 'src/reactnative/java']
|
|
82
|
+
java.excludes = ['**/generated/jni/**']
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
}
|
|
@@ -98,3 +99,21 @@ ReactNative.shared.applyPackageVersion()
|
|
|
98
99
|
ReactNative.shared.applyDefaultExcludes()
|
|
99
100
|
ReactNative.module.applyAndroidVersions()
|
|
100
101
|
ReactNative.module.applyReactNativeDependency("api")
|
|
102
|
+
|
|
103
|
+
def isNewArchitectureDisabled() {
|
|
104
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled != "true"
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (isNewArchitectureDisabled()) {
|
|
108
|
+
def ANSI_RED = "\u001B[31m";
|
|
109
|
+
def ANSI_RESET = "\u001B[0m";
|
|
110
|
+
|
|
111
|
+
println("\n\n\n")
|
|
112
|
+
println(ANSI_RED + "**************************************************************************************************************")
|
|
113
|
+
println("\n\n\n")
|
|
114
|
+
println("New Architecture support is required for @react-native-firebase/remote-config")
|
|
115
|
+
println("\n\n\n")
|
|
116
|
+
println("**************************************************************************************************************" + ANSI_RESET)
|
|
117
|
+
println("\n\n\n")
|
|
118
|
+
System.exit(1)
|
|
119
|
+
}
|
|
@@ -17,12 +17,24 @@ package io.invertase.firebase.config;
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import
|
|
20
|
+
import static io.invertase.firebase.common.ReactNativeFirebaseModule.rejectPromiseWithCodeAndMessage;
|
|
21
|
+
import static io.invertase.firebase.common.ReactNativeFirebaseModule.rejectPromiseWithExceptionMap;
|
|
22
|
+
|
|
23
|
+
import com.facebook.fbreact.specs.NativeRNFBTurboConfigSpec;
|
|
24
|
+
import com.facebook.react.bridge.Arguments;
|
|
25
|
+
import com.facebook.react.bridge.Promise;
|
|
26
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
27
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
28
|
+
import com.facebook.react.bridge.WritableMap;
|
|
21
29
|
import com.google.firebase.FirebaseApp;
|
|
22
|
-
import com.google.firebase.remoteconfig
|
|
30
|
+
import com.google.firebase.remoteconfig.ConfigUpdate;
|
|
31
|
+
import com.google.firebase.remoteconfig.ConfigUpdateListener;
|
|
32
|
+
import com.google.firebase.remoteconfig.ConfigUpdateListenerRegistration;
|
|
33
|
+
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
|
|
34
|
+
import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
|
|
35
|
+
import com.google.firebase.remoteconfig.FirebaseRemoteConfigFetchThrottledException;
|
|
23
36
|
import io.invertase.firebase.common.ReactNativeFirebaseEvent;
|
|
24
37
|
import io.invertase.firebase.common.ReactNativeFirebaseEventEmitter;
|
|
25
|
-
import io.invertase.firebase.common.ReactNativeFirebaseModule;
|
|
26
38
|
import java.util.ArrayList;
|
|
27
39
|
import java.util.HashMap;
|
|
28
40
|
import java.util.Iterator;
|
|
@@ -32,15 +44,15 @@ import java.util.Set;
|
|
|
32
44
|
import javax.annotation.Nullable;
|
|
33
45
|
import org.jetbrains.annotations.NotNull;
|
|
34
46
|
|
|
35
|
-
public class
|
|
47
|
+
public class NativeRNFBTurboConfig extends NativeRNFBTurboConfigSpec {
|
|
36
48
|
private static final String SERVICE_NAME = "Config";
|
|
37
49
|
private final UniversalFirebaseConfigModule module;
|
|
38
50
|
|
|
39
|
-
private static HashMap<String, ConfigUpdateListenerRegistration>
|
|
40
|
-
new HashMap<>();
|
|
51
|
+
private static final HashMap<String, ConfigUpdateListenerRegistration>
|
|
52
|
+
mConfigUpdateRegistrations = new HashMap<>();
|
|
41
53
|
|
|
42
|
-
|
|
43
|
-
super(reactContext
|
|
54
|
+
public NativeRNFBTurboConfig(ReactApplicationContext reactContext) {
|
|
55
|
+
super(reactContext);
|
|
44
56
|
module = new UniversalFirebaseConfigModule(reactContext, SERVICE_NAME);
|
|
45
57
|
}
|
|
46
58
|
|
|
@@ -57,131 +69,138 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
57
69
|
mConfigRegistration.remove();
|
|
58
70
|
configRegistrationsIterator.remove();
|
|
59
71
|
}
|
|
72
|
+
|
|
73
|
+
module.onTearDown();
|
|
60
74
|
}
|
|
61
75
|
|
|
62
|
-
@
|
|
76
|
+
@Override
|
|
77
|
+
protected Map<String, Object> getTypedExportedConstants() {
|
|
78
|
+
return module.getConstantsForApp(FirebaseApp.DEFAULT_APP_NAME);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@Override
|
|
63
82
|
public void activate(String appName, Promise promise) {
|
|
64
83
|
module
|
|
65
84
|
.activate(appName)
|
|
66
85
|
.addOnCompleteListener(
|
|
67
86
|
task -> {
|
|
68
87
|
if (task.isSuccessful()) {
|
|
69
|
-
promise.resolve(resultWithConstants(task.getResult()));
|
|
88
|
+
promise.resolve(resultWithConstants(task.getResult(), appName));
|
|
70
89
|
} else {
|
|
71
90
|
rejectPromiseWithExceptionMap(promise, task.getException());
|
|
72
91
|
}
|
|
73
92
|
});
|
|
74
93
|
}
|
|
75
94
|
|
|
76
|
-
@
|
|
95
|
+
@Override
|
|
77
96
|
public void fetch(String appName, double expirationDurationSeconds, Promise promise) {
|
|
78
97
|
module
|
|
79
98
|
.fetch(appName, (long) expirationDurationSeconds)
|
|
80
99
|
.addOnCompleteListener(
|
|
81
100
|
task -> {
|
|
82
101
|
if (task.isSuccessful()) {
|
|
83
|
-
promise.resolve(resultWithVoidConstants());
|
|
102
|
+
promise.resolve(resultWithVoidConstants(appName));
|
|
84
103
|
} else {
|
|
85
104
|
rejectPromiseWithConfigException(promise, task.getException());
|
|
86
105
|
}
|
|
87
106
|
});
|
|
88
107
|
}
|
|
89
108
|
|
|
90
|
-
@
|
|
109
|
+
@Override
|
|
91
110
|
public void fetchAndActivate(String appName, Promise promise) {
|
|
92
111
|
module
|
|
93
112
|
.fetchAndActivate(appName)
|
|
94
113
|
.addOnCompleteListener(
|
|
95
114
|
task -> {
|
|
96
115
|
if (task.isSuccessful()) {
|
|
97
|
-
promise.resolve(resultWithConstants(task.getResult()));
|
|
116
|
+
promise.resolve(resultWithConstants(task.getResult(), appName));
|
|
98
117
|
} else {
|
|
99
118
|
rejectPromiseWithConfigException(promise, task.getException());
|
|
100
119
|
}
|
|
101
120
|
});
|
|
102
121
|
}
|
|
103
122
|
|
|
104
|
-
@
|
|
123
|
+
@Override
|
|
105
124
|
public void reset(String appName, Promise promise) {
|
|
106
125
|
module
|
|
107
126
|
.reset(appName)
|
|
108
127
|
.addOnCompleteListener(
|
|
109
128
|
task -> {
|
|
110
129
|
if (task.isSuccessful()) {
|
|
111
|
-
promise.resolve(resultWithVoidConstants());
|
|
130
|
+
promise.resolve(resultWithVoidConstants(appName));
|
|
112
131
|
} else {
|
|
113
132
|
rejectPromiseWithConfigException(promise, task.getException());
|
|
114
133
|
}
|
|
115
134
|
});
|
|
116
135
|
}
|
|
117
136
|
|
|
118
|
-
@
|
|
137
|
+
@Override
|
|
119
138
|
public void setConfigSettings(String appName, ReadableMap configSettings, Promise promise) {
|
|
120
139
|
module
|
|
121
140
|
.setConfigSettings(appName, Arguments.toBundle(configSettings))
|
|
122
141
|
.addOnCompleteListener(
|
|
123
142
|
task -> {
|
|
124
143
|
if (task.isSuccessful()) {
|
|
125
|
-
promise.resolve(resultWithVoidConstants());
|
|
144
|
+
promise.resolve(resultWithVoidConstants(appName));
|
|
126
145
|
} else {
|
|
127
146
|
rejectPromiseWithExceptionMap(promise, task.getException());
|
|
128
147
|
}
|
|
129
148
|
});
|
|
130
149
|
}
|
|
131
150
|
|
|
132
|
-
@
|
|
151
|
+
@Override
|
|
133
152
|
public void setDefaults(String appName, ReadableMap defaults, Promise promise) {
|
|
134
153
|
module
|
|
135
154
|
.setDefaults(appName, defaults.toHashMap())
|
|
136
155
|
.addOnCompleteListener(
|
|
137
156
|
task -> {
|
|
138
157
|
if (task.isSuccessful()) {
|
|
139
|
-
promise.resolve(resultWithConstants(task.getResult()));
|
|
158
|
+
promise.resolve(resultWithConstants(task.getResult(), appName));
|
|
140
159
|
} else {
|
|
141
160
|
rejectPromiseWithExceptionMap(promise, task.getException());
|
|
142
161
|
}
|
|
143
162
|
});
|
|
144
163
|
}
|
|
145
164
|
|
|
146
|
-
@
|
|
165
|
+
@Override
|
|
147
166
|
public void setDefaultsFromResource(String appName, String resourceName, Promise promise) {
|
|
148
167
|
module
|
|
149
168
|
.setDefaultsFromResource(appName, resourceName)
|
|
150
169
|
.addOnCompleteListener(
|
|
151
170
|
task -> {
|
|
152
171
|
if (task.isSuccessful()) {
|
|
153
|
-
promise.resolve(resultWithConstants(task.getResult()));
|
|
172
|
+
promise.resolve(resultWithConstants(task.getResult(), appName));
|
|
154
173
|
} else {
|
|
155
174
|
Exception exception = task.getException();
|
|
156
175
|
if (exception != null && exception.getMessage().equals("resource_not_found")) {
|
|
157
176
|
rejectPromiseWithCodeAndMessage(
|
|
158
177
|
promise, "resource_not_found", "The specified resource name was not found.");
|
|
178
|
+
return;
|
|
159
179
|
}
|
|
160
180
|
rejectPromiseWithExceptionMap(promise, task.getException());
|
|
161
181
|
}
|
|
162
182
|
});
|
|
163
183
|
}
|
|
164
184
|
|
|
165
|
-
@
|
|
185
|
+
@Override
|
|
166
186
|
public void ensureInitialized(String appName, Promise promise) {
|
|
167
187
|
module
|
|
168
188
|
.ensureInitialized(appName)
|
|
169
189
|
.addOnCompleteListener(
|
|
170
190
|
task -> {
|
|
171
191
|
if (task.isSuccessful()) {
|
|
172
|
-
promise.resolve(resultWithVoidConstants());
|
|
192
|
+
promise.resolve(resultWithVoidConstants(appName));
|
|
173
193
|
} else {
|
|
174
194
|
rejectPromiseWithExceptionMap(promise, task.getException());
|
|
175
195
|
}
|
|
176
196
|
});
|
|
177
197
|
}
|
|
178
198
|
|
|
179
|
-
@
|
|
199
|
+
@Override
|
|
180
200
|
public void onConfigUpdated(String appName) {
|
|
181
201
|
if (mConfigUpdateRegistrations.get(appName) == null) {
|
|
182
|
-
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
|
|
183
202
|
ConfigUpdateListenerRegistration registration =
|
|
184
|
-
FirebaseRemoteConfig.getInstance(
|
|
203
|
+
FirebaseRemoteConfig.getInstance(FirebaseApp.getInstance(appName))
|
|
185
204
|
.addOnConfigUpdateListener(
|
|
186
205
|
new ConfigUpdateListener() {
|
|
187
206
|
@Override
|
|
@@ -229,7 +248,6 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
229
248
|
userInfoMap.putString("code", "unknown");
|
|
230
249
|
break;
|
|
231
250
|
default:
|
|
232
|
-
// contract violation internal to the RNFB / SDK boundary
|
|
233
251
|
userInfoMap.putString("code", "internal");
|
|
234
252
|
}
|
|
235
253
|
|
|
@@ -245,7 +263,7 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
245
263
|
}
|
|
246
264
|
}
|
|
247
265
|
|
|
248
|
-
@
|
|
266
|
+
@Override
|
|
249
267
|
public void removeConfigUpdateRegistration(String appName) {
|
|
250
268
|
ConfigUpdateListenerRegistration mConfigRegistration = mConfigUpdateRegistrations.get(appName);
|
|
251
269
|
|
|
@@ -255,30 +273,30 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
255
273
|
}
|
|
256
274
|
}
|
|
257
275
|
|
|
258
|
-
@
|
|
276
|
+
@Override
|
|
259
277
|
public void setCustomSignals(String appName, ReadableMap customSignals, Promise promise) {
|
|
260
278
|
module
|
|
261
279
|
.setCustomSignals(appName, customSignals.toHashMap())
|
|
262
280
|
.addOnCompleteListener(
|
|
263
281
|
task -> {
|
|
264
282
|
if (task.isSuccessful()) {
|
|
265
|
-
promise.resolve(resultWithVoidConstants());
|
|
283
|
+
promise.resolve(resultWithVoidConstants(appName));
|
|
266
284
|
} else {
|
|
267
285
|
rejectPromiseWithExceptionMap(promise, task.getException());
|
|
268
286
|
}
|
|
269
287
|
});
|
|
270
288
|
}
|
|
271
289
|
|
|
272
|
-
private WritableMap resultWithConstants(Object result) {
|
|
290
|
+
private WritableMap resultWithConstants(Object result, String appName) {
|
|
273
291
|
Map<String, Object> responseMap = new HashMap<>(2);
|
|
274
292
|
responseMap.put("result", result);
|
|
275
|
-
responseMap.put("constants", module.getConstantsForApp(
|
|
293
|
+
responseMap.put("constants", module.getConstantsForApp(appName));
|
|
276
294
|
return Arguments.makeNativeMap(responseMap);
|
|
277
295
|
}
|
|
278
296
|
|
|
279
|
-
private WritableMap resultWithVoidConstants() {
|
|
297
|
+
private WritableMap resultWithVoidConstants(String appName) {
|
|
280
298
|
Map<String, Object> responseMap = new HashMap<>(1);
|
|
281
|
-
responseMap.put("constants", module.getConstantsForApp(
|
|
299
|
+
responseMap.put("constants", module.getConstantsForApp(appName));
|
|
282
300
|
return Arguments.makeNativeMap(responseMap);
|
|
283
301
|
}
|
|
284
302
|
|
|
@@ -305,9 +323,4 @@ public class ReactNativeFirebaseConfigModule extends ReactNativeFirebaseModule {
|
|
|
305
323
|
exception.getMessage());
|
|
306
324
|
}
|
|
307
325
|
}
|
|
308
|
-
|
|
309
|
-
@Override
|
|
310
|
-
public Map<String, Object> getConstants() {
|
|
311
|
-
return module.getConstants();
|
|
312
|
-
}
|
|
313
326
|
}
|
|
@@ -32,7 +32,7 @@ public class ReactNativeFirebaseConfigPackage implements ReactPackage {
|
|
|
32
32
|
@Override
|
|
33
33
|
public List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext) {
|
|
34
34
|
List<NativeModule> modules = new ArrayList<>();
|
|
35
|
-
modules.add(new
|
|
35
|
+
modules.add(new NativeRNFBTurboConfig(reactContext));
|
|
36
36
|
return modules;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -0,0 +1,115 @@
|
|
|
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.common.build.ReactBuildConfig;
|
|
22
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
23
|
+
import java.util.Arrays;
|
|
24
|
+
import java.util.HashSet;
|
|
25
|
+
import java.util.Map;
|
|
26
|
+
import java.util.Set;
|
|
27
|
+
import javax.annotation.Nonnull;
|
|
28
|
+
import javax.annotation.Nullable;
|
|
29
|
+
|
|
30
|
+
public abstract class NativeRNFBTurboConfigSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
31
|
+
public static final String NAME = "NativeRNFBTurboConfig";
|
|
32
|
+
|
|
33
|
+
public NativeRNFBTurboConfigSpec(ReactApplicationContext reactContext) {
|
|
34
|
+
super(reactContext);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Override
|
|
38
|
+
public @Nonnull String getName() {
|
|
39
|
+
return NAME;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected abstract Map<String, Object> getTypedExportedConstants();
|
|
43
|
+
|
|
44
|
+
@Override
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
public final @Nullable Map<String, Object> getConstants() {
|
|
47
|
+
Map<String, Object> constants = getTypedExportedConstants();
|
|
48
|
+
if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
|
|
49
|
+
Set<String> obligatoryFlowConstants = new HashSet<>(Arrays.asList(
|
|
50
|
+
"fetchTimeout",
|
|
51
|
+
"lastFetchStatus",
|
|
52
|
+
"lastFetchTime",
|
|
53
|
+
"minimumFetchInterval",
|
|
54
|
+
"values"
|
|
55
|
+
));
|
|
56
|
+
Set<String> optionalFlowConstants = new HashSet<>();
|
|
57
|
+
Set<String> undeclaredConstants = new HashSet<>(constants.keySet());
|
|
58
|
+
undeclaredConstants.removeAll(obligatoryFlowConstants);
|
|
59
|
+
undeclaredConstants.removeAll(optionalFlowConstants);
|
|
60
|
+
if (!undeclaredConstants.isEmpty()) {
|
|
61
|
+
throw new IllegalStateException(String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants));
|
|
62
|
+
}
|
|
63
|
+
undeclaredConstants = obligatoryFlowConstants;
|
|
64
|
+
undeclaredConstants.removeAll(constants.keySet());
|
|
65
|
+
if (!undeclaredConstants.isEmpty()) {
|
|
66
|
+
throw new IllegalStateException(String.format("Native Module doesn't fill in constants: %s", undeclaredConstants));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return constants;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@ReactMethod
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
public abstract void activate(String appName, Promise promise);
|
|
75
|
+
|
|
76
|
+
@ReactMethod
|
|
77
|
+
@DoNotStrip
|
|
78
|
+
public abstract void setConfigSettings(String appName, ReadableMap settings, Promise promise);
|
|
79
|
+
|
|
80
|
+
@ReactMethod
|
|
81
|
+
@DoNotStrip
|
|
82
|
+
public abstract void fetch(String appName, double expirationDurationSeconds, Promise promise);
|
|
83
|
+
|
|
84
|
+
@ReactMethod
|
|
85
|
+
@DoNotStrip
|
|
86
|
+
public abstract void fetchAndActivate(String appName, Promise promise);
|
|
87
|
+
|
|
88
|
+
@ReactMethod
|
|
89
|
+
@DoNotStrip
|
|
90
|
+
public abstract void ensureInitialized(String appName, Promise promise);
|
|
91
|
+
|
|
92
|
+
@ReactMethod
|
|
93
|
+
@DoNotStrip
|
|
94
|
+
public abstract void setDefaults(String appName, ReadableMap defaults, Promise promise);
|
|
95
|
+
|
|
96
|
+
@ReactMethod
|
|
97
|
+
@DoNotStrip
|
|
98
|
+
public abstract void setDefaultsFromResource(String appName, String resourceName, Promise promise);
|
|
99
|
+
|
|
100
|
+
@ReactMethod
|
|
101
|
+
@DoNotStrip
|
|
102
|
+
public abstract void reset(String appName, Promise promise);
|
|
103
|
+
|
|
104
|
+
@ReactMethod
|
|
105
|
+
@DoNotStrip
|
|
106
|
+
public abstract void onConfigUpdated(String appName);
|
|
107
|
+
|
|
108
|
+
@ReactMethod
|
|
109
|
+
@DoNotStrip
|
|
110
|
+
public abstract void removeConfigUpdateRegistration(String appName);
|
|
111
|
+
|
|
112
|
+
@ReactMethod
|
|
113
|
+
@DoNotStrip
|
|
114
|
+
public abstract void setCustomSignals(String appName, ReadableMap customSignals, Promise promise);
|
|
115
|
+
}
|
package/android/src/reactnative/java/io/invertase/firebase/config/generated/jni/CMakeLists.txt
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNFBRemoteConfigTurboModules/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNFBRemoteConfigTurboModules
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNFBRemoteConfigTurboModules PUBLIC . react/renderer/components/RNFBRemoteConfigTurboModules)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNFBRemoteConfigTurboModules
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_RNFBRemoteConfigTurboModules
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|
|
@@ -0,0 +1,98 @@
|
|
|
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: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "RNFBRemoteConfigTurboModules.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
+
static jmethodID cachedMethodId = nullptr;
|
|
17
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, ObjectKind, "getConstants", "()Ljava/util/Map;", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_activate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
21
|
+
static jmethodID cachedMethodId = nullptr;
|
|
22
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "activate", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_setConfigSettings(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
26
|
+
static jmethodID cachedMethodId = nullptr;
|
|
27
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setConfigSettings", "(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_fetch(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
31
|
+
static jmethodID cachedMethodId = nullptr;
|
|
32
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "fetch", "(Ljava/lang/String;DLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_fetchAndActivate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
36
|
+
static jmethodID cachedMethodId = nullptr;
|
|
37
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "fetchAndActivate", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_ensureInitialized(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
41
|
+
static jmethodID cachedMethodId = nullptr;
|
|
42
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "ensureInitialized", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_setDefaults(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
46
|
+
static jmethodID cachedMethodId = nullptr;
|
|
47
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setDefaults", "(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_setDefaultsFromResource(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
51
|
+
static jmethodID cachedMethodId = nullptr;
|
|
52
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setDefaultsFromResource", "(Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_reset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
56
|
+
static jmethodID cachedMethodId = nullptr;
|
|
57
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "reset", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_onConfigUpdated(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
61
|
+
static jmethodID cachedMethodId = nullptr;
|
|
62
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "onConfigUpdated", "(Ljava/lang/String;)V", args, count, cachedMethodId);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_removeConfigUpdateRegistration(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
66
|
+
static jmethodID cachedMethodId = nullptr;
|
|
67
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "removeConfigUpdateRegistration", "(Ljava/lang/String;)V", args, count, cachedMethodId);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static facebook::jsi::Value __hostFunction_NativeRNFBTurboConfigSpecJSI_setCustomSignals(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
71
|
+
static jmethodID cachedMethodId = nullptr;
|
|
72
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setCustomSignals", "(Ljava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
NativeRNFBTurboConfigSpecJSI::NativeRNFBTurboConfigSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
76
|
+
: JavaTurboModule(params) {
|
|
77
|
+
methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeRNFBTurboConfigSpecJSI_getConstants};
|
|
78
|
+
methodMap_["activate"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboConfigSpecJSI_activate};
|
|
79
|
+
methodMap_["setConfigSettings"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboConfigSpecJSI_setConfigSettings};
|
|
80
|
+
methodMap_["fetch"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboConfigSpecJSI_fetch};
|
|
81
|
+
methodMap_["fetchAndActivate"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboConfigSpecJSI_fetchAndActivate};
|
|
82
|
+
methodMap_["ensureInitialized"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboConfigSpecJSI_ensureInitialized};
|
|
83
|
+
methodMap_["setDefaults"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboConfigSpecJSI_setDefaults};
|
|
84
|
+
methodMap_["setDefaultsFromResource"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboConfigSpecJSI_setDefaultsFromResource};
|
|
85
|
+
methodMap_["reset"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboConfigSpecJSI_reset};
|
|
86
|
+
methodMap_["onConfigUpdated"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboConfigSpecJSI_onConfigUpdated};
|
|
87
|
+
methodMap_["removeConfigUpdateRegistration"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboConfigSpecJSI_removeConfigUpdateRegistration};
|
|
88
|
+
methodMap_["setCustomSignals"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboConfigSpecJSI_setCustomSignals};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
std::shared_ptr<TurboModule> RNFBRemoteConfigTurboModules_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
92
|
+
if (moduleName == "NativeRNFBTurboConfig") {
|
|
93
|
+
return std::make_shared<NativeRNFBTurboConfigSpecJSI>(params);
|
|
94
|
+
}
|
|
95
|
+
return nullptr;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,31 @@
|
|
|
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: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* JNI C++ class for module 'NativeRNFBTurboConfig'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeRNFBTurboConfigSpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeRNFBTurboConfigSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> RNFBRemoteConfigTurboModules_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|