Skip to content
Merged
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
10 changes: 10 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Release 5.8.0

## Changed

- Set access level of NFCCardReaderProvider entities to public

## Fixed

- Prevent NFCHealthCardSession's continuation from being called twice

# Release 5.7.0

## Changed
Expand Down
18 changes: 9 additions & 9 deletions Sources/NFCCardReaderProvider/Card/NFCCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ import Foundation
import GemCommonsKit
import HealthCardAccess

class NFCCard: CardType {
public class NFCCard: CardType {
var tag: NFCISO7816Tag?
private weak var basicChannel: NFCCardChannel?

init(isoTag tag: NFCISO7816Tag) {
public init(isoTag tag: NFCISO7816Tag) {
self.tag = tag
}

var atr: ATR {
public var atr: ATR {
tag?.historicalBytes ?? Data()
}

var `protocol`: CardProtocol {
public var `protocol`: CardProtocol {
.t1
}

func openBasicChannel() throws -> CardChannelType {
public func openBasicChannel() throws -> CardChannelType {
if let channel = basicChannel {
return channel
}
Expand All @@ -51,7 +51,7 @@ class NFCCard: CardType {
return nfcChannel
}

func openLogicChannel() throws -> CardChannelType {
public func openLogicChannel() throws -> CardChannelType {
guard let tag = tag else {
throw NFCCardError.noCardPresent.illegalState
}
Expand All @@ -74,7 +74,7 @@ class NFCCard: CardType {
return NFCCardChannel(card: self, tag: tag, channelNo: Int(rspData[0]))
}

func openLogicChannelAsync() async throws -> CardChannelType {
public func openLogicChannelAsync() async throws -> CardChannelType {
guard let tag = tag else {
throw NFCCardError.noCardPresent.illegalState
}
Expand All @@ -97,15 +97,15 @@ class NFCCard: CardType {
return NFCCardChannel(card: self, tag: tag, channelNo: Int(rspData[0]))
}

func initialApplicationIdentifier() throws -> Data? {
public func initialApplicationIdentifier() throws -> Data? {
guard let initialSelectedAID = tag?.initialSelectedAID else {
ALog("NFC tag could not deliver initialSelectedAID when expected")
return nil
}
return try Data(hex: initialSelectedAID)
}

func disconnect(reset _: Bool) throws {
public func disconnect(reset _: Bool) throws {
DLog("Disconnecting card ...")
tag = nil
basicChannel = nil
Expand Down
22 changes: 11 additions & 11 deletions Sources/NFCCardReaderProvider/Card/NFCCardChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,28 @@ import Foundation
import GemCommonsKit
import Helper

class NFCCardChannel: CardChannelType {
let maxMessageLength = 0x10000
let maxResponseLength = 0x10000
public class NFCCardChannel: CardChannelType {
public let maxMessageLength = 0x10000
public let maxResponseLength = 0x10000

let channelNumber: Int
public let channelNumber: Int
var tag: NFCISO7816Tag?
let extendedLengthSupported = true
public let extendedLengthSupported = true

private let nfcCard: NFCCard

init(card: NFCCard, tag: NFCISO7816Tag, channelNo: Int = 0) {
public init(card: NFCCard, tag: NFCISO7816Tag, channelNo: Int = 0) {
nfcCard = card
self.tag = tag
channelNumber = channelNo
}

var card: CardType {
public var card: CardType {
nfcCard
}

@available(*, deprecated, message: "Use structured concurrency version instead")
func transmit( // swiftlint:disable:this function_body_length
public func transmit( // swiftlint:disable:this function_body_length
command: CommandType,
writeTimeout _: TimeInterval,
readTimeout: TimeInterval
Expand Down Expand Up @@ -107,7 +107,7 @@ class NFCCardChannel: CardChannelType {
}
}

func transmitAsync(
public func transmitAsync(
command: CommandType,
writeTimeout _: TimeInterval,
readTimeout _: TimeInterval
Expand Down Expand Up @@ -149,7 +149,7 @@ class NFCCardChannel: CardChannelType {
return try APDU.Response(body: data, sw1: sw1, sw2: sw2)
}

func close() throws {
public func close() throws {
defer {
tag = nil
}
Expand All @@ -172,7 +172,7 @@ class NFCCardChannel: CardChannelType {
}
}

func closeAsync() async throws {
public func closeAsync() async throws {
defer {
tag = nil
}
Expand Down
1 change: 1 addition & 0 deletions Sources/NFCCardReaderProvider/NFCHealthCardSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public class NFCHealthCardSession<Output>: NSObject, NFCTagReaderSessionDelegate
do {
let outcome = try await operation(myNFCCardSession)
operationContinuation?.resume(returning: outcome)
operationContinuation = nil
} catch let error as CoreNFCError {
operationContinuation?.resume(throwing: NFCHealthCardSessionError.coreNFC(error))
operationContinuation = nil
Expand Down
2 changes: 1 addition & 1 deletion Sources/NFCDemo/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.2.6</string>
<string>1.2.7</string>
<key>CFBundleVersion</key>
<string>$(GEMATIK_BUNDLE_VERSION)</string>
<key>GEMATIKSourceVersion</key>
Expand Down