1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-17 20:26:09 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Compare commits

..

12 Commits

Author SHA1 Message Date
sunnylqm
80b0401b02 v7.3.4 2021-11-04 17:53:05 +08:00
sunnylqm
786d32d92f Fix simpleUpdate 2021-11-04 17:52:30 +08:00
sunnylqm
27327dbe12 v7.3.3 2021-11-04 16:40:35 +08:00
sunnylqm
96a81cc36d Improve download exception handling 2021-11-04 16:39:50 +08:00
sunnylqm
0aa063c584 v7.3.2 2021-11-04 16:36:06 +08:00
sunnylqm
4d72d49fe4 Chech downloaded hash 2021-11-04 16:35:34 +08:00
sunnylqm
53d07406ef v7.3.1 2021-10-30 14:56:58 +08:00
sunnylqm
d0804cfe15 Fix rolledBackVersion 2021-10-30 14:56:23 +08:00
sunnylqm
35939286d0 v7.3.0 2021-10-29 13:03:34 +08:00
sunnylqm
f49ce30cef Fix assertHash 2021-10-29 13:02:49 +08:00
sunnylqm
e6cd25a2d8 v7.2.0 2021-10-24 16:19:48 +08:00
sunnylqm
0cc96ee59c Add error report 2021-10-24 16:19:17 +08:00
4 changed files with 38 additions and 18 deletions

View File

@@ -68,6 +68,9 @@ export default class App extends Component {
});
},
});
if (!hash) {
return;
}
Alert.alert('提示', '下载完毕,是否重启应用?', [
{
text: '是',

View File

@@ -175,8 +175,8 @@ export async function downloadUpdate(options, eventListeners) {
if (!options.update) {
return;
}
if (rolledbackVersion === options.hash) {
logger(`rolledback hash ${rolledbackVersion}, ignored`);
if (rolledBackVersion === options.hash) {
logger(`rolledback hash ${rolledBackVersion}, ignored`);
return;
}
if (downloadedHash === options.hash) {
@@ -218,19 +218,30 @@ export async function downloadUpdate(options, eventListeners) {
originHash: currentVersion,
});
} catch (e) {
logger(e.message);
logger('diff error, try pdiff');
logger(`diff error: ${e.message}, try pdiff`);
try {
await Pushy.downloadPatchFromPackage({
updateUrl: options.pdiffUrl,
hash: options.hash,
});
} catch (e) {
progressHandler && progressHandler.remove();
report(options.hash, 'error');
throw e;
}
}
} else if (options.pdiffUrl) {
logger('downloading pdiff');
try {
await Pushy.downloadPatchFromPackage({
updateUrl: options.pdiffUrl,
hash: options.hash,
});
} catch (e) {
progressHandler && progressHandler.remove();
report(options.hash, 'error');
throw e;
}
} else if (options.pdiffUrl) {
logger('downloading pdiff');
await Pushy.downloadPatchFromPackage({
updateUrl: options.pdiffUrl,
hash: options.hash,
});
}
setLocalHashInfo(options.hash, {
name: options.name,
@@ -257,20 +268,23 @@ function assertHash(hash) {
return;
}
readyHash = hash;
return true;
}
export function switchVersion(hash) {
assertRelease();
assertHash(hash);
logger('switchVersion: ' + hash);
Pushy.reloadUpdate({ hash });
if (assertHash(hash)) {
logger('switchVersion: ' + hash);
Pushy.reloadUpdate({ hash });
}
}
export function switchVersionLater(hash) {
assertRelease();
assertHash(hash);
logger('switchVersionLater: ' + hash);
Pushy.setNeedUpdate({ hash });
if (assertHash(hash)) {
logger('switchVersionLater: ' + hash);
Pushy.setNeedUpdate({ hash });
}
}
let marked = false;

View File

@@ -41,6 +41,9 @@ export function simpleUpdate(WrappedComponent) {
doUpdate = async (info) => {
try {
const hash = await downloadUpdate(info);
if (!hash) {
return;
}
this.stateListener.remove();
Alert.alert('提示', '下载完毕,是否立即更新?', [
{
@@ -91,7 +94,7 @@ export function simpleUpdate(WrappedComponent) {
},
},
]);
} else {
} else if (info.update) {
Alert.alert(
'提示',
'检查到新的版本' + info.name + ',是否下载?\n' + info.description,

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "7.1.0",
"version": "7.3.4",
"description": "react-native hot update",
"main": "lib/index.js",
"scripts": {