Skip to content

Commit a8fbc5b

Browse files
RSNarafacebook-github-bot
authored andcommitted
Fix BlobModule getConstants()
Summary: It's possible for us to return no constants from the BlobModule. Therefore, I'm correcting the flow-type. Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D18932328 fbshipit-source-id: 2b415d12effd16eda313d5591825c711a20f9ae3
1 parent e1e081b commit a8fbc5b

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

Libraries/Blob/NativeBlobModule.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {TurboModule} from '../TurboModule/RCTExport';
1414
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
1515

1616
export interface Spec extends TurboModule {
17-
+getConstants: () => {|BLOB_URI_SCHEME: string, BLOB_URI_HOST: ?string|};
17+
+getConstants: () => {|BLOB_URI_SCHEME: ?string, BLOB_URI_HOST: ?string|};
1818
+addNetworkingHandler: () => void;
1919
+addWebSocketHandler: (id: number) => void;
2020
+removeWebSocketHandler: (id: number) => void;

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ public NativeBlobModuleSpec(ReactApplicationContext reactContext) {
5555
public final @Nullable Map<String, Object> getConstants() {
5656
Map<String, Object> constants = getTypedExportedConstants();
5757
if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
58-
Set<String> obligatoryFlowConstants = new HashSet<>(Arrays.asList(
59-
"BLOB_URI_SCHEME"
60-
));
58+
Set<String> obligatoryFlowConstants = new HashSet<>();
6159
Set<String> optionalFlowConstants = new HashSet<>(Arrays.asList(
62-
"BLOB_URI_HOST"
60+
"BLOB_URI_HOST",
61+
"BLOB_URI_SCHEME"
6362
));
6463
Set<String> undeclaredConstants = new HashSet<>(constants.keySet());
6564
undeclaredConstants.removeAll(obligatoryFlowConstants);

ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public String getName() {
163163
String packageName = getReactApplicationContext().getPackageName();
164164
int resourceId = resources.getIdentifier("blob_provider_authority", "string", packageName);
165165
if (resourceId == 0) {
166-
return null;
166+
return MapBuilder.<String, Object>of();
167167
}
168168

169169
return MapBuilder.<String, Object>of(

0 commit comments

Comments
 (0)