react-native-update 10.2.2 → 10.2.4
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/package.json +1 -1
- package/src/client.tsx +6 -6
- package/src/provider.tsx +4 -0
package/package.json
CHANGED
package/src/client.tsx
CHANGED
|
@@ -38,7 +38,7 @@ export class Pushy {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
lastChecking: number;
|
|
41
|
-
|
|
41
|
+
lastRespJson?: Promise<any>;
|
|
42
42
|
|
|
43
43
|
progressHandlers: Record<string, EmitterSubscription> = {};
|
|
44
44
|
downloadedHash: string;
|
|
@@ -139,11 +139,11 @@ export class Pushy {
|
|
|
139
139
|
assertRelease();
|
|
140
140
|
const now = Date.now();
|
|
141
141
|
if (
|
|
142
|
-
this.
|
|
142
|
+
this.lastRespJson &&
|
|
143
143
|
this.lastChecking &&
|
|
144
144
|
now - this.lastChecking < 1000 * 5
|
|
145
145
|
) {
|
|
146
|
-
return this.
|
|
146
|
+
return await this.lastRespJson;
|
|
147
147
|
}
|
|
148
148
|
this.lastChecking = now;
|
|
149
149
|
this.report({ type: 'checking' });
|
|
@@ -184,11 +184,11 @@ export class Pushy {
|
|
|
184
184
|
type: 'errorChecking',
|
|
185
185
|
message: 'Can not connect to update server. Please check your network.',
|
|
186
186
|
});
|
|
187
|
-
return this.
|
|
187
|
+
return this.lastRespJson ? await this.lastRespJson : empty;
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
this.lastRespJson = resp.json();
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
const result: CheckResult = await this.lastRespJson;
|
|
192
192
|
|
|
193
193
|
if (resp.status !== 200) {
|
|
194
194
|
this.report({
|
package/src/provider.tsx
CHANGED
|
@@ -148,6 +148,10 @@ export const PushyProvider = ({
|
|
|
148
148
|
const markSuccess = client.markSuccess;
|
|
149
149
|
|
|
150
150
|
useEffect(() => {
|
|
151
|
+
if (__DEV__) {
|
|
152
|
+
console.info('检测到在DEV环境,不会进行热更新检查');
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
151
155
|
const { strategy, dismissErrorAfter, autoMarkSuccess } = options;
|
|
152
156
|
if (isFirstTime && autoMarkSuccess) {
|
|
153
157
|
markSuccess();
|