From ca1190aa473138190fb4cc75f54b3e057f734d81 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Fri, 5 Sep 2025 21:39:47 +0800 Subject: [PATCH] refactor: modernize registration prompt notification in ContactQRScanShowView - Replace deprecated notify.confirm() with modern $notify() API - Add structured notification object with group, type, and title properties - Extract registration prompt response logic into reusable handleRegistrationPromptResponse method - Update settings method from $updateSettings to $saveSettings for consistency - Align implementation with ContactsView.vue for better code consistency This brings the registration prompt notification in ContactQRScanShowView up to parity with the modern implementation used in ContactsView. --- src/views/ContactQRScanShowView.vue | 32 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/views/ContactQRScanShowView.vue b/src/views/ContactQRScanShowView.vue index bdf86a84..45885a02 100644 --- a/src/views/ContactQRScanShowView.vue +++ b/src/views/ContactQRScanShowView.vue @@ -738,24 +738,17 @@ export default class ContactQRScanShow extends Vue { !contact.registered ) { setTimeout(() => { - this.notify.confirm( - "Do you want to register them?", + this.$notify( { + group: "modal", + type: "confirm", + title: "Register", + text: "Do you want to register them?", onCancel: async (stopAsking?: boolean) => { - if (stopAsking) { - await this.$updateSettings({ - hideRegisterPromptOnNewContact: stopAsking, - }); - this.hideRegisterPromptOnNewContact = stopAsking; - } + await this.handleRegistrationPromptResponse(stopAsking); }, onNo: async (stopAsking?: boolean) => { - if (stopAsking) { - await this.$updateSettings({ - hideRegisterPromptOnNewContact: stopAsking, - }); - this.hideRegisterPromptOnNewContact = stopAsking; - } + await this.handleRegistrationPromptResponse(stopAsking); }, onYes: async () => { await this.register(contact); @@ -885,6 +878,17 @@ export default class ContactQRScanShow extends Vue { videoElement.style.transform = shouldMirror ? "scaleX(-1)" : "none"; } } + + private async handleRegistrationPromptResponse( + stopAsking?: boolean, + ): Promise { + if (stopAsking) { + await this.$saveSettings({ + hideRegisterPromptOnNewContact: stopAsking, + }); + this.hideRegisterPromptOnNewContact = stopAsking; + } + } } -- 2.30.2