Mark messages read only when visible, on receipt, focus, scroll

- Only mark messages read when scrolling if in focus and visible
- Remove last seen indicator when scrolling to the bottom with scroll
  down button
- Update last seen indicator when we don't already have one and we're
  scrolled up.

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-05-30 17:29:23 -07:00
parent 9a0a87ab40
commit b60b20bde4
3 changed files with 94 additions and 12 deletions

View file

@ -12,6 +12,13 @@
events: {
'scroll': 'onScroll',
},
initialize: function() {
Whisper.ListView.prototype.initialize.call(this);
this.triggerLazyScroll = _.debounce(function() {
this.$el.trigger('lazyScroll');
}.bind(this), 500);
},
onScroll: function() {
this.measureScrollPosition();
if (this.$el.scrollTop() === 0) {
@ -22,6 +29,8 @@
} else if (this.bottomOffset > this.outerHeight) {
this.$el.trigger('farFromBottom');
}
this.triggerLazyScroll();
},
atBottom: function() {
return this.bottomOffset < 30;