Merge pull request #3853 from cmgustavo/feat/paste-from-clipboard
Use cordova-plugin to paste from clipboard on mobile
This commit is contained in:
commit
b6a129f2f0
5 changed files with 47 additions and 10 deletions
|
|
@ -957,17 +957,17 @@ ul.wallet-selection.wallets {
|
|||
}
|
||||
|
||||
label.postfix, a.postfix {
|
||||
height: 100%;
|
||||
height: 34px;
|
||||
border: none;
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
color: #7A8C9E;
|
||||
text-transform: uppercase;
|
||||
border-radius: 0 2px 2px 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 40px;
|
||||
width: 50px;
|
||||
padding-top: 7px;
|
||||
}
|
||||
|
||||
a.button.postfix {
|
||||
|
|
@ -1000,7 +1000,6 @@ a.button.postfix {
|
|||
|
||||
.icon-wallet {
|
||||
display: block;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.walletHome .icon-wallet {
|
||||
|
|
|
|||
|
|
@ -342,8 +342,9 @@ a.missing-copayers {
|
|||
text-align: center;
|
||||
float: left;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
height: 30px;
|
||||
border-radius: 3px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.sidebar header {
|
||||
|
|
|
|||
|
|
@ -97,6 +97,19 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$rootScope.$digest();
|
||||
});
|
||||
|
||||
var getClipboard = function(cb) {
|
||||
if (!isCordova || isMobile.Windows()) return cb();
|
||||
|
||||
window.cordova.plugins.clipboard.paste(function(value) {
|
||||
var fc = profileService.focusedClient;
|
||||
var Address = bitcore.Address;
|
||||
var networkName = fc.credentials.network;
|
||||
if (Address.isValid(value, networkName) && !$scope.newAddress) {
|
||||
return cb(value);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var accept_msg = gettextCatalog.getString('Accept');
|
||||
var cancel_msg = gettextCatalog.getString('Cancel');
|
||||
var confirm_msg = gettextCatalog.getString('Confirm');
|
||||
|
|
@ -120,6 +133,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
'label': ''
|
||||
};
|
||||
|
||||
$scope.checkClipboard = function() {
|
||||
getClipboard(function(value) {
|
||||
$scope.newAddress = value;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.beforeQrCodeScann = function() {
|
||||
$scope.error = null;
|
||||
$scope.addAddressbookEntry = true;
|
||||
|
|
@ -250,6 +269,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
if (addr) {
|
||||
self.setForm(addr);
|
||||
}
|
||||
}, function() {
|
||||
// onRejected
|
||||
self.resetForm();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -651,6 +673,20 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
if (isCordova && !this.isWindowsPhoneApp) {
|
||||
this.hideMenuBar(what);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
if (isCordova && !this.isWindowsPhoneApp && what == 'address') {
|
||||
getClipboard(function(value) {
|
||||
if (value) {
|
||||
document.getElementById("amount").focus();
|
||||
$timeout(function() {
|
||||
window.plugins.toast.showShortCenter(gettextCatalog.getString('Pasted from clipboard'));
|
||||
self.setForm(value);
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.isWindowsPhoneApp) return
|
||||
|
||||
if (!what) {
|
||||
|
|
@ -939,7 +975,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$timeout(function() {
|
||||
$rootScope.$digest();
|
||||
}, 1);
|
||||
};
|
||||
};
|
||||
|
||||
this.openPPModal = function(paypro) {
|
||||
$rootScope.modalOpened = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue