1
0
Code Issues Pull Requests 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
No known key found for this signature in database

View File

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