add pincode view-controller

This commit is contained in:
JDonadio 2017-02-23 16:56:46 -05:00
commit 86b8bd4326
6 changed files with 170 additions and 2 deletions

View file

@ -0,0 +1,44 @@
'use strict';
angular.module('copayApp.controllers').controller('pincodeController', function($timeout, $scope, $log, $window) {
angular.element($window).on('keydown', function(e) {
if (e.which === 8) { // you can add others here inside brackets.
e.preventDefault();
$scope.delete();
}
if (e.key && e.key.match(/^[0-9]$/))
$scope.add(e.key);
else if (e.key && e.key == 'Enter')
console.log('DONE');
});
$scope.$on('$ionicView.beforeEnter', function(event, data) {
$scope.passcode = "";
});
$scope.add = function(value) {
if (isComplete()) $log.debug("The four digit code was entered");
else updatePassCode(value);
};
$scope.delete = function() {
if ($scope.passcode.length > 0) {
$scope.passcode = $scope.passcode.substring(0, $scope.passcode.length - 1);
updatePassCode();
}
};
function isComplete() {
if ($scope.passcode.length < 4) return false;
else return true;
};
function updatePassCode(value) {
if (value) $scope.passcode = $scope.passcode + value;
$timeout(function() {
$scope.$apply();
});
};
});

View file

@ -672,6 +672,22 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
/*
*
* Pin Code
*
*/
.state('tabs.home.pincode', {
url: '/pincode',
views: {
'tab-home@tabs': {
templateUrl: 'views/pincode.html',
controller: 'pincodeController'
}
}
})
/*
*
* Paper Wallet

View file

@ -0,0 +1,38 @@
.button-stretch {
width: 100%;
}
.col-offset-15 {
margin-left: 15%;
}
@mixin centerer {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.content {
position: relative;
width: 100%;
height: 100%;
}
.block-code {
@include centerer;
top: 20% !important;
width: 50%;
> .row > .col {
border-bottom: 1px solid #3E3E3E;
padding: 5px;
margin: 10px;
height: 35px;
}
}
.block-buttons {
@include centerer;
padding: 20px;
}

View file

@ -46,3 +46,4 @@
@import "includes/accountSelector";
@import "integrations/integrations";
@import "custom-amount";
@import "pincode";