Merge pull request #101 from spasma/master

Remember the state of collapsed/open menus on home tab
This commit is contained in:
Jean-Baptiste Dominguez 2018-05-09 10:22:14 +09:00 committed by GitHub
commit 8ebb3af445
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 7 deletions

View file

@ -257,6 +257,8 @@ angular.module('copayApp.controllers').controller('amountController', function($
if ($scope.alternativeAmount == 0) {
$scope.alternativeAmount = null;
} else {
$scope.amountModel.amount = parseFloat($scope.alternativeAmount.replace(/[^0-9-.]/g, ''));
}
if (fixedUnit) return;
@ -267,6 +269,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
}
if (availableUnits[unitIndex].isFiat) {
$scope.amountModel.amount = parseFloat($scope.amountModel.amount).toFixed(2);
altUnitIndex = altUnitIndex == 0 && availableUnits.length > 2 ? 1 : 0;
} else {
altUnitIndex = lodash.findIndex(availableUnits, {

View file

@ -1,8 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('communityController', function($scope, communityService, $ionicScrollDelegate, $timeout, platformInfo) {
angular.module('copayApp.controllers').controller('communityController', function($scope, communityService, $ionicScrollDelegate, $timeout, platformInfo, configService) {
$scope.hide = false;
configService.whenAvailable(function(config) {
$scope.hide = config.homeSectionIsHidden&&config.homeSectionIsHidden['community']?config.homeSectionIsHidden['community']:false;
});
$scope.services = communityService.get();
$scope.isCordova = platformInfo.isCordova;
@ -11,6 +16,9 @@ angular.module('copayApp.controllers').controller('communityController', functio
$timeout(function() {
$ionicScrollDelegate.resize();
$scope.$apply();
configService.set({homeSectionIsHidden: {community: $scope.hide}}, function(err) {
if (err) $log.debug(err);
});
}, 10);
};

View file

@ -1,8 +1,12 @@
'use strict';
angular.module('copayApp.controllers').controller('homeIntegrationsController', function($scope, homeIntegrationsService, $ionicScrollDelegate, $timeout) {
angular.module('copayApp.controllers').controller('homeIntegrationsController', function($scope, homeIntegrationsService, $ionicScrollDelegate, $timeout, configService) {
$scope.hide = false;
configService.whenAvailable(function(config) {
$scope.hide = config.homeSectionIsHidden&&config.homeSectionIsHidden['homeIntegrations']?config.homeSectionIsHidden['homeIntegrations']:false;
});
$scope.services = homeIntegrationsService.get();
$scope.toggle = function() {
@ -10,6 +14,9 @@ angular.module('copayApp.controllers').controller('homeIntegrationsController',
$timeout(function() {
$ionicScrollDelegate.resize();
$scope.$apply();
configService.set({homeSectionIsHidden: {homeIntegrations: $scope.hide}}, function(err) {
if (err) $log.debug(err);
});
}, 10);
};

View file

@ -1,8 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('nextStepsController', function($scope, nextStepsService, $ionicScrollDelegate, $timeout) {
angular.module('copayApp.controllers').controller('nextStepsController', function($scope, nextStepsService, $ionicScrollDelegate, $timeout, configService) {
$scope.hide = false;
configService.whenAvailable(function(config) {
$scope.hide = config.homeSectionIsHidden&&config.homeSectionIsHidden['nextSteps']?config.homeSectionIsHidden['nextSteps']:false;
});
$scope.services = nextStepsService.get();
$scope.toggle = function() {
@ -10,6 +15,9 @@ angular.module('copayApp.controllers').controller('nextStepsController', functio
$timeout(function() {
$ionicScrollDelegate.resize();
$scope.$apply();
configService.set({homeSectionIsHidden: {nextSteps: $scope.hide}}, function(err) {
if (err) $log.debug(err);
});
}, 10);
};

View file

@ -1,8 +1,12 @@
'use strict';
angular.module('copayApp.controllers').controller('servicesController', function($scope, $ionicScrollDelegate, $timeout, servicesService) {
angular.module('copayApp.controllers').controller('servicesController', function($scope, $ionicScrollDelegate, $timeout, servicesService, configService) {
$scope.hide = false;
configService.whenAvailable(function(config) {
$scope.hide = config.homeSectionIsHidden&&config.homeSectionIsHidden['services']?config.homeSectionIsHidden['services']:false;
});
$scope.services = servicesService.get();
$scope.toggle = function() {
@ -10,6 +14,9 @@ angular.module('copayApp.controllers').controller('servicesController', function
$timeout(function() {
$ionicScrollDelegate.resize();
$scope.$apply();
configService.set({homeSectionIsHidden: {services: $scope.hide}}, function(err) {
if (err) $log.debug(err);
});
}, 10);
};

View file

@ -120,7 +120,9 @@ angular.module('copayApp.services').factory('configService', function(storageSer
bitcoinAlias: 'btc',
bitcoinCashAlias: 'bch',
bitcoinWalletColor: '#fab915', // Observatory
bitcoinCashWalletColor: '#26B03C' // Dollar Green
bitcoinCashWalletColor: '#26B03C', // Dollar Green
homeSectionIsHidden: {}
};
var configCache = null;