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'; '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 updateConfig = function() {
var config = configService.getSync(); var config = configService.getSync();

View file

@ -1,6 +1,6 @@
'use strict'; '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.$on("$ionicView.beforeEnter", function(event) {
$scope.currentPincode = $scope.newPincode = ''; $scope.currentPincode = $scope.newPincode = '';
@ -39,8 +39,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
if (!$scope.locking) { if (!$scope.locking) {
if (match) { if (match) {
$scope.fromSettings ? saveSettings($scope.locking, '') : $scope.close(); $scope.fromSettings ? saveSettings($scope.locking, '') : $scope.close(150);
return;
} }
} else { } else {
checkCodes(); checkCodes();
@ -70,14 +69,13 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
configService.set(opts, function(err) { configService.set(opts, function(err) {
if (err) $log.debug(err); if (err) $log.debug(err);
$timeout(function() { $scope.close();
$scope.close();
});
}); });
}; };
$scope.close = function() { $scope.close = function(delay) {
if ($scope.fromSettings) $state.go('tabs.advanced'); $timeout(function() {
else $state.go('tabs.home'); $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; text-align: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
.row .col {
margin: 10px;
height: 25px;
}
.app-icon { .app-icon {
margin-top: -55px; margin-top: -55px;
.big-icon-svg { .big-icon-svg {
@ -38,18 +34,15 @@
} }
} }
.block-code { .block-code {
width: 300px; width: 120px;
margin: auto; margin: auto;
padding: 0 50px 0 50px; .row {
height: 35px;
}
} }
.block-buttons { .block-buttons {
.row { .col {
padding: 3%; padding: 5%;
}
@media (max-height: 480px) {
.row {
padding: 2%;
}
} }
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
@ -63,9 +56,8 @@
border-radius: 50%; border-radius: 50%;
opacity: 0.6; opacity: 0.6;
box-shadow: 0 0 1px 0px rgb( 255, 255, 255); box-shadow: 0 0 1px 0px rgb( 255, 255, 255);
width: 5px; margin: 2px;
height: 5px; transition: background-color .2s ease-in-out;
transition: background-color .1s ease-in-out;
} }
.filled { .filled {
background-color: #666666; background-color: #666666;