release: v1.2.6 hotfix - restore card discovery, manual hashes, and cache invalidation

This commit is contained in:
Mak5er committed 2026-10-04 13:05:59 +03:00
1 parent d887c6e44e
commit 1e281a462e
9 files changed
+146 -51

No files matched your search

+68 -33
View File
@@ -912,14 +912,15 @@ class AppViewModel: ObservableObject {
for comp in components {
let clean = comp.trimmingCharacters(in: .whitespacesAndNewlines).trimmingCharacters(in: CharacterSet(charactersIn: "."))
if clean.count >= 16 && clean.count <= 64 && !cards.contains(where: { $0.id == clean }) {
cards.append(CardItem(id: clean, isSelected: true, displayName: walletCatalog.name(for: clean)))
cards.append(CardItem(id: clean, isSelected: true, displayName: walletCatalog.name(for: clean), confirmed: true))
currentPreloadedIDs.insert(clean)
addedCount += 1
log("Added card: \(clean)")
}
}
if addedCount > 0 {
saveCards()
scannerMessage = "Saved \(addedCount) ID(s) for matching. They stay hidden until this iPhone exposes them in a scan."
scannerMessage = "Added \(addedCount) card ID(s) ready for skinning and flashing."
}
}
@@ -1018,12 +1019,14 @@ class AppViewModel: ObservableObject {
}
let pipe = Pipe()
let errPipe = Pipe()
process.standardOutput = pipe
process.standardError = FileHandle.nullDevice
process.standardError = errPipe
do {
try process.run()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
let errData = errPipe.fileHandleForReading.readDataToEndOfFile()
process.waitUntilExit()
if let resp = try? JSONDecoder().decode(DeviceResponse.self, from: data) {
@@ -1096,19 +1099,36 @@ class AppViewModel: ObservableObject {
}
} else {
// Nothing parseable came back, which means the backend did not
// run, not that the cable is loose. Saying "no iPhone" here
// sends people to replug a phone that was never the problem.
// run, not that the cable is loose.
let raw = String(data: data, encoding: .utf8) ?? ""
let errRaw = (String(data: errData, encoding: .utf8) ?? "").trimmingCharacters(in: .whitespacesAndNewlines)
let errLower = errRaw.lowercased()
let isLicenseOrCLT = errLower.contains("license") ||
errLower.contains("xcode-select") ||
errLower.contains("commandlinetools") ||
errLower.contains("xcrun")
await MainActor.run {
self.devices = []
self.device = nil
self.activateCardDevice(nil)
self.refreshWalletCatalog()
self.isCheckingDevice = false
self.statusText = "Device detection could not run. See the log."
self.errorMessage = "AirCard could not run its device tools. The app may be damaged or incompletely installed."
self.scannerMessage = "Device check failed. Reconnect and unlock the iPhone, then retry."
self.log("Device detection returned nothing usable: \(raw.isEmpty ? "(no output)" : raw.prefix(400).description)")
if isLicenseOrCLT {
self.statusText = "Command Line Tools required."
self.errorMessage = "AirCard needs Xcode Command Line Tools to communicate with devices.\n\nPlease open Terminal and run:\nxcode-select --install\n\nor open Xcode to accept the license agreement, then restart AirCard."
self.scannerMessage = "Developer tools or license agreement required. See log."
} else {
self.statusText = "Device detection could not run. See the log."
self.errorMessage = errRaw.isEmpty
? "AirCard could not run its device tools. Check the Activity Console log for details."
: "Device tool error: \(errRaw.prefix(300))"
self.scannerMessage = "Device check failed. Reconnect and unlock the iPhone, then retry."
}
if !errRaw.isEmpty {
self.log("Backend stderr: \(errRaw)")
}
self.log("Device detection returned nothing usable: \(raw.isEmpty ? "(no stdout)" : raw.prefix(400).description)")
}
}
} catch {
@@ -1120,6 +1140,7 @@ class AppViewModel: ObservableObject {
self.isCheckingDevice = false
self.scannerMessage = "Device check failed. Reconnect and unlock the iPhone, then retry."
self.statusText = "Device detection failed: \(error.localizedDescription)"
self.log("Process execution failed: \(error.localizedDescription)")
}
}
}
@@ -1279,7 +1300,11 @@ class AppViewModel: ObservableObject {
}
}
for candidate in WalletScanParser.cardIDs(in: line) {
var candidates = WalletScanParser.cardIDs(in: line)
if candidates.isEmpty {
candidates = WalletScanParser.fallbackCardIDs(in: line)
}
for candidate in candidates {
await MainActor.run {
guard self.scanProcess === proc else { return }
self.recordPreloadedCard(candidate)
@@ -1345,14 +1370,13 @@ class AppViewModel: ObservableObject {
errorMessage = "No iPhone connected."
return
}
let verifiedIDs = currentVerifiedCardIDs
let allSkinned = cards.filter { verifiedIDs.contains($0.id) && $0.isSelected && $0.customImageURL != nil }
let allSkinned = cards.filter { $0.isSelected && $0.customImageURL != nil }
guard !allSkinned.isEmpty else {
errorMessage = "Please assign a skin image to at least one selected card."
return
}
// Only flash changed skins; if nothing changed, re-flash everything selected.
let changed = cardsNeedingFlash.filter { verifiedIDs.contains($0.id) }
let changed = cardsNeedingFlash
let selectedCardsWithSkin = changed.isEmpty ? allSkinned : changed
isFlashing = true
@@ -1852,6 +1876,7 @@ struct WalletCardView: View {
@Binding var card: CardItem
let cardIndex: Int
var isFlashed: Bool = false
var isVerified: Bool = true
let onPickImage: () -> Void
let onClearImage: () -> Void
let onDelete: () -> Void
@@ -2022,9 +2047,19 @@ struct WalletCardView: View {
.font(.system(size: 13, weight: .semibold))
.lineLimit(2)
.help(card.displayName ?? "No matching name in the Mac cache. The card ID is preserved.")
Text("Matched to this iPhone in the current scan")
.font(.caption2)
.foregroundStyle(.secondary)
if isVerified {
Text("Matched to this iPhone in current scan")
.font(.caption2)
.foregroundStyle(.green)
} else if card.confirmed {
Text("Saved on this iPhone")
.font(.caption2)
.foregroundStyle(.secondary)
} else {
Text("Manually added · Ready to flash")
.font(.caption2)
.foregroundStyle(.orange)
}
if card.customImageURL != nil && card.customImage == nil {
Text("Skin file unavailable. Choose the image again.")
.font(.caption2).foregroundStyle(.orange)
@@ -2167,7 +2202,7 @@ struct ContentView: View {
@State private var isTargetedTheme = false
private var readyToFlashCount: Int {
vm.currentVerifiedCards.filter { $0.isSelected && $0.customImageURL != nil }.count
vm.cards.filter { $0.isSelected && $0.customImageURL != nil }.count
}
private var changedCount: Int { vm.cardsNeedingFlash.count }
@@ -2211,7 +2246,7 @@ struct ContentView: View {
// 4. Main Workspace
if vm.selectedTab == .walletCards {
ScrollView {
if vm.currentVerifiedCards.isEmpty {
if vm.cards.isEmpty {
emptyStateView
.padding(.top, 40)
} else {
@@ -2219,13 +2254,14 @@ struct ContentView: View {
columns: [GridItem(.adaptive(minimum: 310, maximum: 360), spacing: 20)],
spacing: 20
) {
ForEach(Array(vm.currentVerifiedCards.enumerated()), id: \.element.id) { visibleIndex, verifiedCard in
let cardID = verifiedCard.id
ForEach(Array(vm.cards.enumerated()), id: \.element.id) { visibleIndex, cardItem in
let cardID = cardItem.id
let deviceID = vm.device?.udid
WalletCardView(
card: walletCardBinding(in: $vm.cards, snapshot: verifiedCard),
card: walletCardBinding(in: $vm.cards, snapshot: cardItem),
cardIndex: visibleIndex,
isFlashed: vm.isSkinFlashed(verifiedCard),
isFlashed: vm.isSkinFlashed(cardItem),
isVerified: vm.currentVerifiedCardIDs.contains(cardID),
onPickImage: { openCardImagePicker(for: cardID) },
onClearImage: { vm.clearCardImage(for: cardID) },
onDelete: { vm.deleteCard(id: cardID) },
@@ -2279,7 +2315,7 @@ struct ContentView: View {
if vm.selectedTab == .passcodeThemes {
Text("Passcode theme successfully applied!\n\nLock your iPhone (or restart) to see your new passcode keypad.")
} else {
Text("Skins successfully applied to all selected cards!\n\nPlease force-close the Wallet app on your iPhone (or reboot) to see your new designs.")
Text("Skins successfully applied to all selected cards!\n\nPlease force-close the Wallet app on your iPhone (or reboot) to see your new designs.\n\nNote: Apple Card renders dynamically and its face color reflects your spending categories rather than static cached skins.")
}
}
.sheet(isPresented: $showSupportPopup) {
@@ -2318,7 +2354,7 @@ struct ContentView: View {
Text("AirCard")
.font(.title2)
.fontWeight(.bold)
Text("v1.2.5")
Text("v1.2.6")
.font(.system(size: 10, weight: .bold, design: .rounded))
.padding(.horizontal, 6)
.padding(.vertical, 2)
@@ -2479,7 +2515,7 @@ struct ContentView: View {
.buttonStyle(.bordered)
.controlSize(.regular)
if !vm.currentVerifiedCards.isEmpty {
if !vm.cards.isEmpty {
Button(action: openBulkImagePicker) {
Label("Set Skin for All...", systemImage: "photo.on.rectangle.angled")
}
@@ -2490,11 +2526,10 @@ struct ContentView: View {
Spacer()
if !vm.currentVerifiedCards.isEmpty {
if !vm.cards.isEmpty {
HStack(spacing: 8) {
Button("Select All") {
let verifiedIDs = vm.currentVerifiedCardIDs
for idx in vm.cards.indices where verifiedIDs.contains(vm.cards[idx].id) {
for idx in vm.cards.indices {
vm.cards[idx].isSelected = true
}
}
@@ -2504,8 +2539,7 @@ struct ContentView: View {
Text("·").foregroundColor(.secondary)
Button("Deselect All") {
let verifiedIDs = vm.currentVerifiedCardIDs
for idx in vm.cards.indices where verifiedIDs.contains(vm.cards[idx].id) {
for idx in vm.cards.indices {
vm.cards[idx].isSelected = false
}
}
@@ -3704,8 +3738,9 @@ struct ContentView: View {
.font(.system(size: 10))
.foregroundColor(.secondary)
}
} else if !vm.currentVerifiedCards.isEmpty {
Text("\(vm.currentVerifiedCards.filter { $0.isSelected }.count) of \(vm.currentVerifiedCards.count) verified cards selected · \(changedCount) changed · \(readyToFlashCount - changedCount) already on iPhone")
} else if !vm.cards.isEmpty {
let selectedCount = vm.cards.filter { $0.isSelected }.count
Text("\(selectedCount) of \(vm.cards.count) cards selected · \(changedCount) changed · \(readyToFlashCount - changedCount) already on iPhone")
.font(.system(size: 10))
.foregroundColor(.secondary)
}
@@ -4143,7 +4178,7 @@ struct ContentView: View {
panel.canChooseDirectories = false
panel.message = "Choose a skin to assign to all selected cards..."
if panel.runModal() == .OK, let url = panel.url {
for card in vm.currentVerifiedCards where card.isSelected {
for card in vm.cards where card.isSelected {
vm.setCardImage(for: card.id, url: url)
}
}
+10
View File
@@ -50,6 +50,12 @@ Wallet setup, detailed troubleshooting, multi-card workflows, theme creation, co
> sudo xattr -cr /Applications/AirCard.app
> ```
> [!TIP]
> **macOS Developer Tools / Python Requirement:**
> AirCard uses macOS native Python 3 (`/usr/bin/python3`). If macOS prompts that Developer Tools are required or if you recently installed/updated Xcode:
> - Install Command Line Tools: `xcode-select --install`
> - Accept Xcode license if applicable: `sudo xcodebuild -license accept`
> [!NOTE]
> **Windows users:** an unofficial Windows port is available at [**AirCard-Windows**](https://github.com/Lumid-Off/AirCard-Windows).
@@ -66,6 +72,10 @@ Wallet setup, detailed troubleshooting, multi-card workflows, theme creation, co
5. Click **Flash Skins**.
6. Force-close the **Wallet** app on your iPhone from the App Switcher (or reboot) to see your new custom card design!
> [!NOTE]
> **Apple Card:**
> The Apple Card (titanium/digital card) uses dynamic vector rendering based on your spending categories instead of static cached card skins. Custom skins apply to standard debit/credit cards, transit cards, and passes.
### Card names and missing-card checks
Scanned cards can now display names from this Mac's Wallet cache. Open **Check
+20 -4
View File
@@ -60,8 +60,8 @@ struct WalletSavedCard: Codable, Equatable {
}
}
// A bare base64-like token in a Wallet log is not proof of a card.
// Require a pass/cache path, and preserve first appearance across the line.
// A bare base64-like token in a Wallet log is not proof of a card by itself.
// Prefer structured pass/cache/dashboard paths, with fallback extraction for Wallet events.
enum WalletScanParser {
static let cardReferences = [
try! NSRegularExpression(pattern: #"/([-A-Za-z0-9_+=]{20,64})\.(?:pkpass|cache|pkcache)(?=[/\s\"'\),]|$)"#),
@@ -70,16 +70,21 @@ enum WalletScanParser {
try! NSRegularExpression(pattern: #"PDPassLibrary:\s*wrote pass\s+([-A-Za-z0-9_+=]{20,64})(?=[\s\"'\),]|$)"#, options: .caseInsensitive),
try! NSRegularExpression(pattern: #"VerificationCheck\.([-A-Za-z0-9_+=]{20,64})(?=[\s\"'\),]|$)"#, options: .caseInsensitive),
try! NSRegularExpression(pattern: #"selected pass uniqueID\s*:\s*\"?([-A-Za-z0-9_+=]{20,64})\"?"#, options: .caseInsensitive),
try! NSRegularExpression(pattern: #"Dashboard loading[^:]*:\s*for\s+([-A-Za-z0-9_+=]{20,80})(?=[,\s\"'\)]|$)"#, options: .caseInsensitive),
try! NSRegularExpression(pattern: #"Dashboard loading[^:]*:\s+([-A-Za-z0-9_+=]{20,80})\s+-"#, options: .caseInsensitive),
]
static let inSessionList = try! NSRegularExpression(
pattern: #"passIDs\[InSession\]\s*:\s*(?:\{\s*)?\(([^)]*)\)"#,
pattern: #"passIDs\[(?:InSession|global)\]\s*:\s*(?:\{\s*)?\(([^)]*)\)"#,
options: .caseInsensitive
)
static let cardID = try! NSRegularExpression(pattern: #"(?<![-A-Za-z0-9_+=])[-A-Za-z0-9_+=]{20,64}(?![-A-Za-z0-9_+=])"#)
static let activation = try! NSRegularExpression(
pattern: #"setActivePaymentApplet.{0,4096}?requestedApplet\s*:.{0,4096}?identifier\s*=\s*([A-Fa-f0-9]{10,64})\b"#,
pattern: #"setActivePaymentApplet.{0,4096}?requestedApplet\s*:.{0,4096}?(?:identifier\s*=\s*|\"identifier\"\s*:\s*\")([A-Fa-f0-9]{10,64})\b"#,
options: [.caseInsensitive, .dotMatchesLineSeparators]
)
static let fallbackToken = try! NSRegularExpression(
pattern: #"(?<![-A-Za-z0-9+/=])([A-Za-z0-9+/_-]{27}=)(?![-A-Za-z0-9+/=])"#
)
static let placeholders: Set<String> = ["OM6NYhwXMZrAw0sRUjR62wmF4ZQ=", "M6nDwZrkYbFlsodLgCbvyFZQ1cc=", "kJL-D0rr-SZhbj2c8nK-OQ9hCMY=", "hwAtAmHKYwsQrJbT5cTNDsaxVME="]
static func cardIDs(in line: String) -> [String] {
@@ -105,6 +110,17 @@ enum WalletScanParser {
}
}
static func fallbackCardIDs(in line: String) -> [String] {
let lineRange = NSRange(line.startIndex..., in: line)
var seen = Set<String>()
return fallbackToken.matches(in: line, range: lineRange).compactMap { match in
guard let range = Range(match.range(at: 1), in: line) else { return nil }
let id = String(line[range])
guard !placeholders.contains(id), seen.insert(id).inserted else { return nil }
return id
}
}
static func activationIDs(in line: String) -> [String] {
activation.matches(in: line, range: NSRange(line.startIndex..., in: line)).compactMap { match in
guard let range = Range(match.range(at: 1), in: line) else { return nil }
+29 -7
View File
@@ -453,13 +453,8 @@ def write_files_batch(
return False
def remove_files(udid: str, target: str, leaves: list[str], retries: int = 3) -> bool:
"""Remove specific files through the relocated Airlift symlink.
Wallet only rebuilds its rendered card faces when the old cache entries are
absent. Overwriting them with arbitrary bytes leaves stale artwork active on
recent iOS releases, so cache invalidation must be a real unlink operation.
"""
def remove_files_batch(udid: str, target: str, leaves: list[str], retries: int = 3) -> bool:
"""Remove specific files through the relocated Airlift symlink in a single batch."""
if not leaves:
return True
if any(not leaf or "/" in leaf or leaf in {".", ".."} for leaf in leaves):
@@ -530,6 +525,33 @@ def remove_files(udid: str, target: str, leaves: list[str], retries: int = 3) ->
return False
def remove_files(udid: str, target: str, leaves: list[str], retries: int = 3) -> bool:
"""Remove specific files through the relocated Airlift symlink.
Wallet only rebuilds its rendered card faces when the old cache entries are
absent. Overwriting them with arbitrary bytes leaves stale artwork active on
recent iOS releases, so cache invalidation must be a real unlink operation.
"""
if not leaves:
return True
# 1. Try removing all requested leaves in a fast single batch
if remove_files_batch(udid, target, leaves, retries=retries):
return True
# 2. If the combined batch fails (e.g. PlaceHolder or Preview does not exist
# on this device/card), remove present leaves individually.
if len(leaves) > 1:
removed_any = False
for leaf in leaves:
if remove_files_batch(udid, target, [leaf], retries=1):
removed_any = True
if removed_any:
return True
return False
def invalidate_cache(udid: str, card_hash: str) -> bool:
"""Remove every rendered card face so Wallet must rebuild from the pass."""
all_ok = True
+2 -2
View File
@@ -43,9 +43,9 @@ cat << 'EOF' > "${CONTENTS_DIR}/Info.plist"
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.5</string>
<string>1.2.6</string>
<key>CFBundleVersion</key>
<string>10</string>
<string>11</string>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
<key>NSHighResolutionCapable</key>
+1 -1
View File
@@ -38,7 +38,7 @@ Original card artwork for this guide. Use the links below to download them. If G
| Card | A card already added to Apple Wallet |
| App | Download `AirCard.dmg` from the [original releases page](https://github.com/Mak5er/AirCard/releases/latest); the DMG needs no separate Homebrew or Python installation |
This guide was checked against **AirCard v1.2.5** on **2026-09-30**. The upstream README reports testing on iOS 27; that is not a guarantee for every device. No additional hardware compatibility testing was performed for this guide.
This guide was checked against **AirCard v1.2.6** on **2026-10-04**. The upstream README reports testing on iOS 27; that is not a guarantee for every device. No additional hardware compatibility testing was performed for this guide.
## Change your card artwork in five steps
+1 -1
View File
@@ -38,7 +38,7 @@ AirCard 是一款 macOS 工具,通过 USB 连接 iPhone,自定义 Apple Wall
| 卡片 | 已经添加到 Apple Wallet 的卡片 |
| 软件 | 从[原作者 Releases](https://github.com/Mak5er/AirCard/releases/latest)下载 `AirCard.dmg`;使用 DMG 无需另装 Homebrew 或 Python |
本指南依据 **AirCard v1.2.5** 整理(2026-09-30)。上游 README 标注曾在 iOS 27 测试;这不代表所有设备都已验证。本指南没有新增实机兼容性测试。
本指南依据 **AirCard v1.2.6** 整理(2026-10-04)。上游 README 标注曾在 iOS 27 测试;这不代表所有设备都已验证。本指南没有新增实机兼容性测试。
## 五步换卡面
+4
View File
@@ -35,3 +35,7 @@ class WalletDiscoveryTests(unittest.TestCase):
'-o', binary], capture_output=True, text=True, check=True)
result = subprocess.run([binary], capture_output=True, text=True, check=True)
self.assertIn('clear/relaunch passed', result.stdout)
if __name__ == '__main__':
unittest.main()
+11 -3
View File
@@ -11,12 +11,16 @@ struct WalletDiscoveryTests {
precondition(WalletScanParser.cardIDs(in: "passd identifier \(a)").isEmpty)
precondition(WalletScanParser.cardIDs(in: "/Cards/<private>.pkpass").isEmpty)
let ios27Line = "nfcd: passIDs[InSession]: {(\"\(c)\")} passIDs[global]: {(\"\(a)\")}"
precondition(WalletScanParser.cardIDs(in: ios27Line) == [c])
precondition(WalletScanParser.cardIDs(in: ios27Line) == [c, a])
let sessionCards = (0..<12).map { String(format: "%020dAAAAAAA=", $0) }
let sessionList = sessionCards.map { "\"\($0)\"" }.joined(separator: ", ")
let batchedIOS27Line = "nfcd: passIDs[InSession]: {(\(sessionList))} passIDs[global]: {(\"\(a)\")}"
precondition(WalletScanParser.cardIDs(in: batchedIOS27Line) == sessionCards)
precondition(WalletScanParser.cardIDs(in: "nfcd: passIDs[global]: {(\"\(a)\")}").isEmpty)
precondition(WalletScanParser.cardIDs(in: batchedIOS27Line) == sessionCards + [a])
precondition(WalletScanParser.cardIDs(in: "nfcd: passIDs[global]: {(\"\(a)\")}") == [a])
let dashboardLine1 = "Passbook(PassKitUI): Dashboard loading (...): for \(a), pass feature unknown"
let dashboardLine2 = "Passbook(PassKitUI): Dashboard loading (...): \(b) - m:NO, sm:NO"
precondition(WalletScanParser.cardIDs(in: dashboardLine1) == [a])
precondition(WalletScanParser.cardIDs(in: dashboardLine2) == [b])
precondition(WalletScanParser.cardIDs(in: "Wallet /Passes/Cards/\(a)/FrontFace") == [a])
precondition(WalletScanParser.cardIDs(in: "PDCardFileManager: writing card \(b)") == [b])
precondition(WalletScanParser.cardIDs(in: "PDPassLibrary: wrote pass \(a)") == [a])
@@ -28,6 +32,10 @@ struct WalletDiscoveryTests {
precondition(WalletScanParser.activationIDs(in: activeLine) == [activation])
let multilineActivation = "setActivePaymentApplet: x requestedApplet:\n<NFApplet> { identifier = \(activation) family=0x0 }"
precondition(WalletScanParser.activationIDs(in: multilineActivation) == [activation])
let jsonActivation = "setActivePaymentApplet: x requestedApplet: {\"identifier\":\"\(activation)\",\"family\":0}"
precondition(WalletScanParser.activationIDs(in: jsonActivation) == [activation])
let fallbackLine = "passd: some unusual event \(c) without explicit path"
precondition(WalletScanParser.fallbackCardIDs(in: fallbackLine) == [c])
let cards = [WalletSavedCard(id: b, confirmed: true, imagePath: "/skin-b.png", selected: false),
WalletSavedCard(id: a, imagePath: "/skin-a.png"),
WalletSavedCard(id: b), WalletSavedCard(id: a, confirmed: true)]