Merge pull request #989 from lorenzhs/fix-nicklist

Fix nicklist on mobile: now works on iOS & behaves correctly buffers without a nicklist
This commit is contained in:
Lorenz Hübschle-Schneider 2018-03-29 14:08:45 +02:00 committed by GitHub
commit 005f9f6f5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 26 deletions

View file

@ -835,6 +835,10 @@ img.emojione {
bottom: 0px; bottom: 0px;
} }
.content[sidebar-state=visible] #nicklist {
display: none;
}
.navbar-fixed-bottom { .navbar-fixed-bottom {
margin: 0; margin: 0;
} }

View file

@ -310,14 +310,14 @@ npm run build-electron-{windows, darwin, linux}</pre>
</li> </li>
</ul> </ul>
</div> </div>
<div id="nicklist" ng-if="showNicklist" ng-swipe-right="swipeRight()" ng-swipe-disable-mouse class="vertical-line-left">
<ul class="nicklistgroup list-unstyled" ng-repeat="group in nicklist">
<li ng-repeat="nick in group.nicks|orderBy:'name'">
<a ng-click="openBuffer(nick.name)"><span ng-class="::nick.prefixClasses" ng-bind="::nick.prefix"></span><span ng-class="::nick.nameClasses" ng-bind="::nick.name"></span></a>
</li>
</ul>
</div>
<div id="bufferlines" class="favorite-font" ng-swipe-right="swipeRight()" ng-swipe-left="swipeLeft()" ng-swipe-disable-mouse ng-class="{'withnicklist': showNicklist}" when-scrolled="infiniteScroll()" imgur-drop> <div id="bufferlines" class="favorite-font" ng-swipe-right="swipeRight()" ng-swipe-left="swipeLeft()" ng-swipe-disable-mouse ng-class="{'withnicklist': showNicklist}" when-scrolled="infiniteScroll()" imgur-drop>
<div id="nicklist" ng-if="showNicklist" ng-swipe-right="swipeRight()" ng-swipe-disable-mouse class="vertical-line-left">
<ul class="nicklistgroup list-unstyled" ng-repeat="group in nicklist">
<li ng-repeat="nick in group.nicks|orderBy:'name'">
<a ng-click="openBuffer(nick.name)"><span ng-class="::nick.prefixClasses" ng-bind="::nick.prefix"></span><span ng-class="::nick.nameClasses" ng-bind="::nick.name"></span></a>
</li>
</ul>
</div>
<table> <table>
<tbody> <tbody>
<tr class="bufferline"> <tr class="bufferline">

View file

@ -356,7 +356,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
} else if ($scope.swipeStatus === 0) { } else if ($scope.swipeStatus === 0) {
// show nicklist // show nicklist
$scope.swipeStatus = -1; $scope.swipeStatus = -1;
$scope.updateShowNicklist(); if (!$scope.updateShowNicklist()) {
$scope.swipeStatus = 0;
}
} else if ($scope.swipeStatus === -1) { } else if ($scope.swipeStatus === -1) {
/* do nothing */ /* do nothing */
} else { } else {
@ -761,26 +763,29 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.updateShowNicklist(); $scope.updateShowNicklist();
}); });
$scope.showNicklist = false; $scope.showNicklist = false;
// Utility function that template can use to check if nicklist should // Utility function that template can use to check if nicklist should be
// be displayed for current buffer or not // displayed for current buffer or not is called on buffer switch and
// is called on buffer switch and certain swipe actions // certain swipe actions. Sets $scope.showNicklist accordingly and returns
// whether the buffer even has a nicklist to show.
$scope.updateShowNicklist = function() { $scope.updateShowNicklist = function() {
$scope.showNicklist = (function() { var ab = models.getActiveBuffer();
var ab = models.getActiveBuffer(); // Check whether buffer exists and nicklist is non-empty
// Check whether buffer exists and nicklist is non-empty if (!ab || ab.isNicklistEmpty()) {
if (!ab || ab.isNicklistEmpty()) { $scope.showNicklist = false;
return false; return false;
} }
// Check if nicklist is disabled in settings (ignored on mobile) // Check if nicklist is disabled in settings (ignored on mobile)
if (!utils.isMobileUi() && settings.nonicklist) { if (!utils.isMobileUi() && settings.nonicklist) {
return false; $scope.showNicklist = false;
}
// mobile: hide nicklist unless overriden by setting or swipe action
if (utils.isMobileUi() && !settings.alwaysnicklist && $scope.swipeStatus !== -1) {
return false;
}
return true; return true;
})(); }
// mobile: hide nicklist unless overriden by setting or swipe action
if (utils.isMobileUi() && !settings.alwaysnicklist && $scope.swipeStatus !== -1) {
$scope.showNicklist = false;
return true;
}
$scope.showNicklist = true;
return true;
}; };
//XXX not sure whether this belongs here //XXX not sure whether this belongs here