Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds undo-capable permanent deletion in MainActivity using a Snackbar that calls a new BaseNoteModel.saveNotes; refactors EditActivity to use index-based action selection; removes itemId from EditAction; adds tint to two vector drawables; updates changelog exclude labels. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MainActivity
participant BaseNoteModel
participant DAO
participant Snackbar
User->>MainActivity: Confirm "Delete Forever"
MainActivity->>MainActivity: Capture selected notes (removedNotes)
MainActivity->>BaseNoteModel: deleteSelectedBaseNotes()
BaseNoteModel->>DAO: Delete notes
MainActivity->>Snackbar: Show snackbar with "Undo"
User->>Snackbar: Tap "Undo"
Snackbar->>BaseNoteModel: saveNotes(removedNotes)
BaseNoteModel->>DAO: Insert notes back
DAO-->>MainActivity: Notes restored
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5349238 to
2701929
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.kt`:
- Around line 427-437: The quantity string is using a hardcoded 1; change it to
use the actual deleted count by passing the size of the selected notes to
getQuantityString. In the positive button handler (around
baseModel.actionMode.selectedNotes and baseModel.deleteSelectedBaseNotes()),
determine the count from removedNotes.size (or
baseModel.actionMode.selectedNotes.size) and pass that count into
getQuantityString(R.plurals.deleted_selected_notes, count) so the Snackbar shows
the correct pluralized message; keep using removedNotes for undo via
baseModel.saveNotes(removedNotes).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b9b7ba9e-3cfb-4035-be8a-a5f19c9474e1
📒 Files selected for processing (7)
app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.ktapp/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.ktapp/src/main/java/com/philkes/notallyx/presentation/viewmodel/BaseNoteModel.ktapp/src/main/java/com/philkes/notallyx/presentation/viewmodel/preference/Preference.ktapp/src/main/res/drawable/edit.xmlapp/src/main/res/drawable/home.xmlgenerate-changelogs.sh
app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt (1)
337-341: Add strict index bounds guards before updating top-action lists.The new index-based flow is good, but both callback write paths should verify
index in currentActions.indicesbefore assignment to avoid edge-caseIndexOutOfBoundsException.Suggested defensive fix
- val currentActions = prefs.editNoteActivityTopActions.value.toMutableList() - if ( - index != -1 && - index < NotallyXPreferences.DEFAULT_EDIT_NOTE_TOP_ACTIONS.size - ) { + val currentActions = + prefs.getSafeEditNoteActivityTopActions().toMutableList() + if ( + index in currentActions.indices && + index < NotallyXPreferences.DEFAULT_EDIT_NOTE_TOP_ACTIONS.size + ) { currentActions[index] = NotallyXPreferences.DEFAULT_EDIT_NOTE_TOP_ACTIONS[index] prefs.editNoteActivityTopActions.save(currentActions) } @@ - if (index != -1) { + if (index in currentActions.indices) { currentActions[index] = newAction prefs.editNoteActivityTopActions.save(currentActions) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt` around lines 337 - 341, In showActionSelectionDialog, add strict bounds checks before writing to the action lists: before assigning into currentActions[index] (and the alternate callback write path that updates the top-action list), verify index in currentActions.indices (and index in topActions.indices when updating topActions) and bail out or clamp if not; update both callback branches that perform index-based assignments to guard with these checks to prevent IndexOutOfBoundsException.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@app/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.kt`:
- Around line 337-341: In showActionSelectionDialog, add strict bounds checks
before writing to the action lists: before assigning into currentActions[index]
(and the alternate callback write path that updates the top-action list), verify
index in currentActions.indices (and index in topActions.indices when updating
topActions) and bail out or clamp if not; update both callback branches that
perform index-based assignments to guard with these checks to prevent
IndexOutOfBoundsException.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 882a7cd5-c72b-405e-8970-45b9e4efaeb1
📒 Files selected for processing (7)
app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.ktapp/src/main/java/com/philkes/notallyx/presentation/activity/note/EditActivity.ktapp/src/main/java/com/philkes/notallyx/presentation/viewmodel/BaseNoteModel.ktapp/src/main/java/com/philkes/notallyx/presentation/viewmodel/preference/Preference.ktapp/src/main/res/drawable/edit.xmlapp/src/main/res/drawable/home.xmlgenerate-changelogs.sh
🚧 Files skipped from review as they are similar to previous changes (4)
- app/src/main/java/com/philkes/notallyx/presentation/activity/main/MainActivity.kt
- app/src/main/res/drawable/home.xml
- app/src/main/java/com/philkes/notallyx/presentation/viewmodel/preference/Preference.kt
- app/src/main/res/drawable/edit.xml
2701929 to
d500c2a
Compare
d500c2a to
d3993f1
Compare
Summary by CodeRabbit
New Features
Bug Fixes
Style
Chores