Skip to content

Commit

Permalink
feature/settings-animations — Facility for users with less granted ph…
Browse files Browse the repository at this point in the history
…ones, they can now disable animations.
  • Loading branch information
jeandat committed Feb 26, 2016
1 parent fb02880 commit 8b5bdf9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/setting/setting-list.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
.controller('SettingListController', SettingListController);

function SettingListController($log, $scope, $cordovaToast, defaultCacheName, CacheFactory,
$ionicPopup, throwErr, ImgCache, $timeout) {
$ionicPopup, throwErr, ImgCache, $timeout, $ionicConfig) {

var vm = this;
vm.settings = {
enableCache: true
enableCache: true,
enableAnimations: true
};
vm.clearing = false;
vm.clearCache = clearCache;
Expand All @@ -24,6 +25,18 @@
if (newValue === oldValue) return;
$cordovaToast.showShortBottom('Not implemented yet…');
});
$scope.$watch('vm.settings.enableAnimations', function (newValue, oldValue) {
if (newValue === oldValue) return;
newValue === true ? enableAnimations() : disableAnimations();
});
}

function enableAnimations(){
$ionicConfig.views.transition('platform');
}

function disableAnimations(){
$ionicConfig.views.transition('none');
}

function clearCache() {
Expand Down
2 changes: 2 additions & 0 deletions app/setting/setting-list.jade
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ion-view.settings(view-title='Settings')
ion-list
ion-toggle(ng-model='vm.settings.enableCache', toggle-class='toggle-positive')
| Enable Cache
ion-toggle(ng-model='vm.settings.enableAnimations', toggle-class='toggle-positive')
| Enable Animations
ion-item(ng-click='vm.clearCache()')
button.button.button-assertive.button-small.button-block
span(ng-if='vm.clearing') Clearing…
Expand Down

0 comments on commit 8b5bdf9

Please sign in to comment.