views instead modal

This commit is contained in:
JDonadio 2017-03-03 14:18:56 -03:00
parent 0e9b39a510
commit 93168cdae6
4 changed files with 52 additions and 19 deletions

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $timeout, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) {
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate, pincodeService) {
var updateConfig = function() {
var config = configService.getSync();
@ -53,7 +53,11 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
};
$scope.usePincodeChange = function() {
pincodeService.lockChange({
// pincodeService.lockChange({
// fromSettings: true,
// locking: $scope.usePincode.enabled
// });
$state.go('tabs.pincode', {
fromSettings: true,
locking: $scope.usePincode.enabled
});

View File

@ -1,7 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('pincodeController', function($rootScope, $timeout, $scope, $log, $window, configService) {
$scope.currentPincode = $scope.newPincode = '';
angular.module('copayApp.controllers').controller('pincodeController', function($rootScope, $state, $timeout, $scope, $log, $window, configService) {
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.currentPincode = $scope.newPincode = '';
$scope.fromSettings = data.stateParams.fromSettings == 'true' ? true : false;
$scope.locking = data.stateParams.locking == 'true' ? true : false;
console.log('### From Settings:', $scope.fromSettings, 'Locking:', $scope.locking);
});
angular.element($window).on('keydown', function(e) {
if (e.which === 8) {
@ -87,6 +93,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
$scope.close = function() {
$rootScope.$emit('updatePincodeOption');
$scope.pincodeModal.remove();
if ($scope.fromSettings) $state.go('tabs.advanced');
else $state.go('tabs.home');
};
});

View File

@ -119,6 +119,18 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
/*
*
* Pin code
*
*/
.state('pincode', {
url: '/pincode/:fromSettings/:locking',
controller: 'pincodeController',
templateUrl: 'views/pincode.html'
})
/*
*
* URI
@ -439,6 +451,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
}
})
.state('tabs.pincode', {
url: '/pincode/:fromSettings/:locking',
views: {
'tab-settings@tabs': {
controller: 'pincodeController',
templateUrl: 'views/pincode.html',
}
}
})
/*
*
@ -1091,20 +1112,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
});
})
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, pincodeService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) {
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) {
uxLanguage.init();
$ionicPlatform.ready(function() {
configService.whenAvailable(function(config) {
if (config.pincode && config.pincode.enabled) {
pincodeService.lockChange({
fromSettings: false,
locking: false,
});
}
});
if (screen.width < 768 && platformInfo.isCordova)
screen.lockOrientation('portrait');
@ -1205,9 +1217,19 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
disableAnimate: true,
historyRoot: true
});
$state.transitionTo('tabs.home').then(function() {
// Clear history
$ionicHistory.clearHistory();
configService.whenAvailable(function(config) {
console.log('### CONFIG', config.pincode);
if (config.pincode && config.pincode.enabled) {
$state.go('pincode', {
fromSettings: false,
locking: false
});
} else {
$state.transitionTo('tabs.home').then(function() {
// Clear history
$ionicHistory.clearHistory();
});
}
});
});
}

View File

@ -1,4 +1,4 @@
<ion-modal-view id="pin-code" ng-controller="pincodeController">
<ion-modal-view id="pin-code" ng-controller="pincodeController" hide-tabs>
<div ng-if="fromSettings" ng-click="close()" class="close" translate>Close</div>
<div class="content">
<div class="block-code">