copy to clipboard

This commit is contained in:
Sebastiaan Pasma 2018-06-28 14:16:33 +02:00
commit 243f35c25d
3 changed files with 9 additions and 8 deletions

View file

@ -1,6 +1,6 @@
'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 = [];
$scope.bchAddressType = { type: 'cashaddr' };
@ -73,6 +73,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
currentAddressSocket = new WebSocket("wss://ws.blockchain.info/inv");
paymentSubscriptionObj.addr = $scope.addr
}
clipboardService.copyToClipboard(paymentSubscriptionObj.addr);
// create subscription
var msg = JSON.stringify(paymentSubscriptionObj);

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.directives')
.directive('copyToClipboard', function(clipboardService) {
.directive('copyToClipboard', function(clipboardService, ionicToast, gettextCatalog) {
return {
restrict: 'A',
scope: {
@ -14,8 +14,13 @@ angular.module('copayApp.directives')
elem.bind('click', function() {
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);
});
}
}

View file

@ -4,8 +4,6 @@ angular.module('copayApp.services').factory('clipboardService', function ($http,
var root = {};
root.copyToClipboard = function (data, scope) {
var msg = gettextCatalog.getString('Copied to clipboard');
if (!data) return;
if (platformInfo.isCordova) {
@ -19,9 +17,6 @@ angular.module('copayApp.services').factory('clipboardService', function ($http,
return;
}
scope.$apply(function () {
ionicToast.show(msg, 'bottom', false, 1000);
});
};
return root;