mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook Github Bot
parent
e1e081b00e
commit
a8fbc5b893
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user