# Plan to fix PR #73 Review Comments ## Objective Address all review comments left on PR #73 regarding the Report Bug feature, including bug fixes, styling, UX flow, and tests. ## Implementation Steps 1. **Fix `retryCount` in `ReportBugViewModel.kt`** - Reset `retryCount = 0` inside `ReportBugEvent.Submit` handler before invoking `submitReport()`. 2. **Fix `SentryWrapper.kt` opt-in semantics & `EMPTY_ID`** - Add documentation to `lazyInitAndSendFeedback` explaining the one-shot, explicit bypass policy. - Refactor `captureFeedback` to accept `comments` and `email` directly instead of a `UserFeedback` object. - Inside `captureFeedback`, invoke `Sentry.captureMessage("User Feedback")` to generate a valid `SentryId`, then create and submit the `UserFeedback` object using that ID. 3. **Remove unused `error` state & fix Double-Submit window** - Remove `error` field from `ReportBugState` and delete `ReportBugEvent.DismissError`. - Update `submitReport()` catch block to emit a `ShowSnackbar` effect directly for retrying and failure states. - Ensure `isSubmitting = true` is maintained during the retry chain (remove intermediate `isSubmitting = false`). 4. **Localize hardcoded strings in `ReportBugScreen.kt` & `strings.xml`** - Add `report_bug_type_section` and `report_bug_no_email_app` to `strings.xml`. - Replace hardcoded strings in `ReportBugScreen.kt` with string resources. 5. **Fix UX: `Card` + `Switch` conflict in `ReportBugScreen.kt`** - Remove the separate `Switch`. - Make the "Device information" `Card` act as the sole toggle for inclusion and expansion, or clarify the design (e.g. Card expands to preview, inside it a Checkbox to include). Based on conventions, using a single checkbox inside the expanded card or making the Card expand and show a switch inside it. I will remove `Switch` from the header and place a `Checkbox` inside the expanded content to explicitly toggle `includeDeviceInfo`, while the card title expands/collapses the preview. 6. **Fix `Uri.parse("mailto:")` in `ReportBugScreen.kt`** - Update to use ` "mailto:".toUri() ` (needs `androidx.core.net.toUri`). 7. **Use `REPORT_BUG_LOADING` test tag** - Add a `CircularProgressIndicator` with `REPORT_BUG_LOADING` tag overlaying the "Submit" text inside the Button when `isSubmitting` is true. 8. **Fix S21 heading in `docs/plan-smoke-tests.md`** - Change `- **S21: Crash Reporting Opt-in Persists (Sentry)**` back to `### S21: Crash Reporting Opt-in Persists (Sentry)`. 9. **Update Tests** - **`ReportBugViewModelTest`**: Update mocks for `SentryWrapper` since signature changed. Add test case for `retryCount` reset (submit fails -> succeeds). Add test for `fallbackToEmail` body containing device info. - **`ReportBugScreenTest`**: Update for new UX logic (Checkbox inside expanded card). - **`ReportBugScreenshotTest`**: Update to ensure loading indicator is visible. ## Verification - Run `./gradlew detekt ktlintCheck testDebugUnitTest` to ensure all checks pass. - Verify tests cover the retry reset logic and email fallback body.