From c5f458291ad1c3381f053b3fd121aaffeea491ac Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Fri, 22 Aug 2025 16:39:33 +0800 Subject: [PATCH] update welcome message in App component and add overridePackageVersion option to ClientOptions --- Example/testHotUpdate/src/index.tsx | 2 +- src/client.ts | 4 +++- src/type.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Example/testHotUpdate/src/index.tsx b/Example/testHotUpdate/src/index.tsx index e79a7ad..428bcde 100644 --- a/Example/testHotUpdate/src/index.tsx +++ b/Example/testHotUpdate/src/index.tsx @@ -52,7 +52,7 @@ function App() { return ( - 欢迎使用Pushy热更新服务 + 欢迎xxx使用Pushy热更新服务 {useDefaultAlert ? '当前使用' : '当前不使用'}默认的alert更新提示 diff --git a/src/client.ts b/src/client.ts index e1b9fd3..ba31fb8 100644 --- a/src/client.ts +++ b/src/client.ts @@ -148,6 +148,7 @@ export class Pushy { await this.loggerPromise.promise; const { logger = noop, appKey } = this.options; const info = await getCurrentVersionInfo(); + const overridePackageVersion = this.options.overridePackageVersion; logger({ type, data: { @@ -155,6 +156,7 @@ export class Pushy { currentVersion, cInfo, packageVersion, + overridePackageVersion, buildTime, message, ...info, @@ -233,7 +235,7 @@ export class Pushy { } this.lastChecking = now; const fetchBody = { - packageVersion, + packageVersion: this.options.overridePackageVersion || packageVersion, hash: currentVersion, buildTime, cInfo, diff --git a/src/type.ts b/src/type.ts index 52e4c5e..c0bb679 100644 --- a/src/type.ts +++ b/src/type.ts @@ -93,6 +93,7 @@ export interface ClientOptions { beforeDownloadUpdate?: (info: CheckResult) => Promise; afterDownloadUpdate?: (info: CheckResult) => Promise; onPackageExpired?: (info: CheckResult) => Promise; + overridePackageVersion?: string; } export interface UpdateTestPayload {