parent
e025491a10
commit
984ebeae36
@ -440,7 +440,11 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
if (peerData.peerString == $scope.curDialog.peer &&
|
if (peerData.peerString == $scope.curDialog.peer &&
|
||||||
peerData.messageID == $scope.curDialog.messageID &&
|
peerData.messageID == $scope.curDialog.messageID &&
|
||||||
!peerData.startParam) {
|
!peerData.startParam) {
|
||||||
$scope.$broadcast(peerData.messageID ? 'ui_history_change_scroll' : 'ui_history_focus');
|
if (peerData.messageID) {
|
||||||
|
$scope.$broadcast('ui_history_change_scroll', true);
|
||||||
|
} else {
|
||||||
|
$scope.$broadcast('ui_history_focus');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var peerID = AppPeersManager.getPeerID(peerData.peerString);
|
var peerID = AppPeersManager.getPeerID(peerData.peerString);
|
||||||
var username = AppPeersManager.getPeer(peerID).username;
|
var username = AppPeersManager.getPeer(peerID).username;
|
||||||
@ -1108,7 +1112,6 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
documents: 'inputMessagesFilterDocument',
|
documents: 'inputMessagesFilterDocument',
|
||||||
audio: 'inputMessagesFilterVoice'
|
audio: 'inputMessagesFilterVoice'
|
||||||
},
|
},
|
||||||
unfocusMessagePromise,
|
|
||||||
jump = 0,
|
jump = 0,
|
||||||
moreJump = 0,
|
moreJump = 0,
|
||||||
moreActive = false,
|
moreActive = false,
|
||||||
@ -1131,7 +1134,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
newDialog.messageID) {
|
newDialog.messageID) {
|
||||||
messageFocusHistory();
|
messageFocusHistory();
|
||||||
}
|
}
|
||||||
else if (newDialog.peerID) {
|
else if (peerID) {
|
||||||
updateHistoryPeer(true);
|
updateHistoryPeer(true);
|
||||||
loadHistory();
|
loadHistory();
|
||||||
}
|
}
|
||||||
@ -1292,15 +1295,6 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
var focusedMsgID = $scope.curDialog.messageID || 0;
|
var focusedMsgID = $scope.curDialog.messageID || 0;
|
||||||
$scope.$broadcast('messages_focus', focusedMsgID);
|
$scope.$broadcast('messages_focus', focusedMsgID);
|
||||||
$scope.$broadcast('ui_history_change_scroll', true);
|
$scope.$broadcast('ui_history_change_scroll', true);
|
||||||
|
|
||||||
$timeout.cancel(unfocusMessagePromise);
|
|
||||||
if (focusedMsgID) {
|
|
||||||
unfocusMessagePromise = $timeout(function () {
|
|
||||||
if ($scope.curDialog.messageID == focusedMsgID) {
|
|
||||||
$scope.$broadcast('messages_focus', 0);
|
|
||||||
}
|
|
||||||
}, 2800);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
loadHistory();
|
loadHistory();
|
||||||
}
|
}
|
||||||
@ -1442,10 +1436,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
|
|
||||||
|
|
||||||
$scope.state.mayBeHasMore = true;
|
$scope.state.mayBeHasMore = true;
|
||||||
// console.log(dT(), 'start load history', $scope.curDialog);
|
console.log(dT(), 'start load history', $scope.curDialog);
|
||||||
getMessagesPromise.then(function (historyResult) {
|
getMessagesPromise.then(function (historyResult) {
|
||||||
if (curJump != jump) return;
|
if (curJump != jump) return;
|
||||||
// console.log(dT(), 'history loaded', angular.copy(historyResult));
|
console.log(dT(), 'history loaded', angular.copy(historyResult));
|
||||||
|
|
||||||
var fetchedLength = historyResult.history.length;
|
var fetchedLength = historyResult.history.length;
|
||||||
|
|
||||||
@ -1494,15 +1488,6 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
|||||||
});
|
});
|
||||||
$scope.$broadcast('ui_history_change');
|
$scope.$broadcast('ui_history_change');
|
||||||
|
|
||||||
$timeout.cancel(unfocusMessagePromise);
|
|
||||||
if (focusedMsgID) {
|
|
||||||
unfocusMessagePromise = $timeout(function () {
|
|
||||||
if ($scope.curDialog.messageID == focusedMsgID) {
|
|
||||||
$scope.$broadcast('messages_focus', 0);
|
|
||||||
}
|
|
||||||
}, 2800);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$rootScope.idle.isIDLE) {
|
if (!$rootScope.idle.isIDLE) {
|
||||||
AppMessagesManager.readHistory($scope.curDialog.peerID);
|
AppMessagesManager.readHistory($scope.curDialog.peerID);
|
||||||
}
|
}
|
||||||
|
@ -1169,9 +1169,11 @@ angular.module('myApp.directives', ['myApp.filters'])
|
|||||||
var unreadSplit, focusMessage;
|
var unreadSplit, focusMessage;
|
||||||
|
|
||||||
var newScrollTop = false;
|
var newScrollTop = false;
|
||||||
// console.trace('change scroll');
|
var afterScrollAdd;
|
||||||
|
// console.trace(dT(), 'change scroll', animated);
|
||||||
if (!noFocus &&
|
if (!noFocus &&
|
||||||
(focusMessage = $('.im_message_focus:visible', scrollableWrap)[0])) {
|
(focusMessage = $('.im_message_focus:visible', scrollableWrap)[0])) {
|
||||||
|
// console.log(dT(), 'change scroll to focus', focusMessage);
|
||||||
var ch = scrollableWrap.clientHeight,
|
var ch = scrollableWrap.clientHeight,
|
||||||
st = scrollableWrap.scrollTop,
|
st = scrollableWrap.scrollTop,
|
||||||
ot = focusMessage.offsetTop,
|
ot = focusMessage.offsetTop,
|
||||||
@ -1180,12 +1182,29 @@ angular.module('myApp.directives', ['myApp.filters'])
|
|||||||
newScrollTop = Math.max(0, ot - Math.floor(ch / 2) + 26);
|
newScrollTop = Math.max(0, ot - Math.floor(ch / 2) + 26);
|
||||||
}
|
}
|
||||||
atBottom = false;
|
atBottom = false;
|
||||||
|
|
||||||
|
afterScrollAdd = function () {
|
||||||
|
var unfocusMessagePromise = $(focusMessage).data('unfocus_promise');
|
||||||
|
if (unfocusMessagePromise) {
|
||||||
|
$timeout.cancel(unfocusMessagePromise);
|
||||||
|
$(focusMessage).removeClass('im_message_focus_active');
|
||||||
|
}
|
||||||
|
$timeout(function () {
|
||||||
|
$(focusMessage).addClass('im_message_focus_active');
|
||||||
|
unfocusMessagePromise = $timeout(function () {
|
||||||
|
$(focusMessage).removeClass('im_message_focus_active');
|
||||||
|
$(focusMessage).data('unfocus_promise', false);
|
||||||
|
}, 2800);
|
||||||
|
$(focusMessage).data('unfocus_promise', unfocusMessagePromise);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
} else if (unreadSplit = $('.im_message_unread_split:visible', scrollableWrap)[0]) {
|
} else if (unreadSplit = $('.im_message_unread_split:visible', scrollableWrap)[0]) {
|
||||||
// console.log('change scroll unread', unreadSplit.offsetTop);
|
// console.log(dT(), 'change scroll unread', unreadSplit.offsetTop);
|
||||||
newScrollTop = Math.max(0, unreadSplit.offsetTop - 52);
|
newScrollTop = Math.max(0, unreadSplit.offsetTop - 52);
|
||||||
atBottom = false;
|
atBottom = false;
|
||||||
} else {
|
} else {
|
||||||
// console.log('change scroll bottom');
|
// console.log(dT(), 'change scroll bottom');
|
||||||
newScrollTop = scrollableWrap.scrollHeight;
|
newScrollTop = scrollableWrap.scrollHeight;
|
||||||
atBottom = true;
|
atBottom = true;
|
||||||
}
|
}
|
||||||
@ -1196,6 +1215,9 @@ angular.module('myApp.directives', ['myApp.filters'])
|
|||||||
$(scrollableWrap).trigger('scroll');
|
$(scrollableWrap).trigger('scroll');
|
||||||
scrollTopInitial = scrollableWrap.scrollTop;
|
scrollTopInitial = scrollableWrap.scrollTop;
|
||||||
});
|
});
|
||||||
|
if (afterScrollAdd) {
|
||||||
|
afterScrollAdd();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (animated) {
|
if (animated) {
|
||||||
$(scrollableWrap).animate({scrollTop: newScrollTop}, 200, afterScroll);
|
$(scrollableWrap).animate({scrollTop: newScrollTop}, 200, afterScroll);
|
||||||
|
@ -3878,7 +3878,7 @@ ul.chat_modal_migrate_list {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.im_message_focus {
|
.im_message_focus_active {
|
||||||
.im_message_date,
|
.im_message_date,
|
||||||
.im_message_document_size,
|
.im_message_document_size,
|
||||||
.audio_player_duration,
|
.audio_player_duration,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user