copy to clipboard
This commit is contained in:
parent
8006af279b
commit
243f35c25d
3 changed files with 9 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('tabReceiveController', function($rootScope, $scope, $timeout, $log, $ionicModal, $state, $ionicHistory, $ionicPopover, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService, bwcError, bitcoinCashJsService, $ionicNavBarDelegate, txFormatService) {
|
angular.module('copayApp.controllers').controller('tabReceiveController', function($rootScope, $scope, $timeout, $log, $ionicModal, $state, $ionicHistory, $ionicPopover, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService, bwcError, bitcoinCashJsService, $ionicNavBarDelegate, txFormatService, clipboardService) {
|
||||||
|
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
$scope.bchAddressType = { type: 'cashaddr' };
|
$scope.bchAddressType = { type: 'cashaddr' };
|
||||||
|
|
@ -73,6 +73,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
||||||
currentAddressSocket = new WebSocket("wss://ws.blockchain.info/inv");
|
currentAddressSocket = new WebSocket("wss://ws.blockchain.info/inv");
|
||||||
paymentSubscriptionObj.addr = $scope.addr
|
paymentSubscriptionObj.addr = $scope.addr
|
||||||
}
|
}
|
||||||
|
clipboardService.copyToClipboard(paymentSubscriptionObj.addr);
|
||||||
|
|
||||||
// create subscription
|
// create subscription
|
||||||
var msg = JSON.stringify(paymentSubscriptionObj);
|
var msg = JSON.stringify(paymentSubscriptionObj);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.directives')
|
angular.module('copayApp.directives')
|
||||||
.directive('copyToClipboard', function(clipboardService) {
|
.directive('copyToClipboard', function(clipboardService, ionicToast, gettextCatalog) {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
@ -14,8 +14,13 @@ angular.module('copayApp.directives')
|
||||||
|
|
||||||
elem.bind('click', function() {
|
elem.bind('click', function() {
|
||||||
var data = scope.copyToClipboard;
|
var data = scope.copyToClipboard;
|
||||||
|
clipboardService.copyToClipboard(data);
|
||||||
|
|
||||||
|
var msg = gettextCatalog.getString('Copied to clipboard');
|
||||||
|
scope.$apply(function () {
|
||||||
|
ionicToast.show(msg, 'bottom', false, 1000);
|
||||||
|
});
|
||||||
|
|
||||||
clipboardService.copyToClipboard(data, scope);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ angular.module('copayApp.services').factory('clipboardService', function ($http,
|
||||||
var root = {};
|
var root = {};
|
||||||
|
|
||||||
root.copyToClipboard = function (data, scope) {
|
root.copyToClipboard = function (data, scope) {
|
||||||
var msg = gettextCatalog.getString('Copied to clipboard');
|
|
||||||
|
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
|
||||||
if (platformInfo.isCordova) {
|
if (platformInfo.isCordova) {
|
||||||
|
|
@ -19,9 +17,6 @@ angular.module('copayApp.services').factory('clipboardService', function ($http,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.$apply(function () {
|
|
||||||
ionicToast.show(msg, 'bottom', false, 1000);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue