SFDX-Data-Move-Utility icon indicating copy to clipboard operation
SFDX-Data-Move-Utility copied to clipboard

needUpdate() does NOT work

Open Bilal-Abdeen opened this issue 1 year ago • 5 comments

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

Bilal-Abdeen avatar Jun 07 '23 00:06 Bilal-Abdeen

The same problem with needUpdate()

KanedaOSCube avatar Jul 13 '23 10:07 KanedaOSCube

just use this to compare https://stackoverflow.com/a/65687141/11658653

hssdiv avatar Jul 18 '23 15:07 hssdiv

const res = await VersionCheck.needUpdate({
  packageName: 'com.example' ,
});

This works great.

lazyflog avatar Aug 28 '23 06:08 lazyflog

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
))

SeniorSam7 avatar Sep 02 '23 14:09 SeniorSam7

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 🇮🇳

mukeshbuwade1 avatar Dec 27 '23 07:12 mukeshbuwade1