Skip to content
Open
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
3 changes: 2 additions & 1 deletion assets/codes.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ ChinaPostCode = {
"A004": "全国景区一卡通",
"4000": "重庆",
"2500": "山东一卡通",
"9000": "济南"
"9000": "济南",
"0003": "呼和浩特地铁"
};
UnionPayRegion = {
"1200": "河北省",
Expand Down
10 changes: 6 additions & 4 deletions assets/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
let ReadTransWuhan = async (fci) => {
let f15 = await BasicInfoFile(fci);
if (!f15) return {};
const number = f15.slice(24, 40);
const number = f15.slice(31, 40);

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f15 is a hex string (from buf2hex / APDU response). f15.slice(31, 40) starts at an odd index (splits a byte) and also selects the last 9 chars of the previous 16-char range (24..40), not the “first 9 digits” described in the PR. This is likely an off-by-one / wrong-range bug; consider extracting the full card number field first (byte-aligned) and then truncating to the desired 9-digit display string.

Suggested change
const number = f15.slice(31, 40);
const card_number_field = f15.slice(24, 40);
const number = card_number_field.slice(0, 9);

Copilot uses AI. Check for mistakes.
const issue_date = f15.slice(40, 48);
const expiry_date = f15.slice(48, 56);
const balance_atc_trans = await ReadPBOCBalanceATCAndTrans();
Expand Down Expand Up @@ -840,9 +840,11 @@
returnMap = { ...returnMap, ...subCard };
}
}
if (tag.type === "felica" && tag.systemCode === "8008") {
// Octopus
return await ReadOctopus();
if (tag.type === "iso18092") {
if (tag.systemCode === "8008") {
// Octopus
return await ReadOctopus();
}
Comment on lines +843 to +847

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Octopus detection is now gated on tag.type === "iso18092" only. This removes support for tags reported as type === "felica" (which was previously handled) and can regress Octopus reads depending on platform / polling options. Consider accepting both (iso18092 and felica) or normalizing the type before branching.

Copilot uses AI. Check for mistakes.
} else if (tag.type === "mifare_ultralight") {
return await ReadMifareUltralight();
} else if (tag.type === "mifare_plus") {
Expand Down
6 changes: 4 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ class _PlatformAdaptingHomePageState extends State<PlatformAdaptingHomePage> {
case 'poll':
error = null;
try {
final tag =
await FlutterNfcKit.poll(iosAlertMessage: S(context).waitForCard);
final tag = await FlutterNfcKit.poll(
iosAlertMessage: S(context).waitForCard,
readIso18092: true,
);
Comment on lines +156 to +159

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this poll call enables readIso18092: true. There is at least one other FlutterNfcKit.poll(...) call site (lib/ui/scripts.dart) that does not set this option, which can lead to inconsistent tag.type values between entry points (and break scripts/logic that expect ISO-18092 tags for Octopus). Consider centralizing poll options or updating the other call site(s) to keep behavior consistent.

Copilot uses AI. Check for mistakes.
final json = tag.toJson();

// try to read ndef and insert into json
Expand Down
Loading