Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,14 @@ VersionCheck.needUpdate({
fetchOptions | _object_ | isomorphic-fetch options (https://github.github.io/fetch/)
ignoreErrors | _boolean_ | true

- <a name="needUpdate" href="#needUpdate">#</a>**`needUpdate([option: Object])`** _(Promise<result: Object>)_ - Returns an object contains with boolean value whether update needed, current version and latest version. Current and the latest app versions are first split by delimiter, and check each split numbers into depth.
- <a name="needUpdate" href="#needUpdate">#</a>**`needUpdate([option: NeedUpdateOption])`** _(Promise<result: NeedUpdateResult>)_ - Returns an object contains with boolean value whether update needed, current version and latest version. Current and the latest app versions are first split by delimiter, and check each split numbers into depth.
- Option

Field | Type | Default
--- | --- | ---
currentVersion | _string_ | app's current version from [getCurrentVersion()](#getCurrentVersion)
latestVersion | _string_ | app's latest version from [getLatestVersion()](#getLatestVersion)
depth | _number_ | ```Infinity```
forceUpdate | _boolean_ | ```false```
provider | _string_ or _function_ | provider name or function that returns promise or value of the latest version
fetchOptions | _object_ | isomorphic-fetch options (https://github.github.io/fetch/)
ignoreErrors | _boolean_ | true

- Result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export async function getLatestVersion(
} catch (e) {
if (option.ignoreErrors) {
console.warn(e); // eslint-disable-line no-console
return Promise.resolve('');
} else {
throw e;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/react-native-version-check/src/needUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ export default async function needUpdate(
} catch (e) {
if (option.ignoreErrors) {
console.warn(e); // eslint-disable-line no-console

return Promise.resolve({
isNeeded: false,
storeUrl: providerStoreUrl,
currentVersion: option.currentVersion,
latestVersion: '',
});
} else {
throw e;
}
Expand Down