Skip to content

The big cleanup#2

Merged
rock3r merged 8 commits intomasterfrom
the-big-cleanup
Feb 4, 2026
Merged

The big cleanup#2
rock3r merged 8 commits intomasterfrom
the-big-cleanup

Conversation

@rock3r
Copy link
Owner

@rock3r rock3r commented Feb 4, 2026

Clean up all the code, in multiple passes, to improve both coherency and readability. Update the docs, add Detekt for static analysis (with Compose rules). Improve the device name submission to Ricoh cameras.


Note

Medium Risk
Touches core sync orchestration and connection lifecycle code, so regressions could impact background reconnection, firmware notifications, or location syncing despite being largely a cleanup/refactor.

Overview
Adds Detekt (including Compose rules) to the Android app build and updates README links/task docs.

Refactors the devices list screen by extracting large chunks of Compose UI into focused components (device cards, connection status, battery optimization warnings/dialog, list/empty/loading states, and map LocationCard) without changing the screen’s overall behavior.

Reworks MultiDeviceSyncCoordinator into smaller responsibilities: introduces DeviceConnectionManager to track connections/jobs and DeviceFirmwareManager to encapsulate firmware-update notification logic, switches the coordinator to assisted injection, tightens connection/disconnect/periodic-retry flow, and adjusts device-name submission to use vendor-provided naming via DeviceNameProvider.

Hardens background/service and BLE scan operations by avoiding GlobalScope, improving WorkManager warning logging, and narrowing exception handling in scan/service start paths and BLE scan/pairing operations (e.g., SecurityException/IllegalStateException/IOException).

Written by Cursor Bugbot for commit f00ad4d. This will update automatically on new commits. Configure here.

- Integrated the Detekt plugin into the root and app-level `build.gradle.kts` files.
- Added a new `detekt.yml` configuration file with customized rules for complexity, coroutines, style, and potential bugs.
- Included `io.nlopez.compose.rules:detekt` as a Detekt plugin to enforce Jetpack Compose best practices.
- Updated `gradle/libs.versions.toml` with version definitions for Detekt (1.23.8) and Compose rules (0.5.6).

These changes introduce static code analysis to the project, ensuring better code quality and consistency with a specific focus on Kotlin Coroutines and Jetpack Compose standards.
…ion status

- Introduced `BatteryOptimizationDialog` and `BatteryOptimizationWarning` for managing battery optimization settings.
- Added `ConnectionStatusIcon` and related animated components to visually represent device connection states.
- Created `DeviceCard` for displaying device information and connection status with expandable details.
- Implemented `DevicesList` and `UnpairConfirmationDialog` for managing lists of paired devices and unpairing actions.
- Added `LocationCard` for displaying GPS location with a map interface.

These changes enhance the user experience by providing clear visual feedback on device status and managing battery optimization settings effectively.
… camera synchronization

- Introduced `DeviceNameProvider` interface and its Android implementation `AndroidDeviceNameProvider` to resolve the phone's name using a prioritized fallback logic (Bluetooth name, Global settings, System settings, or Build model).
- Added `getPairedDeviceName` to the `CameraVendor` interface, allowing vendors to customize how the phone's name is formatted when sent to a camera.
- Overrode `getPairedDeviceName` in `RicohCameraVendor` to append a "(CameraSync)" suffix.
- Updated `MultiDeviceSyncCoordinator` to utilize `DeviceNameProvider` instead of directly accessing `Build.MODEL`.
- Enhanced dependency injection in `AppGraph` to provide the new name provider.
- Added comprehensive unit tests and fakes for `DeviceNameProvider` and updated existing tests to reflect constructor changes in the coordinator.

These changes centralize device naming logic, improve testability, and allow for vendor-specific naming conventions when pairing with cameras.
…ure and vendor support

- Updated `MULTI_DEVICE_ARCHITECTURE.md` to include new fields in `PairedDeviceProto` for tracking sync status and firmware versions.
- Refined `LocationCollectionCoordinator` documentation to clarify that update intervals are managed by `LocationRepository`.
- Corrected dependency injection references from `AppGraphFactory` to `AppGraph.Factory`.
- Updated `MULTI_VENDOR_SUPPORT.md` to reflect the migration of vendor registration from `CameraSyncApp.kt` to the `AppGraph` dependency injection module.
- Fixed broken links and updated command descriptions in `README.md`.

These changes ensure the documentation accurately reflects the current state of the codebase's architecture and configuration patterns.
@rock3r rock3r force-pushed the the-big-cleanup branch 2 times, most recently from 4fb2de4 to 1323867 Compare February 4, 2026 07:50
import dev.zacsweers.metro.Inject
import kotlinx.coroutines.Job

private const val TAG = "DeviceConnectionManager"
Copy link

Choose a reason for hiding this comment

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

Unused constant TAG declared

Low Severity

The constant TAG is declared but never used in DeviceConnectionManager. It should be removed to avoid dead code clutter.

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@rock3r rock3r merged commit 99283d0 into master Feb 4, 2026
2 checks passed
@rock3r rock3r deleted the the-big-cleanup branch February 4, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant