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(repo): v7.0.0 #1671

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
88cb8ab
chore(repo): updated minimum supported SDK version to Flutter 3.10/Da…
xsahil03x Jul 12, 2023
531b79b
chore: update CHANGELOG.md
xsahil03x Jul 12, 2023
c1c4b95
feat(ui): add support for `StreamMessageInput.contentInsertionConfigu…
xsahil03x Jun 19, 2023
07780b4
chore: update CHANGELOG.md
xsahil03x Jun 19, 2023
e008c70
chore: update CHANGELOG.md
xsahil03x Jul 12, 2023
f944094
chore(ui): bump jiffy to v6.2.1
xsahil03x Jun 22, 2023
c881d6b
chore(localization): bump stream_chat_flutter
xsahil03x Jun 22, 2023
2be14c3
chore: update CHANGELOG.md
xsahil03x Jun 22, 2023
406ed66
chore: minor change.
xsahil03x Jun 22, 2023
972a0f5
chore(repo): remove deprecated code.
xsahil03x Jul 12, 2023
87e8cd9
chore: migrate loadBuffer to loadImage.
xsahil03x Jul 13, 2023
b6cc2e0
chore: some fixes.
xsahil03x Jul 13, 2023
678fe4e
chore: minor fix, add test
xsahil03x Jul 13, 2023
8ac7522
chore: prepare for release.
xsahil03x Jul 13, 2023
fa6f1f7
chore: update CHANGELOG.md
xsahil03x Jul 13, 2023
945cc05
chore: fix localization version.
xsahil03x Jul 13, 2023
6af3aaa
chore: update localization changelog.
xsahil03x Jul 13, 2023
c02dcab
Merge remote-tracking branch 'origin/develop' into v7.0.0
xsahil03x Jul 24, 2023
e884c75
chore(repo): prepare for release.
xsahil03x Jul 24, 2023
2c0467e
Merge pull request #1688 from GetStream/release/v7.0.0-beta.2
xsahil03x Jul 24, 2023
8366fbf
Merge remote-tracking branch 'origin/develop' into v7.0.0
xsahil03x Jul 28, 2023
d982f6e
chore(ui): prepare for release.
xsahil03x Jul 28, 2023
eb6f085
Merge pull request #1691 from GetStream/release/v7.0.0-beta.3
xsahil03x Jul 28, 2023
f246de5
refactor!: initial attachments refactor.
xsahil03x Jul 11, 2023
e8de288
feat: more implementation.
xsahil03x Jul 26, 2023
b2171b5
test: fix test.
xsahil03x Jul 26, 2023
db6febc
test: fix more test.
xsahil03x Jul 26, 2023
572207c
test: some more test.
xsahil03x Jul 26, 2023
93b4158
refactor: improve fullscreen_media, minor changes.
xsahil03x Jul 28, 2023
72e0c7b
chore: fix lints.
xsahil03x Jul 28, 2023
ff3ad6b
fix: fix test.
xsahil03x Jul 28, 2023
795c494
chore: minor ui fixes.
xsahil03x Jul 28, 2023
eeb957f
chore: fix formatting.
xsahil03x Jul 28, 2023
8aa4322
chore: set changelog as per chronology.
xsahil03x Aug 18, 2023
bcaeb59
Merge remote-tracking branch 'origin/develop' into v7.0.0
xsahil03x Aug 18, 2023
f14c00a
chore(repo): bump min flutter SDK to 3.13.
xsahil03x Aug 18, 2023
bdf06c9
chore(repo): update melos version.
xsahil03x Aug 18, 2023
f7278b8
Merge pull request #1713 from GetStream/chore/bump-min-flutter-3.13
xsahil03x Aug 18, 2023
61c68b7
chore(repo): prepare for release.
xsahil03x Aug 18, 2023
fef1048
Merge pull request #1714 from GetStream/release/v7.0.0-beta.4
xsahil03x Aug 18, 2023
115dced
Merge remote-tracking branch 'origin/v7.0.0' into refactor/attachments
xsahil03x Aug 18, 2023
9f4c31c
chore: fix lints.
xsahil03x Aug 18, 2023
687475b
Merge pull request #1667 from GetStream/refactor/attachments
xsahil03x Sep 7, 2023
c20132b
Merge remote-tracking branch 'origin/develop' into v7.0.0
xsahil03x Sep 7, 2023
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
23 changes: 23 additions & 0 deletions packages/stream_chat/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
- [[#1716]](https://github.com/GetStream/stream-chat-flutter/issues/1716) Fixed client not able to
update message with `type: reply`.

## 7.0.0-beta.3

- Included the changes from version [6.8.0](#670).
- Updated minimum supported `SDK` version to Dart 3.1

## 6.8.0

🐞 Fixed
Expand All @@ -20,6 +25,10 @@

- Updated minimum supported `SDK` version to Dart 3.0

## 7.0.0-beta.2

- Included the changes from version [6.7.0](#670).

## 6.7.0

✅ Added
Expand All @@ -32,6 +41,20 @@
should have the Create System Message permission. Server-side system messages don't need that permission.
```

