diff --git a/src/components/HiddenDidDialog.vue b/src/components/HiddenDidDialog.vue
index dfbc352d..e48c1b27 100644
--- a/src/components/HiddenDidDialog.vue
+++ b/src/components/HiddenDidDialog.vue
@@ -74,7 +74,7 @@
If you'd like an introduction,
click here to copy this page, paste it into a message, and ask if
they'll tell you more about the {{ roleName }}.
@@ -110,7 +110,7 @@
* @since 2024-12-19
*/
import { Component, Vue } from "vue-facing-decorator";
-import { useClipboard } from "@vueuse/core";
+import { copyToClipboard } from "../services/ClipboardService";
import * as R from "ramda";
import * as serverUtil from "../libs/endorserServer";
import { Contact } from "../db/tables/contacts";
@@ -197,19 +197,24 @@ export default class HiddenDidDialog extends Vue {
);
}
- copyToClipboard(name: string, text: string) {
- useClipboard()
- .copy(text)
- .then(() => {
- this.notify.success(
- NOTIFY_COPIED_TO_CLIPBOARD.message(name || "That"),
- TIMEOUTS.SHORT,
- );
- });
+ async copyTextToClipboard(name: string, text: string) {
+ try {
+ await copyToClipboard(text);
+ this.notify.success(
+ NOTIFY_COPIED_TO_CLIPBOARD.message(name || "That"),
+ TIMEOUTS.SHORT,
+ );
+ } catch (error) {
+ this.$logAndConsole(
+ `Error copying ${name || "content"} to clipboard: ${error}`,
+ true,
+ );
+ this.notify.error(`Failed to copy ${name || "content"} to clipboard.`);
+ }
}
onClickShareClaim() {
- this.copyToClipboard("A link to this page", this.deepLinkUrl);
+ this.copyTextToClipboard("A link to this page", this.deepLinkUrl);
window.navigator.share({
title: "Help Connect Me",
text: "I'm trying to find the people who recorded this. Can you help me?",
diff --git a/src/libs/util.ts b/src/libs/util.ts
index c64916cc..d5f720d7 100644
--- a/src/libs/util.ts
+++ b/src/libs/util.ts
@@ -3,7 +3,7 @@
import axios, { AxiosResponse } from "axios";
import { Buffer } from "buffer";
import * as R from "ramda";
-import { useClipboard } from "@vueuse/core";
+import { copyToClipboard } from "../services/ClipboardService";
import { DEFAULT_PUSH_SERVER, NotificationIface } from "../constants/app";
import { Account, AccountEncrypted } from "../db/tables/accounts";
@@ -232,11 +232,19 @@ export const nameForContact = (
);
};
-export const doCopyTwoSecRedo = (text: string, fn: () => void) => {
+export const doCopyTwoSecRedo = async (
+ text: string,
+ fn: () => void,
+): Promise => {
fn();
- useClipboard()
- .copy(text)
- .then(() => setTimeout(fn, 2000));
+ try {
+ await copyToClipboard(text);
+ setTimeout(fn, 2000);
+ } catch (error) {
+ // Note: This utility function doesn't have access to notification system
+ // The calling component should handle error notifications
+ // Error is silently caught to avoid breaking the 2-second redo pattern
+ }
};
export interface ConfirmerData {
diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue
index 19872da6..9f23a955 100644
--- a/src/views/AccountViewView.vue
+++ b/src/views/AccountViewView.vue
@@ -764,7 +764,7 @@ import { IIdentifier } from "@veramo/core";
import { ref } from "vue";
import { Component, Vue } from "vue-facing-decorator";
import { RouteLocationNormalizedLoaded, Router } from "vue-router";
-import { useClipboard } from "@vueuse/core";
+import { copyToClipboard } from "../services/ClipboardService";
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet";
import { Capacitor } from "@capacitor/core";
@@ -1084,11 +1084,15 @@ export default class AccountViewView extends Vue {
}
// call fn, copy text to the clipboard, then redo fn after 2 seconds
- doCopyTwoSecRedo(text: string, fn: () => void): void {
+ async doCopyTwoSecRedo(text: string, fn: () => void): Promise {
fn();
- useClipboard()
- .copy(text)
- .then(() => setTimeout(fn, 2000));
+ try {
+ await copyToClipboard(text);
+ setTimeout(fn, 2000);
+ } catch (error) {
+ this.$logAndConsole(`Error copying to clipboard: ${error}`, true);
+ this.notify.error("Failed to copy to clipboard.");
+ }
}
async toggleShowContactAmounts(): Promise {
diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue
index 2c441687..77b8ed75 100644
--- a/src/views/ClaimView.vue
+++ b/src/views/ClaimView.vue
@@ -58,7 +58,7 @@
title="Copy Printable Certificate Link"
aria-label="Copy printable certificate link"
@click="
- copyToClipboard(
+ copyTextToClipboard(
'A link to the certificate page',
`${APP_SERVER}/deep-link/claim-cert/${veriClaim.id}`,
)
@@ -72,7 +72,9 @@
@@ -399,7 +401,7 @@
contacts can see more details:
click to copy this page info
and see if they can make an introduction. Someone is connected to
@@ -422,7 +424,7 @@
If you'd like an introduction,
share this page with them and ask if they'll tell you more about
about the participants.
@@ -532,7 +534,7 @@ import * as yaml from "js-yaml";
import * as R from "ramda";
import { Component, Vue } from "vue-facing-decorator";
import { Router, RouteLocationNormalizedLoaded } from "vue-router";
-import { useClipboard } from "@vueuse/core";
+import { copyToClipboard } from "../services/ClipboardService";
import { GenericVerifiableCredential } from "../interfaces";
import GiftedDialog from "../components/GiftedDialog.vue";
import QuickNav from "../components/QuickNav.vue";
@@ -1129,16 +1131,21 @@ export default class ClaimView extends Vue {
);
}
- copyToClipboard(name: string, text: string) {
- useClipboard()
- .copy(text)
- .then(() => {
- this.notify.copied(name || "That");
- });
+ async copyTextToClipboard(name: string, text: string) {
+ try {
+ await copyToClipboard(text);
+ this.notify.copied(name || "That");
+ } catch (error) {
+ this.$logAndConsole(
+ `Error copying ${name || "content"} to clipboard: ${error}`,
+ true,
+ );
+ this.notify.error(`Failed to copy ${name || "content"} to clipboard.`);
+ }
}
onClickShareClaim() {
- this.copyToClipboard("A link to this page", this.windowDeepLink);
+ this.copyTextToClipboard("A link to this page", this.windowDeepLink);
window.navigator.share({
title: "Help Connect Me",
text: "I'm trying to find the people who recorded this. Can you help me?",
diff --git a/src/views/ConfirmGiftView.vue b/src/views/ConfirmGiftView.vue
index 95632bb7..4369f04d 100644
--- a/src/views/ConfirmGiftView.vue
+++ b/src/views/ConfirmGiftView.vue
@@ -192,7 +192,7 @@