diff --git a/src/client/app/mobile/views/components/notifications.vue b/src/client/app/mobile/views/components/notifications.vue index e1a296707..d537aefdc 100644 --- a/src/client/app/mobile/views/components/notifications.vue +++ b/src/client/app/mobile/views/components/notifications.vue @@ -48,6 +48,8 @@ export default Vue.extend({ }, mounted() { + window.addEventListener('scroll', this.onScroll, { passive: true }); + this.connection = (this as any).os.stream.useSharedConnection('main'); this.connection.on('notification', this.onNotification); @@ -69,6 +71,7 @@ export default Vue.extend({ }, beforeDestroy() { + window.removeEventListener('scroll', this.onScroll); this.connection.dispose(); }, @@ -101,6 +104,18 @@ export default Vue.extend({ }); this.notifications.unshift(notification); + }, + + onScroll() { + if (this.$store.state.settings.fetchOnScroll !== false) { + // 親要素が display none だったら弾く + // https://github.com/syuilo/misskey/issues/1569 + // http://d.hatena.ne.jp/favril/20091105/1257403319 + if (this.$el.offsetHeight == 0) return; + + const current = window.scrollY + window.innerHeight; + if (current > document.body.offsetHeight - 8) this.fetchMoreNotifications(); + } } } });