Skip to content

Commit

Permalink
Merge pull request #95 from sendbird/v4.2.2
Browse files Browse the repository at this point in the history
Add 4.2.2.
  • Loading branch information
sf-tyler-jeong authored Feb 15, 2024
2 parents fdfe7fa + bb12e3a commit 4d44a44
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
## v4.2.2 (Fed 15, 2024)

### Improvements
- Fixed the bug where `votedPollOptionIds` in `Poll` is always empty

## v4.2.1 (Fed 5, 2024)

### Improvements
- Fixed the bug where `getCachedMetaData()` in `BaseChannel` is not being updated when deleting metadata.
- Fixed the bug where `getCachedMetaData()` in `BaseChannel` is not being updated when deleting metadata

## v4.2.0 (Jan 31, 2024)

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.1
sendbird_chat_sdk: ^4.2.2
```
- 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.1';
const sdkVersion = '4.2.2';

// Internal implementation for main class. Do not directly access this class.
class Chat with WidgetsBindingObserver {
Expand Down
18 changes: 14 additions & 4 deletions lib/src/public/main/model/poll/poll.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Poll {

/// Contains optionIds which the current user voted on.
/// If the current user has not voted, this list will be empty.
@JsonKey(defaultValue: [])
@JsonKey(name: 'voted_option_ids', defaultValue: [])
List<int>? votedPollOptionIds;

Poll({
Expand Down Expand Up @@ -149,9 +149,12 @@ class Poll {
if (event.json['poll']['allow_multiple_votes'] != null) {
allowMultipleVotes = event.json['poll']['allow_multiple_votes'];
}
if (event.json['poll']['voted_poll_option_ids'] != null) {
votedPollOptionIds = event.json['poll']['voted_poll_option_ids'];
}

// voted_option_ids is not coming from PEDI, so validate it by SDK itself
final optionIds = options.map((option) => option.id).toSet();
final validVotedOptionIds =
votedPollOptionIds?.toSet().intersection(optionIds).toList();
votedPollOptionIds = validVotedOptionIds;

return true;
} else {
Expand All @@ -175,6 +178,13 @@ class Poll {
options.firstWhere((e) => (e.id == optionId)).voteCount = voteCount;
}
}

if (event.json['voted_option_ids'] != null) {
votedPollOptionIds = (event.json['voted_option_ids'] as List<dynamic>?)
?.map((e) => e as int)
.toList() ??
[];
}
} else {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/public/main/model/poll/poll.g.dart

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

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.1
version: 4.2.2
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 4d44a44

Please sign in to comment.