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

v10.0.0-beta.2

This commit is contained in:
sunnylqm
2024-01-25 22:07:01 +08:00
parent 296498e20a
commit 05e5c5a1a7
11 changed files with 67 additions and 72 deletions

View File

@@ -45,19 +45,19 @@ export const PushyProvider = ({
);
const switchVersion = useCallback(() => {
if (updateInfo && 'hash' in updateInfo) {
if (updateInfo && updateInfo.hash) {
client.switchVersion(updateInfo.hash);
}
}, [client, updateInfo]);
const switchVersionLater = useCallback(() => {
if (updateInfo && 'hash' in updateInfo) {
if (updateInfo && updateInfo.hash) {
client.switchVersionLater(updateInfo.hash);
}
}, [client, updateInfo]);
const downloadUpdate = useCallback(async () => {
if (!updateInfo || !('update' in updateInfo)) {
if (!updateInfo || !updateInfo.update) {
return;
}
try {
@@ -98,7 +98,7 @@ export const PushyProvider = ({
return;
}
setUpdateInfo(info);
if ('expired' in info) {
if (info.expired) {
const { downloadUrl } = info;
showAlert('提示', '您的应用版本已更新,点击更新下载安装新版本', [
{
@@ -114,7 +114,7 @@ export const PushyProvider = ({
},
},
]);
} else if ('update' in info) {
} else if (info.update) {
showAlert(
'提示',
'检查到新的版本' + info.name + ',是否下载?\n' + info.description,