From 0d840aa5e8ad2c7f97d192c1009e0e74ede29190 Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Fri, 28 Aug 2015 15:46:27 -0700 Subject: [PATCH] Add new API methods as light wrappers for Native implementation --- CodePush.ios.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/CodePush.ios.js b/CodePush.ios.js index 829a582..3f32796 100644 --- a/CodePush.ios.js +++ b/CodePush.ios.js @@ -46,7 +46,7 @@ function getSdk(callback) { } } -function queryUpdate(callback) { +function checkForUpdate(callback) { getConfiguration(function(err, configuration) { if (err) callback(err); getSdk(function(err, sdk) { @@ -58,23 +58,38 @@ function queryUpdate(callback) { } else if (err) { console.log(err); } - + sdk.queryUpdateWithCurrentPackage(queryPackage, callback); }); }); }); } -function installUpdate(update) { +function download(updatePackage) { // Use the downloaded package info. Native code will save the package info // so that the client knows what the current package version is. - return NativeCodePush.installUpdate(update); + return NativeCodePush.downloadUpdate(updatePackage); +} + +function abortDownload() { + return NativeCodePush.abortDownload(); +} + +function apply(updatePackage) { + return NativeCodePush.applyUpdate(updatePackage); +} + +function getCurrentPackage() { + return NativeCodePush.getCurrentPackage(); } var CodePush = { getConfiguration: getConfiguration, - queryUpdate: queryUpdate, - installUpdate: installUpdate, + checkForUpdate: checkForUpdate, + download: download, + abortDownload: abortDownload, + apply: apply, + getCurrentPackage: getCurrentPackage, setUpTestDependencies: setUpTestDependencies };