feat: implement global SnackbarManager and consolidate common UI setup#4909
Merged
jamesarich merged 1 commit intomainfrom Mar 24, 2026
Merged
feat: implement global SnackbarManager and consolidate common UI setup#4909jamesarich merged 1 commit intomainfrom
jamesarich merged 1 commit intomainfrom
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces a centralized
SnackbarManagerto 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 sharedMeshtasticCommonAppSetupto eliminate boilerplate across platform-specific entry points.Specific changes include:
Core UI & Infrastructure:
SnackbarManagerincore:uito manage snackbar events via a bufferedChannel.MeshtasticSnackbarProviderandMeshtasticSnackbarHostto render global snackbars at the root level.MeshtasticCommonAppSetupto unifySharedDialogs,FirmwareVersionCheck,AlertHost, andTracerouteAlertHandler.navigateTopLevelextension forNavBackStackto standardize top-level navigation logic.Feature Node Refactoring:
SnackbarHostStateandNodeRequestEffectwith globalSnackbarManageracross all metrics screens (HostMetrics,PaxMetrics,PowerMetrics,SignalMetrics,EnvironmentMetrics,DeviceMetrics,PositionLog, etc.).CommonNodeRequestActionsto injectSnackbarManagerand trigger feedback directly.effectsflow fromNodeDetailViewModelandMetricsViewModel.Platform-Specific Updates:
Main.ktto useMeshtasticCommonAppSetupandMeshtasticSnackbarProvider. Refactored version check logic.DesktopNotificationManagerto bridge repository notifications with the system tray/ComposeTrayState.bundleIDconfiguration and monochrome SVG tray icons.DesktopMainScreen.ktto use the new common setup and snackbar provider.Documentation & Maintenance:
AGENTS.mdandGEMINI.mdto reflect new guidelines for usingTracerouteAlertHandlerandFirmwareVersionCheck.SnackbarManager.NodeRequestEffect.