1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 10:01:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
sunnylqm
2024-07-27 16:54:24 +08:00
parent 11b383d10b
commit 7243512d3c

View File

@@ -270,21 +270,28 @@ export const PushyProvider = ({
} catch {
return false;
}
if (payload && payload.type) {
if (payload && payload.type && payload.type.startsWith('__rnPushy')) {
const logger = options.logger || (() => {});
options.logger = ({ type, data }) => {
logger({ type, data });
Alert.alert(type, JSON.stringify(data));
};
if (payload.type === '__rnPushyVersionHash') {
await checkUpdate({ toHash: payload.data });
if (updateInfoRef.current && updateInfoRef.current.upToDate) {
Alert.alert(
'提示',
'当前尚未检测到更新版本如果是首次扫码请等待服务器端生成补丁包后再试约10秒',
);
}
return true;
checkUpdate({ toHash: payload.data }).then(() => {
if (updateInfoRef.current && updateInfoRef.current.upToDate) {
Alert.alert(
'提示',
'当前尚未检测到更新版本如果是首次扫码请等待服务器端生成补丁包后再试约10秒',
);
}
options.logger = logger;
});
}
return true;
}
return false;
},
[checkUpdate],
[checkUpdate, options],
);
return (