Fix return value for get update metadata (#864)

* Fixed issue with error on parsing plist path

See https://github.com/Microsoft/react-native-code-push/issues/534#issuecomment-302069326 for details

* Changed return value to null for getUpdateMetadata instead of empty string

In accordance with docs and https://github.com/Microsoft/react-native-code-push/issues/862
This commit is contained in:
Max
2017-06-01 14:12:07 +03:00
committed by Sergey Akhalkov
parent b8bd4a021c
commit bb997f01d8

View File

@@ -321,7 +321,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
JSONObject currentPackage = mUpdateManager.getCurrentPackage();
if (currentPackage == null) {
promise.resolve("");
promise.resolve(null);
return null;
}
@@ -335,14 +335,14 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
if (updateState == CodePushUpdateState.PENDING.getValue() && !currentUpdateIsPending) {
// The caller wanted a pending update
// but there isn't currently one.
promise.resolve("");
promise.resolve(null);
} else if (updateState == CodePushUpdateState.RUNNING.getValue() && currentUpdateIsPending) {
// The caller wants the running update, but the current
// one is pending, so we need to grab the previous.
JSONObject previousPackage = mUpdateManager.getPreviousPackage();
if (previousPackage == null) {
promise.resolve("");
promise.resolve(null);
return null;
}