forked from jsnbuchanan/crowd-funder-for-time-pwa
feat: switch ContactQRScanShowView to URL-based contact sharing
- Replace CSV QR value copying with URL generation for better UX - Add generateEndorserJwtUrlForAccount import and Account type - Implement proper error handling for URL generation failures - Maintain consistency with ContactQRScanFullView behavior - Add documentation for the URL solution implementation Recipients can now click shared URLs to add contacts directly instead of manually pasting CSV data into input fields. addresses: https://app.clickup.com/t/86b63xhz4
This commit is contained in:
@@ -153,6 +153,7 @@ import {
|
||||
CONTACT_IMPORT_CONFIRM_URL_PATH_TIME_SAFARI,
|
||||
register,
|
||||
setVisibilityUtil,
|
||||
generateEndorserJwtUrlForAccount,
|
||||
} from "../libs/endorserServer";
|
||||
import { decodeEndorserJwt, ETHR_DID_PREFIX } from "../libs/crypto/vc";
|
||||
import * as libsUtil from "../libs/util";
|
||||
@@ -187,6 +188,7 @@ import {
|
||||
QR_TIMEOUT_STANDARD,
|
||||
QR_TIMEOUT_LONG,
|
||||
} from "@/constants/notifications";
|
||||
import { Account } from "@/db/tables/accounts";
|
||||
|
||||
interface QRScanResult {
|
||||
rawValue?: string;
|
||||
@@ -610,16 +612,33 @@ export default class ContactQRScanShow extends Vue {
|
||||
}
|
||||
|
||||
async onCopyUrlToClipboard() {
|
||||
// Copy the CSV format QR code value instead of generating a deep link
|
||||
useClipboard()
|
||||
.copy(this.qrValue)
|
||||
.then(() => {
|
||||
this.notify.toast(
|
||||
"Copied",
|
||||
NOTIFY_QR_URL_COPIED.message,
|
||||
QR_TIMEOUT_MEDIUM,
|
||||
);
|
||||
});
|
||||
try {
|
||||
// Generate URL for sharing
|
||||
const account = (await libsUtil.retrieveFullyDecryptedAccount(
|
||||
this.activeDid,
|
||||
)) as Account;
|
||||
const jwtUrl = await generateEndorserJwtUrlForAccount(
|
||||
account,
|
||||
this.isRegistered,
|
||||
this.givenName,
|
||||
this.profileImageUrl,
|
||||
true,
|
||||
);
|
||||
|
||||
// Copy the URL to clipboard
|
||||
useClipboard()
|
||||
.copy(jwtUrl)
|
||||
.then(() => {
|
||||
this.notify.toast(
|
||||
"Copied",
|
||||
NOTIFY_QR_URL_COPIED.message,
|
||||
QR_TIMEOUT_MEDIUM,
|
||||
);
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error("Failed to generate contact URL:", error);
|
||||
this.notify.error("Failed to generate contact URL. Please try again.");
|
||||
}
|
||||
}
|
||||
|
||||
toastQRCodeHelp() {
|
||||
|
||||
Reference in New Issue
Block a user