fix: namespace crypto storage per account, add chat polling, fix notification flow and dark theme issues
This commit is contained in:
@@ -40,6 +40,19 @@ class ChatWidget extends HTMLElement {
|
||||
disconnectedCallback() {
|
||||
if (this.unsubscribe) this.unsubscribe()
|
||||
if (this.i18nUnsubscribe) this.i18nUnsubscribe()
|
||||
this._stopPolling()
|
||||
}
|
||||
|
||||
_startPolling() {
|
||||
this._stopPolling()
|
||||
this._pollTimer = setInterval(() => this.refreshMessages(), 5000)
|
||||
}
|
||||
|
||||
_stopPolling() {
|
||||
if (this._pollTimer) {
|
||||
clearInterval(this._pollTimer)
|
||||
this._pollTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
async activate() {
|
||||
@@ -66,6 +79,8 @@ class ChatWidget extends HTMLElement {
|
||||
|
||||
this.unsubscribe = conversationsService.subscribe(() => this.refreshMessages())
|
||||
this.i18nUnsubscribe = i18n.subscribe(() => this.render())
|
||||
|
||||
if (this.conversation) this._startPolling()
|
||||
}
|
||||
|
||||
async initConversation() {
|
||||
@@ -130,9 +145,12 @@ class ChatWidget extends HTMLElement {
|
||||
}
|
||||
|
||||
async refreshMessages() {
|
||||
const prevCount = this.messages.length
|
||||
await this.loadMessages()
|
||||
this.renderMessages()
|
||||
this.scrollToBottom()
|
||||
if (this.messages.length !== prevCount) {
|
||||
this.renderMessages()
|
||||
this.scrollToBottom()
|
||||
}
|
||||
}
|
||||
|
||||
async loadDealState() {
|
||||
|
||||
Reference in New Issue
Block a user