refactor: consolidate UUID formatting into shared extension #1

Merged
schwifty merged 1 commit from schwifty/consolidate-uuid-formatting into main 2026-03-21 21:43:50 +00:00
Collaborator

Summary

  • Created UUIDFormatting.swift with two String extensions: .normalizedUUID (strips dashes, uppercases) and .uuidWithDashes (formats 32-char hex into 8-4-4-4-12)
  • Eliminated 4 duplicate formatUuidWithDashes() methods across BeaconScanner.swift, ScanView.swift, ServicePointListView.swift, and BeaconBanList.swift
  • Replaced 6+ inline .replacingOccurrences(of: "-", with: "").uppercased() calls in Api.swift, BeaconBanList.swift, and BeaconProvisioner.swift

Files Changed

  • New: UUIDFormatting.swift — single source of truth for UUID formatting
  • Modified: Api.swift, BeaconScanner.swift, ScanView.swift, ServicePointListView.swift, BeaconBanList.swift, BeaconProvisioner.swift

Test plan

  • Verify beacon scanning still shows UUIDs correctly in scan list
  • Verify provisioning flow formats UUIDs with dashes for API calls
  • Verify clipboard copy on ServicePointListView copies formatted UUID
  • Verify ban list detection still works with both dashed and undashed UUIDs

🤖 Generated with Claude Code

## Summary - Created `UUIDFormatting.swift` with two `String` extensions: `.normalizedUUID` (strips dashes, uppercases) and `.uuidWithDashes` (formats 32-char hex into 8-4-4-4-12) - Eliminated **4 duplicate** `formatUuidWithDashes()` methods across `BeaconScanner.swift`, `ScanView.swift`, `ServicePointListView.swift`, and `BeaconBanList.swift` - Replaced **6+ inline** `.replacingOccurrences(of: "-", with: "").uppercased()` calls in `Api.swift`, `BeaconBanList.swift`, and `BeaconProvisioner.swift` ## Files Changed - **New**: `UUIDFormatting.swift` — single source of truth for UUID formatting - **Modified**: `Api.swift`, `BeaconScanner.swift`, `ScanView.swift`, `ServicePointListView.swift`, `BeaconBanList.swift`, `BeaconProvisioner.swift` ## Test plan - [ ] Verify beacon scanning still shows UUIDs correctly in scan list - [ ] Verify provisioning flow formats UUIDs with dashes for API calls - [ ] Verify clipboard copy on ServicePointListView copies formatted UUID - [ ] Verify ban list detection still works with both dashed and undashed UUIDs 🤖 Generated with [Claude Code](https://claude.com/claude-code)
schwifty added 1 commit 2026-03-21 10:03:13 +00:00
Created UUIDFormatting.swift with .normalizedUUID and .uuidWithDashes
String extensions, replacing 4 duplicate formatUuidWithDashes() methods
and 6+ inline .replacingOccurrences(of: "-", with: "").uppercased() calls
across Api.swift, BeaconScanner.swift, ScanView.swift,
ServicePointListView.swift, BeaconBanList.swift, and BeaconProvisioner.swift.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
schwifty merged commit 9ddb9ebe1b into main 2026-03-21 21:43:50 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: payfrit/payfrit-beacon-ios#1
No description provided.