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;
}
.content[sidebar-state=visible] #nicklist {
display: none;
}
.navbar-fixed-bottom {
margin: 0;
}

View File

@ -310,14 +310,14 @@ npm run build-electron-{windows, darwin, linux}</pre>
</li>
</ul>
</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="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>
<tbody>
<tr class="bufferline">

View File

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