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

feat: add afterDownloadUpdate

This commit is contained in:
sunnylqm
2025-03-20 18:45:51 +08:00
parent 90f6b7bcb3
commit 0019e9dd95
3 changed files with 11 additions and 1 deletions

View File

@@ -100,6 +100,14 @@ export const UpdateProvider = ({
return false;
}
stateListener.current && stateListener.current.remove();
if (
options.afterDownloadUpdate &&
(await options.afterDownloadUpdate(info)) === false
) {
log('afterDownloadUpdate returned false, skipping');
return false;
}
if (options.updateStrategy === 'silentAndNow') {
client.switchVersion(hash);
return true;
@@ -134,6 +142,7 @@ export const UpdateProvider = ({
[
client,
options.updateStrategy,
options.afterDownloadUpdate,
alertUpdate,
alertError,
throwErrorIfEnabled,

View File

@@ -88,6 +88,7 @@ export interface ClientOptions {
throwError?: boolean;
beforeCheckUpdate?: () => Promise<boolean>;
beforeDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
afterDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
}
export interface UpdateTestPayload {