Skip to content

feat(ADFA-2839): Persist errors until dismissed#986

Open
dara-abijo-adfa wants to merge 1 commit intostagefrom
ADFA-2839-persist-error-messages
Open

feat(ADFA-2839): Persist errors until dismissed#986
dara-abijo-adfa wants to merge 1 commit intostagefrom
ADFA-2839-persist-error-messages

Conversation

@dara-abijo-adfa
Copy link
Contributor

  • Show error messages indefinitely until user dismisses.
  • Added an action button to dismiss error messages.

This allows users read long error messages without the message getting dismissed prematurely.

@dara-abijo-adfa dara-abijo-adfa requested a review from a team February 16, 2026 17:36
@dara-abijo-adfa dara-abijo-adfa self-assigned this Feb 16, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

📝 Walkthrough

Release Notes - Persist Errors Until Dismissed

Feature:

  • Error messages now persist indefinitely on-screen until the user explicitly dismisses them by tapping the "Dismiss" button
  • Resolves issue where users couldn't read long error messages before they auto-dismissed

Changes:

  • Updated flashError(msg: String?) to display messages with indefinite duration (previously auto-dismissed after ~2 seconds)
  • Added dismiss action button to indefinite error messages for explicit user control
  • Refactored showFlashBar() to use a shared Flashbar.Builder instance, reducing code duplication
  • Added new string resource: dismiss ("Dismiss")

⚠️ Breaking Changes:

  • Removed public API: Activity.flashErrorForLong(msg: String?) has been deleted. External code should use flashError() instead, which now provides the same persistent behavior.
  • Behavior change: All flashError() calls now display messages indefinitely instead of auto-dismissing. Applications relying on short-lived error messages will see changed behavior.

⚠️ Risk Assessment:

  • UI Stack-up Risk: Multiple sequential error messages may accumulate on-screen without auto-clearing, potentially cluttering the UI if users don't dismiss them promptly
  • User Awareness Risk: Users may not immediately recognize the need to dismiss persistent error messages, especially if they're accustomed to auto-dismissing notifications
  • No test coverage mentioned: No indication of UI tests validating the dismiss button functionality and message persistence behavior
  • Default parameter change: Flashbar gravity defaults now use TOP constant instead of Flashbar.Gravity.TOP (stylistically different but functionally equivalent)

Walkthrough

This pull request refactors the flashbar error-handling API by consolidating the separate flashErrorForLong method into a single flashError method that delegates to showFlashBar with indefinite duration. A dismiss action is added for indefinite-duration error flashbars, and a "Dismiss" string resource is introduced to support this UI element.

Changes

Cohort / File(s) Summary
Flashbar Utility Refactoring
common/src/main/java/com/itsaky/androidide/utils/FlashbarActivityUtils.kt
Removed flashErrorForLong API; consolidated error handling by making flashError delegate to showFlashBar with indefinite duration. Introduced shared builder pattern in showFlashBar to reduce recreation overhead. Added dismiss action for indefinite-duration error flashbars with tap listener. Updated default parameter expressions to use TOP constant instead of Flashbar.Gravity.TOP.
Fragment API Migration
app/src/main/java/com/itsaky/androidide/fragments/onboarding/PermissionsFragment.kt
Removed import of flashErrorForLong and replaced call site to use consolidated flashError(event.message) method.
String Resource Addition
resources/src/main/res/values/strings.xml
Added new string resource "dismiss" with value "Dismiss" to support the new dismiss action in flashbars.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Error flashbars hop with grace,
Now consolidated in one place!
With one dismiss button to tap,
No more long errors on the map,
The flashbar API takes a leap! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (3 files):

⚔️ app/src/main/java/com/itsaky/androidide/fragments/onboarding/PermissionsFragment.kt (content)
⚔️ common/src/main/java/com/itsaky/androidide/utils/FlashbarActivityUtils.kt (content)
⚔️ resources/src/main/res/values/strings.xml (content)

These conflicts must be resolved before merging into stage.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main feature change: making error messages persist until dismissed by the user.
Description check ✅ Passed The description clearly explains the changes: error messages now show indefinitely with a dismiss button, solving the issue of premature dismissal of long messages.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ADFA-2839-persist-error-messages
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch ADFA-2839-persist-error-messages
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
common/src/main/java/com/itsaky/androidide/utils/FlashbarActivityUtils.kt (1)

135-137: ⚠️ Potential issue | 🔴 Critical

flashError(@stringres) must use DURATION_INDEFINITE to match the String? overload.

Line 127's flashError(String?) passes duration = DURATION_INDEFINITE, but line 135-137's flashError(@stringres Int) omits the duration parameter, defaulting to DURATION_SHORT (line 61). This causes error messages from string resources to auto-dismiss after 2 seconds without a dismiss button, while string-based errors persist indefinitely with a dismiss button. The inconsistency violates the expected behavior that all error flashbars should remain on-screen until explicitly dismissed.

Fix
 fun Activity.flashError(
 	`@StringRes` msg: Int,
-) = showFlashBar(msg, IconType.ERROR)
+) = showFlashBar(msg, IconType.ERROR, duration = DURATION_INDEFINITE)

Copy link
Collaborator

@hal-eisen-adfa hal-eisen-adfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

2 participants