Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

needUpdate() does NOT work #209

Open
Bilal-Abdeen opened this issue Jun 7, 2023 · 5 comments
Open

needUpdate() does NOT work #209

Bilal-Abdeen opened this issue Jun 7, 2023 · 5 comments

Comments

@Bilal-Abdeen
Copy link

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

@KanedaOSCube
Copy link

The same problem with needUpdate()

@hssdiv
Copy link

hssdiv commented Jul 18, 2023

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

@lazyflog
Copy link

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

This works great.

@SeniorSam7
Copy link

SeniorSam7 commented Sep 2, 2023

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

@mukeshbuwade1
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants