Skip to content

Prevent ringing state updates after RingingState.Timeout#1634

Merged
aleksandar-apostolov merged 1 commit intodevelopfrom
chore/rahullohra/stop-updating-ringingstate-after-timeout-no-answer
Mar 31, 2026
Merged

Prevent ringing state updates after RingingState.Timeout#1634
aleksandar-apostolov merged 1 commit intodevelopfrom
chore/rahullohra/stop-updating-ringingstate-after-timeout-no-answer

Conversation

@rahul-lohra
Copy link
Copy Markdown
Contributor

@rahul-lohra rahul-lohra commented Mar 22, 2026

Goal

Prevent updating ringing state after reaching RingingState.Timeout

Implementation

Prevent updating ringing state after reaching RingingState.Timeout

🎨 UI Changes

None

Testing

  1. Login with User A on both web and Android.
  2. Initiate a call from User B to User A.
  3. Accept the call on the web platform — Android should transition Ringing state RingingState.Timeout to and render the main screen.
  4. Check for logs with tag RingingState to verify Ringing state transitions

Summary by CodeRabbit

  • Bug Fixes
    • Improved call state handling for timeout and rejection scenarios to prevent unnecessary state recalculations, ensuring more reliable call management.

@rahul-lohra rahul-lohra self-assigned this Mar 22, 2026
@rahul-lohra rahul-lohra requested a review from a team as a code owner March 22, 2026 21:04
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 22, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 22, 2026

Walkthrough

The updateRingingState function in CallState.kt now early-returns when the ringing state is either TimeoutNoAnswer or RejectedByAll, expanding the previous single-condition early-exit logic to handle both terminal states uniformly.

Changes

Cohort / File(s) Summary
Call State Logic
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt
Modified updateRingingState early-return condition to check for both TimeoutNoAnswer and RejectedByAll ringing states instead of RejectedByAll alone.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐰 A call rings out, but time runs thin,
When answers don't come in,
Or all have said their "no" with pride,
The state now knows to step aside,
Two paths converge, one quiet end!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete, missing critical sections like Implementation details, Testing clarity, and Contributor/Reviewer checklists. Expand the Implementation section with code details, clarify Testing steps (step 3 appears malformed), and complete the checklist sections with relevant items.
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.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change—preventing ringing state updates after timeout.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/rahullohra/stop-updating-ringingstate-after-timeout-no-answer

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.

Tip

You can get early access to new features in CodeRabbit.

Enable the early_access setting to enable early access features such as new models, tools, and more.

Copy link
Copy Markdown

@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.

🧹 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 empty else branch.

The early-return for both terminal states (TimeoutNoAnswer and RejectedByAll) is appropriate to prevent further ringing state updates after these final states are reached.

Since this is a when statement (not an expression requiring exhaustiveness), the else -> {} 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 when but 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9128cd3 and b54e1ff.

📒 Files selected for processing (1)
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/CallState.kt

@github-actions
Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.00 MB 12.00 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.68 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.27 MB 6.27 MB 0.00 MB 🟢

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@rahul-lohra rahul-lohra added the pr:improvement Enhances an existing feature or code label Mar 23, 2026
@aleksandar-apostolov aleksandar-apostolov merged commit 26f7831 into develop Mar 31, 2026
11 of 14 checks passed
@aleksandar-apostolov aleksandar-apostolov deleted the chore/rahullohra/stop-updating-ringingstate-after-timeout-no-answer branch March 31, 2026 13:20
@stream-public-bot stream-public-bot added the released Included in a release label Apr 1, 2026
@stream-public-bot
Copy link
Copy Markdown
Collaborator

🚀 Available in v1.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Enhances an existing feature or code released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants