Skip to content
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

feat(ui, localization): add support for async audio #2097

Merged
merged 24 commits into from
Feb 11, 2025

Conversation

xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Feb 5, 2025

This pull request includes several changes to the melos.yaml file, improvements to the AttachmentFile class in the stream_chat package, and updates to the stream_chat_flutter package to enhance voice recording features and deprecate older classes.

Dependency Updates:

  • Added record dependency to melos.yaml.
  • Added path_provider_platform_interface and plugin_platform_interface dependencies to melos.yaml.

AttachmentFile Class Improvements:

  • Modified the assertion for file name validation to allow empty names.
  • Updated the name getter to use pattern matching for better readability.
  • Refactored the toMultipartFile method to use a switch statement for platform-specific logic.
  • Changed UploadState and other related classes to use the sealed keyword for better type safety. [1] [2] [3] [4] [5]

Voice Recording Enhancements:

  • Enabled voice recording in StreamMessageInput on ChannelPage and ThreadPage. [1] [2]
  • Added record_linux and record_windows plugins to the generated plugin lists. [1] [2]
  • Introduced VoiceRecordingAttachmentPlaylistBuilder and updated MixedAttachmentBuilder to handle voice recordings. [1] [2] [3] [4] [5] [6]

Deprecated Classes:

  • Deprecated several voice recording-related classes in stream_chat_flutter in favor of new implementations. [1] [2] [3] [4] [5] [6] [7] [8] [9]
Demo
Screen.Recording.2025-02-06.at.00.12.22.mov

Copy link

codecov bot commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 70.41457% with 471 lines in your changes missing coverage. Please review.

Project coverage is 60.22%. Comparing base (e1ec460) to head (004ba73).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...chat_flutter/lib/src/misc/gradient_box_border.dart 31.42% 72 Missing ⚠️
...ge_input/audio_recorder/stream_audio_recorder.dart 76.87% 68 Missing ⚠️
...ge_input/stream_message_input_attachment_list.dart 32.09% 55 Missing ⚠️
...er/lib/src/message_input/stream_message_input.dart 56.45% 54 Missing ⚠️
...ib/src/theme/voice_recording_attachment_theme.dart 26.47% 50 Missing ⚠️
...at_flutter/lib/src/theme/audio_waveform_theme.dart 25.49% 38 Missing ⚠️
...ter/lib/src/theme/audio_waveform_slider_theme.dart 26.82% 30 Missing ⚠️
...ttachment/voice_recording_attachment_playlist.dart 70.58% 15 Missing ⚠️
...c/attachment/builder/mixed_attachment_builder.dart 0.00% 13 Missing ⚠️
...r/voice_recording_attachment_playlist_builder.dart 0.00% 13 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2097      +/-   ##
==========================================
+ Coverage   59.89%   60.22%   +0.32%     
==========================================
  Files         372      382      +10     
  Lines       22730    23762    +1032     
==========================================
+ Hits        13615    14311     +696     
- Misses       9115     9451     +336     

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

Copy link
Contributor

@renefloor renefloor left a comment

Choose a reason for hiding this comment

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

I've found some issues on Android.

First of all, it would not compile. It was complaining about sealed classes. I had to add this to the settings.gradle of the example app:

pluginManagement {
    buildscript {
        repositories {
            mavenCentral()
            maven {
                url = uri("https://storage.googleapis.com/r8-releases/raw")
            }
        }
        dependencies {
            classpath("com.android.tools:r8:8.2.24")
        }
    }
}

From: https://issuetracker.google.com/issues/227160052#comment37

We should definitely document this somewhere, probably in the changelog. I think that's going to effect (almost) every user.

Second (in the example) I have an issue with the permission dialog.
After I give permission my finger is no longer on the record button, but the app thinks it is. There is no way to stop the recording. It does actually happen more often, also when there is no permission dialog in between.

screen-20250207-102626.mp4

When I do manage to get a recording I cannot listen to it. The file does not exist:

Caused by: java.io.FileNotFoundException: /data/user/0/com.example.example/cache/audio_1738920852258.m4a: open failed: ENOENT (No such file or directory)
screen-20250207-102511.mp4

@xsahil03x
Copy link
Member Author

@renefloor

Caused by: java.io.FileNotFoundException: /data/user/0/com.example.example/cache/audio_1738920852258.m4a: open failed: ENOENT (No such file or directory)

should be fixed now

@xsahil03x xsahil03x requested a review from renefloor February 7, 2025 20:25
@xsahil03x xsahil03x changed the title feat(ui): add support for async audio feat(ui, localization): add support for async audio Feb 11, 2025
@xsahil03x xsahil03x requested a review from renefloor February 11, 2025 15:09
@xsahil03x xsahil03x merged commit d2ac7e7 into master Feb 11, 2025
15 checks passed
@xsahil03x xsahil03x deleted the feat/audio-recorder branch February 11, 2025 15:16
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