@@ -27,62 +27,62 @@ import { VersionCheck } from 'react-native-nitro-version-check'
2727| Method | Returns | Description |
2828| --------| ---------| -------------|
2929| ` getCountry() ` | ` string ` | Device's 2-letter ISO country code (sync) |
30- | ` getStoreUrl() ` | ` Promise<string> ` | App Store / Play Store URL |
31- | ` getLatestVersion() ` | ` Promise<string> ` | Latest version available in the store |
32- | ` needsUpdate() ` | ` Promise<boolean> ` | Whether an update is available |
30+ | ` getStoreUrl(options? ) ` | ` Promise<string> ` | App Store / Play Store URL with optional country code |
31+ | ` getLatestVersion(options? ) ` | ` Promise<string> ` | Latest version available in the store with optional country code |
32+ | ` needsUpdate(options? ) ` | ` Promise<boolean> ` | Whether an update is available with optional level filtering |
3333
34- ## Standalone Exports
35-
36- All methods are also available as individual named exports:
37-
38- ``` ts
39- import {
40- getCountry ,
41- getStoreUrl ,
42- getLatestVersion ,
43- needsUpdate ,
44- compareVersions ,
45- } from ' react-native-nitro-version-check'
46- ```
47-
48- ### ` getCountry() `
34+ ### ` VersionCheck.getCountry() `
4935
5036Returns the device's current 2-letter ISO country code. This is a ** synchronous** call.
5137
5238``` ts
53- const country = getCountry () // "US"
39+ const country = VersionCheck . getCountry () // "US"
5440```
5541
56- ### ` getStoreUrl() `
42+ ### ` VersionCheck. getStoreUrl(options? )`
5743
5844Returns the store URL for this app. Automatically resolves to the App Store on iOS and Play Store on Android.
5945
6046``` ts
61- const url = await getStoreUrl ()
47+ const url = await VersionCheck .getStoreUrl ()
48+ const urlUS = await VersionCheck .getStoreUrl ({ countryCode: ' US' })
6249Linking .openURL (url )
6350```
6451
65- ### ` getLatestVersion() `
52+ #### Options
53+
54+ | Option | Type | Default | Description |
55+ | --------| ------| ---------| -------------|
56+ | ` countryCode ` | ` string ` | device country | 2-letter ISO country code (iOS only, ignored on Android) |
57+
58+ ### ` VersionCheck.getLatestVersion(options?) `
6659
6760Fetches the latest version of this app available in the store. Queries the iTunes API on iOS and the Play Store on Android.
6861
6962``` ts
70- const latest = await getLatestVersion () // "1.3.0"
63+ const latest = await VersionCheck .getLatestVersion () // "1.3.0"
64+ const latestUS = await VersionCheck .getLatestVersion ({ countryCode: ' US' })
7165```
7266
73- ### ` needsUpdate(options?) `
67+ #### Options
68+
69+ | Option | Type | Default | Description |
70+ | --------| ------| ---------| -------------|
71+ | ` countryCode ` | ` string ` | device country | 2-letter ISO country code (iOS only, ignored on Android) |
72+
73+ ### ` VersionCheck.needsUpdate(options?) `
7474
7575Checks whether an app update is available using semantic version comparison.
7676
7777``` ts
7878// Any version increase
79- if (await needsUpdate ()) {
80- const url = await getStoreUrl ()
79+ if (await VersionCheck . needsUpdate ()) {
80+ const url = await VersionCheck . getStoreUrl ()
8181 Linking .openURL (url )
8282}
8383
8484// Only prompt for major updates (1.x → 2.x)
85- if (await needsUpdate ({ level: ' major' })) {
85+ if (await VersionCheck . needsUpdate ({ level: ' major' })) {
8686 // ...
8787}
8888```
@@ -97,16 +97,14 @@ if (await needsUpdate({ level: 'major' })) {
9797- ` "minor" ` — returns ` true ` for major or minor bumps
9898- ` "patch" ` — returns ` true ` for any version increase (default)
9999
100- ### ` compareVersions(v1, v2) `
100+ ### ` VersionCheck. compareVersions(v1, v2)`
101101
102- Compare two semver strings. Returns ` -1 ` , ` 0 ` , or ` 1 ` .
102+ Compare two semantic version strings. Returns ` -1 ` (first is older) , ` 0 ` (equal) , or ` 1 ` (first is newer) .
103103
104104``` ts
105- import { compareVersions } from ' react-native-nitro-version-check'
106-
107- compareVersions (' 1.0.0' , ' 1.0.1' ) // -1
108- compareVersions (' 2.0.0' , ' 2.0.0' ) // 0
109- compareVersions (' 3.0.0' , ' 2.9.9' ) // 1
105+ VersionCheck .compareVersions (' 1.0.0' , ' 1.0.1' ) // -1
106+ VersionCheck .compareVersions (' 2.0.0' , ' 2.0.0' ) // 0
107+ VersionCheck .compareVersions (' 3.0.0' , ' 2.9.9' ) // 1
110108```
111109
112110## Types
0 commit comments