Add an "always show nicklist" setting on mobile to replace "hide nicklist"

This commit is contained in:
Lorenz Hübschle-Schneider 2017-04-17 18:04:03 +02:00 committed by Lorenz Hübschle-Schneider
parent e37666a571
commit 6b7b639618
2 changed files with 19 additions and 8 deletions

View file

@ -437,6 +437,16 @@ npm run build-electron-{windows, darwin, linux}</pre>
</div> </div>
</form> </form>
</li> </li>
<li ng-if="isMobileUi()">
<form class="form-inline" role="form">
<div class="checkbox">
<label>
<input type="checkbox" ng-model="settings.alwaysnicklist">
Always show nicklist
</label>
</div>
</form>
</li>
<li ng-if="!isMobileUi()"> <li ng-if="!isMobileUi()">
<form class="form-inline" role="form"> <form class="form-inline" role="form">
<div class="checkbox"> <div class="checkbox">

View file

@ -42,6 +42,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
'savepassword': false, 'savepassword': false,
'autoconnect': false, 'autoconnect': false,
'nonicklist': utils.isMobileUi(), 'nonicklist': utils.isMobileUi(),
'alwaysnicklist': false, // only significant on mobile
'noembed': true, 'noembed': true,
'onlyUnread': false, 'onlyUnread': false,
'hotlistsync': true, 'hotlistsync': true,
@ -173,7 +174,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// Check if we should show nicklist or not // Check if we should show nicklist or not
$scope.showNicklist = $scope.updateShowNicklist(); $scope.showNicklist = $scope.updateShowNicklist();
} }
if ($scope.swipeStatus <= 0) { if ($scope.swipeStatus <= 0 && !settings.alwaysnicklist) {
$scope.swipeStatus = $scope.showNicklist ? -1 : 0; $scope.swipeStatus = $scope.showNicklist ? -1 : 0;
} }
@ -336,10 +337,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// Depending on swipe state // Depending on swipe state
if ($scope.swipeStatus === 1) { if ($scope.swipeStatus === 1) {
/* do nothing */ /* do nothing */
} else if ($scope.swipeStatus === 0 && touch) { } else if ($scope.swipeStatus === 0) {
$scope.showSidebar(); if (touch) $scope.showSidebar();
} else if ($scope.swipeStatus === -1) { } else if ($scope.swipeStatus === -1) {
$scope.closeNick(); if (!settings.alwaysnicklist) $scope.closeNick();
} else { } else {
console.log("Weird swipe status:", $scope.swipeStatus); console.log("Weird swipe status:", $scope.swipeStatus);
$scope.swipeStatus = 0; // restore sanity $scope.swipeStatus = 0; // restore sanity
@ -351,8 +352,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.swipeLeft = function($event) { $rootScope.swipeLeft = function($event) {
var touch = $event instanceof TouchEvent; var touch = $event instanceof TouchEvent;
// Depending on swipe state, ... // Depending on swipe state, ...
if ($scope.swipeStatus === 1 && touch) { if ($scope.swipeStatus === 1) {
$scope.hideSidebar(); if (touch) $scope.hideSidebar();
} else if ($scope.swipeStatus === 0) { } else if ($scope.swipeStatus === 0) {
$scope.openNick(); $scope.openNick();
} else if ($scope.swipeStatus === -1) { } else if ($scope.swipeStatus === -1) {
@ -769,7 +770,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// Watch model and update show setting when it changes // Watch model and update show setting when it changes
settings.addCallback('nonicklist', function() { settings.addCallback('nonicklist', function() {
$scope.showNicklist = $scope.updateShowNicklist(); $scope.showNicklist = $scope.updateShowNicklist();
if ($scope.swipeStatus <= 0) { if ($scope.swipeStatus <= 0 && !settings.alwaysnicklist) {
$scope.swipeStatus = $scope.showNicklist ? -1 : 0; $scope.swipeStatus = $scope.showNicklist ? -1 : 0;
} }
// restore bottom view // restore bottom view
@ -789,7 +790,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
return false; return false;
} }
// Check if option no nicklist is set // Check if option no nicklist is set
if (settings.nonicklist) { if (settings.nonicklist && !settings.alwaysnicklist) {
return false; return false;
} }
// Check if nicklist is empty // Check if nicklist is empty