feat: Add mute node functionality#4181
Merged
Merged
Conversation
This commit introduces the ability to mute nodes. - Add `isMuted` boolean property to the `Node` data class and `NodeEntity`. - Update the database schema to version 31 to include the `is_muted` column in the `nodes` table. - Implement the UI for muting/unmuting nodes in `DeviceActions` and the node list context menu, including new icons and string resources. - Add `Mute` action to `ServiceAction` and handle it in `MeshActionHandler` to send the corresponding admin message. - Wire up the mute functionality in `NodeDetailViewModel` and `NodeListViewModel`. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This change introduces the ability to mute all notifications from a specific node. - Adds `isMuted` flag to `NodeInfo` in the database. - Checks `nodeMuted` status in `MeshDataHandler` before showing notifications for new messages or replies. - Displays a "mute" icon in the node list UI for muted nodes. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Refactors several composables within the node feature to improve readability and maintainability.
- Extracts `DeviceActionsContent` from `DeviceActions` to separate logic from the card container.
- Splits the `ContextMenu` in `NodeListScreen` into individual `MenuItem` composables (`FavoriteMenuItem`, `IgnoreMenuItem`, etc.).
- Breaks down `NodeStatusIcons` into smaller, more focused composables like `ThisNodeStatusBadge` and `StatusBadge`.
- Removes the `@Suppress("LongMethod")` and `@Suppress("LongParameterList")` annotations where the refactoring has resolved the underlying issue.
- Renames a parameter in `NodeDetailViewModel.requestPosition` for clarity.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
…ations This commit refactors the `NodeDetailViewModel` by extracting node management and request logic into separate, reusable `NodeManagementActions` and `NodeRequestActions` classes. This improves separation of concerns and testability within the node detail feature. Additionally, it introduces a `isSilent` parameter to waypoint notifications, allowing them to be delivered without sound or vibration. Specific changes: - Create `NodeDetailActions`, `NodeManagementActions`, and `NodeRequestActions` to handle business logic. - Update `NodeDetailViewModel` to delegate calls to the new action classes. - Refactor `DeviceActions` and `NodeStatusIcons` Composables for better structure and clarity. - Add an `isSilent` flag to `updateWaypointNotification` and related calls to control notification behavior. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit refactors the string resources related to muting and unmuting nodes to improve clarity and consistency. Key changes: - Renamed `mute_always` to `mute_notifications` for better user understanding. - Added new confirmation strings `mute_add` and `mute_remove` to provide more context in dialogs. - Updated the mute status strings for better formatting with multiple arguments. - Removed the unused `formatAgo` and `onEditorAction` extension functions. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Introduces a `Capabilities` class to determine feature availability based on the node's firmware version. This allows for conditionally rendering UI elements and enabling/disabling functionality. - Add `Capabilities.kt` to define feature flags like `canMuteNode` and `canRequestNeighborInfo`. - Integrate `Capabilities` into the `Node.kt` data model. - Conditionally show the "Mute notifications" option in `DeviceActions.kt` and `NodeListScreen.kt` based on `canMuteNode`. - Conditionally show the "Request neighbors" chip in `RemoteDeviceActions.kt` based on `canRequestNeighborInfo`. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit centralizes various firmware version checks into the `Capabilities` class. By doing this, we avoid hardcoding firmware version strings throughout the codebase and provide a single, consistent way to check for feature support based on the device's firmware version. The following capabilities have been added: - `canToggleTelemetryEnabled` (>= 2.7.12) - `canToggleUnmessageable` (>= 2.6.9) - `supportsQrCodeSharing` (>= 2.6.8) These new properties are now used in the Telemetry, User, and Node settings screens, as well as in the messaging and contact sharing logic, replacing the previous direct version comparisons. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Adds unit tests for the `Capabilities` class. This ensures that the version-based capability checks behave as expected and correctly handle null or invalid firmware versions. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4181 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 3 3
Lines 23 23
Branches 7 7
=====================================
Misses 23 23 ☔ View full report in Codecov by Sentry. |
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 introduces the ability to mute notifications on a per-node basis. Introduced in meshtastic/protobufs#838
Changes include:
is_mutedflag is added to theNodedatabase entity.Capabilitiesclass has been created to centralize firmware version checks for feature availability.NodeDetailViewModelis refactored to delegate actions to new dedicatedNodeManagementActionsandNodeRequestActionsclasses.