Skip to content
Snippets Groups Projects
Commit f24c718f authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] hide qrcode on logout, and reuse it if already created - fix #503

parent c725bd3f
No related branches found
No related tags found
No related merge requests found
......@@ -81,7 +81,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state,
$scope.formData = walletData;
$scope.loading=false; // very important, to avoid TX to be display before wallet.currentUd is loaded
$scope.updateView();
$scope.showQRCode('qrcode', $scope.formData.pubkey, 1100);
$scope.showQRCode('qrcode', $scope.formData.pubkey);
$scope.showHelpTip();
UIUtils.loading.hide(); // loading could have be open (e.g. new account)
})
......@@ -108,7 +108,8 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state,
// Clean controller data when logout
$scope.onWalletLogout = function() {
delete $scope.qrcode; // clean QRcode
// clean QRcode
$scope.hideQRCode('qrcode');
delete $scope.formData;
$scope.loading = true;
};
......@@ -444,16 +445,27 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state,
};
$scope.showQRCode = function(id, text, timeout) {
if (!!$scope.qrcode) {
return;
if (!$scope.qrcode) {
$scope.qrcode = new QRCode(id, {
text: text,
width: 200,
height: 200,
correctLevel: QRCode.CorrectLevel.L
});
UIUtils.motion.toggleOn({selector: '#wallet #'+id+'.qrcode'}, timeout || 1100);
}
else {
$scope.qrcode.clear();
$scope.qrcode.makeCode(text);
UIUtils.motion.toggleOn({selector: '#wallet #'+id+'.qrcode'}, timeout || 1100);
}
};
$scope.hideQRCode = function(id) {
if ($scope.qrcode) {
$scope.qrcode.clear();
UIUtils.motion.toggleOff({selector: '#wallet #'+id+'.qrcode'});
}
$scope.qrcode = new QRCode(id, {
text: text,
width: 200,
height: 200,
correctLevel: QRCode.CorrectLevel.L
});
UIUtils.motion.toggleOn({selector: '#wallet #'+id+'.qrcode'}, timeout || 1100);
};
$scope.showCertifications = function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment