Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
195bc21
feat(ui): add support for async audio
xsahil03x Feb 5, 2025
46f4f64
feat: fix loading icon size
xsahil03x Feb 5, 2025
9567e6e
chore: push updated linux files
xsahil03x Feb 5, 2025
22f3860
chore: Update Goldens
xsahil03x Feb 5, 2025
8579e78
chore: trigger build
xsahil03x Feb 5, 2025
7f50820
feat: add voice_recording_attachment_theme.dart
xsahil03x Feb 5, 2025
713af8a
chore: Update Goldens
xsahil03x Feb 5, 2025
d208d02
fix: mic icon size and ripple
xsahil03x Feb 6, 2025
cd6d88a
chore: Update Goldens
xsahil03x Feb 7, 2025
ef90176
chore: remove deprecated tests and coverage
xsahil03x Feb 7, 2025
18507b5
fix: fix tests
xsahil03x Feb 7, 2025
dbccf15
chore: Update Goldens
xsahil03x Feb 7, 2025
f7d5997
chore: update CHANGELOG.md
xsahil03x Feb 7, 2025
c60ef62
Discard changes to packages/stream_chat_flutter/lib/src/attachment/fi…
xsahil03x Feb 7, 2025
9cc572c
chore: minor fixes in example
xsahil03x Feb 7, 2025
c0197e0
fix: fix recorded track getting deleted when finished
xsahil03x Feb 7, 2025
6465022
chore: minor improvements
xsahil03x Feb 10, 2025
4f8573e
feat: introduce audio_waveform_theme.dart
xsahil03x Feb 10, 2025
dfaa127
fix: fix analysis
xsahil03x Feb 10, 2025
569efe9
feat: remove playbackSpeedTextStyle in favor ButtonStyle.textStyle
xsahil03x Feb 10, 2025
23b62f3
chore: Update Goldens
xsahil03x Feb 10, 2025
9fea1e8
chore: trigger build
xsahil03x Feb 11, 2025
498332c
feat: add translations for voice recorder labels
xsahil03x Feb 11, 2025
004ba73
chore: review changes
xsahil03x Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ linter:
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
Expand Down
3 changes: 3 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ command:
photo_manager: ^3.2.0
photo_view: ^0.15.0
rate_limiter: ^1.0.0
record: ^5.2.0
responsive_builder: ^0.7.0
rxdart: ^0.28.0
share_plus: ^10.0.2
Expand Down Expand Up @@ -82,6 +83,8 @@ command:
json_serializable: ^6.7.1
mocktail: ^1.0.0
path: ^1.8.3
path_provider_platform_interface: ^2.0.0
plugin_platform_interface: ^2.0.0
test: ^1.24.6

scripts:
Expand Down
38 changes: 18 additions & 20 deletions packages/stream_chat/lib/src/core/models/attachment_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'File by path is not supported in web, Please provide bytes',
),
assert(
name?.contains('.') ?? true,
name == null || name.isEmpty || name.contains('.'),
'Invalid file name, should also contain file extension',
),
_name = name;
Expand All @@ -47,8 +47,10 @@
final String? _name;

/// File name including its extension.
String? get name =>
_name ?? path?.split(CurrentPlatform.isWindows ? r'\' : '/').last;
String? get name {
if (_name case final name? when name.isNotEmpty) return name;
return path?.split(CurrentPlatform.isWindows ? r'\' : '/').last;
}

/// Byte data for this file. Particularly useful if you want to manipulate
/// its data or easily upload to somewhere else.
Expand All @@ -69,22 +71,18 @@

/// Converts this into a [MultipartFile]
Future<MultipartFile> toMultipartFile() async {
MultipartFile multiPartFile;

if (CurrentPlatform.isWeb) {
multiPartFile = MultipartFile.fromBytes(
bytes!,
filename: name,
contentType: mediaType,
);
} else {
multiPartFile = await MultipartFile.fromFile(
path!,
filename: name,
contentType: mediaType,
);
}
return multiPartFile;
return switch (CurrentPlatform.type) {
PlatformType.web => MultipartFile.fromBytes(
bytes!,
filename: name,
contentType: mediaType,

Check warning on line 78 in packages/stream_chat/lib/src/core/models/attachment_file.dart

View check run for this annotation

Codecov / codecov/patch

packages/stream_chat/lib/src/core/models/attachment_file.dart#L76-L78

Added lines #L76 - L78 were not covered by tests
),
_ => await MultipartFile.fromFile(
path!,
filename: name,
contentType: mediaType,
),
};
}

/// Creates a copy of this [AttachmentFile] but with the given fields
Expand All @@ -106,7 +104,7 @@

/// Union class to hold various [UploadState] of a attachment.
@freezed
class UploadState with _$UploadState {
sealed class UploadState with _$UploadState {
// Dummy private constructor in order to use getters
const UploadState._();

Expand Down
8 changes: 4 additions & 4 deletions packages/stream_chat/lib/src/core/models/message_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ extension MessageStateX on MessageState {

/// Represents the various states a message can be in.
@freezed
class MessageState with _$MessageState {
sealed class MessageState with _$MessageState {
/// Initial state when the message is created.
const factory MessageState.initial() = MessageInitial;

Expand Down Expand Up @@ -243,7 +243,7 @@ class MessageState with _$MessageState {

/// Represents the state of an outgoing message.
@freezed
class OutgoingState with _$OutgoingState {
sealed class OutgoingState with _$OutgoingState {
/// Sending state when the message is being sent.
const factory OutgoingState.sending() = Sending;

Expand All @@ -262,7 +262,7 @@ class OutgoingState with _$OutgoingState {

/// Represents the completed state of a message.
@freezed
class CompletedState with _$CompletedState {
sealed class CompletedState with _$CompletedState {
/// Sent state when the message has been successfully sent.
const factory CompletedState.sent() = Sent;

Expand All @@ -281,7 +281,7 @@ class CompletedState with _$CompletedState {

/// Represents the failed state of a message.
@freezed
class FailedState with _$FailedState {
sealed class FailedState with _$FailedState {
/// Sending failed state when the message fails to be sent.
const factory FailedState.sendingFailed() = SendingFailed;

Expand Down
10 changes: 3 additions & 7 deletions packages/stream_chat/lib/src/core/util/extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ extension MapX<K, V> on Map<K?, V?> {
extension StringX on String {
/// returns the media type from the passed file name.
MediaType? get mediaType {
if (toLowerCase().endsWith('heic')) {
return MediaType.parse('image/heic');
} else {
final mimeType = lookupMimeType(this);
if (mimeType == null) return null;
return MediaType.parse(mimeType);
}
final mimeType = lookupMimeType(this);
if (mimeType == null) return null;
return MediaType.parse(mimeType);
}
}
6 changes: 6 additions & 0 deletions packages/stream_chat_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Upcoming

✅ Added

- Added support for `voiceRecording` type attachments.

## 9.2.0+1

- Remove untracked files from the package.
Expand Down
Loading