diff --git a/ReleaseNotes.md b/ReleaseNotes.md index c44a96c..8458ce2 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -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 diff --git a/Sources/NFCCardReaderProvider/Card/NFCCard.swift b/Sources/NFCCardReaderProvider/Card/NFCCard.swift index c53b0ae..e79396e 100644 --- a/Sources/NFCCardReaderProvider/Card/NFCCard.swift +++ b/Sources/NFCCardReaderProvider/Card/NFCCard.swift @@ -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 } @@ -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 } @@ -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 } @@ -97,7 +97,7 @@ 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 @@ -105,7 +105,7 @@ class NFCCard: CardType { return try Data(hex: initialSelectedAID) } - func disconnect(reset _: Bool) throws { + public func disconnect(reset _: Bool) throws { DLog("Disconnecting card ...") tag = nil basicChannel = nil diff --git a/Sources/NFCCardReaderProvider/Card/NFCCardChannel.swift b/Sources/NFCCardReaderProvider/Card/NFCCardChannel.swift index 7fa3d21..08f2b7e 100644 --- a/Sources/NFCCardReaderProvider/Card/NFCCardChannel.swift +++ b/Sources/NFCCardReaderProvider/Card/NFCCardChannel.swift @@ -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 @@ -107,7 +107,7 @@ class NFCCardChannel: CardChannelType { } } - func transmitAsync( + public func transmitAsync( command: CommandType, writeTimeout _: TimeInterval, readTimeout _: TimeInterval @@ -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 } @@ -172,7 +172,7 @@ class NFCCardChannel: CardChannelType { } } - func closeAsync() async throws { + public func closeAsync() async throws { defer { tag = nil } diff --git a/Sources/NFCCardReaderProvider/NFCHealthCardSession.swift b/Sources/NFCCardReaderProvider/NFCHealthCardSession.swift index d40eae9..cae4d7c 100644 --- a/Sources/NFCCardReaderProvider/NFCHealthCardSession.swift +++ b/Sources/NFCCardReaderProvider/NFCHealthCardSession.swift @@ -274,6 +274,7 @@ public class NFCHealthCardSession: 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 diff --git a/Sources/NFCDemo/Resources/Info.plist b/Sources/NFCDemo/Resources/Info.plist index bb18dcf..26f2d26 100644 --- a/Sources/NFCDemo/Resources/Info.plist +++ b/Sources/NFCDemo/Resources/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.2.6 + 1.2.7 CFBundleVersion $(GEMATIK_BUNDLE_VERSION) GEMATIKSourceVersion