Skip to content

Commit ab48cd6

Browse files
committed
Avoid iOS SDK version constraints caused by the addition of NFCReaderError.Code.
1 parent bd7df26 commit ab48cd6

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.1.1
2+
3+
* Avoid iOS SDK version constraints caused by the addition of `NFCReaderError.Code`.
4+
15
## 4.1.0
26

37
* Deprecated `NfcManager#isAvailable`. Use `NfcManager#checkAvailability` instead.

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ packages:
6868
path: ".."
6969
relative: true
7070
source: path
71-
version: "0.0.0"
71+
version: "4.1.1"
7272
sky_engine:
7373
dependency: transitive
7474
description: flutter

ios/Classes/NfcManagerPlugin.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ private func convert(_ value: NFCMiFareFamily) -> MiFareFamilyPigeon {
892892
case .ultralight: return .ultralight
893893
case .plus: return .plus
894894
case .desfire: return .desfire
895-
default: fatalError()
895+
@unknown default: fatalError()
896896
}
897897
}
898898

@@ -946,15 +946,18 @@ private func convert(_ value: NFCReaderError.Code) -> NfcReaderErrorCodePigeon {
946946
case .readerTransceiveErrorSessionInvalidated: return .readerTransceiveErrorSessionInvalidated
947947
case .readerTransceiveErrorPacketTooLong: return .readerTransceiveErrorPacketTooLong
948948
case .tagCommandConfigurationErrorInvalidParameters: return .tagCommandConfigurationErrorInvalidParameters
949-
case .readerErrorAccessNotAccepted: return .readerErrorAccessNotAccepted
950-
case .readerErrorIneligible: return .readerErrorIneligible
951949
case .readerErrorUnsupportedFeature: return .readerErrorUnsupportedFeature
952950
case .readerErrorInvalidParameter: return .readerErrorInvalidParameter
953951
case .readerErrorInvalidParameterLength: return .readerErrorInvalidParameterLength
954952
case .readerErrorParameterOutOfBound: return .readerErrorParameterOutOfBound
955953
case .readerErrorRadioDisabled: return .readerErrorRadioDisabled
956954
case .readerErrorSecurityViolation: return .readerErrorSecurityViolation
957-
@unknown default: fatalError()
955+
default:
956+
// Introduced in iOS SDK 26; since we added it before 26 was widely adopted, compare `rawValue` to maintain backward compatibility.
957+
// See: https://github.com/okadan/flutter-nfc-manager/issues/249
958+
if (value.rawValue == 7) { return .readerErrorIneligible }
959+
if (value.rawValue == 8) { return .readerErrorAccessNotAccepted }
960+
fatalError()
958961
}
959962
}
960963

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: nfc_manager
22
description: A Flutter plugin providing access to NFC features on Android and iOS.
33
repository: https://github.com/okadan/flutter-nfc-manager
4-
version: 4.1.0
4+
version: 4.1.1
55

66
environment:
77
sdk: ^3.9.2

0 commit comments

Comments
 (0)