mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-17 23:56:11 +08:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
80b0401b02 | ||
![]() |
786d32d92f | ||
![]() |
27327dbe12 | ||
![]() |
96a81cc36d | ||
![]() |
0aa063c584 | ||
![]() |
4d72d49fe4 | ||
![]() |
53d07406ef | ||
![]() |
d0804cfe15 | ||
![]() |
35939286d0 | ||
![]() |
f49ce30cef |
@@ -68,6 +68,9 @@ export default class App extends Component {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
if (!hash) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Alert.alert('提示', '下载完毕,是否重启应用?', [
|
Alert.alert('提示', '下载完毕,是否重启应用?', [
|
||||||
{
|
{
|
||||||
text: '是',
|
text: '是',
|
||||||
|
15
lib/main.js
15
lib/main.js
@@ -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;
|
||||||
|
@@ -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,
|
||||||
|
@@ -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": {
|
||||||
|
Reference in New Issue
Block a user