Skip to content

Conversation

laevandus
Copy link
Contributor

@laevandus laevandus commented Jul 25, 2025

🔗 Issue Links

Resolves: https://linear.app/stream/issue/IOS-1034

🎯 Goal

Progress should start from right in RTL layout

📝 Summary

Flip coordinates in the custom drawing code.

🛠 Implementation

🎨 Showcase

Before After
img img

🧪 Manual Testing Notes

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • Changelog is updated with new localization keys
  • New code is covered by unit tests
  • Documentation has been updated in the docs-content repo

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes
    • Fixed audio visualization display to correctly mirror in right-to-left (RTL) layouts.

@laevandus laevandus requested a review from a team as a code owner July 25, 2025 12:22
@laevandus laevandus added 🐞 Bug An issue or PR related to a bug 🎨 SDK: StreamChatUI Tasks related to the StreamChatUI SDK labels Jul 25, 2025
Copy link

coderabbitai bot commented Jul 25, 2025

"""

Walkthrough

The drawing logic in the AudioVisualizationView was updated to handle right-to-left (RTL) layout directions. The graphics context is now flipped horizontally when the interface is in RTL mode, ensuring the audio visualization bars and gradient are mirrored appropriately. No public interfaces were changed.

Changes

Cohort / File(s) Change Summary
Audio Visualization RTL Support
Sources/StreamChatUI/VoiceRecording/Views/AudioVisualizationView.swift
Updated drawing logic to support RTL layout direction by flipping the graphics context horizontally before rendering the visualization.
Documentation
CHANGELOG.md
Added changelog entry documenting the fix for audio visualization progress in right-to-left (RTL) layout.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Assessment against linked issues

Objective Addressed Explanation
Align waveform visualization with text direction in voice messages (IOS-1034)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes identified.

Suggested reviewers

  • martinmitrevski

Poem

A bunny hopped in, paintbrush in paw,
Mirrored the waves with a gentle "aha!"
Now left flows to right, or right flows to left,
In any direction, the music's bereft
Of confusion or fuss—just symmetry's law!
🐇🎶
"""

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 81c6be1 and 6771a4b.

⛔ Files ignored due to path filters (11)
  • Tests/StreamChatUITests/SnapshotTests/ChatMessageList/Attachments/__Snapshots__/ChatMessageVoiceRecordingAttachmentListView_Tests/test_appearanceCustomization_usingSubclassing.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/ChatMessageList/Attachments/__Snapshots__/ChatMessageVoiceRecordingAttachmentListView_Tests/test_appearance_five_attachments.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/ChatMessageList/Attachments/__Snapshots__/ChatMessageVoiceRecordingAttachmentListView_Tests/test_appearance_one_attachment.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/ChatMessageList/Attachments/__Snapshots__/ChatMessageVoiceRecordingAttachmentListView_Tests/test_appearance_two_attachments.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/VoiceRecording/Views/__Snapshots__/AudioVisualizationView_Tests/test_appearance_nonSilence_snapshotsAreAsExpected.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/VoiceRecording/Views/__Snapshots__/AudioVisualizationView_Tests/test_appearance_silence_snapshotsAreAsExpected.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/VoiceRecording/Views/__Snapshots__/LiveRecordingView_Tests/test_appearance_isPaused_snapshotsAreAsExpected.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/VoiceRecording/Views/__Snapshots__/LiveRecordingView_Tests/test_appearance_isPlaying_snapshotsAreAsExpected.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/VoiceRecording/Views/__Snapshots__/LiveRecordingView_Tests/test_appearance_isRecording_snapshotsAreAsExpected.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/VoiceRecording/Views/__Snapshots__/WaveformView_Tests/test_appearance_isPlaying_snapshotsAreAsExpected.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/VoiceRecording/Views/__Snapshots__/WaveformView_Tests/test_appearance_isRecording_snapshotsAreAsExpected.rightToLeftLayout-default.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • Sources/StreamChatUI/VoiceRecording/Views/AudioVisualizationView.swift (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • Sources/StreamChatUI/VoiceRecording/Views/AudioVisualizationView.swift
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ltr-audio-visualisation

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 generate unit tests to generate unit tests for 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 bot commented Jul 25, 2025

Walkthrough

The AudioVisualizationView's drawing logic was updated to detect right-to-left (RTL) user interface layouts and horizontally flip the waveform visualization when RTL is active. This is achieved by transforming the graphics context before drawing and restoring it afterward, ensuring correct visual alignment for both RTL and LTR languages.

Changes

File(s) Change Summary
Sources/StreamChatUI/VoiceRecording/Views/AudioVisualizationView.swift Modified draw(_:) to flip visualization for RTL layouts

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

A bunny with brushes, painting the sound,
Hops left and right, where languages are found.
Now waves flip and mirror, in Arabic delight,
The waveform flows true, from right into night.
With every hop, the code aligns,
For voices in all, across the lines!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8f73c15 and 270b967.

⛔ Files ignored due to path filters (2)
  • Tests/StreamChatUITests/SnapshotTests/VoiceRecording/Views/__Snapshots__/AudioVisualizationView_Tests/test_appearance_nonSilence_snapshotsAreAsExpected.rightToLeftLayout-default.png is excluded by !**/*.png
  • Tests/StreamChatUITests/SnapshotTests/VoiceRecording/Views/__Snapshots__/AudioVisualizationView_Tests/test_appearance_silence_snapshotsAreAsExpected.rightToLeftLayout-default.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • Sources/StreamChatUI/VoiceRecording/Views/AudioVisualizationView.swift (1 hunks)
🔇 Additional comments (1)
Sources/StreamChatUI/VoiceRecording/Views/AudioVisualizationView.swift (1)

74-81: LGTM! Solid RTL implementation following iOS best practices.

The RTL handling correctly:

  • Uses effectiveUserInterfaceLayoutDirection for proper RTL detection
  • Applies standard Core Graphics transformations (translate + scale) to flip the coordinate system
  • Properly manages graphics context state with save/restore operations
  • Ensures the audio visualization starts from the right side in RTL layouts

This implementation aligns perfectly with the PR objective to fix audio visualization in RTL layouts.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ltr-audio-visualisation

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 generate unit tests to generate unit tests for 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.

@laevandus laevandus force-pushed the fix/ltr-audio-visualisation branch from 270b967 to 81c6be1 Compare July 25, 2025 12:23
@laevandus laevandus force-pushed the fix/ltr-audio-visualisation branch from 81c6be1 to 59d76f2 Compare July 25, 2025 12:24
@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Jul 25, 2025

SDK Size

title develop branch diff status
StreamChat 7.92 MB 7.92 MB 0 KB 🟢
StreamChatUI 4.84 MB 4.84 MB 0 KB 🟢

Copy link

Public Interface

🚀 No changes affecting the public interface.

@laevandus laevandus enabled auto-merge (squash) July 28, 2025 05:46
Copy link

Public Interface

🚀 No changes affecting the public interface.

Copy link

Public Interface

🚀 No changes affecting the public interface.

Copy link

@laevandus laevandus merged commit 1aa5226 into develop Jul 28, 2025
14 checks passed
@laevandus laevandus deleted the fix/ltr-audio-visualisation branch July 28, 2025 10:26
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug An issue or PR related to a bug 🎨 SDK: StreamChatUI Tasks related to the StreamChatUI SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants