wip add modal config
This commit is contained in:
parent
1ee75fd424
commit
82e556b026
7 changed files with 57 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, profileService, feeService, storageService, $ionicHistory, $timeout, $ionicScrollDelegate) {
|
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $rootScope, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $timeout, $ionicScrollDelegate) {
|
||||||
|
|
||||||
var updateConfig = function() {
|
var updateConfig = function() {
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
|
|
@ -11,10 +11,12 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
|
||||||
$scope.recentTransactionsEnabled = {
|
$scope.recentTransactionsEnabled = {
|
||||||
value: config.recentTransactions.enabled
|
value: config.recentTransactions.enabled
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.hideNextSteps = {
|
$scope.hideNextSteps = {
|
||||||
value: config.hideNextSteps.enabled
|
value: config.hideNextSteps.enabled
|
||||||
};
|
};
|
||||||
|
$scope.usePincode = {
|
||||||
|
value: config.pincode ? config.pincode.enabled : false
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.spendUnconfirmedChange = function() {
|
$scope.spendUnconfirmedChange = function() {
|
||||||
|
|
@ -31,7 +33,24 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
|
||||||
$scope.nextStepsChange = function() {
|
$scope.nextStepsChange = function() {
|
||||||
var opts = {
|
var opts = {
|
||||||
hideNextSteps: {
|
hideNextSteps: {
|
||||||
enabled: $scope.hideNextSteps.value
|
enabled: $scope.hideNextSteps.value
|
||||||
|
},
|
||||||
|
};
|
||||||
|
configService.set(opts, function(err) {
|
||||||
|
if (err) $log.debug(err);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.savePincodeChanges = function(val) {
|
||||||
|
if (!val || val.length < 4) {
|
||||||
|
$scope.usePincode = {
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var opts = {
|
||||||
|
usePincode: {
|
||||||
|
enabled: $scope.usePincode.enabled
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
configService.set(opts, function(err) {
|
configService.set(opts, function(err) {
|
||||||
|
|
@ -50,6 +69,18 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.showPincodeModal = function() {
|
||||||
|
$scope.fromSettings = true;
|
||||||
|
$ionicModal.fromTemplateUrl('views/modals/pincode.html', {
|
||||||
|
scope: $scope,
|
||||||
|
backdropClickToClose: false,
|
||||||
|
hardwareBackButtonClose: false
|
||||||
|
}).then(function(modal) {
|
||||||
|
$scope.pincodeModal = modal;
|
||||||
|
$scope.pincodeModal.show();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
updateConfig();
|
updateConfig();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,16 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
|
||||||
};
|
};
|
||||||
|
|
||||||
function checkPasscode() {
|
function checkPasscode() {
|
||||||
|
console.log('Checking');
|
||||||
configService.whenAvailable(function(config) {
|
configService.whenAvailable(function(config) {
|
||||||
var value = '1234';
|
var value = '1234';
|
||||||
if (value != $scope.pincode) return;
|
if (value != $scope.pincode) return;
|
||||||
console.log('MATCH');
|
console.log('MATCH');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.cancel = function() {
|
||||||
|
$scope.savePincodeChanges(false);
|
||||||
|
$scope.pincodeModal.hide();
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
$scope.pincodeModal.show();
|
$scope.pincodeModal.show();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
openPincodeModal();
|
// openPincodeModal();
|
||||||
$scope.$on("$ionicView.afterEnter", function() {
|
$scope.$on("$ionicView.afterEnter", function() {
|
||||||
startupService.ready();
|
startupService.ready();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer
|
||||||
},
|
},
|
||||||
|
|
||||||
pincode: {
|
pincode: {
|
||||||
|
enabled: false,
|
||||||
value: null,
|
value: null,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#pin-code {
|
#pin-code {
|
||||||
background-color: #C3C3C3;
|
background-color: #C3C3C3;
|
||||||
|
.close {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: .5rem;
|
||||||
|
}
|
||||||
.button-stretch {
|
.button-stretch {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +18,7 @@
|
||||||
}
|
}
|
||||||
.content {
|
.content {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
text-align: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
.block-code {
|
.block-code {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,12 @@
|
||||||
<ion-toggle ng-model="hideNextSteps.value" toggle-class="toggle-balanced" ng-change="nextStepsChange()">
|
<ion-toggle ng-model="hideNextSteps.value" toggle-class="toggle-balanced" ng-change="nextStepsChange()">
|
||||||
<span class="toggle-label" translate>Hide Next Steps Card</span>
|
<span class="toggle-label" translate>Hide Next Steps Card</span>
|
||||||
</ion-toggle>
|
</ion-toggle>
|
||||||
|
|
||||||
|
<div class="item item-divider"></div>
|
||||||
|
|
||||||
|
<ion-toggle ng-model="usePincode.value" toggle-class="toggle-balanced" ng-change="showPincodeModal()">
|
||||||
|
<span class="toggle-label" translate>Use pin to lock/unlock the app</span>
|
||||||
|
</ion-toggle>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-view>
|
</ion-view>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<ion-modal-view id="pin-code" ng-controller="pincodeController">
|
<ion-modal-view id="pin-code" ng-controller="pincodeController">
|
||||||
|
<div ng-if="fromSettings" ng-click="cancel()" class="close" translate>Close</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="block-code">
|
<div class="block-code">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -52,13 +53,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button class="button button-light button-stretch"></button>
|
<button class="button button-light button-stretch icon ion-checkmark" ng-click="save()"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button class="button button-light button-stretch" ng-click="add('0')">0</button>
|
<button class="button button-light button-stretch" ng-click="add('0')">0</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<button class="button icon ion-arrow-left-a button-light button-stretch" ng-click="delete()"></button>
|
<button class="button button-light button-stretch icon ion-arrow-left-a" ng-click="delete()"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue