diff --git a/src/views/ContactQRScanFullView.vue b/src/views/ContactQRScanFullView.vue index 42358b65..2664c03d 100644 --- a/src/views/ContactQRScanFullView.vue +++ b/src/views/ContactQRScanFullView.vue @@ -104,7 +104,6 @@ import { Buffer } from "buffer/"; import QRCodeVue3 from "qr-code-generator-vue3"; import { Component, Vue } from "vue-facing-decorator"; import { Router } from "vue-router"; -import { useClipboard } from "@vueuse/core"; import { logger } from "../utils/logger"; import { QRScannerFactory } from "../services/QRScanner/QRScannerFactory"; @@ -196,7 +195,7 @@ export default class ContactQRScanFull extends Vue { $router!: Router; // Notification helper system - private notify = createNotifyHelpers(this.$notify); + private notify!: ReturnType; isScanning = false; error: string | null = null; @@ -264,6 +263,9 @@ export default class ContactQRScanFull extends Vue { * Loads user settings and generates QR code for contact sharing */ async created() { + // Initialize notification helper system + this.notify = createNotifyHelpers(this.$notify); + try { const settings = await this.$accountSettings(); this.activeDid = settings.activeDid || ""; @@ -646,36 +648,53 @@ export default class ContactQRScanFull extends Vue { * Copies contact URL to clipboard for sharing */ async onCopyUrlToClipboard() { - const account = (await libsUtil.retrieveFullyDecryptedAccount( - this.activeDid, - )) as Account; - const jwtUrl = await generateEndorserJwtUrlForAccount( - account, - this.isRegistered, - this.givenName, - this.profileImageUrl, - true, - ); - useClipboard() - .copy(jwtUrl) - .then(() => { - this.notify.toast( - NOTIFY_QR_URL_COPIED.title, - NOTIFY_QR_URL_COPIED.message, - QR_TIMEOUT_MEDIUM, - ); + try { + const account = (await libsUtil.retrieveFullyDecryptedAccount( + this.activeDid, + )) as Account; + const jwtUrl = await generateEndorserJwtUrlForAccount( + account, + this.isRegistered, + this.givenName, + this.profileImageUrl, + true, + ); + + // Use the platform-specific ClipboardService for reliable iOS support + const { copyToClipboard } = await import("../services/ClipboardService"); + await copyToClipboard(jwtUrl); + + this.notify.toast( + NOTIFY_QR_URL_COPIED.title, + NOTIFY_QR_URL_COPIED.message, + QR_TIMEOUT_MEDIUM, + ); + } catch (error) { + logger.error("Error copying URL to clipboard:", { + error: error instanceof Error ? error.message : String(error), + stack: error instanceof Error ? error.stack : undefined, }); + this.notify.error("Failed to copy URL to clipboard."); + } } /** * Copies DID to clipboard for manual sharing */ - onCopyDidToClipboard() { - useClipboard() - .copy(this.activeDid) - .then(() => { - this.notify.info(NOTIFY_QR_DID_COPIED.message, QR_TIMEOUT_LONG); + async onCopyDidToClipboard() { + try { + // Use the platform-specific ClipboardService for reliable iOS support + const { copyToClipboard } = await import("../services/ClipboardService"); + await copyToClipboard(this.activeDid); + + this.notify.info(NOTIFY_QR_DID_COPIED.message, QR_TIMEOUT_LONG); + } catch (error) { + logger.error("Error copying DID to clipboard:", { + error: error instanceof Error ? error.message : String(error), + stack: error instanceof Error ? error.stack : undefined, }); + this.notify.error("Failed to copy DID to clipboard."); + } } /**