diff --git a/src/App.vue b/src/App.vue index 36aa444..36497c7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,24 +12,23 @@ - - + mdi-loginLogin + + - + @@ -38,10 +37,11 @@ - + menu - - Powered by Guardian Project. Version: {{ buildVersion }} + + Powered by Guardian Project. Version: {{ buildVersion }} @@ -68,8 +68,11 @@ export default { return this.$store.state.auth.status.loggedIn; }, logOut() { + this.openDrawer = false; this.$store.dispatch("auth/logout"); - this.$navigation.push("/login", -1); + this.$nextTick(() => { + this.$navigation.push({path: "/login"}, -1); + }) }, }, computed: { @@ -82,7 +85,8 @@ export default { immediate: true, handler(ignorednewVal, ignoredoldVal) { if (this.loggedIn()) { - this.$matrix.getMatrixClient(this.currentUser) + this.$matrix + .getMatrixClient(this.currentUser) .then(() => { console.log("Matrix client ready"); }) diff --git a/src/assets/css/chat.scss b/src/assets/css/chat.scss index c5ea536..a3952b2 100644 --- a/src/assets/css/chat.scss +++ b/src/assets/css/chat.scss @@ -367,30 +367,29 @@ .read-marker { - //display: block; - margin-top: 20px; - margin-bottom: 20px; margin-left: 20px; margin-right: 20px; height: 1px; + width: 100%; line-height: var(--v-theme-title-featured-line-height); - position: relative; + position: absolute; + bottom: 0; font-family: sans-serif; font-style: normal; font-weight: bold; - font-size: 9.88014 * $chat-text-size; + font-size: 8 * $chat-text-size; line-height: 140%; /* identical to box height, or 14px */ letter-spacing: 0.29px; - color: #9C9CAE; - background-color: #9C9CAE; + color: #c0c0c0; + background-color: #c0c0c0; + text-align: center; &::after { position: absolute; - left: 10px; - top: -6px; + top: -4px; background: white; - padding-left: 10px; - padding-right: 10px; + padding-left: 4px; + padding-right: 4px; content: attr(title); } } \ No newline at end of file diff --git a/src/components/Chat.vue b/src/components/Chat.vue index 97f5f22..7d65e4c 100644 --- a/src/components/Chat.vue +++ b/src/components/Chat.vue @@ -282,8 +282,8 @@ export default { /** A timer for read receipts. */ rrTimer: null, - /** Timestamp of last send Read Receipt */ - lastRRTimestamp: null, + /** Last event we sent a Read Receipt/Read Marker for */ + lastRR: null, }; }, @@ -295,6 +295,10 @@ export default { this.chatContainerSize = this.$refs.chatContainerResizer.$el.clientHeight; }, + beforeDestroy() { + this.stopRRTimer(); + }, + destroyed() { this.$matrix.off("Room.timeline", this.onEvent); this.$matrix.off("RoomMember.typing", this.onUserTyping); @@ -308,9 +312,16 @@ export default { return this.$matrix.currentRoom; }, roomId() { + if (this.room) { + return this.room.roomId; + } return this.$matrix.currentRoomId; }, readMarker() { + if (this.lastRR) { + // If we have sent a RR, use that as read marker (so we don't have to wait for server round trip) + return this.lastRR.getId(); + } return this.fullyReadMarker || this.room.getEventReadUpTo(this.$matrix.currentUserId, false); }, fullyReadMarker() { @@ -370,6 +381,10 @@ export default { this.typingMembers = []; this.initialLoadDone = false; + // Stop RR timer + this.stopRRTimer(); + this.lastRR = null; + if (!room) { // Public room? if (this.roomId && this.roomId.startsWith('#')) { @@ -552,6 +567,9 @@ export default { }, onScroll(ignoredevent) { const container = this.$refs.chatContainer; + if (!container) { + return; + } if (container.scrollTop == 0) { // Scrolled to top this.handleScrolledToTop(); @@ -855,14 +873,19 @@ export default { } }, - /** - * Start/restart the timer to Read Receipts. - */ - restartRRTimer() { + /** Stop Read Receipt timer */ + stopRRTimer() { if (this.rrTimer) { clearInterval(this.rrTimer); this.rrTimer = null; } + }, + + /** + * Start/restart the timer to Read Receipts. + */ + restartRRTimer() { + this.stopRRTimer(); this.rrTimer = setInterval(this.rrTimerElapsed, READ_RECEIPT_TIMEOUT); }, @@ -873,7 +896,7 @@ export default { const eventId = el.getAttribute('eventId'); if (eventId && this.room) { const event = this.room.findEventById(eventId); - if (event && event.getTs() > this.lastRRTimestamp) { + if (event && (!this.lastRR || event.getTs() > this.lastRR.getTs())) { // Disable timer while we are sending clearInterval(this.rrTimer); @@ -886,7 +909,7 @@ export default { }) .then(() => { console.log("RR sent for event: " + eventId); - this.lastRRTimestamp = event.getTs(); + this.lastRR = event; }) .catch(err => { console.log("Failed to update read marker: ", err); diff --git a/src/components/Join.vue b/src/components/Join.vue index 96b02ce..d7054db 100644 --- a/src/components/Join.vue +++ b/src/components/Join.vue @@ -19,9 +19,9 @@
Welcome to {{ roomName }}
- Join the group chat in a web browser or with the Keanu app. +
- Open Keanu app -
OR
+
OR
-->