Scrolling bug fix
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "Chatenium Nexum 3.0 Beta 9 (April 19, 2026)",
|
||||
"version": "Chatenium Nexum 3.0 Beta 10 (April 27, 2026)",
|
||||
"ok": "Ok",
|
||||
"back": "Back",
|
||||
"aChatProgram": "A messaging platform that you can trust.",
|
||||
@@ -218,8 +218,7 @@
|
||||
"changeLogDialog": {
|
||||
"label": "Chatenium has been updated",
|
||||
"changeLog": {
|
||||
"1": "Started implementing user settings, Privacy & Security is now available.",
|
||||
"2": "Enabled Chatenium Pictures on mobile devices."
|
||||
"1": "Fixed scrolling issues when sending or receiving new messages."
|
||||
}
|
||||
},
|
||||
"chatnav": {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<h3>{{ "version"|translate }}</h3>
|
||||
<ul>
|
||||
<li>{{ "chat.changeLogDialog.changeLog.1"|translate }}</li>
|
||||
<li>{{ "chat.changeLogDialog.changeLog.2"|translate }}</li>
|
||||
</ul>
|
||||
|
||||
<button tuiButton iconStart="@tui.check"
|
||||
|
||||
@@ -43,7 +43,6 @@ export class Dm implements OnInit {
|
||||
|
||||
async sendMessage(message: string, files: FileDataWithPreview[] | null) {
|
||||
if (!files && message.trim() == "") return
|
||||
this.scrollToBottom("smooth")
|
||||
|
||||
const session = this.serviceManager.currentSession();
|
||||
if (session != null) {
|
||||
@@ -102,14 +101,13 @@ export class Dm implements OnInit {
|
||||
forwardedFromName: ""
|
||||
}])
|
||||
|
||||
this.scrollToBottom("smooth")
|
||||
|
||||
const respMessage = await this.store.service.sendMessage(tempMsgId, message, null, null, files, <FileUploadProgressListener>{
|
||||
fileProgressUpdate: (tempMsgId, fileId, allChunks, chunksDone) => {
|
||||
this.uploadProgressUpdate(tempMsgId, fileId, allChunks, chunksDone)
|
||||
}
|
||||
})
|
||||
this.updateTempMessage(tempMsgId, respMessage)
|
||||
this.scrollToBottom("smooth")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,13 +124,13 @@ export class Dm implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
scrollToBottom(anim: 'instant' | 'smooth'): void {
|
||||
restoreScrollState(): void {
|
||||
setTimeout(() => {
|
||||
const scrollContainer = <HTMLDivElement>document.querySelector("#scrollContainer")
|
||||
scrollContainer.scroll({
|
||||
top: this.store.messagesVm.scrollBarStatus() == -1 ? scrollContainer.scrollHeight : this.store.messagesVm.scrollBarStatus(),
|
||||
left: 0,
|
||||
behavior: anim
|
||||
behavior: "instant"
|
||||
});
|
||||
|
||||
if (this.store.messagesVm.scrollBarStatus() == -1) {
|
||||
@@ -141,6 +139,17 @@ export class Dm implements OnInit {
|
||||
}, 0)
|
||||
}
|
||||
|
||||
scrollToBottom(anim: 'instant' | 'smooth'): void {
|
||||
setTimeout(() => {
|
||||
const scrollContainer = <HTMLDivElement>document.querySelector("#scrollContainer")
|
||||
scrollContainer.scroll({
|
||||
top: scrollContainer.scrollHeight,
|
||||
left: 0,
|
||||
behavior: anim
|
||||
});
|
||||
}, 0)
|
||||
}
|
||||
|
||||
handleMessagesScroll(e: any) {
|
||||
this.store.messagesVm.scrollBarStatus.set(e.target.scrollTop)
|
||||
}
|
||||
@@ -241,18 +250,18 @@ export class Dm implements OnInit {
|
||||
const messagesCache = await currentStore.service.getQuick();
|
||||
currentStore.messages.set(messagesCache);
|
||||
this.store.messagesStatus.set(LoadStatus.updating)
|
||||
this.scrollToBottom("instant")
|
||||
this.restoreScrollState()
|
||||
} catch (e) {
|
||||
console.warn(`Cache load failed: ${e}. Skipping cache load...`)
|
||||
}
|
||||
const messages = await currentStore.service.get();
|
||||
currentStore.messages.set(messages);
|
||||
this.store.messagesStatus.set(LoadStatus.loaded)
|
||||
this.scrollToBottom("instant")
|
||||
this.restoreScrollState()
|
||||
|
||||
await currentStore.service.joinWebSocketRoom();
|
||||
} else {
|
||||
this.scrollToBottom("instant")
|
||||
this.restoreScrollState()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -116,14 +116,13 @@ export class Text {
|
||||
forwardedFromName: ""
|
||||
}])
|
||||
|
||||
this.scrollToBottom("smooth")
|
||||
|
||||
const respMessage = await this.store.service.sendMessage(tempMsgId, message, null, null, files, <FileUploadProgressListener>{
|
||||
fileProgressUpdate: (tempMsgId, fileId, allChunks, chunksDone) => {
|
||||
this.uploadProgressUpdate(tempMsgId, fileId, allChunks, chunksDone)
|
||||
}
|
||||
})
|
||||
this.updateTempMessage(tempMsgId, respMessage)
|
||||
this.scrollToBottom("smooth")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +140,7 @@ export class Text {
|
||||
}
|
||||
}
|
||||
|
||||
scrollToBottom(anim: 'instant' | 'smooth'): void {
|
||||
restoreScrollState() {
|
||||
setTimeout(() => {
|
||||
if (!this.store) {
|
||||
return
|
||||
@@ -150,7 +149,7 @@ export class Text {
|
||||
scrollContainer.scroll({
|
||||
top: this.store.messagesVm.scrollBarStatus() == -1 ? scrollContainer.scrollHeight : this.store.messagesVm.scrollBarStatus(),
|
||||
left: 0,
|
||||
behavior: anim
|
||||
behavior: "instant"
|
||||
});
|
||||
|
||||
if (this.store.messagesVm.scrollBarStatus() == -1) {
|
||||
@@ -159,6 +158,17 @@ export class Text {
|
||||
}, 0)
|
||||
}
|
||||
|
||||
scrollToBottom(anim: 'instant' | 'smooth'): void {
|
||||
setTimeout(() => {
|
||||
const scrollContainer = <HTMLDivElement>document.querySelector("#scrollContainer")
|
||||
scrollContainer.scroll({
|
||||
top: scrollContainer.scrollHeight,
|
||||
left: 0,
|
||||
behavior: anim
|
||||
});
|
||||
}, 0)
|
||||
}
|
||||
|
||||
handleMessagesScroll(e: any) {
|
||||
if (!this.store) return
|
||||
this.store.messagesVm.scrollBarStatus.set(e.target.scrollTop)
|
||||
@@ -282,7 +292,7 @@ export class Text {
|
||||
try {
|
||||
const messagesCache = await currentStore.service.getQuick();
|
||||
currentStore.messages.set(messagesCache);
|
||||
this.scrollToBottom("instant")
|
||||
this.restoreScrollState()
|
||||
currentStore.messagesStatus.set(LoadStatus.updating)
|
||||
} catch (e) {
|
||||
console.warn(`Cache load failed: ${e}. Skipping cache load...`)
|
||||
@@ -290,11 +300,11 @@ export class Text {
|
||||
const messages = await currentStore.service.get();
|
||||
currentStore.messages.set(messages);
|
||||
currentStore.messagesStatus.set(LoadStatus.loaded)
|
||||
this.scrollToBottom("instant")
|
||||
this.restoreScrollState()
|
||||
|
||||
await currentStore.service.joinWebSocketRoom();
|
||||
} else {
|
||||
this.scrollToBottom("instant")
|
||||
this.restoreScrollState()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const environment = {
|
||||
version: "3.0-beta9",
|
||||
version: "3.0-beta10",
|
||||
api_url: "http://localhost:3000",
|
||||
cdn_url: "http://localhost:4000",
|
||||
ws_url: "ws://localhost:3000",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export const environment = {
|
||||
version: "3.0-beta9",
|
||||
version: "3.0-beta10",
|
||||
api_url: "https://api.chatenium.hu",
|
||||
cdn_url: "https://cdn.chatenium.hu",
|
||||
ws_url: "wss://api.chatenium.hu",
|
||||
|
||||
Reference in New Issue
Block a user