react-native-update 10.29.0-beta.0 → 10.29.0-beta.2
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.ts +45 -30
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -394,26 +394,30 @@ export class Pushy {
|
|
|
394
394
|
this.report({ type: 'downloading' });
|
|
395
395
|
let lastError: any;
|
|
396
396
|
let errorMessages: string[] = [];
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
397
|
+
const diffUrl = await testUrls(joinUrls(paths, diff));
|
|
398
|
+
if (diffUrl) {
|
|
399
|
+
log('downloading diff');
|
|
400
|
+
try {
|
|
401
|
+
await PushyModule.downloadPatchFromPpk({
|
|
402
|
+
updateUrl: diffUrl,
|
|
403
|
+
hash,
|
|
404
|
+
originHash: currentVersion,
|
|
405
|
+
});
|
|
406
|
+
succeeded = 'diff';
|
|
407
|
+
} catch (e: any) {
|
|
408
|
+
const errorMessage = `diff error: ${e.message}`;
|
|
409
|
+
errorMessages.push(errorMessage);
|
|
410
|
+
lastError = new Error(errorMessage);
|
|
411
|
+
if (__DEV__) {
|
|
407
412
|
succeeded = 'diff';
|
|
408
|
-
}
|
|
409
|
-
const errorMessage = `diff error: ${e.message}`;
|
|
410
|
-
errorMessages.push(errorMessage);
|
|
411
|
-
lastError = new Error(errorMessage);
|
|
413
|
+
} else {
|
|
412
414
|
log(errorMessage);
|
|
413
415
|
}
|
|
414
416
|
}
|
|
417
|
+
}
|
|
418
|
+
if (!succeeded) {
|
|
415
419
|
const pdiffUrl = await testUrls(joinUrls(paths, pdiff));
|
|
416
|
-
if (
|
|
420
|
+
if (pdiffUrl) {
|
|
417
421
|
log('downloading pdiff');
|
|
418
422
|
try {
|
|
419
423
|
await PushyModule.downloadPatchFromPackage({
|
|
@@ -425,24 +429,35 @@ export class Pushy {
|
|
|
425
429
|
const errorMessage = `pdiff error: ${e.message}`;
|
|
426
430
|
errorMessages.push(errorMessage);
|
|
427
431
|
lastError = new Error(errorMessage);
|
|
428
|
-
|
|
432
|
+
if (__DEV__ && !full) {
|
|
433
|
+
succeeded = 'pdiff';
|
|
434
|
+
log('当前是开发环境,无法执行增量式热更新。如果需要在开发环境中测试全量热更新,请打开“忽略时间戳”开关再重试。');
|
|
435
|
+
} else {
|
|
436
|
+
log(errorMessage);
|
|
437
|
+
}
|
|
429
438
|
}
|
|
430
439
|
}
|
|
431
440
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
441
|
+
if (!succeeded) {
|
|
442
|
+
const fullUrl = await testUrls(joinUrls(paths, full));
|
|
443
|
+
if (fullUrl) {
|
|
444
|
+
log('downloading full patch');
|
|
445
|
+
try {
|
|
446
|
+
await PushyModule.downloadFullUpdate({
|
|
447
|
+
updateUrl: fullUrl,
|
|
448
|
+
hash,
|
|
449
|
+
});
|
|
450
|
+
succeeded = 'full';
|
|
451
|
+
} catch (e: any) {
|
|
452
|
+
const errorMessage = `full patch error: ${e.message}`;
|
|
453
|
+
errorMessages.push(errorMessage);
|
|
454
|
+
lastError = new Error(errorMessage);
|
|
455
|
+
if (__DEV__) {
|
|
456
|
+
succeeded = 'full';
|
|
457
|
+
} else {
|
|
458
|
+
log(errorMessage);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
446
461
|
}
|
|
447
462
|
}
|
|
448
463
|
if (sharedState.progressHandlers[hash]) {
|