SFDX-Data-Move-Utility
SFDX-Data-Move-Utility copied to clipboard
needUpdate() does NOT work
Thank you for the great library.
needUpdate
returns null. The other functions (getCurrentVersion
, getStoreUrl
, getLatestVersion
) work flawlessly.
console.log("getCurrentVersion:", VersionCheck.getCurrentVersion()); // works fine
VersionCheck.getStoreUrl().then(value => { console.log("getStoreUrl - value:", value, ); }); // works fine
VersionCheck.getLatestVersion().then(value => { console.log("getLatestVersion - value:", value, ); }); // works fine
// DOES NOT WORK!?
const result1 = VersionCheck.needUpdate().then(async res => {
console.log("needUpdate - res:", res, ); // "res" is always null
});
react-native-version-check Version: 3.4.7
react-native Version: 0.71.8
The same problem with needUpdate()
just use this to compare https://stackoverflow.com/a/65687141/11658653
const res = await VersionCheck.needUpdate({
packageName: 'com.example' ,
});
This works great.
It was working fine for me, and stopped suddenly since 7 days or so, the problem (at least in my case) that if you call needUpdate() without params, it returns {"currentVersion": "3.0.9", "isNeeded": false, "latestVersion": "3.0.9", "storeUrl": ""}, but if you call latestVersion() it returns 3.1.0, so to solve this problem just call the latestVersion() which returns a promise, and after resolving the promise call needUpdate() passing the result as a parameter.
VersionCheck.getLatestVersion().then(lVersion =>
VersionCheck.needUpdate({provider: _your_provider_handler, latestVersion: lVersion})
.then(res =>
// handle the result
))
Resolve this issue by adding country
VersionCheck.needUpdate({ country: 'us' })
.then()
in my case im building app for US region and my location is India 🇮🇳