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

Compare commits

..

10 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
4 changed files with 21 additions and 12 deletions

View File

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

View File

@@ -175,8 +175,8 @@ export async function downloadUpdate(options, eventListeners) {
if (!options.update) { if (!options.update) {
return; return;
} }
if (rolledbackVersion === options.hash) { if (rolledBackVersion === options.hash) {
logger(`rolledback hash ${rolledbackVersion}, ignored`); logger(`rolledback hash ${rolledBackVersion}, ignored`);
return; return;
} }
if (downloadedHash === options.hash) { if (downloadedHash === options.hash) {
@@ -227,7 +227,7 @@ export async function downloadUpdate(options, eventListeners) {
} catch (e) { } catch (e) {
progressHandler && progressHandler.remove(); progressHandler && progressHandler.remove();
report(options.hash, 'error'); report(options.hash, 'error');
return; throw e;
} }
} }
} else if (options.pdiffUrl) { } else if (options.pdiffUrl) {
@@ -240,7 +240,7 @@ export async function downloadUpdate(options, eventListeners) {
} catch (e) { } catch (e) {
progressHandler && progressHandler.remove(); progressHandler && progressHandler.remove();
report(options.hash, 'error'); report(options.hash, 'error');
return; throw e;
} }
} }
setLocalHashInfo(options.hash, { setLocalHashInfo(options.hash, {
@@ -268,20 +268,23 @@ function assertHash(hash) {
return; return;
} }
readyHash = hash; readyHash = hash;
return true;
} }
export function switchVersion(hash) { export function switchVersion(hash) {
assertRelease(); assertRelease();
assertHash(hash); if (assertHash(hash)) {
logger('switchVersion: ' + hash); logger('switchVersion: ' + hash);
Pushy.reloadUpdate({ hash }); Pushy.reloadUpdate({ hash });
}
} }
export function switchVersionLater(hash) { export function switchVersionLater(hash) {
assertRelease(); assertRelease();
assertHash(hash); if (assertHash(hash)) {
logger('switchVersionLater: ' + hash); logger('switchVersionLater: ' + hash);
Pushy.setNeedUpdate({ hash }); Pushy.setNeedUpdate({ hash });
}
} }
let marked = false; let marked = false;

View File

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

View File

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