Prevent ringing state updates after RingingState.Timeout#1634
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
WalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 Tip You can get early access to new features in CodeRabbit.Enable the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt (1)
1262-1268: Logic is correct; consider removing the emptyelsebranch.The early-return for both terminal states (
TimeoutNoAnswerandRejectedByAll) is appropriate to prevent further ringing state updates after these final states are reached.Since this is a
whenstatement (not an expression requiring exhaustiveness), theelse -> {}branch is unnecessary and can be removed for cleaner code.,
🧹 Optional cleanup
- when (ringingState.value) { - RingingState.TimeoutNoAnswer, RingingState.RejectedByAll -> { - return - } - - else -> {} - } + if (ringingState.value == RingingState.TimeoutNoAnswer || + ringingState.value == RingingState.RejectedByAll + ) { + return + }Alternatively, keep
whenbut drop the empty branch:when (ringingState.value) { RingingState.TimeoutNoAnswer, RingingState.RejectedByAll -> { return } - - else -> {} }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt` around lines 1262 - 1268, The when block checking ringingState (RingingState.TimeoutNoAnswer, RingingState.RejectedByAll) has an unnecessary empty else branch; remove the else -> {} entirely from the when that guards ringingState.value (in CallState.kt) so the early-return branches remain and the when is simplified to only handle those terminal states.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt`:
- Around line 1262-1268: The when block checking ringingState
(RingingState.TimeoutNoAnswer, RingingState.RejectedByAll) has an unnecessary
empty else branch; remove the else -> {} entirely from the when that guards
ringingState.value (in CallState.kt) so the early-return branches remain and the
when is simplified to only handle those terminal states.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c5b9bff4-8b02-4924-99f6-abbb15aa2f8f
📒 Files selected for processing (1)
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt
SDK Size Comparison 📏
|
|
|
🚀 Available in v1.21.0 |




Goal
Prevent updating ringing state after reaching
RingingState.TimeoutImplementation
Prevent updating ringing state after reaching
RingingState.Timeout🎨 UI Changes
None
Testing
RingingState.Timeoutto and render the main screen.Summary by CodeRabbit