react-native-update 9.0.2 → 9.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/main.ts CHANGED
@@ -132,12 +132,12 @@ function assertRelease() {
132
132
  }
133
133
 
134
134
  let lastChecking = Date.now();
135
- let lastResult:CheckResult;
135
+ let lastResult: CheckResult = {};
136
136
  export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
137
137
  assertRelease();
138
138
  const now = Date.now();
139
139
  if (lastResult && now - lastChecking < 1000 * 60) {
140
- logger('repeated checking, ignored');
140
+ // logger('repeated checking, ignored');
141
141
  return lastResult;
142
142
  }
143
143
  lastChecking = now;
@@ -148,7 +148,7 @@ export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
148
148
  blockUpdate.until * 1000,
149
149
  ).toLocaleString()}"之后重试。`,
150
150
  });
151
- return;
151
+ return lastResult;
152
152
  }
153
153
  report({ type: 'checking' });
154
154
  let resp;
@@ -172,12 +172,13 @@ export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
172
172
  type: 'errorChecking',
173
173
  message: '无法连接更新服务器,请检查网络连接后重试',
174
174
  });
175
- return;
175
+ return lastResult;
176
176
  }
177
177
  await tryBackupEndpoints();
178
178
  return checkUpdate(APPKEY, true);
179
179
  }
180
180
  const result: CheckResult = await resp.json();
181
+
181
182
  lastResult = result;
182
183
  // @ts-ignore
183
184
  checkOperation(result.op);
@@ -188,7 +189,7 @@ export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
188
189
  //@ts-ignore
189
190
  message: result.message,
190
191
  });
191
- return;
192
+ return lastResult;
192
193
  }
193
194
 
194
195
  return result;
package/lib/type.ts CHANGED
@@ -26,7 +26,8 @@ export interface UpdateAvailableResult {
26
26
  export type CheckResult =
27
27
  | ExpiredResult
28
28
  | UpTodateResult
29
- | UpdateAvailableResult;
29
+ | UpdateAvailableResult
30
+ | {};
30
31
 
31
32
  export interface ProgressData {
32
33
  hash: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "9.0.2",
3
+ "version": "9.0.3",
4
4
  "description": "react-native hot update",
5
5
  "main": "lib/index.ts",
6
6
  "scripts": {