Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Mobile): Fix copy did on friends page in mobile #897

Merged
merged 9 commits into from
Dec 3, 2024
3 changes: 3 additions & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')

}
Expand Down
9 changes: 9 additions & 0 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
3 changes: 3 additions & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
40 changes: 29 additions & 11 deletions ios/App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,40 +1,58 @@
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:
Capacitor:
: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
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 9 additions & 2 deletions src/routes/friends/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
</script>
Expand Down
Loading