mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-11-01 22:03:10 +08:00
feat: add afterDownloadUpdate
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update",
|
"name": "react-native-update",
|
||||||
"version": "10.26.4",
|
"version": "10.27.0",
|
||||||
"description": "react-native hot update",
|
"description": "react-native hot update",
|
||||||
"main": "src/index",
|
"main": "src/index",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -100,6 +100,14 @@ export const UpdateProvider = ({
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
stateListener.current && stateListener.current.remove();
|
stateListener.current && stateListener.current.remove();
|
||||||
|
|
||||||
|
if (
|
||||||
|
options.afterDownloadUpdate &&
|
||||||
|
(await options.afterDownloadUpdate(info)) === false
|
||||||
|
) {
|
||||||
|
log('afterDownloadUpdate returned false, skipping');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (options.updateStrategy === 'silentAndNow') {
|
if (options.updateStrategy === 'silentAndNow') {
|
||||||
client.switchVersion(hash);
|
client.switchVersion(hash);
|
||||||
return true;
|
return true;
|
||||||
@@ -134,6 +142,7 @@ export const UpdateProvider = ({
|
|||||||
[
|
[
|
||||||
client,
|
client,
|
||||||
options.updateStrategy,
|
options.updateStrategy,
|
||||||
|
options.afterDownloadUpdate,
|
||||||
alertUpdate,
|
alertUpdate,
|
||||||
alertError,
|
alertError,
|
||||||
throwErrorIfEnabled,
|
throwErrorIfEnabled,
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ export interface ClientOptions {
|
|||||||
throwError?: boolean;
|
throwError?: boolean;
|
||||||
beforeCheckUpdate?: () => Promise<boolean>;
|
beforeCheckUpdate?: () => Promise<boolean>;
|
||||||
beforeDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
|
beforeDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
|
||||||
|
afterDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateTestPayload {
|
export interface UpdateTestPayload {
|
||||||
|
|||||||
Reference in New Issue
Block a user