improve performance and UX - handle history views properly

This commit is contained in:
JDonadio 2017-03-08 16:02:34 -03:00
commit d4c8576032
4 changed files with 16 additions and 52 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) {
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate) {
var updateConfig = function() {
var config = configService.getSync();

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $timeout, $scope, $log, $window, configService) {
angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, $window, configService) {
$scope.$on("$ionicView.beforeEnter", function(event) {
$scope.currentPincode = $scope.newPincode = '';
@ -39,8 +39,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
if (!$scope.locking) {
if (match) {
$scope.fromSettings ? saveSettings($scope.locking, '') : $scope.close();
return;
$scope.fromSettings ? saveSettings($scope.locking, '') : $scope.close(150);
}
} else {
checkCodes();
@ -70,14 +69,13 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
configService.set(opts, function(err) {
if (err) $log.debug(err);
$timeout(function() {
$scope.close();
});
$scope.close();
});
};
$scope.close = function() {
if ($scope.fromSettings) $state.go('tabs.advanced');
else $state.go('tabs.home');
$scope.close = function(delay) {
$timeout(function() {
$ionicHistory.viewHistory().backView ? $ionicHistory.goBack() : $state.go('tabs.home');
}, delay || 1);
};
});

View file

@ -1,26 +0,0 @@
'use strict';
angular.module('copayApp.services').factory('pincodeService', function($log, $rootScope, $ionicModal, configService) {
var root = {};
root.lockChange = function(opts) {
var scope = $rootScope.$new(true);
scope.fromSettings = opts.fromSettings;
scope.locking = opts.locking;
$ionicModal.fromTemplateUrl('views/modals/pincode.html', {
scope: scope,
backdropClickToClose: false,
hardwareBackButtonClose: false
}).then(function(modal) {
scope.pincodeModal = modal;
scope.pincodeModal.show();
});
};
root.isLocked = function() {
var config = configService.getSync();
return config.pincode ? config.pincode.enabled : false;
};
return root;
});

View file

@ -11,10 +11,6 @@
text-align: center;
width: 100%;
height: 100%;
.row .col {
margin: 10px;
height: 25px;
}
.app-icon {
margin-top: -55px;
.big-icon-svg {
@ -38,18 +34,15 @@
}
}
.block-code {
width: 300px;
width: 120px;
margin: auto;
padding: 0 50px 0 50px;
.row {
height: 35px;
}
}
.block-buttons {
.row {
padding: 3%;
}
@media (max-height: 480px) {
.row {
padding: 2%;
}
.col {
padding: 5%;
}
cursor: pointer;
position: absolute;
@ -63,9 +56,8 @@
border-radius: 50%;
opacity: 0.6;
box-shadow: 0 0 1px 0px rgb( 255, 255, 255);
width: 5px;
height: 5px;
transition: background-color .1s ease-in-out;
margin: 2px;
transition: background-color .2s ease-in-out;
}
.filled {
background-color: #666666;