Skip to content

Commit

Permalink
Merge pull request #98 from sendbird/v4.2.5
Browse files Browse the repository at this point in the history
Add 4.2.5.
  • Loading branch information
sf-tyler-jeong authored Mar 12, 2024
2 parents c33bfb2 + fdde865 commit 3394fe2
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v4.2.5 (Mar 12, 2024)

### Improvements
- Added `secureUrl` in `Thumbnail`

## v4.2.4 (Mar 8, 2024)

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Before installing Sendbird Chat SDK, you need to create a Sendbird application o

```yaml
dependencies:
sendbird_chat_sdk: ^4.2.4
sendbird_chat_sdk: ^4.2.5
```
- Run `flutter pub get` command in your project directory.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/internal/main/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ part 'chat_notifications.dart';
part 'chat_push.dart';
part 'chat_user.dart';

const sdkVersion = '4.2.4';
const sdkVersion = '4.2.5';

// Internal implementation for main class. Do not directly access this class.
class Chat with WidgetsBindingObserver {
Expand Down
34 changes: 33 additions & 1 deletion lib/src/public/core/message/file_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ class FileMessage extends BaseMessage {
FileMessage fileMessage = _$FileMessageFromJson(json)
..set(SendbirdChat().chat); // Set the singleton chat

if (fileMessage.thumbnails != null && fileMessage.thumbnails!.isNotEmpty) {
for (final thumbnail in fileMessage.thumbnails!) {
thumbnail.set(
chat: fileMessage.chat,
requireAuth: fileMessage.requireAuth,
);
}
}

// Scheduled message
if (json['scheduled_message_id'] != null) {
fileMessage.scheduledInfo = ScheduledInfo.fromJson(json);
Expand Down Expand Up @@ -212,8 +221,14 @@ class FileMessage extends BaseMessage {
/// An object represents thumbnail
@JsonSerializable()
class Thumbnail {
@JsonKey(includeFromJson: false, includeToJson: false)
Chat? _chat;

@JsonKey(includeFromJson: false, includeToJson: false)
bool? _requireAuth;

String url;
String? plainUrl;
String? plainUrl; // This property is always null. This will be removed.
double? height;
double? width;
double? realHeight;
Expand All @@ -228,6 +243,23 @@ class Thumbnail {
this.realWidth,
);

void set({required Chat chat, required bool requireAuth}) {
_chat = chat;
_requireAuth = requireAuth;
}

/// The secure thumbnail URL.
/// @since 4.2.5
String? get secureUrl {
if (_chat != null && _requireAuth != null) {
final eKey = _chat!.chatContext.eKey;
if (_requireAuth! && eKey != null) {
return '$url?auth=$eKey';
}
}
return url;
}

factory Thumbnail.fromJson(Map<String, dynamic> json) =>
_$ThumbnailFromJson(json);

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sendbird_chat_sdk
description: With Sendbird Chat for Flutter, you can easily build an in-app chat with all the essential messaging features.
version: 4.2.4
version: 4.2.5
homepage: https://sendbird.com
repository: https://github.com/sendbird/sendbird-chat-sdk-flutter
documentation: https://sendbird.com/docs/chat/sdk/v4/flutter/getting-started/send-first-message
Expand Down

0 comments on commit 3394fe2

Please sign in to comment.