Skip to content

Commit 2488d28

Browse files
Merge pull request #9 from sendbird/v1.0.0-beta.5
Add 1.0.0-beta.5.
2 parents 0c566a4 + d734954 commit 2488d28

29 files changed

+3558
-905
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v1.0.0-beta.5 (Nov 15, 2024)
2+
3+
### Features
4+
- Added `useReaction`, `useOGTag` and `replyType` parameters in `init()` in `SendbirdUIKit`
5+
- Added `onListItemClicked` parameter in `SBUGroupChannelScreen`
6+
- Added video thumbnail for Android and iOS
7+
18
## v1.0.0-beta.4 (Jul 11, 2024)
29

310
### Improvements

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Add following dependencies and fonts for `SendbirdIcons` in `pubspec.yaml`.
3838

3939
```yaml
4040
dependencies:
41-
sendbird_uikit: ^1.0.0-beta.4
41+
sendbird_uikit: ^1.0.0-beta.5
42+
sendbird_chat_sdk: ^4.2.28
4243

4344
flutter:
4445
fonts:

lib/sendbird_uikit.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ export 'src/public/screen/group_channel/channel_list/sbu_group_channel_list_scre
2323
export 'src/public/screen/group_channel/channel_list/sbu_group_channel_settings_screen.dart';
2424

2525
// Main
26+
export 'src/public/sbu_config.dart';
2627
export 'src/public/sendbird_uikit.dart';

lib/src/internal/component/base/sbu_base_component.dart

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ abstract class SBUStatelessComponent extends StatelessWidget
2121
const SBUStatelessComponent({super.key});
2222
}
2323

24+
enum SBUFileType {
25+
image,
26+
video,
27+
other,
28+
}
29+
2430
mixin SBUBaseComponent {
2531
// Name
2632
String getGroupChannelName(GroupChannel channel, SBUStrings strings) {
@@ -60,6 +66,21 @@ mixin SBUBaseComponent {
6066
return nickname;
6167
}
6268

69+
String getNicknameOrYou(User? user, SBUStrings strings) {
70+
String result = '';
71+
if (user != null) {
72+
if (user.userId.isNotEmpty &&
73+
user.userId == SendbirdChat.currentUser?.userId) {
74+
return strings.you;
75+
}
76+
77+
if (user.nickname.isNotEmpty) {
78+
result = user.nickname;
79+
}
80+
}
81+
return result;
82+
}
83+
6384
List<User> sortUsersByNickname(List<User> users) {
6485
final sortedMembers = List.of(users);
6586
sortedMembers.sort((a, b) {
@@ -223,23 +244,28 @@ mixin SBUBaseComponent {
223244
return null;
224245
}
225246

226-
bool isImage(String? fileName) {
227-
// Check
228-
if (fileName != null && fileName.isNotEmpty) {
229-
final splitFileName = fileName.split('.');
230-
if (splitFileName.length >= 2) {
231-
final ext = splitFileName.last.toLowerCase();
232-
if (ext == 'png' || ext == 'jpg' || ext == 'jpeg' || ext == 'gif') {
233-
return true;
234-
}
247+
SBUFileType getFileType(FileMessage message) {
248+
String? mimeType = message.type;
249+
if (mimeType != null) {
250+
if (mimeType.startsWith('image')) {
251+
return SBUFileType.image;
252+
} else if (mimeType.startsWith('video')) {
253+
return SBUFileType.video;
235254
}
236255
}
237-
return false;
256+
return SBUFileType.other;
257+
}
258+
259+
String? getChannelCacheKey(BaseChannel? channel) {
260+
if (channel != null) {
261+
return channel.channelUrl; // Check
262+
}
263+
return null;
238264
}
239265

240-
String? getImageCacheKey(BaseMessage? message) {
266+
String? getMessageCacheKey(BaseMessage? message) {
241267
if (message != null) {
242-
return '${message.requestId}_${message.messageId}';
268+
return '${message.requestId}_${message.messageId}'; // Check
243269
}
244270
return null;
245271
}
@@ -372,6 +398,18 @@ mixin SBUBaseComponent {
372398
} catch (_) {}
373399
}
374400

401+
Size getThumbnailSize() {
402+
return const Size(600, 600); // Check
403+
}
404+
405+
bool isReplyMessageToChannel(BaseMessage message) {
406+
return (message.isReplyToChannel && message.parentMessage != null);
407+
}
408+
409+
bool isReplyMessage(BaseMessage message) {
410+
return (!message.isReplyToChannel && message.parentMessage != null);
411+
}
412+
375413
// Test
376414
bool isThemeTestOn() {
377415
return false;

0 commit comments

Comments
 (0)