You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -11,29 +11,38 @@ This library gets the latest app version by parsing google play store, apple app
11
11
Parsing code is referenced from [here](http://itmir.tistory.com/524)
12
12
13
13
### Looking for maintainers!
14
+
14
15
I have almost zero experience in ios development, and I am no longer working on mobile app development(doing backend and devops works mainly and some web frontend). It makes it hard to maintain this library actively. Hope to have someone to help maintaining react-native-version-check!
15
16
16
17
### expo
18
+
17
19
react-native-version-check supports [expo](https://expo.io)! with [react-native-version-check-expo](https://www.npmjs.com/package/react-native-version-check-expo)
VersionCheck.getLatestVersion() // Automatically choose profer provider using `Platform.select` by device platform.
142
+
VersionCheck.getLatestVersion() // Automatically choose profer provider using `Platform.select` by device platform.
127
143
.then(latestVersion=> {
128
-
console.log(latestVersion); // 0.1.2
144
+
console.log(latestVersion); // 0.1.2
129
145
});
130
146
131
147
VersionCheck.getLatestVersion({
132
148
forceUpdate:true,
133
-
provider: () =>fetch('http://your.own/api')
134
-
.then(r=>r.json())
135
-
.then(({version}) => version), // You can get latest version from your own api.
136
-
}).then(latestVersion=>{
149
+
provider: () =>
150
+
fetch('http://your.own/api')
151
+
.then(r=>r.json())
152
+
.then(({ version }) => version), // You can get latest version from your own api.
153
+
}).then(latestVersion=> {
137
154
console.log(latestVersion);
138
155
});
139
156
140
-
VersionCheck.needUpdate()
141
-
.then(asyncres=> {
142
-
console.log(res.isNeeded); // true
143
-
if (res.isNeeded) {
144
-
Linking.openURL(res.storeUrl); // open store if update is needed.
145
-
}
146
-
});
157
+
VersionCheck.needUpdate().then(asyncres=> {
158
+
console.log(res.isNeeded); // true
159
+
if (res.isNeeded) {
160
+
Linking.openURL(res.storeUrl); // open store if update is needed.
161
+
}
162
+
});
147
163
148
164
VersionCheck.needUpdate({
149
-
depth:2
165
+
depth:2,
150
166
}).then(res=> {
151
167
console.log(res.isNeeded);
152
168
// false; because first two fields of current and the latest versions are the same as "0.1".
153
169
});
154
170
155
171
VersionCheck.needUpdate({
156
-
currentVersion:"1.0",
157
-
latestVersion:"2.0"
172
+
currentVersion:'1.0',
173
+
latestVersion:'2.0',
158
174
}).then(res=> {
159
-
console.log(res.isNeeded); // true
175
+
console.log(res.isNeeded); // true
160
176
});
161
177
162
178
VersionCheck.needUpdate({
163
179
depth:1,
164
-
currentVersion:"2.1",
165
-
latestVersion:"2.0",
180
+
currentVersion:'2.1',
181
+
latestVersion:'2.0',
166
182
}).then(res=> {
167
-
console.log(res.isNeeded); // false
183
+
console.log(res.isNeeded); // false
168
184
});
169
-
170
185
```
171
186
172
187
## Methods
@@ -176,58 +191,61 @@ VersionCheck.needUpdate({
176
191
- <aname="getCurrentBuildNumber"href="#getCurrentBuildNumber">#</a>**`getCurrentBuildNumber()`**_(buildNumber: Number)_ - Returns current app build number.
177
192
- <aname="getStoreUrl"href="#getStoreUrl">#</a>**`getStoreUrl([option: Object])`**_(Promise<storeUrl: String>)_ - Returns url of Play Market or App Store of app.
178
193
- <aname="getAppStoreUrl"href="#getAppStoreUrl">#</a>**`getAppStoreUrl([option: Object])`**_(Promise<storeUrl: String>)_ - Returns url of App Store of app.
194
+
179
195
- Option
180
196
181
-
Field | Type | Default
182
-
--- | --- | ---
183
-
appID | _string_ | App ID
184
-
ignoreErrors | _boolean_ | true
197
+
| Field | Type | Default |
198
+
| ------------ | --------- | ------- |
199
+
| appID |_string_| App ID |
200
+
| ignoreErrors |_boolean_| true |
201
+
185
202
- <aname="getPlayStoreUrl"href="#getPlayStoreUrl">#</a>**`getPlayStoreUrl([option: Object])`**_(Promise<storeUrl: String>)_ - Returns url of Play Store of app.
203
+
186
204
- Option
187
205
188
-
Field | Type | Default
189
-
--- | --- | ---
190
-
packageName | _string_ | Package Name
191
-
ignoreErrors | _boolean_ | true
206
+
|Field | Type | Default|
207
+
|------------| ---------| ------------ |
208
+
|packageName |_string_| Package Name|
209
+
|ignoreErrors |_boolean_| true|
192
210
193
211
- <aname="getCurrentVersion"href="#getCurrentVersion">#</a>**`getCurrentVersion()`**_(currentVersion: String)_ - Returns current app version.
194
212
- <aname="getLatestVersion"href="#getLatestVersion">#</a>**`getLatestVersion([option: Object])`**_(Promise<latestVersion: String>)_ - Returns the latest app version parsed from url. Returns `null` when parsing error occurs.
213
+
195
214
- Option
196
215
197
-
Field | Type | Default
198
-
--- | --- | ---
199
-
forceUpdate | _boolean_ | ```false```
200
-
provider | _string_ or _function_ | provider name or function that returns promise or value of the latest version
- <aname="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.
224
+
205
225
- Option
206
226
207
-
Field | Type | Default
208
-
--- | --- | ---
209
-
currentVersion | _string_ | app's current version from [getCurrentVersion()](#getCurrentVersion)
210
-
latestVersion | _string_ | app's latest version from [getLatestVersion()](#getLatestVersion)
211
-
depth | _number_ | ```Infinity```
212
-
forceUpdate | _boolean_ | ```false```
213
-
provider | _string_ or _function_ | provider name or function that returns promise or value of the latest version
Copy file name to clipboardExpand all lines: packages/react-native-version-check-expo/README.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,11 @@
9
9
> A version checker for expo(react-native) applications
10
10
11
11
### Looking for maintainers!
12
+
12
13
I have almost zero experience in ios development, and I am no longer working on mobile app development(doing backend and devops works mainly and some web frontend). It makes me hard to maintain this library actively. Hope to have someone to help maintaining react-native-version-check!
Copy file name to clipboardExpand all lines: packages/react-native-version-check/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@
9
9
> A version checker for react-native applications
10
10
11
11
### Looking for maintainers!
12
+
12
13
I have almost zero experience in ios development, and I am no longer working on mobile app development(doing backend and devops works mainly and some web frontend). It makes me hard to maintain this library actively. Hope to have someone to help maintaining react-native-version-check!
0 commit comments