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

feat: setup for iOS #10

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ android.iml
android/app/libs
android/keystores/debug.keystore

# Cocoapods
example/ios/Pods

# Ruby
example/vendor/

# node.js
node_modules/
npm-debug.log
Expand Down
24 changes: 0 additions & 24 deletions MdocDataTransfer.podspec

This file was deleted.

6 changes: 0 additions & 6 deletions example/.gitignore

This file was deleted.

36 changes: 18 additions & 18 deletions example/app.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
{
"expo": {
"name": "mdoc-data-transfer-example",
"slug": "mdoc-data-transfer-example",
"name": "expo-mdoc-data-transfer-example",
"slug": "expo-mdoc-data-transfer-example",
"version": "1.0.0",
"orientation": "portrait",
"scheme": "mdoc-data-transfer-example",
"userInterfaceStyle": "automatic",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
"splash": {
"image": "./assets/images/splash.png"
},
"ios": {
"bundleIdentifier": "id.animo.expo-mdoc-data-transfer-example"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"package": "id.animo.expomdocdatatransferexample"
},
"plugins": [
"../app.plugin.js",
[
"expo-build-properties",
{
Expand All @@ -18,18 +30,6 @@
}
}
]
],
"experiments": {
"typedRoutes": true
},
"android": {
"package": "id.animo.mdocdatatransfer.example"
},
"ios": {
"bundleIdentifier": "id.animo.mdocdatatransfer.example"
},
"splash": {
"backgroundColor": "#ffffff"
}
]
}
}
49 changes: 3 additions & 46 deletions example/app/App.tsx
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.
Binary file added example/assets/images/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions example/babel.config.js

This file was deleted.

34 changes: 0 additions & 34 deletions example/metro.config.js

This file was deleted.

39 changes: 18 additions & 21 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
{
"name": "mdoc-data-transfer-example",
"main": "app/index.tsx",
"version": "0.0.0",
"name": "expo-mdoc-data-transfer-example",
"main": "app/index.js",
"version": "1.0.0",
"scripts": {
"start": "expo start -c --dev-client",
"start": "expo start",
"android": "expo run:android",
"ios": "expo run:ios",
"prebuild": "expo prebuild --no-install"
"prebuild": "expo prebuild"
},
"dependencies": {
"@animo-id/expo-mdoc-data-transfer": "../",
"@babel/runtime": "^7.25.9",
"expo": "~51.0.38",
"expo-build-properties": "~0.12.5",
"expo-dev-client": "~4.0.28",
"react": "18.2.0",
"react-native": "0.74.5",
"react-native-gesture-handler": "2.16.2",
"react-native-qrcode-svg": "^6.3.12",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "3.31.1",
"react-native-svg": "15.2.0"
"expo": "~52.0.23",
"expo-build-properties": "~0.13.1",
"react": "18.3.1",
"react-native": "0.76.5",
"react-native-gesture-handler": "~2.20.2",
"react-native-reanimated": "~3.16.1",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "~4.4.0",
"react-native-web": "~0.19.13",
"react-native-webview": "13.12.5"
},
"devDependencies": {
"@babel/core": "7.24.7",
"@react-native-community/cli": "^14.1.1",
"@types/react": "18.2.79",
"typescript": "5.3.3"
"@babel/core": "^7.25.2",
"@types/react": "~18.3.12",
"typescript": "^5.3.3"
},
"expo": {
"autoLinking": {
Expand Down
Loading
Loading