Skip to content

Commit 048f88a

Browse files
RSNarafacebook-github-bot
authored andcommitted
Fix NativePlatformConstants
Summary: When in debug mode, PlatformConstants doesn't have a `ServerHost` constant. This wasn't captured by `NativePlatformConstants`. Changelog: [Android][Fixed] - Make sure ServerHost is optional in NativePlatformConstants.js Reviewed By: rickhanlonii Differential Revision: D19091270 fbshipit-source-id: 4b3ac73a4ab6111b3e433ecca01cc769e8cdec6b
1 parent 38af48d commit 048f88a

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,7 @@ namespace JS {
19761976
RCTRequired<NSString *> Serial;
19771977
RCTRequired<NSString *> Fingerprint;
19781978
RCTRequired<NSString *> Model;
1979-
RCTRequired<NSString *> ServerHost;
1979+
NSString *ServerHost;
19801980
RCTRequired<NSString *> uiMode;
19811981
};
19821982

@@ -3633,7 +3633,7 @@ inline JS::NativePlatformConstantsAndroid::Constants::Builder::Builder(const Inp
36333633
d[@"Fingerprint"] = Fingerprint;
36343634
auto Model = i.Model.get();
36353635
d[@"Model"] = Model;
3636-
auto ServerHost = i.ServerHost.get();
3636+
auto ServerHost = i.ServerHost;
36373637
d[@"ServerHost"] = ServerHost;
36383638
auto uiMode = i.uiMode.get();
36393639
d[@"uiMode"] = uiMode;

Libraries/Utilities/NativePlatformConstantsAndroid.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface Spec extends TurboModule {
2727
Serial: string,
2828
Fingerprint: string,
2929
Model: string,
30-
ServerHost: string,
30+
ServerHost?: string,
3131
uiMode: string,
3232
|};
3333
+getAndroidID: () => string;

Libraries/Utilities/Platform.android.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const Platform = {
3838
Serial: string,
3939
Fingerprint: string,
4040
Model: string,
41-
ServerHost: string,
41+
ServerHost?: string,
4242
uiMode: string,
4343
|} {
4444
if (this.__constants == null) {

ReactAndroid/src/main/java/com/facebook/fbreact/specs/NativePlatformConstantsAndroidSpec.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ public NativePlatformConstantsAndroidSpec(ReactApplicationContext reactContext)
4747
"Version",
4848
"reactNativeVersion",
4949
"Model",
50-
"ServerHost",
5150
"isTesting",
5251
"Release"
5352
));
54-
Set<String> optionalFlowConstants = new HashSet<>();
53+
Set<String> optionalFlowConstants = new HashSet<>(Arrays.asList(
54+
"ServerHost"
55+
));
5556
Set<String> undeclaredConstants = new HashSet<>(constants.keySet());
5657
undeclaredConstants.removeAll(obligatoryFlowConstants);
5758
undeclaredConstants.removeAll(optionalFlowConstants);

0 commit comments

Comments
 (0)