Skip to content

feat: implement global SnackbarManager and consolidate common UI setup#4909

Merged
jamesarich merged 1 commit intomainfrom
feat/snackbars-and-alerts
Mar 24, 2026
Merged

feat: implement global SnackbarManager and consolidate common UI setup#4909
jamesarich merged 1 commit intomainfrom
feat/snackbars-and-alerts

Conversation

@jamesarich
Copy link
Copy Markdown
Collaborator

This commit introduces a centralized SnackbarManager to handle transient feedback across the application, decoupling ViewModels from specific UI implementations. It also consolidates global UI components and side-effect handlers (alerts, version checks, traceroute responses) into a shared MeshtasticCommonAppSetup to eliminate boilerplate across platform-specific entry points.

Specific changes include:

  • Core UI & Infrastructure:

    • Introduced SnackbarManager in core:ui to manage snackbar events via a buffered Channel.
    • Created MeshtasticSnackbarProvider and MeshtasticSnackbarHost to render global snackbars at the root level.
    • Implemented MeshtasticCommonAppSetup to unify SharedDialogs, FirmwareVersionCheck, AlertHost, and TracerouteAlertHandler.
    • Added navigateTopLevel extension for NavBackStack to standardize top-level navigation logic.
  • Feature Node Refactoring:

    • Replaced local SnackbarHostState and NodeRequestEffect with global SnackbarManager across all metrics screens (HostMetrics, PaxMetrics, PowerMetrics, SignalMetrics, EnvironmentMetrics, DeviceMetrics, PositionLog, etc.).
    • Updated CommonNodeRequestActions to inject SnackbarManager and trigger feedback directly.
    • Removed effects flow from NodeDetailViewModel and MetricsViewModel.
  • Platform-Specific Updates:

    • Android: Updated Main.kt to use MeshtasticCommonAppSetup and MeshtasticSnackbarProvider. Refactored version check logic.
    • Desktop: Integrated DesktopNotificationManager to bridge repository notifications with the system tray/Compose TrayState.
    • Desktop: Added native macOS support, including bundleID configuration and monochrome SVG tray icons.
    • Desktop: Updated DesktopMainScreen.kt to use the new common setup and snackbar provider.
  • Documentation & Maintenance:

    • Updated AGENTS.md and GEMINI.md to reflect new guidelines for using TracerouteAlertHandler and FirmwareVersionCheck.
    • Added unit tests for SnackbarManager.
    • Updated various tests to align with the removal of NodeRequestEffect.

This commit introduces a centralized `SnackbarManager` to handle transient feedback across the application, decoupling ViewModels from specific UI implementations. It also consolidates global UI components and side-effect handlers (alerts, version checks, traceroute responses) into a shared `MeshtasticCommonAppSetup` to eliminate boilerplate across platform-specific entry points.

Specific changes include:

- **Core UI & Infrastructure:**
  - Introduced `SnackbarManager` in `core:ui` to manage snackbar events via a buffered `Channel`.
  - Created `MeshtasticSnackbarProvider` and `MeshtasticSnackbarHost` to render global snackbars at the root level.
  - Implemented `MeshtasticCommonAppSetup` to unify `SharedDialogs`, `FirmwareVersionCheck`, `AlertHost`, and `TracerouteAlertHandler`.
  - Added `navigateTopLevel` extension for `NavBackStack` to standardize top-level navigation logic.

- **Feature Node Refactoring:**
  - Replaced local `SnackbarHostState` and `NodeRequestEffect` with global `SnackbarManager` across all metrics screens (`HostMetrics`, `PaxMetrics`, `PowerMetrics`, `SignalMetrics`, `EnvironmentMetrics`, `DeviceMetrics`, `PositionLog`, etc.).
  - Updated `CommonNodeRequestActions` to inject `SnackbarManager` and trigger feedback directly.
  - Removed `effects` flow from `NodeDetailViewModel` and `MetricsViewModel`.

- **Platform-Specific Updates:**
  - **Android:** Updated `Main.kt` to use `MeshtasticCommonAppSetup` and `MeshtasticSnackbarProvider`. Refactored version check logic.
  - **Desktop:** Integrated `DesktopNotificationManager` to bridge repository notifications with the system tray/Compose `TrayState`.
  - **Desktop:** Added native macOS support, including `bundleID` configuration and monochrome SVG tray icons.
  - **Desktop:** Updated `DesktopMainScreen.kt` to use the new common setup and snackbar provider.

- **Documentation & Maintenance:**
  - Updated `AGENTS.md` and `GEMINI.md` to reflect new guidelines for using `TracerouteAlertHandler` and `FirmwareVersionCheck`.
  - Added unit tests for `SnackbarManager`.
  - Updated various tests to align with the removal of `NodeRequestEffect`.

Signed-off-by: James Rich <[email protected]>
@github-actions github-actions bot added the enhancement New feature or request label Mar 24, 2026
@jamesarich jamesarich enabled auto-merge March 24, 2026 22:21
@jamesarich jamesarich added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit 553ca2f Mar 24, 2026
8 checks passed
@jamesarich jamesarich deleted the feat/snackbars-and-alerts branch March 24, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant