mirror of https://github.com/BTCPrivate/copay.git
wip add modal config
This commit is contained in:
parent
1ee75fd424
commit
82e556b026
|
@ -1,6 +1,6 @@
|
|||
'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 config = configService.getSync();
|
||||
|
@ -11,10 +11,12 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
|
|||
$scope.recentTransactionsEnabled = {
|
||||
value: config.recentTransactions.enabled
|
||||
};
|
||||
|
||||
$scope.hideNextSteps = {
|
||||
value: config.hideNextSteps.enabled
|
||||
};
|
||||
$scope.usePincode = {
|
||||
value: config.pincode ? config.pincode.enabled : false
|
||||
};
|
||||
};
|
||||
|
||||
$scope.spendUnconfirmedChange = function() {
|
||||
|
@ -31,7 +33,24 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
|
|||
$scope.nextStepsChange = function() {
|
||||
var opts = {
|
||||
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) {
|
||||
|
@ -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) {
|
||||
updateConfig();
|
||||
});
|
||||
|
|
|
@ -41,10 +41,16 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
|
|||
};
|
||||
|
||||
function checkPasscode() {
|
||||
console.log('Checking');
|
||||
configService.whenAvailable(function(config) {
|
||||
var value = '1234';
|
||||
if (value != $scope.pincode) return;
|
||||
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();
|
||||
});
|
||||
};
|
||||
openPincodeModal();
|
||||
// openPincodeModal();
|
||||
$scope.$on("$ionicView.afterEnter", function() {
|
||||
startupService.ready();
|
||||
});
|
||||
|
|
|
@ -54,6 +54,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer
|
|||
},
|
||||
|
||||
pincode: {
|
||||
enabled: false,
|
||||
value: null,
|
||||
},
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#pin-code {
|
||||
background-color: #C3C3C3;
|
||||
|
||||
.close {
|
||||
cursor: pointer;
|
||||
padding: .5rem;
|
||||
}
|
||||
.button-stretch {
|
||||
width: 100%;
|
||||
}
|
||||
|
@ -15,6 +18,7 @@
|
|||
}
|
||||
.content {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.block-code {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="comment" translate>
|
||||
If enabled, wallets will also try to spend unconfirmed funds. This option may cause transaction delays.
|
||||
</div>
|
||||
|
||||
|
||||
<div class="item item-divider"></div>
|
||||
|
||||
<ion-toggle class="has-comment" ng-show="!isWP" ng-model="recentTransactionsEnabled.value" toggle-class="toggle-balanced" ng-change="recentTransactionsChange()">
|
||||
|
@ -28,6 +28,12 @@
|
|||
<ion-toggle ng-model="hideNextSteps.value" toggle-class="toggle-balanced" ng-change="nextStepsChange()">
|
||||
<span class="toggle-label" translate>Hide Next Steps Card</span>
|
||||
</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>
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<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="block-code">
|
||||
<div class="row">
|
||||
|
@ -52,13 +53,13 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<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 class="col">
|
||||
<button class="button button-light button-stretch" ng-click="add('0')">0</button>
|
||||
</div>
|
||||
<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>
|
||||
|
|
Loading…
Reference in New Issue