Skip to content

fix(llc, push): some fixes to ringing flow #1027

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

Merged
merged 1 commit into from
Jul 17, 2025
Merged

fix(llc, push): some fixes to ringing flow #1027

merged 1 commit into from
Jul 17, 2025

Conversation

Brazol
Copy link
Contributor

@Brazol Brazol commented Jul 17, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of caller display names in missed and incoming call notifications to avoid showing empty names.
    • Prevented concurrent reconnect attempts during an ongoing join operation to enhance call stability.
  • Chores

    • Removed an unused import to streamline code.
    • Updated a dependency to use a fixed version for improved reliability.

@Brazol Brazol requested a review from a team as a code owner July 17, 2025 07:08
Copy link

coderabbitai bot commented Jul 17, 2025

Walkthrough

A guard clause was added to prevent reconnect attempts during an ongoing join operation in call logic. Caller display name selection was improved to avoid empty names in notifications. An unused import was removed, and a dependency was pinned to a specific version. iOS notification logic now skips empty display names.

Changes

File(s) Change Summary
packages/stream_video/lib/src/call/call.dart Added a guard clause in _reconnect to skip reconnect if _callJoinLock is held.
packages/stream_video/lib/src/call/state/mixins/state_coordinator_mixin.dart Removed an unused import statement.
packages/stream_video/lib/src/stream_video.dart Enhanced display name logic to check for non-empty strings before showing notifications.
packages/stream_video_push_notification/ios/Classes/StreamVideoPKDelegateManager.swift Added a closure to filter out empty display names in notification assignment.
packages/stream_video_push_notification/pubspec.yaml Changed flutter_callkit_incoming dependency from ^2.5.2 to 2.5.2 (pinned exact version).

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant Call
    participant Logger

    App->>Call: Attempt _reconnect()
    Call->>Call: Check if _callJoinLock is held
    alt Lock is held
        Call->>Logger: Log warning
        Call-->>App: Return early, skip reconnect
    else Lock is not held
        Call->>Call: Proceed with reconnect logic
    end
Loading
sequenceDiagram
    participant Notification
    participant Logic

    Notification->>Logic: Prepare caller display name
    Logic->>Logic: Check if callDisplayName is non-empty
    alt callDisplayName is non-empty
        Logic-->>Notification: Use callDisplayName
    else
        Logic->>Logic: Use createdByName if non-empty, else default text
        Logic-->>Notification: Use fallback name
    end
Loading

Possibly related PRs

  • GetStream/stream-video-flutter#1022: Adds lifecycle cancellation to abort ongoing operations, including _reconnect, after leave() is called. Both PRs adjust _reconnect to manage operation concurrency and cancellation.

Suggested reviewers

  • renefloor

Poem

In the warren of code, a lock now stands,
Guarding reconnects with careful hands.
Names for callers, now shining bright,
No empty echoes in the night.
A version pinned, imports trimmed,
🐇 Cheers to code that's neatly primmed!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/stream_video_push_notification/pubspec.yaml (1)

19-19: Exact version pin may impede future patch fixes

Locking flutter_callkit_incoming to 2.5.2 forfeits automatic bug-/security-fix uptake (e.g., 2.5.x). Consider caret (^2.5.2) and rely on pubspec.lock for reproducibility unless a strict pin is required for compatibility.

packages/stream_video/lib/src/stream_video.dart (2)

909-912: Trim whitespace to avoid “blank-but-non-empty” caller names

String.isNotEmpty treats " " (spaces) as valid content, so the current guard can still surface a visually empty caller name.
A more robust check would trim the string first:

-          nameCaller: (callDisplayName?.isNotEmpty ?? false)
-              ? callDisplayName
-              : createdByName,
+          nameCaller: (callDisplayName?.trim().isNotEmpty ?? false)
+              ? callDisplayName!.trim()
+              : createdByName,

This prevents notifications that show only whitespace.


932-935: DRY: extract the display-name fallback into a local variable

The same ternary expression appears twice (missed & incoming). Computing it once improves readability and removes duplication:

+    final callerName = (callDisplayName?.trim().isNotEmpty ?? false)
+        ? callDisplayName!.trim()
+        : createdByName;
+
 ...
-            nameCaller: (callDisplayName?.isNotEmpty ?? false)
-                ? callDisplayName
-                : createdByName,
+            nameCaller: callerName,

(Apply similarly in the missed-call branch above.)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between baf4a05 and 4c48a8e.

📒 Files selected for processing (5)
  • packages/stream_video/lib/src/call/call.dart (1 hunks)
  • packages/stream_video/lib/src/call/state/mixins/state_coordinator_mixin.dart (0 hunks)
  • packages/stream_video/lib/src/stream_video.dart (2 hunks)
  • packages/stream_video_push_notification/ios/Classes/StreamVideoPKDelegateManager.swift (1 hunks)
  • packages/stream_video_push_notification/pubspec.yaml (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/stream_video/lib/src/call/state/mixins/state_coordinator_mixin.dart
🔇 Additional comments (1)
packages/stream_video_push_notification/ios/Classes/StreamVideoPKDelegateManager.swift (1)

96-103: Caller-name fallback logic looks good – empty strings are now skipped, preventing blank CallKit titles. No further issues spotted.

Comment on lines +1236 to +1239
if (_callJoinLock.inLock) {
_logger.w(() => '[_reconnect] skipping reconnect (join in progress)');
return;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Broken property: _callJoinLock.inLock does not exist

Lock exposes locked, not inLock. The code won’t compile.

-    if (_callJoinLock.inLock) {
+    if (_callJoinLock.locked) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (_callJoinLock.inLock) {
_logger.w(() => '[_reconnect] skipping reconnect (join in progress)');
return;
}
if (_callJoinLock.locked) {
_logger.w(() => '[_reconnect] skipping reconnect (join in progress)');
return;
}
🤖 Prompt for AI Agents
In packages/stream_video/lib/src/call/call.dart around lines 1236 to 1239, the
property `_callJoinLock.inLock` is incorrect because the `Lock` class uses
`locked` to indicate if it is locked. Replace `_callJoinLock.inLock` with
`_callJoinLock.locked` to fix the compilation error.

Copy link

codecov bot commented Jul 17, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 4.40%. Comparing base (650befb) to head (4c48a8e).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
packages/stream_video/lib/src/stream_video.dart 0.00% 2 Missing ⚠️
packages/stream_video/lib/src/call/call.dart 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #1027      +/-   ##
========================================
+ Coverage   4.24%   4.40%   +0.16%     
========================================
  Files        574     574              
  Lines      38526   38589      +63     
========================================
+ Hits        1634    1700      +66     
+ Misses     36892   36889       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Brazol Brazol merged commit a65e424 into main Jul 17, 2025
13 of 15 checks passed
@Brazol Brazol deleted the fix/ringing-fixes branch July 17, 2025 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants