Skip to content

Commit a131ebf

Browse files
feat(ios): wrapper implementation (#11)
Signed-off-by: Berend Sliedrecht <[email protected]>
1 parent 977c6b0 commit a131ebf

25 files changed

+16325
-21531
lines changed

.npmignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
/.github
12
/example
3+
/src/*.ts
24
/android/build
35
/android/.gradle
46

5-
/plugin/src
7+
plugin/src
68
tsconfig.json
79
.release-it.json
810
biome.json
11+
12+
*.tgz

.npmrc

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

MdocDataTransfer.podspec

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Pod::Spec.new do |s|
1010
s.license = package['license']
1111
s.author = package['author']
1212
s.homepage = package['homepage']
13-
s.platforms = { :ios => '13.4' }
13+
s.platforms = { :ios => '14.0'}
1414
s.swift_version = '5.4'
15-
s.source = { git: 'https://github.com/animo/mdoc-data-transfer' }
15+
s.source = { :git => "https://github.com/animo/mdoc-data-transfer.git", :tag => "#{s.version}" }
1616

1717
s.pod_target_xcconfig = {
1818
'DEFINES_MODULE' => 'YES',
@@ -21,4 +21,17 @@ Pod::Spec.new do |s|
2121

2222
s.source_files = "ios/**/*.{h,m,mm,swift}"
2323

24+
install_modules_dependencies(s)
25+
26+
if defined?(:spm_dependency)
27+
spm_dependency(s,
28+
# Currently we use this fork because it adds a manual `sendDeviceResponse` method
29+
# Which we use as we generate this outside of the library
30+
url: 'https://github.com/berendsliedrecht/eudi-lib-ios-iso18013-data-transfer.git',
31+
requirement: {kind: 'upToNextMinorVersion', minimumVersion: '0.3.12'},
32+
products: ['MdocDataTransfer18013']
33+
)
34+
else
35+
raise "Please upgrade React Native to >=0.75.0 to use SPM dependencies."
36+
end
2437
end

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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@
66
"orientation": "portrait",
77
"scheme": "mdoc-data-transfer-example",
88
"userInterfaceStyle": "automatic",
9+
"newArchEnabled": false,
910
"plugins": [
10-
"../app.plugin.js",
11+
["../app.plugin.js", { "ios": { "buildStatic": ["RNReanimated"] } }],
1112
[
1213
"expo-build-properties",
1314
{
1415
"android": {
1516
"minSdkVersion": 26,
1617
"useLegacyPackaging": true,
1718
"extraMavenRepos": ["https://s01.oss.sonatype.org/content/repositories/snapshots/"]
19+
},
20+
"ios": {
21+
"useFrameworks": "dynamic",
22+
"deploymentTarget": "15.1"
1823
}
1924
}
2025
]

example/app/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mdocDataTransfer, useMdocDataTransferShutdownOnUnmount } from '@animo-id/expo-mdoc-data-transfer'
2-
import { useEffect, useState } from 'react'
2+
import { useState } from 'react'
33
import { Button, Platform, View } from 'react-native'
44
import { type Permission, PermissionsAndroid } from 'react-native'
55

@@ -24,10 +24,10 @@ export const App = () => {
2424

2525
const startEngagement = async () => {
2626
const mdt = mdocDataTransfer.instance()
27-
const qr = await mdt.startQrEngagement()
2827
mdt.enableNfc()
29-
await mdt.sendDeviceResponse(new Uint8Array([1, 2, 3]))
28+
const qr = await mdt.startQrEngagement()
3029
setQrCode(qr)
30+
await mdt.sendDeviceResponse(new Uint8Array([1, 2, 3]))
3131
await mdt.waitForDeviceRequest()
3232
console.log('--- convert device request into a device response ---')
3333
await mdt.sendDeviceResponse(new Uint8Array())

example/babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = (api) => {
22
api.cache(true)
33
return {
4-
presets: ['babel-preset-expo'],
4+
presets: ['module:@react-native/babel-preset'],
55
}
66
}

example/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "mdoc-data-transfer-example",
33
"main": "app/index.tsx",
4+
"private": true,
45
"version": "0.0.0",
56
"scripts": {
67
"start": "expo start -c --dev-client",
@@ -9,13 +10,14 @@
910
"prebuild": "expo prebuild --no-install"
1011
},
1112
"dependencies": {
12-
"@animo-id/expo-mdoc-data-transfer": "../",
13+
"@animo-id/expo-mdoc-data-transfer": "link:../",
1314
"@babel/runtime": "^7.25.9",
14-
"expo": "~51.0.38",
15+
"@react-native/babel-preset": "^0.76.6",
16+
"expo": "~51.0.39",
1517
"expo-build-properties": "~0.12.5",
16-
"expo-dev-client": "~4.0.28",
18+
"expo-dev-client": "~4.0.29",
1719
"react": "18.2.0",
18-
"react-native": "0.74.5",
20+
"react-native": "0.75.3",
1921
"react-native-gesture-handler": "2.16.2",
2022
"react-native-qrcode-svg": "^6.3.12",
2123
"react-native-reanimated": "~3.10.1",
@@ -24,7 +26,7 @@
2426
"react-native-svg": "15.2.0"
2527
},
2628
"devDependencies": {
27-
"@babel/core": "7.24.7",
29+
"@babel/core": "7.26.0",
2830
"@react-native-community/cli": "^14.1.1",
2931
"@types/react": "18.2.79",
3032
"typescript": "5.3.3"
@@ -33,6 +35,5 @@
3335
"autoLinking": {
3436
"nativeModulesDir": ".."
3537
}
36-
},
37-
"private": true
38+
}
3839
}

0 commit comments

Comments
 (0)