feat: extra param for checkupdate
This commit is contained in:
parent
54036c0f16
commit
a5893d8022
@ -150,7 +150,7 @@ export class Pushy {
|
||||
PushyModule.setNeedUpdate({ hash });
|
||||
}
|
||||
};
|
||||
checkUpdate = async () => {
|
||||
checkUpdate = async (extra?: Record<string, any>) => {
|
||||
if (__DEV__ && !this.options.debug) {
|
||||
console.info(
|
||||
'您当前处于开发环境且未启用 debug,不会进行热更检查。如需在开发环境中调试热更,请在 client 中设置 debug 为 true',
|
||||
@ -176,6 +176,7 @@ export class Pushy {
|
||||
hash: currentVersion,
|
||||
buildTime,
|
||||
cInfo,
|
||||
...extra,
|
||||
};
|
||||
if (__DEV__) {
|
||||
delete fetchBody.buildTime;
|
||||
|
@ -145,7 +145,8 @@ export const PushyProvider = ({
|
||||
[client],
|
||||
);
|
||||
|
||||
const checkUpdate = useCallback(async () => {
|
||||
const checkUpdate = useCallback(
|
||||
async (extra?: Record<string, any>) => {
|
||||
const now = Date.now();
|
||||
if (lastChecking.current && now - lastChecking.current < 1000) {
|
||||
return;
|
||||
@ -153,7 +154,7 @@ export const PushyProvider = ({
|
||||
lastChecking.current = now;
|
||||
let info: CheckResult;
|
||||
try {
|
||||
info = await client.checkUpdate();
|
||||
info = await client.checkUpdate(extra);
|
||||
} catch (e: any) {
|
||||
setLastError(e);
|
||||
alertError('更新检查失败', e.message);
|
||||
@ -211,7 +212,8 @@ export const PushyProvider = ({
|
||||
],
|
||||
);
|
||||
}
|
||||
}, [
|
||||
},
|
||||
[
|
||||
client,
|
||||
alertError,
|
||||
throwErrorIfEnabled,
|
||||
@ -219,7 +221,8 @@ export const PushyProvider = ({
|
||||
alertUpdate,
|
||||
downloadAndInstallApk,
|
||||
downloadUpdate,
|
||||
]);
|
||||
],
|
||||
);
|
||||
|
||||
const markSuccess = client.markSuccess;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user