From 964d66da74eb1d7ce9c7e3392852c6c7e5d2404f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A2=E4=BB=94=E7=B3=95?= Date: Sun, 12 Jan 2025 12:17:54 +0800 Subject: [PATCH] adapter for harmony (#464) * update hvigorfile.ts file * change versionName get logic * change post logic for harmony --- Example/harmony_use_pushy/harmony/entry/hvigorfile.ts | 4 ++-- src/client.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Example/harmony_use_pushy/harmony/entry/hvigorfile.ts b/Example/harmony_use_pushy/harmony/entry/hvigorfile.ts index 054a94b1..a1641ea7 100644 --- a/Example/harmony_use_pushy/harmony/entry/hvigorfile.ts +++ b/Example/harmony_use_pushy/harmony/entry/hvigorfile.ts @@ -14,11 +14,11 @@ export function generatePushyBuildTime(str?: string) { if (!fs.existsSync(dirPath)) { fs.mkdirSync(dirPath, { recursive: true }); } - const moduleJsonPath = path.resolve(__dirname, './oh-package.json5'); + const moduleJsonPath = path.resolve(__dirname, '../AppScope/app.json5'); let versionName = ''; if (fs.existsSync(moduleJsonPath)) { const moduleContent = fs.readFileSync(moduleJsonPath, 'utf-8'); - const versionMatch = moduleContent.match(/"version":\s*"([^"]+)"/); + const versionMatch = moduleContent.match(/"versionName":\s*"([^"]+)"/); if (versionMatch && versionMatch[1]) { versionName = versionMatch[1]; } diff --git a/src/client.ts b/src/client.ts index cbd1c16e..e1b3b04f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -205,7 +205,10 @@ export class Pushy { // @ts-ignore delete fetchBody.buildTime; } - const body = JSON.stringify(fetchBody); + let body = JSON.stringify(fetchBody); + if (Platform.OS === 'harmony') { + body = fetchBody; + } const fetchPayload = { method: 'POST', headers: {