Only hide bufferlist when switching to mobile

Showing the keyboard on mobile will trigger a resize event, therefore
trying to use the bufferlist filter will actually hide the bufferlist
making the feature unusable. Bug introduced by 554b1669.
This commit is contained in:
Felix Eckhofer 2014-03-30 23:53:29 +02:00
parent 2000437c3a
commit 3ed3df9ede

View file

@ -740,10 +740,13 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
var noembed = false;
var notimestamp = false;
$rootScope.wasMobileDevice = false;
if ($rootScope.isMobileDevice()) {
nonicklist = true;
noembed = true;
notimestamp = true;
$rootScope.wasMobileDevice = true;
}
@ -853,10 +856,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
if ($rootScope.connected) {
// Show the sidebar if switching away from mobile view, hide it when switching to mobile
// Wrap in a condition so we save ourselves the $apply if nothing changes (50ms or more)
if ($scope.showSidebar === $scope.isMobileDevice()) {
if ($scope.wasMobileDevice !== $scope.isMobileDevice() &&
$scope.showSidebar === $scope.isMobileDevice()) {
$scope.showSidebar = !$scope.showSidebar;
$scope.$apply();
}
$scope.wasMobileDevice = $scope.isMobileDevice();
$scope.calculateNumLines();
}
}, 100));