From 41ebf13156380054365714f600bdabd72032580e Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Mon, 27 Mar 2023 16:36:27 +0530 Subject: [PATCH] Some more changes --- .../stages/SelectMethodViewModel.ts | 4 ++++ .../stages/VerificationCancelledViewModel.ts | 4 ++++ .../stages/VerificationCompleteViewModel.ts | 4 ++++ .../stages/VerifyEmojisViewModel.ts | 4 ++++ .../stages/WaitingForOtherUserViewModel.ts | 4 ++++ .../verification/DeviceVerificationView.ts | 20 ++++++++----------- .../verification/stages/SelectMethodView.ts | 4 ++-- .../stages/VerificationCancelledView.ts | 7 ++----- .../stages/VerificationCompleteView.ts | 4 ++-- .../verification/stages/VerifyEmojisView.ts | 4 ++-- .../stages/WaitingForOtherUserView.ts | 4 ++-- 11 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/domain/session/verification/stages/SelectMethodViewModel.ts b/src/domain/session/verification/stages/SelectMethodViewModel.ts index 681a2e46..e88d0f83 100644 --- a/src/domain/session/verification/stages/SelectMethodViewModel.ts +++ b/src/domain/session/verification/stages/SelectMethodViewModel.ts @@ -47,4 +47,8 @@ export class SelectMethodViewModel extends ErrorReportViewModel { - render(t, vm) { + render(t: Builder) { return t.div({ className: { "middle": true, @@ -36,21 +31,22 @@ export class DeviceVerificationView extends TemplateView vm.currentStageViewModel, (stageVm) => { - if (stageVm instanceof WaitingForOtherUserViewModel) { + if (stageVm.kind === "waiting-for-user") { return new WaitingForOtherUserView(stageVm); } - else if (stageVm instanceof VerificationCancelledViewModel) { + else if (stageVm.kind === "verification-cancelled") { return new VerificationCancelledView(stageVm); } - else if (stageVm instanceof SelectMethodViewModel) { + else if (stageVm.kind === "select-method") { return new SelectMethodView(stageVm); } - else if (stageVm instanceof VerifyEmojisViewModel) { + else if (stageVm.kind === "verify-emojis") { return new VerifyEmojisView(stageVm); } - else if (stageVm instanceof VerificationCompleteViewModel) { + else if (stageVm.kind === "verification-completed") { return new VerificationCompleteView(stageVm); } + return null; }) ]) } diff --git a/src/platform/web/ui/session/verification/stages/SelectMethodView.ts b/src/platform/web/ui/session/verification/stages/SelectMethodView.ts index 9e665f31..e7603700 100644 --- a/src/platform/web/ui/session/verification/stages/SelectMethodView.ts +++ b/src/platform/web/ui/session/verification/stages/SelectMethodView.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {TemplateView} from "../../../general/TemplateView"; +import {Builder, TemplateView} from "../../../general/TemplateView"; import {spinner} from "../../../common.js" import type {SelectMethodViewModel} from "../../../../../../domain/session/verification/stages/SelectMethodViewModel"; export class SelectMethodView extends TemplateView { - render(t) { + render(t: Builder) { return t.div({ className: "SelectMethodView" }, [ t.map(vm => vm.hasProceeded, (hasProceeded, t, vm) => { if (hasProceeded) { diff --git a/src/platform/web/ui/session/verification/stages/VerificationCancelledView.ts b/src/platform/web/ui/session/verification/stages/VerificationCancelledView.ts index 28cebf80..d2832ddb 100644 --- a/src/platform/web/ui/session/verification/stages/VerificationCancelledView.ts +++ b/src/platform/web/ui/session/verification/stages/VerificationCancelledView.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {TemplateView} from "../../../general/TemplateView"; +import {Builder, TemplateView} from "../../../general/TemplateView"; import {VerificationCancelledViewModel} from "../../../../../../domain/session/verification/stages/VerificationCancelledViewModel"; import {CancelReason} from "../../../../../../matrix/verification/SAS/channel/types"; export class VerificationCancelledView extends TemplateView { - render(t, vm: VerificationCancelledViewModel) { + render(t: Builder, vm: VerificationCancelledViewModel) { const headerTextStart = vm.isCancelledByUs ? "You" : "The other device"; return t.div( @@ -50,10 +50,8 @@ export class VerificationCancelledView extends TemplateView { - render(t, vm: VerificationCompleteViewModel) { + render(t: Builder, vm: VerificationCompleteViewModel) { return t.div({ className: "VerificationCompleteView" }, [ t.div({className: "VerificationCompleteView__icon"}), t.div({ className: "VerificationCompleteView__heading" }, [ diff --git a/src/platform/web/ui/session/verification/stages/VerifyEmojisView.ts b/src/platform/web/ui/session/verification/stages/VerifyEmojisView.ts index 9f7b312b..32aba691 100644 --- a/src/platform/web/ui/session/verification/stages/VerifyEmojisView.ts +++ b/src/platform/web/ui/session/verification/stages/VerifyEmojisView.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {TemplateView} from "../../../general/TemplateView"; +import {Builder, TemplateView} from "../../../general/TemplateView"; import {spinner} from "../../../common.js" import type {VerifyEmojisViewModel} from "../../../../../../domain/session/verification/stages/VerifyEmojisViewModel"; export class VerifyEmojisView extends TemplateView { - render(t, vm: VerifyEmojisViewModel) { + render(t: Builder, vm: VerifyEmojisViewModel) { const emojiList = vm.emojis.reduce((acc, [emoji, name]) => { const e = t.div({ className: "EmojiContainer" }, [ t.div({ className: "EmojiContainer__emoji" }, emoji), diff --git a/src/platform/web/ui/session/verification/stages/WaitingForOtherUserView.ts b/src/platform/web/ui/session/verification/stages/WaitingForOtherUserView.ts index 007b258e..0018a4b3 100644 --- a/src/platform/web/ui/session/verification/stages/WaitingForOtherUserView.ts +++ b/src/platform/web/ui/session/verification/stages/WaitingForOtherUserView.ts @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {TemplateView} from "../../../general/TemplateView"; +import {Builder, TemplateView} from "../../../general/TemplateView"; import {spinner} from "../../../common.js"; import {WaitingForOtherUserViewModel} from "../../../../../../domain/session/verification/stages/WaitingForOtherUserViewModel"; export class WaitingForOtherUserView extends TemplateView { - render(t, vm) { + render(t: Builder, vm: WaitingForOtherUserViewModel) { return t.div({ className: "WaitingForOtherUserView" }, [ t.div({ className: "WaitingForOtherUserView__heading" }, [ spinner(t),