+ ng-click="shareAddress('{{protocol}}:{{code}}')">
Share address
diff --git a/src/js/controllers/correspondentDevice.js b/src/js/controllers/correspondentDevice.js
index da6c654dc..0527df371 100644
--- a/src/js/controllers/correspondentDevice.js
+++ b/src/js/controllers/correspondentDevice.js
@@ -179,8 +179,8 @@ angular.module('copayApp.controllers').controller('correspondentDeviceController
$scope.color = fc.backgroundColor;
$scope.bWorking = false;
$scope.arrRelations = ["=", ">", "<", ">=", "<=", "!="];
- $scope.arrParties = [{value: 'me', display_value: "I"}, {value: 'peer', display_value: "the peer"}];
- $scope.arrPeerPaysTos = [{value: 'me', display_value: "to me"}, {value: 'contract', display_value: "to this contract"}];
+ $scope.arrParties = [{value: 'me', display_value: gettext("I")}, {value: 'peer', display_value: gettext("the peer")}];
+ $scope.arrPeerPaysTos = [{value: 'me', display_value: gettext("to me")}, {value: 'contract', display_value: gettext("to this contract")}];
$scope.arrAssetInfos = indexScope.arrBalances.map(function(b){
var info = {asset: b.asset, is_private: b.is_private};
if (b.asset === 'base')
@@ -190,7 +190,7 @@ angular.module('copayApp.controllers').controller('correspondentDeviceController
else if (profileService.assetMetadata[b.asset])
info.displayName = profileService.assetMetadata[b.asset].name;
else
- info.displayName = 'of '+b.asset.substr(0, 4);
+ info.displayName = gettext('of')+' '+b.asset.substr(0, 4);
return info;
});
$scope.arrPublicAssetInfos = $scope.arrAssetInfos.filter(function(b){ return !b.is_private; });
@@ -262,13 +262,13 @@ angular.module('copayApp.controllers').controller('correspondentDeviceController
if (contract.peerAsset === "base")
peer_amount *= walletSettings.unitValue;
if (contract.peerAsset === constants.BLACKBYTES_ASSET)
- throw Error("peer asset cannot be blackbytes");
+ throw Error(gettext("peer asset cannot be blackbytes"));
if (profileService.assetMetadata[contract.peerAsset])
peer_amount *= Math.pow(10, profileService.assetMetadata[contract.peerAsset].decimals || 0);
peer_amount = Math.round(peer_amount);
if (my_amount === peer_amount && contract.myAsset === contract.peerAsset && contract.peer_pays_to === 'contract'){
- $scope.error = "The amounts are equal, you cannot require the peer to pay to the contract. Please either change the amounts slightly or fund the entire contract yourself and require the peer to pay his half to you.";
+ $scope.error = gettext("The amounts are equal, you cannot require the peer to pay to the contract. Please either change the amounts slightly or fund the entire contract yourself and require the peer to pay his half to you.");
$timeout(function() {
$scope.$digest();
}, 1);
@@ -376,9 +376,9 @@ angular.module('copayApp.controllers').controller('correspondentDeviceController
profileService.bKeepUnlocked = false;
if (err){
if (err.match(/device address/))
- err = "This is a private asset, please send it only by clicking links from chat";
+ err = gettext("This is a private asset, please send it only by clicking links from chat");
if (err.match(/no funded/))
- err = "Not enough spendable funds, make sure all your funds are confirmed";
+ err = gettext("Not enough spendable funds, make sure all your funds are confirmed");
if ($scope)
$scope.error = err;
return;
diff --git a/src/js/controllers/inviteCorrespondentDevice.js b/src/js/controllers/inviteCorrespondentDevice.js
index 7c33c6f40..2487f57da 100644
--- a/src/js/controllers/inviteCorrespondentDevice.js
+++ b/src/js/controllers/inviteCorrespondentDevice.js
@@ -2,6 +2,8 @@
var eventBus = require('byteballcore/event_bus.js');
+
+
angular.module('copayApp.controllers').controller('inviteCorrespondentDeviceController',
function($scope, $timeout, profileService, go, isCordova, correspondentListService, gettextCatalog) {
@@ -42,25 +44,8 @@ angular.module('copayApp.controllers').controller('inviteCorrespondentDeviceCont
correspondentListService.startWaitingForPairing(function(pairingInfo){
console.log("beginAddCorrespondent " + pairingInfo.pairing_secret);
$scope.code = pairingInfo.device_pubkey + "@" + pairingInfo.hub + "#" + pairingInfo.pairing_secret;
-
- function determineQRcodeVersionFromString( inputtext ) {
- // maximum characters per QR code version using ECC level m
- // source: http://www.qrcode.com/en/about/version.html
- var maxCharsforQRVersion = [0,14,26,42,62,84,106,122,152,180,213];
- var qrversion = 5;
- // find lowest version number that has enough space for our text
- for (var i = (maxCharsforQRVersion.length-1); i > 0 ; i--) {
- if ( maxCharsforQRVersion[i] >= inputtext.length)
- {
- qrversion = i;
- }
- }
-
- return qrversion;
- }
-
var qrstring = $scope.protocol + ":" +$scope.code; //as passed to the qr generator in inviteCorrespondentDevice.html
- $scope.qr_version = determineQRcodeVersionFromString( qrstring );
+ $scope.qr_version = correspondentListService.determineQRcodeVersionFromString( qrstring );
$scope.$digest();
//$timeout(function(){$scope.$digest();}, 100);
diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js
index 663f731df..480da094c 100644
--- a/src/js/controllers/walletHome.js
+++ b/src/js/controllers/walletHome.js
@@ -443,6 +443,10 @@ angular.module('copayApp.controllers')
amount + ' ' + ((asset === 'base') ? $scope.unitName : (asset === constants.BLACKBYTES_ASSET ? $scope.bbUnitName : (assetInfo.name || 'of ' + asset)));
$scope.amountInSmallestUnits = amountInSmallestUnits;
$scope.asset_param = (asset === 'base') ? '' : '&asset=' + encodeURIComponent(asset);
+ //prepare QR Code
+ $scope.code = $scope.addr+'?amount=' + $scope.amountInSmallestUnits + $scope.asset_param;
+ var qrstring = $scope.protocol + ":" + $scope.code; //as passed to the qr generator in customized-amount.html
+ $scope.qr_version = correspondentListService.determineQRcodeVersionFromString( qrstring );
}, 1);
};
diff --git a/src/js/services/correspondentListService.js b/src/js/services/correspondentListService.js
index 0857a20e4..c393065c6 100644
--- a/src/js/services/correspondentListService.js
+++ b/src/js/services/correspondentListService.js
@@ -5,7 +5,7 @@ var eventBus = require('byteballcore/event_bus.js');
var ValidationUtils = require('byteballcore/validation_utils.js');
var objectHash = require('byteballcore/object_hash.js');
-angular.module('copayApp.services').factory('correspondentListService', function($state, $rootScope, $sce, $compile, configService, storageService, profileService, go, lodash, $stickyState, $deepStateRedirect, $timeout, gettext) {
+angular.module('copayApp.services').factory('correspondentListService', function($state, $rootScope, $sce, $compile, configService, storageService, profileService, go, lodash, $stickyState, $deepStateRedirect, $timeout, gettext, gettextCatalog) {
var root = {};
var device = require('byteballcore/device.js');
var wallet = require('byteballcore/wallet.js');
@@ -35,6 +35,21 @@ angular.module('copayApp.services').factory('correspondentListService', function
$rootScope.totalNewMsgCnt = lodash.sum(lodash.values(counters));
}, true);
+ function determineQRcodeVersionFromString( inputtext ) {
+ // maximum characters per QR code version using ECC level m
+ // source: http://www.qrcode.com/en/about/version.html
+ var maxCharsforQRVersion = [0,14,26,42,62,84,106,122,152,180,213];
+ var qrversion = 5;
+ // find lowest version number that has enough space for our text
+ for (var i = (maxCharsforQRVersion.length-1); i > 0 ; i--) {
+ if ( maxCharsforQRVersion[i] >= inputtext.length)
+ {
+ qrversion = i;
+ }
+ }
+ return qrversion;
+ }
+
function addIncomingMessageEvent(from_address, body, message_counter){
var walletGeneral = require('byteballcore/wallet_general.js');
walletGeneral.readMyAddresses(function(arrMyAddresses){
@@ -107,7 +122,7 @@ angular.module('copayApp.services').factory('correspondentListService', function
// if (arrMyAddresses.indexOf(address) >= 0)
// return address;
//return '
'+address+'';
- return '
'+address+'';
+ return '
'+address+'';
// return '
'+address+'';
//return '
'+address+'';
//return '
'+address+'';
@@ -127,7 +142,7 @@ angular.module('copayApp.services').factory('correspondentListService', function
var arrMovements = getMovementsFromJsonBase64PaymentRequest(paymentJsonBase64, true);
if (!arrMovements)
return '[invalid payment request]';
- description = 'Payment request: '+arrMovements.join(', ');
+ description = gettext('Payment request:')+' '+arrMovements.join(', ');
return '
'+description+'';
}).replace(/\[(.+?)\]\(vote:(.+?)\)/g, function(str, description, voteJsonBase64){
var objVote = getVoteFromJsonBase64(voteJsonBase64);
@@ -245,7 +260,7 @@ angular.module('copayApp.services').factory('correspondentListService', function
var arrMovements = getMovementsFromJsonBase64PaymentRequest(paymentJsonBase64);
if (!arrMovements)
return '[invalid payment request]';
- return '
Payment request: '+arrMovements.join(', ')+'';
+ return '
'+gettext('Payment request:')+' '+arrMovements.join(', ')+'';
}).replace(/\[(.+?)\]\(vote:(.+?)\)/g, function(str, description, voteJsonBase64){
var objVote = getVoteFromJsonBase64(voteJsonBase64);
if (!objVote)
@@ -282,7 +297,7 @@ angular.module('copayApp.services').factory('correspondentListService', function
var device_address = assocParams['device_address'] || '';
if (device_address && !ValidationUtils.isValidDeviceAddress(device_address))
return null;
- var amountStr = 'Payment request: ' + getAmountText(amount, asset);
+ var amountStr = gettext('Payment request:')+' ' + getAmountText(amount, asset);
return {
amount: amount,
asset: asset,
@@ -609,6 +624,7 @@ angular.module('copayApp.services').factory('correspondentListService', function
root.parseMessage = parseMessage;
root.escapeHtmlAndInsertBr = escapeHtmlAndInsertBr;
root.addMessageEvent = addMessageEvent;
+ root.determineQRcodeVersionFromString = determineQRcodeVersionFromString;
root.list = function(cb) {
device.readCorrespondents(function(arrCorrespondents){