Skip to content

feat(pids): separate alert threshold editing from core PID configuration#181

Merged
tzebrowski merged 28 commits into
masterfrom
feat/pid-edit-alert-separation
Jul 13, 2026
Merged

feat(pids): separate alert threshold editing from core PID configuration#181
tzebrowski merged 28 commits into
masterfrom
feat/pid-edit-alert-separation

Conversation

@tzebrowski

Copy link
Copy Markdown
Owner
  • Introduce distinct 'alert' and 'edit' modes for EditPidBottomSheet.
  • Hide core PID fields (Description, Mode, PID Code, Formula) during 'alert' mode to prevent accidental modification of PID logic.
  • Restrict the 'Add new PID' FAB to only appear in full 'edit' mode.
  • Update save callback logic in the main dialog to conditionally update core fields versus alert thresholds based on the active mode.

tzebrowski added 28 commits July 9, 2026 22:32
- Introduce distinct 'alert' and 'edit' modes for EditPidBottomSheet.
- Hide core PID fields (Description, Mode, PID Code, Formula) during 'alert' mode to prevent accidental modification of PID logic.
- Restrict the 'Add new PID' FAB to only appear in full 'edit' mode.
- Update save callback logic in the main dialog to conditionally update core fields versus alert thresholds based on the active mode.
- Extracted `isEdit`, `isAlert`, and `isInteractive` logic into a dedicated `PidExtensions.kt` file.
- Removed redundant state fields (`isEditMode`, `isAlertMode`, etc.) from `PidDefinitionPreferenceDialogFragment` to simplify the class state.
- Updated `EditPidBottomSheet` and dialog fragment to use the new extensions instead of inline string comparisons.
- Improves code readability and centralizes mode-evaluation logic across the PID management UI.
…updates

- Refactor PID dialog logic into PidDefinitionViewModel for StateFlow state management.
- Fix UI state synchronization issue where edit and alert threshold updates were not immediately reflected in the RecyclerView.
- Ensure state emissions occur on the main dispatcher and break object equality traps on state updates.
- Ensure user-created PIDs are prioritized at the top of the PID list.
- Fix custom PID deletion logic to filter by explicit ID and properly refresh the list state.
…before long description

- Update PidViewAdapter to display the primary description first in bold.
- Render the long description underneath in a secondary text style when available.
- Hide the long description view when empty or identical to the primary description.
- Add `isUserCustom` extension property on `PidDefinition` and `PidDefinitionDetails` in Modules.kt.
- Replace hardcoded resource file string comparisons ("user_custom_pids.json") across PidViewAdapter and PidDefinitionViewModel with the extension property.
- Clean up custom PID checks for deletion UI actions and list sorting logic.
…t crash

- Merged `DiagnosticRequestIDMapper` into `DiagnosticRequestIDManager` to serve as the single source of truth for CAN ID mapping logic.
- Unified SharedPreferences key prefixes and consolidated configuration mapping methods (`getMapping()`, `updateSettings()`, `reset()`).
- Standardized the mapping loop limit (`DRI_MAX_MAPPINGS_ALLOWED`) to 100 to prevent potential data loss.
- Fixed an `IllegalArgumentException` (WordIterator invalid offset) during mapping creation by removing the conflicting `android:textAllCaps="true"` attribute from the `TextInputEditText` in `dialog_dri_edit.xml`. Capitalization remains safely handled in the bottom sheet logic.
- Created `CustomPidRepository` to handle saving and deleting user custom PIDs (`user_custom_pids.json`), separating this concern from the `Modules` configuration manager.
- Wrapped Jackson ObjectMapper file I/O operations in `Dispatchers.IO` to ensure they do not block the main thread.
- Updated `PidDefinitionViewModel` and `PidViewModelFactory` to use constructor injection for the new repository.
- Cleaned up `PidDefinitionDialogFragment` by delegating custom PID save/delete operations directly to the ViewModel, removing the need to pass Android `Context` downward.
- Allowed negative inputs for Min/Max fields by explicitly setting `android:digits="0123456789.-"` in `dialog_pid_edit.xml`.
- Fixed PID modification by constructing a new `PidDefinition` instance in `PidDefinitionDialogFragment` to bypass immutable fields.
- Synced the global `DataLoggerRepository` registry during PID updates to prevent stale data from appearing upon reopening the form.
- Preserved the correct `resourceFile` binding (e.g., `user_custom_pids.json`) by restoring it immediately after the registry forces it to `"memory"`.
- Added a `lastUpdate` timestamp to `PidUiState` to reliably trigger `StateFlow` UI refreshes when list sizes remain identical.
@tzebrowski tzebrowski merged commit 993369a into master Jul 13, 2026
2 checks passed
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