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>
</form>
</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()">
<form class="form-inline" role="form">
<div class="checkbox">

View file

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