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
This commit is contained in:
Ramanpreet Nara
2019-12-11 11:28:40 -08:00
committed by Facebook Github Bot
parent e1e081b00e
commit a8fbc5b893
3 changed files with 5 additions and 6 deletions
@@ -55,11 +55,10 @@ public abstract class NativeBlobModuleSpec extends ReactContextBaseJavaModule im
public final @Nullable Map<String, Object> getConstants() {
Map<String, Object> constants = getTypedExportedConstants();
if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
Set<String> obligatoryFlowConstants = new HashSet<>(Arrays.asList(
"BLOB_URI_SCHEME"
));
Set<String> obligatoryFlowConstants = new HashSet<>();
Set<String> optionalFlowConstants = new HashSet<>(Arrays.asList(
"BLOB_URI_HOST"
"BLOB_URI_HOST",
"BLOB_URI_SCHEME"
));
Set<String> undeclaredConstants = new HashSet<>(constants.keySet());
undeclaredConstants.removeAll(obligatoryFlowConstants);
@@ -163,7 +163,7 @@ public class BlobModule extends ReactContextBaseJavaModule {
String packageName = getReactApplicationContext().getPackageName();
int resourceId = resources.getIdentifier("blob_provider_authority", "string", packageName);
if (resourceId == 0) {
return null;
return MapBuilder.<String, Object>of();
}
return MapBuilder.<String, Object>of(