From bbf29df6965a5d479386e27690d189f6a9cadd4f Mon Sep 17 00:00:00 2001 From: Tarmo Date: Sat, 19 Sep 2020 20:36:37 +0300 Subject: [PATCH 01/18] request to sign message --- public/views/correspondentDevice.html | 5 +++++ src/js/controllers/correspondentDevice.js | 7 +++++++ src/js/services/correspondentListService.js | 10 +++------- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/public/views/correspondentDevice.html b/public/views/correspondentDevice.html index 33964dd95..4d87bc2ac 100644 --- a/public/views/correspondentDevice.html +++ b/public/views/correspondentDevice.html @@ -410,6 +410,11 @@

) +
  • + + Request to sign message + +
  • diff --git a/src/js/controllers/correspondentDevice.js b/src/js/controllers/correspondentDevice.js index 61478fcfe..cd5a896a8 100644 --- a/src/js/controllers/correspondentDevice.js +++ b/src/js/controllers/correspondentDevice.js @@ -138,6 +138,13 @@ angular.module('copayApp.controllers').controller('correspondentDeviceController // issueNextAddressIfNecessary(showRequestPaymentModal); }; + $scope.requestToSignMessage = function(message){ + if (!message || !String(message).trim()) + return $rootScope.$emit('Local/ShowErrorAlert', "Enter a text message first"); + chatScope.message = '[...](sign-message-request:'+ message.trim() +')'; + chatScope.send(); + }; + $scope.sendPayment = function(address, amount, asset, device_address, base64data, from_address, single_address){ console.log("will send payment to "+address); if (asset && $scope.index.arrBalances.filter(function(balance){ return (balance.asset === asset); }).length === 0){ diff --git a/src/js/services/correspondentListService.js b/src/js/services/correspondentListService.js index 55f0eeecf..0620664b1 100644 --- a/src/js/services/correspondentListService.js +++ b/src/js/services/correspondentListService.js @@ -226,14 +226,12 @@ angular.module('copayApp.services').factory('correspondentListService', function return '[invalid signed message]'; var objSignedMessage = info.objSignedMessage; var displayed_signed_message = (typeof objSignedMessage.signed_message === 'string') ? objSignedMessage.signed_message : JSON.stringify(objSignedMessage.signed_message, null, '\t'); - var text = 'Message signed by '+objSignedMessage.authors[0].address+': '+escapeHtml(displayed_signed_message); + var text = 'Message signed by '+objSignedMessage.authors[0].address+': '+escapeHtmlAndInsertBr(displayed_signed_message); if (info.bValid) text += " (valid)"; else if (info.bValid === false) text += " (invalid)"; - else - text += ' (verify)'; - return toDelayedReplacement('['+text+']'); + return toDelayedReplacement('['+text+']'); }).replace(url_regexp, function(str){ param_index++; params[param_index] = str; @@ -457,9 +455,7 @@ angular.module('copayApp.services').factory('correspondentListService', function text += " (valid)"; else if (info.bValid === false) text += " (invalid)"; - else - text += ' (verify)'; - return toDelayedReplacement('['+text+']'); + return toDelayedReplacement('['+text+']'); }).replace(url_regexp, function(str){ param_index++; params[param_index] = str; From 957f45277029144c8f1f395c07d891a4023d7196 Mon Sep 17 00:00:00 2001 From: Tarmo Date: Sat, 19 Sep 2020 20:55:44 +0300 Subject: [PATCH 02/18] string --- src/js/controllers/correspondentDevice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/controllers/correspondentDevice.js b/src/js/controllers/correspondentDevice.js index cd5a896a8..6bdf84c4a 100644 --- a/src/js/controllers/correspondentDevice.js +++ b/src/js/controllers/correspondentDevice.js @@ -141,7 +141,7 @@ angular.module('copayApp.controllers').controller('correspondentDeviceController $scope.requestToSignMessage = function(message){ if (!message || !String(message).trim()) return $rootScope.$emit('Local/ShowErrorAlert', "Enter a text message first"); - chatScope.message = '[...](sign-message-request:'+ message.trim() +')'; + chatScope.message = '[...](sign-message-request:'+ String(message).trim() +')'; chatScope.send(); }; From e9439d2ecf29265d74f3da1ed024bd33d3576139 Mon Sep 17 00:00:00 2001 From: Tarmo Date: Sat, 19 Sep 2020 23:10:50 +0300 Subject: [PATCH 03/18] clear --- public/views/correspondentDevice.html | 1 + 1 file changed, 1 insertion(+) diff --git a/public/views/correspondentDevice.html b/public/views/correspondentDevice.html index 4d87bc2ac..a9c168d91 100644 --- a/public/views/correspondentDevice.html +++ b/public/views/correspondentDevice.html @@ -410,6 +410,7 @@

    )

  • +
  • Request to sign message From e921ed449c08bd8b5abf3d4350f5a7e011f88823 Mon Sep 17 00:00:00 2001 From: Tarmo Date: Sun, 20 Sep 2020 05:37:57 +0300 Subject: [PATCH 04/18] better UX --- public/views/modals/sign-message.html | 10 ++++++++-- public/views/modals/signed-message.html | 8 +++++++- src/js/controllers/correspondentDevice.js | 12 ++++++++++-- src/js/controllers/preferencesInformation.js | 10 +++++++++- src/js/services/correspondentListService.js | 9 ++++----- 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/public/views/modals/sign-message.html b/public/views/modals/sign-message.html index 61cb35813..3384081c0 100644 --- a/public/views/modals/sign-message.html +++ b/public/views/modals/sign-message.html @@ -15,11 +15,17 @@