forked from jsnbuchanan/crowd-funder-for-time-pwa
feat: migrate all clipboard operations from useClipboard to ClipboardService
- Replace useClipboard with platform-agnostic ClipboardService across 13 files - Add proper error handling with user notifications for all clipboard operations - Fix naming conflicts between method names and imported function names - Ensure consistent async/await patterns throughout the codebase - Add notification system to HelpView.vue for user feedback on clipboard errors - Remove unnecessary wrapper methods for cleaner code Files migrated: - View components: UserProfileView, QuickActionBvcEndView, ProjectViewView, InviteOneView, SeedBackupView, HelpView, AccountViewView, DatabaseMigration, ConfirmGiftView, ClaimView, OnboardMeetingSetupView - Utility functions: libs/util.ts (doCopyTwoSecRedo) - Components: HiddenDidDialog Naming conflicts resolved: - DatabaseMigration: copyToClipboard() → copyExportedDataToClipboard() - ShareMyContactInfoView: copyToClipboard() → copyContactMessageToClipboard() → removed - HiddenDidDialog: copyToClipboard() → copyTextToClipboard() - ClaimView: copyToClipboard() → copyTextToClipboard() - ConfirmGiftView: copyToClipboard() → copyTextToClipboard() This migration ensures reliable clipboard functionality across iOS, Android, and web platforms with proper error handling and user feedback. Closes: Platform-specific clipboard issues on mobile devices
This commit is contained in:
@@ -616,7 +616,7 @@ import * as serverUtil from "../libs/endorserServer";
|
||||
import { retrieveAccountDids } from "../libs/util";
|
||||
import HiddenDidDialog from "../components/HiddenDidDialog.vue";
|
||||
import { logger } from "../utils/logger";
|
||||
import { useClipboard } from "@vueuse/core";
|
||||
import { copyToClipboard } from "../services/ClipboardService";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||
import { NOTIFY_CONFIRM_CLAIM } from "@/constants/notifications";
|
||||
@@ -817,7 +817,7 @@ export default class ProjectViewView extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
onCopyLinkClick() {
|
||||
async onCopyLinkClick() {
|
||||
const shortestProjectId = this.projectId.startsWith(
|
||||
serverUtil.ENDORSER_CH_HANDLE_PREFIX,
|
||||
)
|
||||
@@ -825,11 +825,13 @@ export default class ProjectViewView extends Vue {
|
||||
: this.projectId;
|
||||
// Use production URL for sharing to avoid localhost issues in development
|
||||
const deepLink = `${APP_SERVER}/deep-link/project/${shortestProjectId}`;
|
||||
useClipboard()
|
||||
.copy(deepLink)
|
||||
.then(() => {
|
||||
this.notify.copied("link to this project", TIMEOUTS.SHORT);
|
||||
});
|
||||
try {
|
||||
await copyToClipboard(deepLink);
|
||||
this.notify.copied("link to this project", TIMEOUTS.SHORT);
|
||||
} catch (error) {
|
||||
this.$logAndConsole(`Error copying project link: ${error}`, true);
|
||||
this.notify.error("Failed to copy project link.");
|
||||
}
|
||||
}
|
||||
|
||||
// Isn't there a better way to make this available to the template?
|
||||
|
||||
Reference in New Issue
Block a user