-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CMM-926 support offline bug and better handling #22334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
CMM-926 support offline bug and better handling #22334
Conversation
…/github.com/wordpress-mobile/WordPress-Android into feat/CMM-843-Create-the-Ask-the-HE-entry-UI
…d for full screen
…support-HE-attachments-i2
…26-support-offline-bug-and-better-handling
|
Claude finished @adalpari's task —— View job Code Review Complete ✅I've completed a comprehensive review of this PR. Overall, this is a well-implemented bug fix with good test coverage. The changes properly address the offline error handling issue and add more specific error messaging. SummaryThis PR fixes a critical bug where the Reply button becomes non-functional after an offline error, and introduces a new Positive Aspects ✨
Issues & Recommendations1. Minor: Unnecessary State Update (Low Priority)Location: onSend = { message, includeAppLogs ->
draftMessageText = message // ⚠️ This line seems unnecessary
onSendMessage(message, includeAppLogs)
}The 2. Code Duplication in Bottom Sheet Dismissal (Medium Priority)Location: The LaunchedEffect(messageSendResult) {
val shouldDismiss = messageSendResult != null
if (shouldDismiss) {
onClearMessageSendResult()
scope.launch {
sheetState.hide()
}.invokeOnCompletion {
showBottomSheet = false
}
// Clear draft only on success
if (messageSendResult is HESupportViewModel.MessageSendResult.Success) {
draftMessageText = ""
draftIncludeAppLogs = false
}
}
}This reduces duplication and makes the logic clearer. 3. Network Check Timing Issue (Low Priority)Location: The network availability check happens at the start of the operation, but network status can change during the async operation. Consider:
Current behavior is acceptable since there are already catch blocks for exceptions, but documenting this behavior or adding more specific network error handling in the catch blocks could be beneficial. 4. Missing Tests for ViewModel Network Checks (Medium Priority)Location: While there are excellent tests for
Recommendation: Add test coverage for: @Test
fun `onSendNewConversation sets OFFLINE error when network unavailable`()
@Test
fun `onAddMessageToConversation sets OFFLINE error when network unavailable`()Security & Performance Notes
Architecture & Code Quality
Testing Recommendations
DocumentationThe code is well-structured and self-documenting. The PR description clearly explains the issue and fix. No additional documentation needed. Final VerdictApprove with minor recommendations ✅ The core fix is solid and addresses the reported bug. The issues identified are minor improvements that can be addressed in a follow-up PR if desired. The excellent test coverage and consistent implementation across the codebase demonstrate good engineering practices. Key Strengths:
Suggested Follow-ups:
|
This suggestion is not accurate
Done!
Done! |
|
| App Name | WordPress | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22334-c2e1a45 | |
| Commit | c2e1a45 | |
| Direct Download | wordpress-prototype-build-pr22334-c2e1a45.apk |
|
| App Name | Jetpack | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22334-c2e1a45 | |
| Commit | c2e1a45 | |
| Direct Download | jetpack-prototype-build-pr22334-c2e1a45.apk |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #22334 +/- ##
=======================================
Coverage 39.21% 39.22%
=======================================
Files 2201 2201
Lines 105788 105795 +7
Branches 15009 15012 +3
=======================================
+ Hits 41485 41498 +13
+ Misses 60811 60806 -5
+ Partials 3492 3491 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Generated by 🚫 Danger |
…-handling # Conflicts: # WordPress/src/main/java/org/wordpress/android/support/he/ui/HEConversationDetailScreen.kt # WordPress/src/main/java/org/wordpress/android/support/he/ui/HEConversationReplyBottomSheet.kt # WordPress/src/main/java/org/wordpress/android/support/he/ui/HESupportViewModel.kt # WordPress/src/test/java/org/wordpress/android/support/he/ui/HESupportViewModelTest.kt
|





Description
This PR fixes a problem where, after showing an "error" because of being offline, the "Reply" button inside a HE conversation was not working anymore. This was because of the error state not being reset.
Apart from that, in this PR a new, more specific error message is used when the app is offline. So now, trying to create new conversations, loading, or answering them will show a more proper error.
Testing instructions
Before/After
