-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Berend Sliedrecht <[email protected]>
- Loading branch information
Berend Sliedrecht
committed
Jan 7, 2025
1 parent
977c6b0
commit 7e0190f
Showing
19 changed files
with
1,710 additions
and
3,486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,38 @@ | ||
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files | ||
|
||
# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb | ||
# The following patterns were generated by expo-cli | ||
# dependencies | ||
node_modules/ | ||
|
||
# Expo | ||
.expo/ | ||
dist/ | ||
web-build/ | ||
expo-env.d.ts | ||
# @end expo-cli | ||
|
||
# Native | ||
*.orig.* | ||
*.jks | ||
*.p8 | ||
*.p12 | ||
*.key | ||
*.mobileprovision | ||
|
||
# Metro | ||
.metro-health-check* | ||
|
||
# debug | ||
npm-debug.* | ||
yarn-debug.* | ||
yarn-error.* | ||
|
||
# macOS | ||
.DS_Store | ||
*.pem | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
|
||
app-example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node-linker=hoisted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,9 @@ | ||
import { mdocDataTransfer, useMdocDataTransferShutdownOnUnmount } from '@animo-id/expo-mdoc-data-transfer' | ||
import { useEffect, useState } from 'react' | ||
import { Button, Platform, View } from 'react-native' | ||
import { type Permission, PermissionsAndroid } from 'react-native' | ||
|
||
import QrCode from 'react-native-qrcode-svg' | ||
|
||
const Pad = () => <View style={{ marginBottom: 10 }} /> | ||
|
||
const PERMISSIONS = [ | ||
'android.permission.ACCESS_FINE_LOCATION', | ||
'android.permission.BLUETOOTH_CONNECT', | ||
'android.permission.BLUETOOTH_SCAN', | ||
'android.permission.BLUETOOTH_ADVERTISE', | ||
'android.permission.ACCESS_COARSE_LOCATION', | ||
] as const as Permission[] | ||
|
||
const requestPermissions = async () => PermissionsAndroid.requestMultiple(PERMISSIONS) | ||
import { Text, View } from 'react-native' | ||
|
||
export const App = () => { | ||
const [qrCode, setQrCode] = useState<string>() | ||
|
||
useMdocDataTransferShutdownOnUnmount() | ||
|
||
const startEngagement = async () => { | ||
const mdt = mdocDataTransfer.instance() | ||
const qr = await mdt.startQrEngagement() | ||
mdt.enableNfc() | ||
await mdt.sendDeviceResponse(new Uint8Array([1, 2, 3])) | ||
setQrCode(qr) | ||
await mdt.waitForDeviceRequest() | ||
console.log('--- convert device request into a device response ---') | ||
await mdt.sendDeviceResponse(new Uint8Array()) | ||
mdt.shutdown() | ||
} | ||
|
||
const shutdown = () => { | ||
mdocDataTransfer.instance().shutdown() | ||
} | ||
|
||
return ( | ||
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> | ||
{Platform.OS === 'android' && <Button title="request permissions" onPress={requestPermissions} />} | ||
<Pad /> | ||
<Button title="start engagement" onPress={startEngagement} /> | ||
<Pad /> | ||
<Button title="shutdown" onPress={shutdown} /> | ||
<Pad /> | ||
{qrCode && <QrCode value={qrCode} size={300} />} | ||
<View> | ||
<Text>Hello</Text> | ||
</View> | ||
) | ||
} |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.