Skip to content

Break up BLEManager.swift (2596 lines, 1756-line class body) #80

@kmatzen

Description

@kmatzen

Problem

BLEManager.swift is at 2596 lines with a class body spanning 1756 lines. SwiftLint warns at 1000/800 respectively and errors at 2600. We're 4 lines from the error threshold — any new feature will trip it.

Suggested approach

Extract coherent sections into dedicated managers:

  1. Command queue logic (~200 lines) — queueCommand, processCommandQueue, startCommandQueueTimer, rate limiting → BLECommandQueue.swift
  2. Connection lifecycle (~300 lines) — connectToGoPro, disconnectFromGoPro, connectStaggered, straggler retry, scheduleReconnectIfNeeded → merge into existing BLEConnectionManager.swift
  3. Sleep/power-down (~100 lines) — sendSleepCommand, sendPowerDownCommand, putCamerasToSleep, keep-alive timer → BLESleepManager.swift
  4. Device query/scan timers (~80 lines) — startDeviceQueryTimer, startDeviceScanTimerBLEPollingManager.swift
  5. Settings sync (~150 lines) — sendSettings, sendSettingsToCamerasInGroup, queryAllSettings, verifySettingsBLESettingsManager.swift

Acceptance criteria

  • BLEManager.swift under 800 lines (class body)
  • No functional regressions — same behavior, same public API
  • Each extracted manager gets its own unit test file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions