Hardware back button support

This commit is contained in:
Sebastiaan Pasma 2018-09-19 11:37:46 +02:00
commit 33df5044d5
No known key found for this signature in database
GPG key ID: 9A2B0C8B95A1D26F

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $state, $timeout, $log, $ionicHistory, configService, profileService, fingerprintService, walletService, platformInfo, externalLinkService, gettextCatalog, $ionicNavBarDelegate) {
function($scope, $rootScope, $state, $timeout, $log, $ionicHistory, $ionicPlatform, configService, profileService, fingerprintService, walletService, platformInfo, externalLinkService, gettextCatalog, $ionicNavBarDelegate) {
var wallet;
var walletId;
var backToDetails = false;
@ -121,15 +121,18 @@ angular.module('copayApp.controllers').controller('preferencesController',
$scope.goBack = function() {
if (backToDetails) {
$ionicHistory.nextViewOptions({disableAnimate: true});
$state.go('tabs.home').then(function () {
$ionicHistory.clearHistory();
$ionicHistory.nextViewOptions({
disableAnimate: true
});
$state.go('tabs.wallet', {'walletId': wallet.id});
});
} else {
$ionicHistory.goBack();
}
};
$ionicPlatform.registerBackButtonAction(function (event) {
event.preventDefault();
$scope.goBack()
}, 1000);
});