## 7.0.0-beta.1

🛑️ Breaking

- Removed deprecated `channelQuery.sort` property. Use `channelStateSort` instead.
- Removed deprecated `RetryPolicy.retryTimeout` property. Use `delayFactor` instead.
- Removed deprecated `StreamChatNetworkError.fromDioError` constructor. Use `StreamChatNetworkError.fromDioException`
instead.
- Removed deprecated `MessageSendingStatus` enum. Use `MessageState` instead.

🔄 Changed

- Updated minimum supported `SDK` version to Dart 3.0

## 6.6.0

🔄 Changed
Expand Down
4 changes: 2 additions & 2 deletions packages/stream_chat/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ publish_to: "none"
version: 1.0.0+1

environment:
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0"
sdk: ">=3.1.0 <4.0.0"
flutter: ">=3.13.0"

dependencies:
cupertino_icons: ^1.0.5
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat/lib/src/client/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ class Channel {
]);
}

final isImage = it.type == 'image';
final isImage = it.type == AttachmentType.image;
final cancelToken = CancelToken();
Future<SendAttachmentResponse> future;
if (isImage) {
Expand Down
15 changes: 2 additions & 13 deletions packages/stream_chat/lib/src/client/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import 'package:stream_chat/src/core/http/stream_http_client.dart';
import 'package:stream_chat/src/core/http/token.dart';
import 'package:stream_chat/src/core/http/token_manager.dart';
import 'package:stream_chat/src/core/models/attachment_file.dart';
import 'package:stream_chat/src/core/models/channel_model.dart';
import 'package:stream_chat/src/core/models/channel_state.dart';
import 'package:stream_chat/src/core/models/event.dart';
import 'package:stream_chat/src/core/models/filter.dart';
Expand Down Expand Up @@ -572,8 +571,6 @@ class StreamChatClient {
/// Requests channels with a given query.
Stream<List<Channel>> queryChannels({
Filter? filter,
@Deprecated('Use channelStateSort instead.')
List<SortOption<ChannelModel>>? sort,
List<SortOption<ChannelState>>? channelStateSort,
bool state = true,
bool watch = true,
Expand All @@ -590,7 +587,7 @@ class StreamChatClient {

final hash = generateHash([
filter,
sort,
channelStateSort,
state,
watch,
presence,
Expand All @@ -604,8 +601,6 @@ class StreamChatClient {
} else {
final channels = await queryChannelsOffline(
filter: filter,
// ignore: deprecated_member_use_from_same_package
sort: sort,
channelStateSort: channelStateSort,
paginationParams: paginationParams,
);
Expand All @@ -614,7 +609,7 @@ class StreamChatClient {
try {
final newQueryChannelsFuture = queryChannelsOnline(
filter: filter,
sort: channelStateSort ?? sort,
sort: channelStateSort,
state: state,
watch: watch,
presence: presence,
Expand Down Expand Up @@ -731,17 +726,11 @@ class StreamChatClient {
/// Requests channels with a given query from the Persistence client.
Future<List<Channel>> queryChannelsOffline({
Filter? filter,
@Deprecated('''
sort has been deprecated.
Please use channelStateSort instead.''')
List<SortOption<ChannelModel>>? sort,
List<SortOption<ChannelState>>? channelStateSort,
PaginationParams paginationParams = const PaginationParams(),
}) async {
final offlineChannels = (await chatPersistenceClient?.getChannelStates(
filter: filter,
// ignore: deprecated_member_use_from_same_package
sort: sort,
channelStateSort: channelStateSort,
paginationParams: paginationParams,
)) ??
Expand Down
10 changes: 0 additions & 10 deletions packages/stream_chat/lib/src/client/retry_policy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class RetryPolicy {
/// Instantiate a new RetryPolicy
RetryPolicy({
required this.shouldRetry,
@Deprecated("Use 'delayFactor' instead.") this.retryTimeout,
this.maxRetryAttempts = 6,
this.delayFactor = const Duration(milliseconds: 200),
this.randomizationFactor = 0.25,
Expand Down Expand Up @@ -53,13 +52,4 @@ class RetryPolicy {
int attempt,
StreamChatError? error,
) shouldRetry;

/// In the case that we want to retry a failed request the retryTimeout
/// method is called to determine the timeout
@Deprecated("Use 'delayFactor' instead.")
final Duration Function(
StreamChatClient client,
int attempt,
StreamChatError? error,
)? retryTimeout;
}
2 changes: 0 additions & 2 deletions packages/stream_chat/lib/src/core/api/requests.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: deprecated_member_use_from_same_package

import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ class StreamChatNetworkError extends StreamChatError {
this.isRequestCancelledError = false,
}) : super(message);

///
@Deprecated('Use `StreamChatNetworkError.fromDioException` instead')
factory StreamChatNetworkError.fromDioError(DioException error) =
StreamChatNetworkError.fromDioException;

///
factory StreamChatNetworkError.fromDioException(DioException exception) {
final response = exception.response;
Expand Down
74 changes: 61 additions & 13 deletions packages/stream_chat/lib/src/core/models/attachment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ import 'package:uuid/uuid.dart';

part 'attachment.g.dart';

mixin AttachmentType {
/// Backend specified types.
static const image = 'image';
static const file = 'file';
static const giphy = 'giphy';
static const video = 'video';
static const audio = 'audio';

/// Application custom types.
static const urlPreview = 'url_preview';
}

/// The class that contains the information about an attachment
@JsonSerializable(includeIfNull: false)
class Attachment extends Equatable {
/// Constructor used for json serialization
Attachment({
String? id,
this.type,
String? type,
this.titleLink,
String? title,
this.thumbUrl,
Expand All @@ -33,26 +45,24 @@ class Attachment extends Equatable {
this.authorLink,
this.authorIcon,
this.assetUrl,
List<Action>? actions,
this.actions = const [],
this.originalWidth,
this.originalHeight,
Map<String, Object?> extraData = const {},
this.file,
UploadState? uploadState,
}) : id = id ?? const Uuid().v4(),
_type = type,
title = title ?? file?.name,
_uploadState = uploadState,
localUri = file?.path != null ? Uri.parse(file!.path!) : null,
actions = actions ?? [],
// For backwards compatibility,
// set 'file_size', 'mime_type' in [extraData].
extraData = {
...extraData,
if (file?.size != null) 'file_size': file?.size,
if (file?.mimeType != null) 'mime_type': file?.mimeType?.mimeType,
} {
this.uploadState = uploadState ??
((assetUrl != null || imageUrl != null || thumbUrl != null)
? const UploadState.success()
: const UploadState.preparing());
}
if (file?.mediaType != null) 'mime_type': file?.mediaType?.mimeType,
};

/// Create a new instance from a json
factory Attachment.fromJson(Map<String, dynamic> json) =>
Expand All @@ -69,7 +79,8 @@ class Attachment extends Equatable {

factory Attachment.fromOGAttachment(OGAttachmentResponse ogAttachment) =>
Attachment(
type: ogAttachment.type,
// If the type is not specified, we default to urlPreview.
type: ogAttachment.type ?? AttachmentType.urlPreview,
title: ogAttachment.title,
titleLink: ogAttachment.titleLink,
text: ogAttachment.text,
Expand All @@ -84,7 +95,20 @@ class Attachment extends Equatable {

///The attachment type based on the URL resource. This can be: audio,
///image or video
final String? type;
String? get type {
// If the attachment contains titleLink but is not of type giphy, we
// consider it as a urlPreview.
if (_type != AttachmentType.giphy && titleLink != null) {
return AttachmentType.urlPreview;
}

return _type;
}

final String? _type;

/// The raw attachment type.
String? get rawType => _type;

///The link to which the attachment message points to.
final String? titleLink;
Expand Down Expand Up @@ -126,13 +150,27 @@ class Attachment extends Equatable {
/// Actions from a command
final List<Action>? actions;

/// The original width of the attached image.
final int? originalWidth;

/// The original height of the attached image.
final int? originalHeight;

final Uri? localUri;

/// The file present inside this attachment.
final AttachmentFile? file;

/// The current upload state of the attachment
late final UploadState uploadState;
UploadState get uploadState {
if (_uploadState case final state?) return state;

return ((assetUrl != null || imageUrl != null || thumbUrl != null)
? const UploadState.success()
: const UploadState.preparing());
}

final UploadState? _uploadState;

/// Map of custom channel extraData
final Map<String, Object?> extraData;
Expand Down Expand Up @@ -175,6 +213,8 @@ class Attachment extends Equatable {
'author_icon',
'asset_url',
'actions',
'original_width',
'original_height',
];

/// Known db specific top level fields.
Expand Down Expand Up @@ -214,6 +254,8 @@ class Attachment extends Equatable {
String? authorIcon,
String? assetUrl,
List<Action>? actions,
int? originalWidth,
int? originalHeight,
AttachmentFile? file,
UploadState? uploadState,
Map<String, Object?>? extraData,
Expand All @@ -238,6 +280,8 @@ class Attachment extends Equatable {
authorIcon: authorIcon ?? this.authorIcon,
assetUrl: assetUrl ?? this.assetUrl,
actions: actions ?? this.actions,
originalWidth: originalWidth ?? this.originalWidth,
originalHeight: originalHeight ?? this.originalHeight,
file: file ?? this.file,
uploadState: uploadState ?? this.uploadState,
extraData: extraData ?? this.extraData,
Expand All @@ -264,6 +308,8 @@ class Attachment extends Equatable {
authorIcon: other.authorIcon,
assetUrl: other.assetUrl,
actions: other.actions,
originalWidth: other.originalWidth,
originalHeight: other.originalHeight,
file: other.file,
uploadState: other.uploadState,
extraData: other.extraData,
Expand Down Expand Up @@ -291,6 +337,8 @@ class Attachment extends Equatable {
authorIcon,
assetUrl,
actions,
originalWidth,
originalHeight,
file,
uploadState,
extraData,
Expand Down
9 changes: 7 additions & 2 deletions packages/stream_chat/lib/src/core/models/attachment.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/stream_chat/lib/src/core/models/attachment_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class AttachmentFile {
String? get extension => name?.split('.').last;

/// The mime type of this file.
MediaType? get mimeType => name?.mimeType;
MediaType? get mediaType => name?.mediaType;

/// Serialize to json
Map<String, dynamic> toJson() => _$AttachmentFileToJson(this);
Expand All @@ -75,13 +75,13 @@ class AttachmentFile {
multiPartFile = MultipartFile.fromBytes(
bytes!,
filename: name,
contentType: mimeType,
contentType: mediaType,
);
} else {
multiPartFile = await MultipartFile.fromFile(
path!,
filename: name,
contentType: mimeType,
contentType: mediaType,
);
}
return multiPartFile;
Expand Down
Loading
Loading