From 4aaed48e2da03cfdb87ff6cd7d1dc1a1d96070e2 Mon Sep 17 00:00:00 2001 From: qhily999 Date: Mon, 13 Sep 2021 10:18:01 +0800 Subject: [PATCH 1/3] add visible attr Signed-off-by: qhily999 --- common/DistributeCalc/entry/src/main/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/DistributeCalc/entry/src/main/config.json b/common/DistributeCalc/entry/src/main/config.json index a5509bf233..59b1bc2c67 100644 --- a/common/DistributeCalc/entry/src/main/config.json +++ b/common/DistributeCalc/entry/src/main/config.json @@ -36,6 +36,7 @@ "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", + "visible": true, "type": "page", "launchType": "standard" } @@ -54,4 +55,4 @@ } ] } -} \ No newline at end of file +} -- Gitee From 52886bd331f612d18822beec701c0adf5dd3c980 Mon Sep 17 00:00:00 2001 From: qhily999 Date: Mon, 13 Sep 2021 15:57:51 +0800 Subject: [PATCH 2/3] modify dm parameters Signed-off-by: qhily999 --- .../js/default/common/RemoteDeviceModel.js | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/common/DistributeCalc/entry/src/main/js/default/common/RemoteDeviceModel.js b/common/DistributeCalc/entry/src/main/js/default/common/RemoteDeviceModel.js index 752fddc6b4..add00da8e0 100644 --- a/common/DistributeCalc/entry/src/main/js/default/common/RemoteDeviceModel.js +++ b/common/DistributeCalc/entry/src/main/js/default/common/RemoteDeviceModel.js @@ -23,11 +23,10 @@ export default class RemoteDeviceModel { callback; deviceManager_; - constructor() { - } + constructor() {} registerDeviceListCallback(callback) { - if (typeof (this.deviceManager_) == 'undefined') { + if (typeof(this.deviceManager_) == 'undefined') { console.log("Calc[RemoteDeviceModel] deviceManager.createDeviceManager begin"); let self = this; deviceManager.createDeviceManager("com.example.distributedcalc", (error, value) => { @@ -57,7 +56,7 @@ export default class RemoteDeviceModel { console.info('Calc[RemoteDeviceModel] getTrustedDeviceListSync begin'); var list = this.deviceManager_.getTrustedDeviceListSync(); console.info('Calc[RemoteDeviceModel] getTrustedDeviceListSync end, deviceList=' + JSON.stringify(list)); - if (typeof (list) != 'undefined' && typeof (list.length) != 'undefined') { + if (typeof(list) != 'undefined' && typeof(list.length) != 'undefined') { this.deviceList = list; } this.callback(); @@ -110,10 +109,27 @@ export default class RemoteDeviceModel { console.info('Calc[RemoteDeviceModel] deviceFound self.deviceList=' + self.deviceList); console.info('Calc[RemoteDeviceModel] deviceFound self.deviceList.length=' + self.deviceList.length); console.info('Calc[RemoteDeviceModel] authenticateDevice ' + JSON.stringify(data.device)); - self.deviceManager_.authenticateDevice(data.device); + let extraInfo = { + "targetPkgName": 'com.example.distributedcalc', + "appName": '.MyApplication', + "appDescription": 'apply auth', + "business": '0' + }; + let authParam = { + "authType": 1, + "appIcon": '', + "appThumbnail": '', + "extraInfo": extraInfo + }; + self.deviceManager_.authenticateDevice(data.device, authParam, (err, data) => { + if (err) { + console.info('Calc[RemoteDeviceModel] authenticateDevice error:' + JSON.stringify(err)); + return; + } + }); var list = self.deviceManager_.getTrustedDeviceListSync(); console.info('Calc[RemoteDeviceModel] getTrustedDeviceListSync end, deviceList=' + JSON.stringify(list)); - if (typeof (list) != 'undefined' && typeof (list.length) != 'undefined') { + if (typeof(list) != 'undefined' && typeof(list.length) != 'undefined') { self.deviceList = list; } }); -- Gitee From 4d2321a4c760e98f4620af11e2064245862ae453 Mon Sep 17 00:00:00 2001 From: qhily999 Date: Mon, 13 Sep 2021 16:48:45 +0800 Subject: [PATCH 3/3] modify dm Signed-off-by: qhily999 --- .../src/main/js/default/common/RemoteDeviceModel.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/common/DistributeCalc/entry/src/main/js/default/common/RemoteDeviceModel.js b/common/DistributeCalc/entry/src/main/js/default/common/RemoteDeviceModel.js index add00da8e0..971fcd7b89 100644 --- a/common/DistributeCalc/entry/src/main/js/default/common/RemoteDeviceModel.js +++ b/common/DistributeCalc/entry/src/main/js/default/common/RemoteDeviceModel.js @@ -111,8 +111,8 @@ export default class RemoteDeviceModel { console.info('Calc[RemoteDeviceModel] authenticateDevice ' + JSON.stringify(data.device)); let extraInfo = { "targetPkgName": 'com.example.distributedcalc', - "appName": '.MyApplication', - "appDescription": 'apply auth', + "appName": 'Distributed Calc', + "appDescription": 'Distributed Calc', "business": '0' }; let authParam = { @@ -140,13 +140,6 @@ export default class RemoteDeviceModel { }); console.info('Calc[RemoteDeviceModel] discoverFail data=' + JSON.stringify(data)); }); - this.deviceManager_.on('authResult', (data) => { - prompt.showToast({ - message: 'authResult data=' + JSON.stringify(data), - duration: 3000, - }); - console.info('Calc[RemoteDeviceModel] authResult data=' + JSON.stringify(data)); - }); this.deviceManager_.on('serviceDie', () => { prompt.showToast({ message: 'serviceDie', @@ -175,7 +168,6 @@ export default class RemoteDeviceModel { this.deviceManager_.off('deviceStateChange'); this.deviceManager_.off('deviceFound'); this.deviceManager_.off('discoverFail'); - this.deviceManager_.off('authResult'); this.deviceManager_.off('serviceDie'); this.deviceList = new Array(); } -- Gitee