Skip to content

Commit 7e0190f

Browse files
author
Berend Sliedrecht
committed
feat: setup for iOS
Signed-off-by: Berend Sliedrecht <[email protected]>
1 parent 977c6b0 commit 7e0190f

19 files changed

+1710
-3486
lines changed

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ android.iml
3636
android/app/libs
3737
android/keystores/debug.keystore
3838

39-
# Cocoapods
40-
example/ios/Pods
41-
42-
# Ruby
43-
example/vendor/
44-
4539
# node.js
4640
node_modules/
4741
npm-debug.log

example/.gitignore

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,38 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
12

2-
# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
3-
# The following patterns were generated by expo-cli
3+
# dependencies
4+
node_modules/
45

6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
510
expo-env.d.ts
6-
# @end expo-cli
11+
12+
# Native
13+
*.orig.*
14+
*.jks
15+
*.p8
16+
*.p12
17+
*.key
18+
*.mobileprovision
19+
20+
# Metro
21+
.metro-health-check*
22+
23+
# debug
24+
npm-debug.*
25+
yarn-debug.*
26+
yarn-error.*
27+
28+
# macOS
29+
.DS_Store
30+
*.pem
31+
32+
# local env files
33+
.env*.local
34+
35+
# typescript
36+
*.tsbuildinfo
37+
38+
app-example

example/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node-linker=hoisted

example/app.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
{
22
"expo": {
3-
"name": "mdoc-data-transfer-example",
4-
"slug": "mdoc-data-transfer-example",
3+
"name": "expo-mdoc-data-transfer-example",
4+
"slug": "expo-mdoc-data-transfer-example",
55
"version": "1.0.0",
66
"orientation": "portrait",
7-
"scheme": "mdoc-data-transfer-example",
8-
"userInterfaceStyle": "automatic",
7+
"icon": "./assets/images/icon.png",
8+
"scheme": "myapp",
9+
"splash": {
10+
"image": "./assets/images/splash.png"
11+
},
12+
"ios": {
13+
"bundleIdentifier": "id.animo.expo-mdoc-data-transfer-example"
14+
},
15+
"android": {
16+
"adaptiveIcon": {
17+
"foregroundImage": "./assets/images/adaptive-icon.png",
18+
"backgroundColor": "#ffffff"
19+
},
20+
"package": "id.animo.expomdocdatatransferexample"
21+
},
922
"plugins": [
10-
"../app.plugin.js",
1123
[
1224
"expo-build-properties",
1325
{
@@ -18,18 +30,6 @@
1830
}
1931
}
2032
]
21-
],
22-
"experiments": {
23-
"typedRoutes": true
24-
},
25-
"android": {
26-
"package": "id.animo.mdocdatatransfer.example"
27-
},
28-
"ios": {
29-
"bundleIdentifier": "id.animo.mdocdatatransfer.example"
30-
},
31-
"splash": {
32-
"backgroundColor": "#ffffff"
33-
}
33+
]
3434
}
3535
}

example/app/App.tsx

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,9 @@
1-
import { mdocDataTransfer, useMdocDataTransferShutdownOnUnmount } from '@animo-id/expo-mdoc-data-transfer'
2-
import { useEffect, useState } from 'react'
3-
import { Button, Platform, View } from 'react-native'
4-
import { type Permission, PermissionsAndroid } from 'react-native'
5-
6-
import QrCode from 'react-native-qrcode-svg'
7-
8-
const Pad = () => <View style={{ marginBottom: 10 }} />
9-
10-
const PERMISSIONS = [
11-
'android.permission.ACCESS_FINE_LOCATION',
12-
'android.permission.BLUETOOTH_CONNECT',
13-
'android.permission.BLUETOOTH_SCAN',
14-
'android.permission.BLUETOOTH_ADVERTISE',
15-
'android.permission.ACCESS_COARSE_LOCATION',
16-
] as const as Permission[]
17-
18-
const requestPermissions = async () => PermissionsAndroid.requestMultiple(PERMISSIONS)
1+
import { Text, View } from 'react-native'
192

203
export const App = () => {
21-
const [qrCode, setQrCode] = useState<string>()
22-
23-
useMdocDataTransferShutdownOnUnmount()
24-
25-
const startEngagement = async () => {
26-
const mdt = mdocDataTransfer.instance()
27-
const qr = await mdt.startQrEngagement()
28-
mdt.enableNfc()
29-
await mdt.sendDeviceResponse(new Uint8Array([1, 2, 3]))
30-
setQrCode(qr)
31-
await mdt.waitForDeviceRequest()
32-
console.log('--- convert device request into a device response ---')
33-
await mdt.sendDeviceResponse(new Uint8Array())
34-
mdt.shutdown()
35-
}
36-
37-
const shutdown = () => {
38-
mdocDataTransfer.instance().shutdown()
39-
}
40-
414
return (
42-
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
43-
{Platform.OS === 'android' && <Button title="request permissions" onPress={requestPermissions} />}
44-
<Pad />
45-
<Button title="start engagement" onPress={startEngagement} />
46-
<Pad />
47-
<Button title="shutdown" onPress={shutdown} />
48-
<Pad />
49-
{qrCode && <QrCode value={qrCode} size={300} />}
5+
<View>
6+
<Text>Hello</Text>
507
</View>
518
)
529
}
File renamed without changes.
17.1 KB
Loading

example/assets/images/icon.png

21.9 KB
Loading

example/assets/images/splash.png

21.9 KB
Loading

example/babel.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)