From 1c1b040598db66ad8819763becf31f987c5a133f Mon Sep 17 00:00:00 2001 From: wangkai Date: Thu, 14 Jul 2022 16:25:39 +0800 Subject: [PATCH 1/4] api mock change Signed-off-by: wangkai --- .../napi/ohos_data_distributedData.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js b/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js index c01860f7..290d1c7e 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js +++ b/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js @@ -229,6 +229,21 @@ export function mockDistributedData() { S4: 6, }, +<<<<<<< HEAD +======= + SyncMode: { + PULL_ONLY: 0, + PUSH_ONLY: 1, + PUSH_PULL: 2, + }, + + SubscribeType: { + SUBSCRIBE_TYPE_LOCAL: 0, + SUBSCRIBE_TYPE_REMOTE: 1, + SUBSCRIBE_TYPE_ALL: 2, + }, + +>>>>>>> 21b6c42... api mock change createKVManager: function (...args) { console.warn("distributedData.createKVManager interface mocked in the Previewer." + " How this interface works on the Previewer may be different from that on a real device.") @@ -262,6 +277,17 @@ export function mockDistributedData() { MAX_QUERY_LENGTH: "[PC Preview] unknown MAX_QUERY_LENGTH", MAX_BATCH_SIZE: "[PC Preview] unknown MAX_BATCH_SIZE" }; + const schemaMock = { + root: "[PC Preview] unknown root", + indexes: "[PC Preview] unknown indexes", + mode: "[PC Preview] unknown mode", + skip: "[PC Preview] unknown skip" + }; + const fieldnodeMock = { + default: "[PC Preview] unknown default", + nullable: "[PC Preview] unknown nullable", + type: "[PC Preview] unknown type" + }; const valueTypeMock = { STRING: "[PC Preview] unknown STRING", INTEGER: "[PC Preview] unknown INTEGER", @@ -302,6 +328,7 @@ export function mockDistributedData() { autoSync: "[PC Preview] unknown autoSync", kvStoreType: "[PC Preview] unknown kvStoreType", securityLevel: "[PC Preview] unknown securityLevel", + schema : "[PC Preview] unknown schema" }; const KVStoreClass = class KVStore { From 63317ec11367653afa6cec2c0db3ff6fce37254f Mon Sep 17 00:00:00 2001 From: wangkai Date: Fri, 15 Jul 2022 10:13:50 +0800 Subject: [PATCH 2/4] =?UTF-8?q?api=E5=88=86=E6=94=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangkai --- .../systemplugin/napi/ohos_data_distributedData.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js b/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js index 290d1c7e..fa3b0545 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js +++ b/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js @@ -229,8 +229,6 @@ export function mockDistributedData() { S4: 6, }, -<<<<<<< HEAD -======= SyncMode: { PULL_ONLY: 0, PUSH_ONLY: 1, @@ -243,7 +241,6 @@ export function mockDistributedData() { SUBSCRIBE_TYPE_ALL: 2, }, ->>>>>>> 21b6c42... api mock change createKVManager: function (...args) { console.warn("distributedData.createKVManager interface mocked in the Previewer." + " How this interface works on the Previewer may be different from that on a real device.") @@ -310,17 +307,6 @@ export function mockDistributedData() { deleteEntries: new Array(entryMock), deviceId: "[PC Preview] unknown deviceId" }; - const syncModeMock = { - PULL_ONLY: "[PC Preview] unknown PULL_ONLY", - PUSH_ONLY: "[PC Preview] unknown PUSH_ONLY", - PUSH_PULL: "[PC Preview] unknown PUSH_PULL" - }; - const subscribeTypeMock = { - SUBSCRIBE_TYPE_LOCAL: "[PC Preview] unknown SUBSCRIBE_TYPE_LOCAL", - SUBSCRIBE_TYPE_REMOTE: "[PC Preview] unknown SUBSCRIBE_TYPE_REMOTE", - SUBSCRIBE_TYPE_ALL: "[PC Preview] unknown SUBSCRIBE_TYPE_ALL" - }; - const optionsMock = { createIfMissing: "[PC Preview] unknown createIfMissing", encrypt: "[PC Preview] unknown encrypt", From 6ace312bd008e7ab076702a17c95cf615be57e86 Mon Sep 17 00:00:00 2001 From: wangkai Date: Fri, 15 Jul 2022 15:29:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?apimock=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangkai --- .../extend/systemplugin/napi/ohos_data_distributedData.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js b/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js index fa3b0545..7f8b3d9e 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js +++ b/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js @@ -367,6 +367,9 @@ export function mockDistributedData() { if (typeof args[len - 1] === 'function') { if (args[0] == 'dataChange') { args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) + } else if (args[0] === 'syncComplete') { + var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); + args[len - 1].call(this, array); } } }; @@ -378,6 +381,9 @@ export function mockDistributedData() { if (typeof args[len - 1] === 'function') { if (args[0] == 'dataChange') { args[len - 1].call(this, paramMock.businessErrorMock, changeNotificationMock) + } else if (args[0] === 'syncComplete') { + var array = new Array([paramMock.paramStringMock, paramMock.paramNumberMock]); + args[len - 1].call(this, array); } } }; From d68ec1ea1575b92834264159650bf156ffe5d081 Mon Sep 17 00:00:00 2001 From: wangkai Date: Fri, 15 Jul 2022 16:43:09 +0800 Subject: [PATCH 4/4] api mock Signed-off-by: wangkai --- .../main/extend/systemplugin/napi/ohos_data_distributedData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js b/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js index 7f8b3d9e..09b1b3e4 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js +++ b/runtime/main/extend/systemplugin/napi/ohos_data_distributedData.js @@ -314,7 +314,7 @@ export function mockDistributedData() { autoSync: "[PC Preview] unknown autoSync", kvStoreType: "[PC Preview] unknown kvStoreType", securityLevel: "[PC Preview] unknown securityLevel", - schema : "[PC Preview] unknown schema" + schema: "[PC Preview] unknown schema" }; const KVStoreClass = class KVStore {