feat(ADFA-3073): Show Git clone messages on banners#1201
feat(ADFA-3073): Show Git clone messages on banners#1201dara-abijo-adfa merged 2 commits intostagefrom
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 32 minutes and 8 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR removes the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/src/main/java/com/itsaky/androidide/fragments/CloneRepositoryFragment.kt (1)
184-196:⚠️ Potential issue | 🟠 MajorFlash notifications re-fire on configuration change / lifecycle restart.
viewModel.uiStateis aStateFlow, sorepeatOnLifecycle(STARTED)will replay the latest cached value every time the fragment restarts (e.g., rotation, returning from background). If the terminal state isErrororSuccess,flashError(...)/flashInfo(R.string.clone_successful)will be shown again each time, even though the user has already seen it. The old approach of writing to a persistentTextViewwas idempotent; flashes are not.For
Cloning, the same issue applies sincelastStatusResIdis reset tonullon fragment recreation — any cachedCloningstate will re-flash on restart.Consider tracking "already-flashed" terminal states (e.g., via a consumed/SingleLiveEvent-style channel,
SharedFlowwith no replay, or by transitioning the VM toIdleafter the flash is consumed) so banners are shown exactly once per event.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/itsaky/androidide/fragments/CloneRepositoryFragment.kt` around lines 184 - 196, The fragment currently re-displays flashError/flashInfo because viewModel.uiState (a StateFlow) replays terminal states on lifecycle restart; change the flow of flash events so they're emitted once: update the ViewModel to expose one-shot events (e.g., a SharedFlow<Unit/String with replay=0 or a dedicated SingleLiveEvent-like channel) instead of encoding transient flash messages in the persistent CloneRepoUiState, or add a consumed flag on the UI state and clear/transition the VM back to Idle after emitting; then in CloneRepositoryFragment collect that one-shot event (not the persistent StateFlow) and call flashError/flashInfo once, and stop relying on lastStatusResId to gate flashes so Cloning/Error/Success are only shown a single time per event (reference symbols: viewModel.uiState, CloneRepoUiState.Error/Success/Cloning, cloneButton, flashError, flashInfo, lastStatusResId).
🤖 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/itsaky/androidide/fragments/CloneRepositoryFragment.kt`:
- Around line 189-191: The code in CloneRepositoryFragment builds statusMessage
from state.errorResId or state.errorMessage and then calls
flashError(statusMessage), which can pass null; update the logic to provide a
non-null fallback (e.g., getString(R.string.clone_failed) or a suitable generic
error string) when both state.errorResId and state.errorMessage are null so
flashError is never invoked with null; modify the statusMessage assignment to
check state.errorResId, state.errorMessage, and finally the fallback string
before calling flashError.
---
Outside diff comments:
In
`@app/src/main/java/com/itsaky/androidide/fragments/CloneRepositoryFragment.kt`:
- Around line 184-196: The fragment currently re-displays flashError/flashInfo
because viewModel.uiState (a StateFlow) replays terminal states on lifecycle
restart; change the flow of flash events so they're emitted once: update the
ViewModel to expose one-shot events (e.g., a SharedFlow<Unit/String with
replay=0 or a dedicated SingleLiveEvent-like channel) instead of encoding
transient flash messages in the persistent CloneRepoUiState, or add a consumed
flag on the UI state and clear/transition the VM back to Idle after emitting;
then in CloneRepositoryFragment collect that one-shot event (not the persistent
StateFlow) and call flashError/flashInfo once, and stop relying on
lastStatusResId to gate flashes so Cloning/Error/Success are only shown a single
time per event (reference symbols: viewModel.uiState,
CloneRepoUiState.Error/Success/Cloning, cloneButton, flashError, flashInfo,
lastStatusResId).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 01a509c3-619a-4f40-ab05-49b6a35dcef6
📒 Files selected for processing (2)
app/src/main/java/com/itsaky/androidide/fragments/CloneRepositoryFragment.ktapp/src/main/res/layout/fragment_clone_repository.xml
💤 Files with no reviewable changes (1)
- app/src/main/res/layout/fragment_clone_repository.xml
Show git clone messages on banner, instead of the status text view