From fa3eba22754bc96dc3cde27d47c6944ddda43bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Gon=C3=A7alves=20Marchi?= Date: Tue, 3 Dec 2024 20:07:55 -0300 Subject: [PATCH] fix(Mobile): Fix copy did on friends page in mobile (#897) --- android/app/capacitor.build.gradle | 3 +++ android/capacitor.settings.gradle | 9 +++++++ ios/App/Podfile | 3 +++ ios/App/Podfile.lock | 40 ++++++++++++++++++++++-------- package.json | 6 +++-- src/routes/friends/+page.svelte | 11 ++++++-- 6 files changed, 57 insertions(+), 15 deletions(-) diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle index e56420ac8..cb0fd0024 100644 --- a/android/app/capacitor.build.gradle +++ b/android/app/capacitor.build.gradle @@ -10,7 +10,10 @@ android { apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" dependencies { implementation project(':capacitor-camera') + implementation project(':capacitor-clipboard') + implementation project(':capacitor-device') implementation project(':capacitor-filesystem') + implementation project(':capacitor-screen-orientation') implementation project(':capacitor-splash-screen') } diff --git a/android/capacitor.settings.gradle b/android/capacitor.settings.gradle index b9a33d939..9dd1d9112 100644 --- a/android/capacitor.settings.gradle +++ b/android/capacitor.settings.gradle @@ -5,8 +5,17 @@ project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/ include ':capacitor-camera' project(':capacitor-camera').projectDir = new File('../node_modules/@capacitor/camera/android') +include ':capacitor-clipboard' +project(':capacitor-clipboard').projectDir = new File('../node_modules/@capacitor/clipboard/android') + +include ':capacitor-device' +project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/device/android') + include ':capacitor-filesystem' project(':capacitor-filesystem').projectDir = new File('../node_modules/@capacitor/filesystem/android') +include ':capacitor-screen-orientation' +project(':capacitor-screen-orientation').projectDir = new File('../node_modules/@capacitor/screen-orientation/android') + include ':capacitor-splash-screen' project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android') diff --git a/ios/App/Podfile b/ios/App/Podfile index 61a7291ad..388474730 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -12,7 +12,10 @@ def capacitor_pods pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera' + pod 'CapacitorClipboard', :path => '../../node_modules/@capacitor/clipboard' + pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device' pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem' + pod 'CapacitorScreenOrientation', :path => '../../node_modules/@capacitor/screen-orientation' pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen' end diff --git a/ios/App/Podfile.lock b/ios/App/Podfile.lock index 3ee439ea1..5d67c18b0 100644 --- a/ios/App/Podfile.lock +++ b/ios/App/Podfile.lock @@ -1,19 +1,28 @@ PODS: - - Capacitor (6.1.2): + - Capacitor (6.2.0): - CapacitorCordova - - CapacitorCamera (6.1.0): + - CapacitorCamera (6.1.1): - Capacitor - - CapacitorCordova (6.1.2) - - CapacitorFilesystem (6.0.1): + - CapacitorClipboard (6.0.2): - Capacitor - - CapacitorSplashScreen (6.0.2): + - CapacitorCordova (6.2.0) + - CapacitorDevice (6.0.2): + - Capacitor + - CapacitorFilesystem (6.0.2): + - Capacitor + - CapacitorScreenOrientation (6.0.3): + - Capacitor + - CapacitorSplashScreen (6.0.3): - Capacitor DEPENDENCIES: - "Capacitor (from `../../node_modules/@capacitor/ios`)" - "CapacitorCamera (from `../../node_modules/@capacitor/camera`)" + - "CapacitorClipboard (from `../../node_modules/@capacitor/clipboard`)" - "CapacitorCordova (from `../../node_modules/@capacitor/ios`)" + - "CapacitorDevice (from `../../node_modules/@capacitor/device`)" - "CapacitorFilesystem (from `../../node_modules/@capacitor/filesystem`)" + - "CapacitorScreenOrientation (from `../../node_modules/@capacitor/screen-orientation`)" - "CapacitorSplashScreen (from `../../node_modules/@capacitor/splash-screen`)" EXTERNAL SOURCES: @@ -21,20 +30,29 @@ EXTERNAL SOURCES: :path: "../../node_modules/@capacitor/ios" CapacitorCamera: :path: "../../node_modules/@capacitor/camera" + CapacitorClipboard: + :path: "../../node_modules/@capacitor/clipboard" CapacitorCordova: :path: "../../node_modules/@capacitor/ios" + CapacitorDevice: + :path: "../../node_modules/@capacitor/device" CapacitorFilesystem: :path: "../../node_modules/@capacitor/filesystem" + CapacitorScreenOrientation: + :path: "../../node_modules/@capacitor/screen-orientation" CapacitorSplashScreen: :path: "../../node_modules/@capacitor/splash-screen" SPEC CHECKSUMS: - Capacitor: 679f9673fdf30597493a6362a5d5bf233d46abc2 - CapacitorCamera: 81ce64062cd82b82cc75a79616fda4bd09d7f643 - CapacitorCordova: f48c89f96c319101cd2f0ce8a2b7449b5fb8b3dd - CapacitorFilesystem: 37fb3aa5c945b4539ab11c74a5c57925a302bf24 - CapacitorSplashScreen: 250df9ef8014fac5c7c1fd231f0f8b1d8f0b5624 + Capacitor: 1f3c7b9802d958cd8c4eb63895fff85dff2e1eea + CapacitorCamera: b9904b48258a91a48930e72a400638a5fc223b27 + CapacitorClipboard: 55e0a514f1e97b1409d533266c119dcbff3e78c3 + CapacitorCordova: b33e7f4aa4ed105dd43283acdd940964374a87d9 + CapacitorDevice: 1a215717f0b5061503b21a03508b0ec458a57d78 + CapacitorFilesystem: c832a3f6d4870c3872688e782ae8e33665e6ecbf + CapacitorScreenOrientation: 3bb823f5d265190301cdc5d58a568a287d98972a + CapacitorSplashScreen: 68893659d77b5f82d753b3a70475082845e3039c -PODFILE CHECKSUM: 46011c4258f4c76d658cc7d9721149c3759c52d7 +PODFILE CHECKSUM: 80366870d5c5081f271e0ddeab86b283217ebd9d COCOAPODS: 1.16.1 diff --git a/package.json b/package.json index b72264e3e..99a349d8f 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,12 @@ "@capacitor/android": "^6.1.2", "@capacitor/camera": "^6.1.0", "@capacitor/cli": "^6.1.2", - "@capacitor/core": "^6.1.2", + "@capacitor/clipboard": "^6.0.2", + "@capacitor/core": "^6.2.0", "@capacitor/device": "^6.0.2", "@capacitor/filesystem": "^6.0.1", - "@capacitor/ios": "^6.1.2", + "@capacitor/ios": "^6.2.0", + "@capacitor/screen-orientation": "^6.0.3", "@capacitor/splash-screen": "^6.0.2", "@dicebear/collection": "^9.0.1", "@dicebear/core": "^9.0.1", diff --git a/src/routes/friends/+page.svelte b/src/routes/friends/+page.svelte index f75065fef..68308ffe4 100644 --- a/src/routes/friends/+page.svelte +++ b/src/routes/friends/+page.svelte @@ -20,6 +20,7 @@ import { CommonInputRules } from "$lib/utils/CommonInputRules" import CreateGroup from "$lib/components/group/CreateGroup.svelte" import { onDestroy } from "svelte" + import { Clipboard } from "@capacitor/clipboard" let loading: boolean = false $: sidebarOpen = UIStore.state.sidebarOpen @@ -151,13 +152,19 @@ let activeChat: Chat = get(Store.state.activeChat) Store.state.activeChat.subscribe(c => (activeChat = c)) + const writeToClipboard = async (text: string) => { + await Clipboard.write({ + string: text, + }) + } + async function copy_did(short: boolean) { let user = get(Store.state.user) if (short) { - await navigator.clipboard.writeText(`${user.name}#${user.id.short}`) + await writeToClipboard(`${user.name}#${user.id.short}`) } else { const updatedKey = user.key.replace("did:key:", "") - await navigator.clipboard.writeText(updatedKey) + await writeToClipboard(updatedKey) } }