Wallet Settings button in Wallet Details

This commit is contained in:
Sebastiaan Pasma 2018-09-13 14:49:06 +02:00
commit 1615db9890
No known key found for this signature in database
GPG key ID: 9A2B0C8B95A1D26F
5 changed files with 26 additions and 3 deletions

View file

@ -1,9 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $timeout, $log, $ionicHistory, configService, profileService, fingerprintService, walletService, platformInfo, externalLinkService, gettextCatalog, $ionicNavBarDelegate) {
function($scope, $rootScope, $state, $timeout, $log, $ionicHistory, configService, profileService, fingerprintService, walletService, platformInfo, externalLinkService, gettextCatalog, $ionicNavBarDelegate) {
var wallet;
var walletId;
var backToDetails = false;
$scope.hiddenBalanceChange = function() {
var opts = {
@ -83,6 +84,7 @@ angular.module('copayApp.controllers').controller('preferencesController',
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
backToDetails = data.stateParams.backToDetails;
wallet = profileService.getWallet(data.stateParams.walletId);
walletId = wallet.credentials.walletId;
$scope.wallet = wallet;
@ -116,4 +118,15 @@ angular.module('copayApp.controllers').controller('preferencesController',
$scope.$on("$ionicView.enter", function(event, data) {
$ionicNavBarDelegate.showBar(true);
});
$scope.goBack = function() {
if (backToDetails) {
$state.go('tabs.home').then(function () {
$ionicHistory.clearHistory();
$state.go('tabs.wallet', {'walletId': wallet.id});
});
} else {
$ionicHistory.goBack();
}
};
});

View file

@ -115,6 +115,13 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
});
};
$scope.openSettings = function() {
$state.go('tabs.settings').then(function () {
$ionicHistory.clearHistory();
$state.go('tabs.preferences', {'walletId': $scope.wallet.id, 'backToDetails': true});
});
};
$scope.openSearchModal = function() {
$scope.color = $scope.wallet.color;
$scope.isSearching = true;

View file

@ -526,7 +526,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*/
.state('tabs.preferences', {
url: '/preferences/:walletId',
url: '/preferences/:walletId/:backToDetails',
views: {
'tab-settings@tabs': {
controller: 'preferencesController',

View file

@ -3,7 +3,7 @@
<ion-nav-title>
{{'Wallet Settings'|translate}}
</ion-nav-title>
<ion-nav-back-button>
<ion-nav-back-button ng-click="goBack()">
</ion-nav-back-button>
</ion-nav-bar>
<ion-content>

View file

@ -8,6 +8,9 @@
<button class="button back-button" ng-click="startSearch(); openSearchModal()" ng-if="txHistory.length > 4">
<i class="icon ion-ios-search-strong tx-search"></i>
</button>
<button class="button" ng-click="openSettings();">
<i class="icon ion-android-settings"></i>
</button>
</ion-nav-buttons>
</ion-nav-bar>
<style type="text/css">