From 2a52b3958899ad15f2cfe7b535462eb06ef5cb0c Mon Sep 17 00:00:00 2001 From: RMidhunSuresh <hi@midhun.dev> Date: Tue, 3 May 2022 14:09:08 +0530 Subject: [PATCH] Add explaining comments --- src/viewmodels/RootViewModel.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/viewmodels/RootViewModel.ts b/src/viewmodels/RootViewModel.ts index 27d4dfa..cf72fe1 100644 --- a/src/viewmodels/RootViewModel.ts +++ b/src/viewmodels/RootViewModel.ts @@ -23,6 +23,7 @@ export class RootViewModel extends ViewModel { this._client = new Client(this.platform); this._setupNavigation(); this._messageFromParent.on("maximize", () => this._showTimeline(Promise.resolve())); + // Chatterbox can be minimized via the start button on the parent page! this._messageFromParent.on("minimize", () => this.minimizeChatterbox()); } @@ -97,6 +98,11 @@ export class RootViewModel extends ViewModel { const newCount = room.notificationCount; if (newCount !== previousCount) { if (!room.isUnread && newCount !== 0) { + /* + when chatterbox is maximized and there are previous unread messages, + this condition is hit but we still want to send the notification count so that + the badge zeroes out. + */ room.clearUnread(); return; } -- GitLab