|
|
@ -104,7 +104,7 @@ 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 { copyToClipboard } from "../services/ClipboardService"; |
|
|
|
|
|
|
|
import { logger } from "../utils/logger"; |
|
|
|
import { QRScannerFactory } from "../services/QRScanner/QRScannerFactory"; |
|
|
@ -196,7 +196,7 @@ export default class ContactQRScanFull extends Vue { |
|
|
|
$router!: Router; |
|
|
|
|
|
|
|
// Notification helper system |
|
|
|
private notify = createNotifyHelpers(this.$notify); |
|
|
|
private notify!: ReturnType<typeof createNotifyHelpers>; |
|
|
|
|
|
|
|
isScanning = false; |
|
|
|
error: string | null = null; |
|
|
@ -264,6 +264,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(); |
|
|
|
|
|
|
@ -651,36 +654,51 @@ 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 |
|
|
|
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 |
|
|
|
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."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|