From 1da3c7df17640ddb8f576625b45ce23e148f87cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=B5=B7?= Date: Wed, 20 Jul 2022 10:52:44 +0000 Subject: [PATCH 1/6] =?UTF-8?q?Signed-off-by:=20=E6=B1=9F=E6=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extend/systemplugin/napi/ohos_update.js | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js index d78eeb32..cc209a65 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ b/runtime/main/extend/systemplugin/napi/ohos_update.js @@ -246,6 +246,16 @@ export function mockUpdate() { UpgradeStatus, EventClassify, EventId, + UpgradeInfo, + BusinessType, + DownloadOptions, + ResumeDownloadOptions, + PauseDownloadOptions, + UpgradeOptions, + ClearOptions, + EventClassifyInfo, + UpgradeFile, + UpgradeTaskCallback, getOnlineUpdater: function (...args) { console.warn("update.getOnlineUpdater interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") @@ -271,7 +281,6 @@ const BusinessVendor = { const BusinessSubType = { FIRMWARE: 1, - PARAM: 2, } const ComponentType = { @@ -413,3 +422,48 @@ const EventInfo = { eventId: EventId.EVENT_TASK_RECEIVE, taskBody: TaskBody, } + +const UpgradeInfo = { + upgradeApp: "com.ohos.ota.updateclient", + businessType: BusinessType +} + +const BusinessType = { + vendor: BusinessVendor, + subType: BusinessSubType +} + +const DownloadOptions = { + allowNetwork: NetType, + order: Order +} + +const ResumeDownloadOptions = { + allowNetwork: NetType +} + +const PauseDownloadOptions = { + isAllowAutoResume: boolean +} + +const UpgradeOptions = { + order: Order +} + +const ClearOptions = { + status: UpgradeStatus +} + +const EventClassifyInfo = { + eventClassify: EventClassify, + extraInfo: string +} + +const UpgradeFile = { + fileType: ComponentType, + filePath: string +} + +const UpgradeTaskCallback = { + UpgradeTaskCallback: (eventInfo) => {} +} \ No newline at end of file From 885b2f6d63a6f2863d06867f8dbffc318f6039e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=B5=B7?= Date: Thu, 21 Jul 2022 02:10:47 +0000 Subject: [PATCH 2/6] =?UTF-8?q?Signed-off-by:=20=E6=B1=9F=E6=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/extend/systemplugin/napi/ohos_update.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js index cc209a65..3e388ff6 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ b/runtime/main/extend/systemplugin/napi/ohos_update.js @@ -142,10 +142,10 @@ export function mockUpdate() { " Previewer may be different from that on a real device.") const len = args.length if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + args[len - 1].call(this, paramMock.businessErrorMock); } else { return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); + resolve(); }) } }, @@ -198,10 +198,10 @@ export function mockUpdate() { " works on the Previewer may be different from that on a real device.") const len = args.length if (len > 0 && typeof args[len - 1] === 'function') { - args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock); + args[len - 1].call(this, paramMock.businessErrorMock); } else { return new Promise((resolve, reject) => { - resolve(paramMock.paramNumberMock); + resolve(); }) } }, @@ -306,13 +306,17 @@ const DescriptionType = { const NetType = { CELLULAR: 1, METERED_WIFI: 2, - NOT_METERED_WIFI: 4, + NOT_METERED_WIFI = 4, + WIFI = 6, + CELLULAR_AND_WIFI = 7 } const Order = { DOWNLOAD: 1, INSTALL: 2, - APPLY: 4, + DOWNLOAD_AND_INSTALL = 3, + APPLY = 4, + INSTALL_AND_APPLY = 6 } const UpgradeStatus = { From 2908ef5e4701f7f1e46cd929accfbef1fd794f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=B5=B7?= Date: Thu, 21 Jul 2022 02:13:37 +0000 Subject: [PATCH 3/6] =?UTF-8?q?Signed-off-by:=20=E6=B1=9F=E6=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/main/extend/systemplugin/napi/ohos_update.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js index 3e388ff6..8059e0fe 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ b/runtime/main/extend/systemplugin/napi/ohos_update.js @@ -306,17 +306,17 @@ const DescriptionType = { const NetType = { CELLULAR: 1, METERED_WIFI: 2, - NOT_METERED_WIFI = 4, - WIFI = 6, - CELLULAR_AND_WIFI = 7 + NOT_METERED_WIFI: 4, + WIFI: 6, + CELLULAR_AND_WIFI: 7 } const Order = { DOWNLOAD: 1, INSTALL: 2, - DOWNLOAD_AND_INSTALL = 3, - APPLY = 4, - INSTALL_AND_APPLY = 6 + DOWNLOAD_AND_INSTALL: 3, + APPLY: 4, + INSTALL_AND_APPLY: 6 } const UpgradeStatus = { From ad3aa2a3f81c488262ffabfede49548de6a2cafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=B5=B7?= Date: Thu, 21 Jul 2022 03:41:08 +0000 Subject: [PATCH 4/6] =?UTF-8?q?Signed-off-by:=20=E6=B1=9F=E6=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extend/systemplugin/napi/ohos_update.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js index 8059e0fe..f052ee8d 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ b/runtime/main/extend/systemplugin/napi/ohos_update.js @@ -428,44 +428,44 @@ const EventInfo = { } const UpgradeInfo = { - upgradeApp: "com.ohos.ota.updateclient", + upgradeApp: "[PC Preview] unknown upgradeApp", businessType: BusinessType } const BusinessType = { vendor: BusinessVendor, - subType: BusinessSubType + subType: BusinessSubType.FIRMWARE } const DownloadOptions = { - allowNetwork: NetType, - order: Order + allowNetwork: NetType.CELLULAR, + order: Order.DOWNLOAD_AND_INSTALL } const ResumeDownloadOptions = { - allowNetwork: NetType + allowNetwork: NetType.CELLULAR } const PauseDownloadOptions = { - isAllowAutoResume: boolean + isAllowAutoResume: true } const UpgradeOptions = { - order: Order + order: Order.INSTALL } const ClearOptions = { - status: UpgradeStatus + status: UpgradeStatus.UPGRADE_SUCCESS } const EventClassifyInfo = { eventClassify: EventClassify, - extraInfo: string + extraInfo: "[PC Preview] unknown extraInfo" } const UpgradeFile = { - fileType: ComponentType, - filePath: string + fileType: ComponentType.OTA, + filePath: "[PC Preview] unknown filePath" } const UpgradeTaskCallback = { From 995a76a81f0597a5a6b90eddfdccc9d5ff954896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=B5=B7?= Date: Fri, 22 Jul 2022 09:38:06 +0000 Subject: [PATCH 5/6] =?UTF-8?q?Signed-off-by:=20=E6=B1=9F=E6=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/extend/systemplugin/napi/ohos_update.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js index f052ee8d..c5a40d7e 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ b/runtime/main/extend/systemplugin/napi/ohos_update.js @@ -434,16 +434,16 @@ const UpgradeInfo = { const BusinessType = { vendor: BusinessVendor, - subType: BusinessSubType.FIRMWARE + subType: BusinessSubType } const DownloadOptions = { - allowNetwork: NetType.CELLULAR, - order: Order.DOWNLOAD_AND_INSTALL + allowNetwork: NetType, + order: Order } const ResumeDownloadOptions = { - allowNetwork: NetType.CELLULAR + allowNetwork: NetType } const PauseDownloadOptions = { @@ -451,11 +451,11 @@ const PauseDownloadOptions = { } const UpgradeOptions = { - order: Order.INSTALL + order: Order } const ClearOptions = { - status: UpgradeStatus.UPGRADE_SUCCESS + status: UpgradeStatus } const EventClassifyInfo = { @@ -464,7 +464,7 @@ const EventClassifyInfo = { } const UpgradeFile = { - fileType: ComponentType.OTA, + fileType: ComponentType, filePath: "[PC Preview] unknown filePath" } From 98537bd4182ca240d50cc77a3fb25cbaf67d83f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=B5=B7?= Date: Fri, 22 Jul 2022 09:49:40 +0000 Subject: [PATCH 6/6] =?UTF-8?q?Signed-off-by:=20=E6=B1=9F=E6=B5=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/main/extend/systemplugin/napi/ohos_update.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_update.js b/runtime/main/extend/systemplugin/napi/ohos_update.js index c5a40d7e..deba644b 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_update.js +++ b/runtime/main/extend/systemplugin/napi/ohos_update.js @@ -255,7 +255,6 @@ export function mockUpdate() { ClearOptions, EventClassifyInfo, UpgradeFile, - UpgradeTaskCallback, getOnlineUpdater: function (...args) { console.warn("update.getOnlineUpdater interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") @@ -466,8 +465,4 @@ const EventClassifyInfo = { const UpgradeFile = { fileType: ComponentType, filePath: "[PC Preview] unknown filePath" -} - -const UpgradeTaskCallback = { - UpgradeTaskCallback: (eventInfo) => {} } \ No newline at end of file