From 645d016467221cdb81e796f6157cf99be95efbdc Mon Sep 17 00:00:00 2001 From: Tyler Jeong Date: Wed, 6 Nov 2024 16:06:51 +0900 Subject: [PATCH] Add 4.2.27. --- CHANGELOG.md | 9 ++++ README.md | 2 +- lib/src/internal/main/chat/chat.dart | 2 +- .../main/chat_manager/command_manager.dart | 2 + .../main/chat_manager/connection_manager.dart | 20 +++++--- .../extensions/group_channel_extensions.dart | 50 +++++++++++++++++++ .../main/model/delivery_status.g.dart | 2 +- .../main/model/group_channel_filter.g.dart | 4 +- .../internal/main/model/read_status.g.dart | 2 +- .../main/model/reconnect_configuration.g.dart | 4 +- .../model/unread_message_count_info.g.dart | 8 +-- .../http_client/response/responses.g.dart | 8 +-- .../network/websocket/command/command.g.dart | 4 +- .../websocket/event/channel_event.g.dart | 6 +-- .../websocket/event/login_event.g.dart | 8 +-- .../network/websocket/event/mcnt_event.g.dart | 4 +- .../websocket/event/message_event.g.dart | 2 +- .../network/websocket/event/user_event.g.dart | 4 +- .../group_channel/group_channel.g.dart | 23 +++++---- .../channel/open_channel/open_channel.g.dart | 4 +- .../public/core/message/admin_message.g.dart | 13 ++--- .../public/core/message/file_message.g.dart | 15 +++--- .../core/message/notification_message.g.dart | 4 +- .../public/core/message/user_message.g.dart | 13 ++--- lib/src/public/core/user/member.g.dart | 2 +- .../public/core/user/restricted_user.g.dart | 4 +- lib/src/public/core/user/sender.g.dart | 2 +- lib/src/public/core/user/user.g.dart | 2 +- .../base_message_collection.dart | 3 ++ .../group_channel_unread_item_count.g.dart | 20 ++++---- .../main/model/chat/do_not_disturb.g.dart | 8 +-- lib/src/public/main/model/chat/emoji.g.dart | 2 +- lib/src/public/main/model/info/app_info.dart | 12 +++++ .../public/main/model/info/app_info.g.dart | 6 ++- .../public/main/model/info/file_info.g.dart | 2 +- .../public/main/model/info/mute_info.g.dart | 6 +-- .../main/model/info/notification_info.g.dart | 2 +- .../main/model/info/scheduled_info.g.dart | 4 +- lib/src/public/main/model/og/og_image.g.dart | 4 +- lib/src/public/main/model/poll/poll.g.dart | 14 +++--- .../public/main/model/poll/poll_option.g.dart | 10 ++-- .../main/model/reaction/reaction.g.dart | 2 +- .../main/model/reaction/reaction_event.g.dart | 4 +- .../main/model/thread/thread_info.g.dart | 6 +-- .../thread/thread_info_updated_event.g.dart | 2 +- .../params/message/message_list_params.g.dart | 4 +- .../message/message_retrieval_params.g.dart | 2 +- ...cheduled_file_message_update_params.g.dart | 4 +- ...cheduled_user_message_update_params.g.dart | 2 +- .../threaded_message_list_params.g.dart | 4 +- .../params/poll/poll_create_params.g.dart | 2 +- .../params/poll/poll_update_params.g.dart | 2 +- pubspec.yaml | 2 +- 53 files changed, 221 insertions(+), 131 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4860624d..7fec623e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## v4.2.27 (Nov 6, 2024) + +### Features +- Applied the message threading policy for last message and unread message count in `GroupChannel` + +### Improvements +- Fixed a bug where update events are not called for messages with OGTags +- Fixed the reconnection events to be called in pairs + ## v4.2.26 (Oct 28, 2024) ### Features diff --git a/README.md b/README.md index e5368a3c..91620400 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Before installing Sendbird Chat SDK, you need to create a Sendbird application o ```yaml dependencies: - sendbird_chat_sdk: ^4.2.26 + sendbird_chat_sdk: ^4.2.27 ``` - Run `flutter pub get` command in your project directory. diff --git a/lib/src/internal/main/chat/chat.dart b/lib/src/internal/main/chat/chat.dart index 465a810d..822a6460 100644 --- a/lib/src/internal/main/chat/chat.dart +++ b/lib/src/internal/main/chat/chat.dart @@ -62,7 +62,7 @@ part 'chat_notifications.dart'; part 'chat_push.dart'; part 'chat_user.dart'; -const sdkVersion = '4.2.26'; +const sdkVersion = '4.2.27'; // Internal implementation for main class. Do not directly access this class. class Chat with WidgetsBindingObserver { diff --git a/lib/src/internal/main/chat_manager/command_manager.dart b/lib/src/internal/main/chat_manager/command_manager.dart index 8787cb11..3f32a522 100644 --- a/lib/src/internal/main/chat_manager/command_manager.dart +++ b/lib/src/internal/main/chat_manager/command_manager.dart @@ -447,6 +447,7 @@ class CommandManager { groupChannel.updateMember(event.sender); + // Last message if (channel is GroupChannel && message is BaseMessage) { if (groupChannel.shouldUpdateLastMessage(message, message.sender)) { shouldCallChannelChanged = true; @@ -459,6 +460,7 @@ class CommandManager { } } + // Unread message count if (groupChannel.fromCache && groupChannel.updateUnreadCount(message)) { shouldCallChannelChanged = true; } diff --git a/lib/src/internal/main/chat_manager/connection_manager.dart b/lib/src/internal/main/chat_manager/connection_manager.dart index cd00404b..5bcc2c5a 100644 --- a/lib/src/internal/main/chat_manager/connection_manager.dart +++ b/lib/src/internal/main/chat_manager/connection_manager.dart @@ -258,9 +258,6 @@ class ConnectionManager { if (isReconnecting()) { reconnectTimer?.cancel(); reconnectTimer = null; - if (clear) { - chat.eventManager.notifyReconnectFailed(); - } } final isClosedSuccessfully = await webSocketClient.close(); @@ -298,6 +295,9 @@ class ConnectionManager { if (fromEnterBackground && !chat.isBackground && !isClosedSuccessfully) { chat.connectionManager.reconnect(reset: true); // Check } else { + if (isReconnecting()) { + chat.eventManager.notifyReconnectFailed(); + } changeState(DisconnectedState(chat: chat)); if (clear && disconnectedUserId.isNotEmpty) { @@ -309,11 +309,13 @@ class ConnectionManager { Future doReconnect({bool reset = false}) async { sbLog.i(StackTrace.current, 'reset: $reset'); + bool doNotCallReconnectStartedEvent = false; + if (isReconnecting() && reset) { + doNotCallReconnectStartedEvent = true; + } + if (chat.chatContext.currentUser == null || chat.chatContext.sessionKey == null) { - if (isReconnecting()) { - chat.eventManager.notifyReconnectFailed(); - } changeState(DisconnectedState(chat: chat)); return false; } @@ -348,8 +350,10 @@ class ConnectionManager { ); if (chat.chatContext.reconnectTask?.retryCount == 1) { - await chat.eventDispatcher.onReconnecting(); - chat.eventManager.notifyReconnectStarted(); + if (!doNotCallReconnectStartedEvent) { + await chat.eventDispatcher.onReconnecting(); + chat.eventManager.notifyReconnectStarted(); + } } // ===== Reconnect ===== diff --git a/lib/src/internal/main/extensions/group_channel_extensions.dart b/lib/src/internal/main/extensions/group_channel_extensions.dart index 4868abab..12c37635 100644 --- a/lib/src/internal/main/extensions/group_channel_extensions.dart +++ b/lib/src/internal/main/extensions/group_channel_extensions.dart @@ -4,6 +4,10 @@ part of 'package:sendbird_chat_sdk/src/public/core/channel/group_channel/group_c extension GroupChannelExtensions on GroupChannel { bool shouldUpdateLastMessage(BaseMessage message, Sender? sender) { + if (_shouldUpdateLastMessageByThreadingPolicy(message) == false) { + return false; + } + final lm = lastMessage; if (!message.isSilent || sender?.isCurrentUser == true || @@ -22,6 +26,10 @@ extension GroupChannelExtensions on GroupChannel { } bool updateUnreadCount(RootMessage message) { + if (_shouldUpdateUnreadMessageCountByThreadingPolicy(message) == false) { + return false; + } + final currentUser = chat.chatContext.currentUser; if (message is BaseMessage) { @@ -165,4 +173,46 @@ extension GroupChannelExtensions on GroupChannel { .toList() .length; } + + bool _shouldUpdateLastMessageByThreadingPolicy(RootMessage message) { + return _shouldUpdateByThreadingPolicy( + message: message, + threadingPolicy: chat.chatContext.appInfo?.lastMsgThreadingPolicy, + ); + } + + bool _shouldUpdateUnreadMessageCountByThreadingPolicy(RootMessage message) { + return _shouldUpdateByThreadingPolicy( + message: message, + threadingPolicy: chat.chatContext.appInfo?.unreadCntThreadingPolicy, + ); + } + + bool _shouldUpdateByThreadingPolicy({ + required RootMessage message, + required int? threadingPolicy, + }) { + bool result = true; + bool isReplyMessage = message is BaseMessage && + message.parentMessageId != null && + message.parentMessageId! > 0; + + if (isReplyMessage && threadingPolicy != null) { + switch (threadingPolicy) { + case 0: // NONE + break; + case 1: // INCLUDE_REPLY + break; + case 2: // EXCLUDE_REPLY + result = false; + break; + case 3: // INCLUDE_REPLY_TO_CHANNEL + if (message.isReplyToChannel == false) { + result = false; + } + break; + } + } + return result; + } } diff --git a/lib/src/internal/main/model/delivery_status.g.dart b/lib/src/internal/main/model/delivery_status.g.dart index e816aa7d..df049b71 100644 --- a/lib/src/internal/main/model/delivery_status.g.dart +++ b/lib/src/internal/main/model/delivery_status.g.dart @@ -10,7 +10,7 @@ DeliveryStatus _$DeliveryStatusFromJson(Map json) => DeliveryStatus( channelUrl: json['channel_url'] as String, updatedDeliveryStatus: (json['updated'] as Map?)?.map( - (k, e) => MapEntry(k, e as int), + (k, e) => MapEntry(k, (e as num).toInt()), ) ?? const {}, ); diff --git a/lib/src/internal/main/model/group_channel_filter.g.dart b/lib/src/internal/main/model/group_channel_filter.g.dart index 81202db3..bd738b9e 100644 --- a/lib/src/internal/main/model/group_channel_filter.g.dart +++ b/lib/src/internal/main/model/group_channel_filter.g.dart @@ -34,8 +34,8 @@ GroupChannelFilter _$GroupChannelFilterFromJson(Map json) => .toList() ..metaDataValueStartsWithFilter = json['metadata_value_startswith'] as String? - ..createdBefore = json['created_before'] as int? - ..createdAfter = json['created_after'] as int?; + ..createdBefore = (json['created_before'] as num?)?.toInt() + ..createdAfter = (json['created_after'] as num?)?.toInt(); Map _$GroupChannelFilterToJson(GroupChannelFilter instance) => { diff --git a/lib/src/internal/main/model/read_status.g.dart b/lib/src/internal/main/model/read_status.g.dart index 7b00eb1c..3bd59b4c 100644 --- a/lib/src/internal/main/model/read_status.g.dart +++ b/lib/src/internal/main/model/read_status.g.dart @@ -8,7 +8,7 @@ part of 'read_status.dart'; ReadStatus _$ReadStatusFromJson(Map json) => ReadStatus( userId: userToUserId(json['user'] as Map?), - timestamp: json['ts'] as int? ?? 0, + timestamp: (json['ts'] as num?)?.toInt() ?? 0, channelUrl: json['channel_url'] as String, channelType: $enumDecode(_$ChannelTypeEnumMap, json['channel_type']), ); diff --git a/lib/src/internal/main/model/reconnect_configuration.g.dart b/lib/src/internal/main/model/reconnect_configuration.g.dart index 1d818248..88498a63 100644 --- a/lib/src/internal/main/model/reconnect_configuration.g.dart +++ b/lib/src/internal/main/model/reconnect_configuration.g.dart @@ -11,8 +11,8 @@ ReconnectConfiguration _$ReconnectConfigurationFromJson( ReconnectConfiguration( interval: (json['interval'] as num).toDouble(), maxInterval: (json['max_interval'] as num).toDouble(), - multiplier: json['mul'] as int, - maximumRetryCount: json['retry_cnt'] as int, + multiplier: (json['mul'] as num).toInt(), + maximumRetryCount: (json['retry_cnt'] as num).toInt(), ); Map _$ReconnectConfigurationToJson( diff --git a/lib/src/internal/main/model/unread_message_count_info.g.dart b/lib/src/internal/main/model/unread_message_count_info.g.dart index 3b72af32..f757e57f 100644 --- a/lib/src/internal/main/model/unread_message_count_info.g.dart +++ b/lib/src/internal/main/model/unread_message_count_info.g.dart @@ -9,11 +9,11 @@ part of 'unread_message_count_info.dart'; UnreadMessageCountInfo _$UnreadMessageCountInfoFromJson( Map json) => UnreadMessageCountInfo( - all: json['all'] as int? ?? 0, - feed: json['feed'] as int? ?? 0, + all: (json['all'] as num?)?.toInt() ?? 0, + feed: (json['feed'] as num?)?.toInt() ?? 0, customTypes: (json['custom_types'] as Map?)?.map( - (k, e) => MapEntry(k, e as int), + (k, e) => MapEntry(k, (e as num).toInt()), ) ?? const {}, - ts: json['ts'] as int? ?? 0, + ts: (json['ts'] as num?)?.toInt() ?? 0, ); diff --git a/lib/src/internal/network/http/http_client/response/responses.g.dart b/lib/src/internal/network/http/http_client/response/responses.g.dart index 5aeeea9c..bb6831c4 100644 --- a/lib/src/internal/network/http/http_client/response/responses.g.dart +++ b/lib/src/internal/network/http/http_client/response/responses.g.dart @@ -34,7 +34,7 @@ PollVoterListQueryResponse _$PollVoterListQueryResponseFromJson( .toList() ?? const [], next: json['next'] as String?, - voteCount: json['vote_count'] as int?, + voteCount: (json['vote_count'] as num?)?.toInt(), ); UserListQueryResponse _$UserListQueryResponseFromJson( @@ -97,7 +97,7 @@ MessageSearchQueryResponse _$MessageSearchQueryResponseFromJson( ? const [] : toBaseMessageList(json['results'] as List), hasNext: json['has_next'] as bool? ?? false, - totalCount: json['total_count'] as int? ?? -1, + totalCount: (json['total_count'] as num?)?.toInt() ?? -1, next: json['end_cursor'] as String?, ); @@ -107,7 +107,7 @@ MetaDataResponse _$MetaDataResponseFromJson(Map json) => (k, e) => MapEntry(k, e as String), ) ?? const {}, - ts: json['ts'] as int?, + ts: (json['ts'] as num?)?.toInt(), ); ScheduledMessageResponse _$ScheduledMessageResponseFromJson( @@ -124,5 +124,5 @@ UploadResponse _$UploadResponseFromJson(Map json) => url: json['url'] as String, thumbnails: json['thumbnails'] as List? ?? [], requireAuth: json['require_auth'] as bool, - fileSize: json['file_size'] as int, + fileSize: (json['file_size'] as num).toInt(), ); diff --git a/lib/src/internal/network/websocket/command/command.g.dart b/lib/src/internal/network/websocket/command/command.g.dart index c15c995e..7e657cf0 100644 --- a/lib/src/internal/network/websocket/command/command.g.dart +++ b/lib/src/internal/network/websocket/command/command.g.dart @@ -9,9 +9,9 @@ part of 'command.dart'; Command _$CommandFromJson(Map json) => Command( cmd: json['cmd'] as String, requestId: json['req_id'] as String?, - timestamp: json['ts'] as int?, + timestamp: (json['ts'] as num?)?.toInt(), requireAuth: json['require_auth'] as bool?, - errorCode: json['code'] as int?, + errorCode: (json['code'] as num?)?.toInt(), errorMessage: json['message'] as String?, replyToChannel: json['reply_to_channel'] as bool? ?? false, ); diff --git a/lib/src/internal/network/websocket/event/channel_event.g.dart b/lib/src/internal/network/websocket/event/channel_event.g.dart index ece829f1..62b8264a 100644 --- a/lib/src/internal/network/websocket/event/channel_event.g.dart +++ b/lib/src/internal/network/websocket/event/channel_event.g.dart @@ -9,10 +9,10 @@ part of 'channel_event.dart'; ChannelEvent _$ChannelEventFromJson(Map json) => ChannelEvent( channelType: $enumDecode(_$ChannelTypeEnumMap, json['channel_type']), channelUrl: json['channel_url'] as String, - category: channelEventValueOf(json['cat'] as int), + category: channelEventValueOf((json['cat'] as num).toInt()), data: json['data'] as Map? ?? {}, - ts: json['ts'] as int?, - messageOffset: json['ts_message_offset'] as int?, + ts: (json['ts'] as num?)?.toInt(), + messageOffset: (json['ts_message_offset'] as num?)?.toInt(), ); const _$ChannelTypeEnumMap = { diff --git a/lib/src/internal/network/websocket/event/login_event.g.dart b/lib/src/internal/network/websocket/event/login_event.g.dart index d361e0a1..af8dc08f 100644 --- a/lib/src/internal/network/websocket/event/login_event.g.dart +++ b/lib/src/internal/network/websocket/event/login_event.g.dart @@ -10,11 +10,11 @@ LoginEvent _$LoginEventFromJson(Map json) => LoginEvent( eKey: json['ekey'] as String?, newKey: json['new_key'] as String?, key: json['key'] as String?, - loginTimestamp: json['login_ts'] as int, + loginTimestamp: (json['login_ts'] as num).toInt(), reconnectConfiguration: ReconnectConfiguration.fromJson( json['reconnect'] as Map), - pingInterval: json['ping_interval'] as int? ?? 15, - watchdogInterval: json['pong_timeout'] as int, + pingInterval: (json['ping_interval'] as num?)?.toInt() ?? 15, + watchdogInterval: (json['pong_timeout'] as num).toInt(), maxUnreadCountOnSuperGroup: - json['max_unread_count_on_super_group'] as int?, + (json['max_unread_count_on_super_group'] as num?)?.toInt(), ); diff --git a/lib/src/internal/network/websocket/event/mcnt_event.g.dart b/lib/src/internal/network/websocket/event/mcnt_event.g.dart index 16a7be09..5cb07eac 100644 --- a/lib/src/internal/network/websocket/event/mcnt_event.g.dart +++ b/lib/src/internal/network/websocket/event/mcnt_event.g.dart @@ -15,6 +15,6 @@ MCNTEvent _$MCNTEventFromJson(Map json) => MCNTEvent( ?.map((e) => OpenChannel.fromJson(e as Map)) .toList() ?? [], - systemTimestamp: json['sts'] as int?, - timestamp: json['ts'] as int?, + systemTimestamp: (json['sts'] as num?)?.toInt(), + timestamp: (json['ts'] as num?)?.toInt(), ); diff --git a/lib/src/internal/network/websocket/event/message_event.g.dart b/lib/src/internal/network/websocket/event/message_event.g.dart index 3b87ff83..6949f4a5 100644 --- a/lib/src/internal/network/websocket/event/message_event.g.dart +++ b/lib/src/internal/network/websocket/event/message_event.g.dart @@ -7,7 +7,7 @@ part of 'message_event.dart'; // ************************************************************************** MessageEvent _$MessageEventFromJson(Map json) => MessageEvent( - messageId: json['msg_id'] as int, + messageId: (json['msg_id'] as num).toInt(), channelType: $enumDecode(_$ChannelTypeEnumMap, json['channel_type'], unknownValue: ChannelType.group), channelUrl: json['channel_url'] as String, diff --git a/lib/src/internal/network/websocket/event/user_event.g.dart b/lib/src/internal/network/websocket/event/user_event.g.dart index b36cce70..dc0009e2 100644 --- a/lib/src/internal/network/websocket/event/user_event.g.dart +++ b/lib/src/internal/network/websocket/event/user_event.g.dart @@ -7,7 +7,7 @@ part of 'user_event.dart'; // ************************************************************************** UserEvent _$UserEventFromJson(Map json) => UserEvent( - category: userEventValueOf(json['cat'] as int), + category: userEventValueOf((json['cat'] as num).toInt()), data: json['data'] as Map, - ts: json['ts'] as int, + ts: (json['ts'] as num).toInt(), ); diff --git a/lib/src/public/core/channel/group_channel/group_channel.g.dart b/lib/src/public/core/channel/group_channel/group_channel.g.dart index 5deeed55..2def08db 100644 --- a/lib/src/public/core/channel/group_channel/group_channel.g.dart +++ b/lib/src/public/core/channel/group_channel/group_channel.g.dart @@ -16,14 +16,14 @@ GroupChannel _$GroupChannelFromJson(Map json) => GroupChannel( isDiscoverable: json['is_discoverable'] as bool? ?? false, isExclusive: json['is_exclusive'] as bool? ?? false, isAccessCodeRequired: json['is_access_code_required'] as bool? ?? false, - unreadMessageCount: json['unread_message_count'] as int? ?? 0, - unreadMentionCount: json['unread_mention_count'] as int? ?? 0, + unreadMessageCount: (json['unread_message_count'] as num?)?.toInt() ?? 0, + unreadMentionCount: (json['unread_mention_count'] as num?)?.toInt() ?? 0, members: (json['members'] as List?) ?.map((e) => Member.fromJson(e as Map)) .toList() ?? const [], - memberCount: json['member_count'] as int? ?? 0, - joinedMemberCount: json['joined_member_count'] as int? ?? 0, + memberCount: (json['member_count'] as num?)?.toInt() ?? 0, + joinedMemberCount: (json['joined_member_count'] as num?)?.toInt() ?? 0, myPushTriggerOption: $enumDecodeNullable( _$GroupChannelPushTriggerOptionEnumMap, json['push_trigger_option']) ?? @@ -47,24 +47,25 @@ GroupChannel _$GroupChannelFromJson(Map json) => GroupChannel( inviter: json['inviter'] == null ? null : Member.fromJson(json['inviter'] as Map), - invitedAt: json['invited_at'] as int? ?? 0, - joinedAt: json['joined_ts'] as int? ?? 0, + invitedAt: (json['invited_at'] as num?)?.toInt() ?? 0, + joinedAt: (json['joined_ts'] as num?)?.toInt() ?? 0, isHidden: json['is_hidden'] as bool? ?? false, hiddenState: $enumDecodeNullable( _$GroupChannelHiddenStateEnumMap, json['hidden_state'], unknownValue: GroupChannelHiddenState.unhidden) ?? GroupChannelHiddenState.unhidden, - myLastRead: json['user_last_read'] as int? ?? 0, - messageOffsetTimestamp: json['ts_message_offset'] as int?, - messageSurvivalSeconds: json['message_survival_seconds'] as int? ?? -1, + myLastRead: (json['user_last_read'] as num?)?.toInt() ?? 0, + messageOffsetTimestamp: (json['ts_message_offset'] as num?)?.toInt(), + messageSurvivalSeconds: + (json['message_survival_seconds'] as num?)?.toInt() ?? -1, pinnedMessageIds: (json['pinned_message_ids'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ?? const [], lastPinnedMessage: toNullableBaseMessage(json['latest_pinned_message']), name: json['name'] as String? ?? '', coverUrl: json['cover_url'] as String? ?? '', - createdAt: json['created_at'] as int?, + createdAt: (json['created_at'] as num?)?.toInt(), data: json['data'] as String? ?? '', customType: json['custom_type'] as String? ?? '', isFrozen: json['freeze'] as bool? ?? false, diff --git a/lib/src/public/core/channel/open_channel/open_channel.g.dart b/lib/src/public/core/channel/open_channel/open_channel.g.dart index eb3d39bf..64685025 100644 --- a/lib/src/public/core/channel/open_channel/open_channel.g.dart +++ b/lib/src/public/core/channel/open_channel/open_channel.g.dart @@ -7,7 +7,7 @@ part of 'open_channel.dart'; // ************************************************************************** OpenChannel _$OpenChannelFromJson(Map json) => OpenChannel( - participantCount: json['participant_count'] as int, + participantCount: (json['participant_count'] as num).toInt(), operators: (json['operators'] as List?) ?.map((e) => User.fromJson(e as Map)) .toList() ?? @@ -15,7 +15,7 @@ OpenChannel _$OpenChannelFromJson(Map json) => OpenChannel( channelUrl: json['channel_url'] as String, name: json['name'] as String? ?? '', coverUrl: json['cover_url'] as String? ?? '', - createdAt: json['created_at'] as int?, + createdAt: (json['created_at'] as num?)?.toInt(), data: json['data'] as String? ?? '', customType: json['custom_type'] as String? ?? '', isFrozen: json['freeze'] as bool? ?? false, diff --git a/lib/src/public/core/message/admin_message.g.dart b/lib/src/public/core/message/admin_message.g.dart index 7712620d..13a50364 100644 --- a/lib/src/public/core/message/admin_message.g.dart +++ b/lib/src/public/core/message/admin_message.g.dart @@ -12,7 +12,7 @@ AdminMessage _$AdminMessageFromJson(Map json) => AdminMessage( _$ChannelTypeEnumMap, json['channel_type'], unknownValue: ChannelType.group) ?? ChannelType.group, - messageId: json['message_id'] as int? ?? 0, + messageId: (json['message_id'] as num?)?.toInt() ?? 0, message: json['message'] as String, sendingStatus: $enumDecodeNullable(_$SendingStatusEnumMap, json['sending_status']), @@ -25,15 +25,16 @@ AdminMessage _$AdminMessageFromJson(Map json) => AdminMessage( _$MentionTypeEnumMap, json['mention_type'], unknownValue: MentionType.users) ?? MentionType.users, - createdAt: json['created_at'] as int? ?? 0, - updatedAt: json['updated_at'] as int? ?? 0, - parentMessageId: json['parent_message_id'] as int?, + createdAt: (json['created_at'] as num?)?.toInt() ?? 0, + updatedAt: (json['updated_at'] as num?)?.toInt() ?? 0, + parentMessageId: (json['parent_message_id'] as num?)?.toInt(), parentMessage: json['parent_message_info'] as Map?, threadInfo: json['thread_info'] == null ? null : ThreadInfo.fromJson(json['thread_info'] as Map), customType: json['custom_type'] as String?, - messageSurvivalSeconds: json['message_survival_seconds'] as int? ?? -1, + messageSurvivalSeconds: + (json['message_survival_seconds'] as num?)?.toInt() ?? -1, forceUpdateLastMessage: json['force_update_last_message'] as bool? ?? false, isSilent: json['silent'] as bool? ?? false, @@ -52,7 +53,7 @@ AdminMessage _$AdminMessageFromJson(Map json) => AdminMessage( ?.map((e) => MessageMetaArray.fromJson(e as Map)) .toList() ..isReplyToChannel = json['is_reply_to_channel'] as bool? ?? false - ..errorCode = json['error_code'] as int? + ..errorCode = (json['error_code'] as num?)?.toInt() ..sender = json['user'] == null ? null : Sender.fromJson(json['user'] as Map); diff --git a/lib/src/public/core/message/file_message.g.dart b/lib/src/public/core/message/file_message.g.dart index bd99bbbc..b0a7f806 100644 --- a/lib/src/public/core/message/file_message.g.dart +++ b/lib/src/public/core/message/file_message.g.dart @@ -12,10 +12,10 @@ FileMessage _$FileMessageFromJson(Map json) => FileMessage( _$ChannelTypeEnumMap, json['channel_type'], unknownValue: ChannelType.group) ?? ChannelType.group, - messageId: json['message_id'] as int? ?? 0, + messageId: (json['message_id'] as num?)?.toInt() ?? 0, url: json['url'] as String, name: json['name'] as String?, - size: json['size'] as int? ?? 0, + size: (json['size'] as num?)?.toInt() ?? 0, type: json['type'] as String?, thumbnails: (json['thumbnails'] as List?) ?.map((e) => Thumbnail.fromJson(e as Map)) @@ -36,14 +36,15 @@ FileMessage _$FileMessageFromJson(Map json) => FileMessage( _$MentionTypeEnumMap, json['mention_type'], unknownValue: MentionType.users) ?? MentionType.users, - createdAt: json['created_at'] as int? ?? 0, - updatedAt: json['updated_at'] as int? ?? 0, - parentMessageId: json['parent_message_id'] as int?, + createdAt: (json['created_at'] as num?)?.toInt() ?? 0, + updatedAt: (json['updated_at'] as num?)?.toInt() ?? 0, + parentMessageId: (json['parent_message_id'] as num?)?.toInt(), threadInfo: json['thread_info'] == null ? null : ThreadInfo.fromJson(json['thread_info'] as Map), customType: json['custom_type'] as String?, - messageSurvivalSeconds: json['message_survival_seconds'] as int? ?? -1, + messageSurvivalSeconds: + (json['message_survival_seconds'] as num?)?.toInt() ?? -1, forceUpdateLastMessage: json['force_update_last_message'] as bool? ?? false, isSilent: json['silent'] as bool? ?? false, @@ -64,7 +65,7 @@ FileMessage _$FileMessageFromJson(Map json) => FileMessage( ..extendedMessage = json['extended_message'] as Map? ?? {} ..isReplyToChannel = json['is_reply_to_channel'] as bool? ?? false - ..errorCode = json['error_code'] as int?; + ..errorCode = (json['error_code'] as num?)?.toInt(); Map _$FileMessageToJson(FileMessage instance) => { diff --git a/lib/src/public/core/message/notification_message.g.dart b/lib/src/public/core/message/notification_message.g.dart index 8960d64a..04c7097b 100644 --- a/lib/src/public/core/message/notification_message.g.dart +++ b/lib/src/public/core/message/notification_message.g.dart @@ -32,8 +32,8 @@ NotificationMessage _$NotificationMessageFromJson(Map json) => ?.map((e) => MessageMetaArray.fromJson(e as Map)) .toList(), extendedMessage: json['extended_message'] as Map? ?? {}, - createdAt: json['created_at'] as int? ?? 0, - updatedAt: json['updated_at'] as int? ?? 0, + createdAt: (json['created_at'] as num?)?.toInt() ?? 0, + updatedAt: (json['updated_at'] as num?)?.toInt() ?? 0, ); Map _$NotificationMessageToJson( diff --git a/lib/src/public/core/message/user_message.g.dart b/lib/src/public/core/message/user_message.g.dart index 8fbc10cd..9fe487c9 100644 --- a/lib/src/public/core/message/user_message.g.dart +++ b/lib/src/public/core/message/user_message.g.dart @@ -12,7 +12,7 @@ UserMessage _$UserMessageFromJson(Map json) => UserMessage( _$ChannelTypeEnumMap, json['channel_type'], unknownValue: ChannelType.group) ?? ChannelType.group, - messageId: json['message_id'] as int? ?? 0, + messageId: (json['message_id'] as num?)?.toInt() ?? 0, message: json['message'] as String, translations: (json['translations'] as Map?)?.map( (k, e) => MapEntry(k, e as String), @@ -32,14 +32,15 @@ UserMessage _$UserMessageFromJson(Map json) => UserMessage( _$MentionTypeEnumMap, json['mention_type'], unknownValue: MentionType.users) ?? MentionType.users, - createdAt: json['created_at'] as int? ?? 0, - updatedAt: json['updated_at'] as int? ?? 0, - parentMessageId: json['parent_message_id'] as int?, + createdAt: (json['created_at'] as num?)?.toInt() ?? 0, + updatedAt: (json['updated_at'] as num?)?.toInt() ?? 0, + parentMessageId: (json['parent_message_id'] as num?)?.toInt(), threadInfo: json['thread_info'] == null ? null : ThreadInfo.fromJson(json['thread_info'] as Map), customType: json['custom_type'] as String?, - messageSurvivalSeconds: json['message_survival_seconds'] as int? ?? -1, + messageSurvivalSeconds: + (json['message_survival_seconds'] as num?)?.toInt() ?? -1, forceUpdateLastMessage: json['force_update_last_message'] as bool? ?? false, isSilent: json['silent'] as bool? ?? false, @@ -67,7 +68,7 @@ UserMessage _$UserMessageFromJson(Map json) => UserMessage( ..extendedMessage = json['extended_message'] as Map? ?? {} ..isReplyToChannel = json['is_reply_to_channel'] as bool? ?? false - ..errorCode = json['error_code'] as int?; + ..errorCode = (json['error_code'] as num?)?.toInt(); Map _$UserMessageToJson(UserMessage instance) => { diff --git a/lib/src/public/core/user/member.g.dart b/lib/src/public/core/user/member.g.dart index fc5cf725..f2b909d7 100644 --- a/lib/src/public/core/user/member.g.dart +++ b/lib/src/public/core/user/member.g.dart @@ -22,7 +22,7 @@ Member _$MemberFromJson(Map json) => Member( connectionStatus: json['is_online'] == null ? UserConnectionStatus.notAvailable : boolToConnectionStatus(json['is_online'] as bool?), - lastSeenAt: json['last_seen_at'] as int?, + lastSeenAt: (json['last_seen_at'] as num?)?.toInt(), preferredLanguages: (json['preferred_languages'] as List?) ?.map((e) => e as String) .toList(), diff --git a/lib/src/public/core/user/restricted_user.g.dart b/lib/src/public/core/user/restricted_user.g.dart index e6442234..c7b0a05d 100644 --- a/lib/src/public/core/user/restricted_user.g.dart +++ b/lib/src/public/core/user/restricted_user.g.dart @@ -14,7 +14,7 @@ RestrictedUser _$RestrictedUserFromJson(Map json) => connectionStatus: json['is_online'] == null ? UserConnectionStatus.notAvailable : boolToConnectionStatus(json['is_online'] as bool?), - lastSeenAt: json['last_seen_at'] as int?, + lastSeenAt: (json['last_seen_at'] as num?)?.toInt(), preferredLanguages: (json['preferred_languages'] as List?) ?.map((e) => e as String) .toList(), @@ -30,7 +30,7 @@ RestrictedUser _$RestrictedUserFromJson(Map json) => RestrictionInfo _$RestrictionInfoFromJson(Map json) => RestrictionInfo( description: json['description'] as String?, - endAt: json['end_at'] as int?, + endAt: (json['end_at'] as num?)?.toInt(), restrictionType: $enumDecodeNullable( _$RestrictionTypeEnumMap, json['restriction_type']) ?? RestrictionType.muted, diff --git a/lib/src/public/core/user/sender.g.dart b/lib/src/public/core/user/sender.g.dart index fd6df6a0..0a597e4f 100644 --- a/lib/src/public/core/user/sender.g.dart +++ b/lib/src/public/core/user/sender.g.dart @@ -17,7 +17,7 @@ Sender _$SenderFromJson(Map json) => Sender( connectionStatus: json['is_online'] == null ? UserConnectionStatus.notAvailable : boolToConnectionStatus(json['is_online'] as bool?), - lastSeenAt: json['last_seen_at'] as int?, + lastSeenAt: (json['last_seen_at'] as num?)?.toInt(), preferredLanguages: (json['preferred_languages'] as List?) ?.map((e) => e as String) .toList(), diff --git a/lib/src/public/core/user/user.g.dart b/lib/src/public/core/user/user.g.dart index 1bdac242..1f2b8a6f 100644 --- a/lib/src/public/core/user/user.g.dart +++ b/lib/src/public/core/user/user.g.dart @@ -13,7 +13,7 @@ User _$UserFromJson(Map json) => User( connectionStatus: json['is_online'] == null ? UserConnectionStatus.notAvailable : boolToConnectionStatus(json['is_online'] as bool?), - lastSeenAt: json['last_seen_at'] as int?, + lastSeenAt: (json['last_seen_at'] as num?)?.toInt(), isActive: json['is_active'] as bool? ?? true, preferredLanguages: (json['preferred_languages'] as List?) ?.map((e) => e as String) diff --git a/lib/src/public/main/collection/group_channel_message_collection/base_message_collection.dart b/lib/src/public/main/collection/group_channel_message_collection/base_message_collection.dart index 3f29a8b7..6da5dd46 100644 --- a/lib/src/public/main/collection/group_channel_message_collection/base_message_collection.dart +++ b/lib/src/public/main/collection/group_channel_message_collection/base_message_collection.dart @@ -925,6 +925,9 @@ abstract class BaseMessageCollection { originalMessage.poll!.updatedAt <= updatedMessage.poll!.updatedAt) { canUpdate = true; } + } else if (eventSource == CollectionEventSource.eventMessageUpdated) { + // eg. Updated message for OGTag + canUpdate = true; } else if (eventSource == CollectionEventSource.eventReactionUpdated) { // Check updatedAt (?) canUpdate = true; diff --git a/lib/src/public/main/model/channel/group_channel_unread_item_count.g.dart b/lib/src/public/main/model/channel/group_channel_unread_item_count.g.dart index 1a6a81e4..848cdd2d 100644 --- a/lib/src/public/main/model/channel/group_channel_unread_item_count.g.dart +++ b/lib/src/public/main/model/channel/group_channel_unread_item_count.g.dart @@ -10,21 +10,23 @@ GroupChannelUnreadItemCount _$GroupChannelUnreadItemCountFromJson( Map json) => GroupChannelUnreadItemCount( groupChannelInvitationCount: - json['group_channel_invitation_count'] as int?, + (json['group_channel_invitation_count'] as num?)?.toInt(), groupChannelUnreadMentionCount: - json['group_channel_unread_mention_count'] as int?, + (json['group_channel_unread_mention_count'] as num?)?.toInt(), groupChannelUnreadMessageCount: - json['group_channel_unread_message_count'] as int?, + (json['group_channel_unread_message_count'] as num?)?.toInt(), superGroupChannelInvitationCount: - json['super_group_channel_invitation_count'] as int?, + (json['super_group_channel_invitation_count'] as num?)?.toInt(), superGroupChannelUnreadMentionCount: - json['super_group_channel_unread_mention_count'] as int?, + (json['super_group_channel_unread_mention_count'] as num?)?.toInt(), superGroupChannelUnreadMessageCount: - json['super_group_channel_unread_message_count'] as int?, + (json['super_group_channel_unread_message_count'] as num?)?.toInt(), nonSuperGroupChannelInvitationCount: - json['non_super_group_channel_invitation_count'] as int?, + (json['non_super_group_channel_invitation_count'] as num?)?.toInt(), nonSuperGroupChannelUnreadMentionCount: - json['non_super_group_channel_unread_mention_count'] as int?, + (json['non_super_group_channel_unread_mention_count'] as num?) + ?.toInt(), nonSuperGroupChannelUnreadMessageCount: - json['non_super_group_channel_unread_message_count'] as int?, + (json['non_super_group_channel_unread_message_count'] as num?) + ?.toInt(), ); diff --git a/lib/src/public/main/model/chat/do_not_disturb.g.dart b/lib/src/public/main/model/chat/do_not_disturb.g.dart index bb91ce18..377b01b9 100644 --- a/lib/src/public/main/model/chat/do_not_disturb.g.dart +++ b/lib/src/public/main/model/chat/do_not_disturb.g.dart @@ -8,9 +8,9 @@ part of 'do_not_disturb.dart'; DoNotDisturb _$DoNotDisturbFromJson(Map json) => DoNotDisturb( isDoNotDisturbOn: json['do_not_disturb'] as bool, - startHour: json['start_hour'] as int?, - startMin: json['start_min'] as int?, - endHour: json['end_hour'] as int?, - endMin: json['end_min'] as int?, + startHour: (json['start_hour'] as num?)?.toInt(), + startMin: (json['start_min'] as num?)?.toInt(), + endHour: (json['end_hour'] as num?)?.toInt(), + endMin: (json['end_min'] as num?)?.toInt(), timezone: json['timezone'] as String?, ); diff --git a/lib/src/public/main/model/chat/emoji.g.dart b/lib/src/public/main/model/chat/emoji.g.dart index f18aef78..82e07d4e 100644 --- a/lib/src/public/main/model/chat/emoji.g.dart +++ b/lib/src/public/main/model/chat/emoji.g.dart @@ -13,7 +13,7 @@ Emoji _$EmojiFromJson(Map json) => Emoji( EmojiCategory _$EmojiCategoryFromJson(Map json) => EmojiCategory( - id: json['id'] as int, + id: (json['id'] as num).toInt(), name: json['name'] as String, url: json['url'] as String, emojis: (json['emojis'] as List?) diff --git a/lib/src/public/main/model/info/app_info.dart b/lib/src/public/main/model/info/app_info.dart index 2be32cc4..197c53a5 100644 --- a/lib/src/public/main/model/info/app_info.dart +++ b/lib/src/public/main/model/info/app_info.dart @@ -42,6 +42,16 @@ class AppInfo { @JsonKey(name: 'disable_supergroup_mack') final bool disableSuperGroupMack; + /// The unread message count policy for message threading. + /// 0(NONE), 1(INCLUDE_REPLY), 2(EXCLUDE_REPLY), 3(INCLUDE_REPLY_TO_CHANNEL) + /// @since 4.2.27 + final int unreadCntThreadingPolicy; + + /// The last message policy for message threading. + /// 0(NONE), 1(INCLUDE_REPLY), 2(EXCLUDE_REPLY), 3(INCLUDE_REPLY_TO_CHANNEL) + /// @since 4.2.27 + final int lastMsgThreadingPolicy; + AppInfo({ required this.premiumFeatureList, required this.uploadSizeLimit, @@ -51,6 +61,8 @@ class AppInfo { this.notificationInfo, this.allowSdkStatsUpload = true, this.disableSuperGroupMack = false, + this.unreadCntThreadingPolicy = 0, + this.lastMsgThreadingPolicy = 0, }); /// Checks whether the emoji list needs to be updated. diff --git a/lib/src/public/main/model/info/app_info.g.dart b/lib/src/public/main/model/info/app_info.g.dart index a8c7e8d3..702c5a76 100644 --- a/lib/src/public/main/model/info/app_info.g.dart +++ b/lib/src/public/main/model/info/app_info.g.dart @@ -11,7 +11,7 @@ AppInfo _$AppInfoFromJson(Map json) => AppInfo( ?.map((e) => e as String) .toList() ?? [], - uploadSizeLimit: json['file_upload_size_limit'] as int? ?? 30, + uploadSizeLimit: (json['file_upload_size_limit'] as num?)?.toInt() ?? 30, attributesInUse: (json['application_attributes'] as List?) ?.map((e) => e as String) .toList() ?? @@ -24,4 +24,8 @@ AppInfo _$AppInfoFromJson(Map json) => AppInfo( json['notifications'] as Map), allowSdkStatsUpload: json['allow_sdk_log_ingestion'] as bool? ?? true, disableSuperGroupMack: json['disable_supergroup_mack'] as bool? ?? false, + unreadCntThreadingPolicy: + (json['unread_cnt_threading_policy'] as num?)?.toInt() ?? 0, + lastMsgThreadingPolicy: + (json['last_msg_threading_policy'] as num?)?.toInt() ?? 0, ); diff --git a/lib/src/public/main/model/info/file_info.g.dart b/lib/src/public/main/model/info/file_info.g.dart index ff28edeb..b9a9b5f7 100644 --- a/lib/src/public/main/model/info/file_info.g.dart +++ b/lib/src/public/main/model/info/file_info.g.dart @@ -10,7 +10,7 @@ FileInfo _$FileInfoFromJson(Map json) => FileInfo( fileUrl: json['url'] as String?, fileName: json['name'] as String?, mimeType: json['type'] as String?, - fileSize: json['size'] as int?, + fileSize: (json['size'] as num?)?.toInt(), ); Map _$FileInfoToJson(FileInfo instance) => { diff --git a/lib/src/public/main/model/info/mute_info.g.dart b/lib/src/public/main/model/info/mute_info.g.dart index 7d099d8f..12820174 100644 --- a/lib/src/public/main/model/info/mute_info.g.dart +++ b/lib/src/public/main/model/info/mute_info.g.dart @@ -9,7 +9,7 @@ part of 'mute_info.dart'; MuteInfo _$MuteInfoFromJson(Map json) => MuteInfo( isMuted: json['is_muted'] as bool, description: json['description'] as String?, - startAt: json['start_at'] as int?, - endAt: json['end_at'] as int?, - remainingDuration: json['remaining_duration'] as int?, + startAt: (json['start_at'] as num?)?.toInt(), + endAt: (json['end_at'] as num?)?.toInt(), + remainingDuration: (json['remaining_duration'] as num?)?.toInt(), ); diff --git a/lib/src/public/main/model/info/notification_info.g.dart b/lib/src/public/main/model/info/notification_info.g.dart index 08eced89..3c490944 100644 --- a/lib/src/public/main/model/info/notification_info.g.dart +++ b/lib/src/public/main/model/info/notification_info.g.dart @@ -10,6 +10,6 @@ NotificationInfo _$NotificationInfoFromJson(Map json) => NotificationInfo( isEnabled: json['enabled'] as bool, feedChannels: Map.from(json['feed_channels'] as Map), - settingsUpdatedAt: json['settings_updated_at'] as int, + settingsUpdatedAt: (json['settings_updated_at'] as num).toInt(), templateListToken: json['template_list_token'] as String?, ); diff --git a/lib/src/public/main/model/info/scheduled_info.g.dart b/lib/src/public/main/model/info/scheduled_info.g.dart index b8105abb..4f1c6b12 100644 --- a/lib/src/public/main/model/info/scheduled_info.g.dart +++ b/lib/src/public/main/model/info/scheduled_info.g.dart @@ -8,8 +8,8 @@ part of 'scheduled_info.dart'; ScheduledInfo _$ScheduledInfoFromJson(Map json) => ScheduledInfo( - scheduledMessageId: json['scheduled_message_id'] as int, - scheduledAt: json['scheduled_at'] as int, + scheduledMessageId: (json['scheduled_message_id'] as num).toInt(), + scheduledAt: (json['scheduled_at'] as num).toInt(), scheduledStatus: $enumDecode(_$ScheduledStatusEnumMap, json['scheduled_status']), ); diff --git a/lib/src/public/main/model/og/og_image.g.dart b/lib/src/public/main/model/og/og_image.g.dart index 76f29fd1..03b80ee9 100644 --- a/lib/src/public/main/model/og/og_image.g.dart +++ b/lib/src/public/main/model/og/og_image.g.dart @@ -11,8 +11,8 @@ OGImage _$OGImageFromJson(Map json) => OGImage( secureUrl: json['secure_url'] as String?, type: json['type'] as String?, alt: json['alt'] as String?, - width: json['width'] as int? ?? 0, - height: json['height'] as int? ?? 0, + width: (json['width'] as num?)?.toInt() ?? 0, + height: (json['height'] as num?)?.toInt() ?? 0, ); Map _$OGImageToJson(OGImage instance) => { diff --git a/lib/src/public/main/model/poll/poll.g.dart b/lib/src/public/main/model/poll/poll.g.dart index cf6ce76a..72cda526 100644 --- a/lib/src/public/main/model/poll/poll.g.dart +++ b/lib/src/public/main/model/poll/poll.g.dart @@ -7,17 +7,17 @@ part of 'poll.dart'; // ************************************************************************** Poll _$PollFromJson(Map json) => Poll( - id: json['id'] as int, + id: (json['id'] as num).toInt(), title: json['title'] as String? ?? '', - createdAt: json['created_at'] as int, - updatedAt: json['updated_at'] as int, - closeAt: json['close_at'] as int, + createdAt: (json['created_at'] as num).toInt(), + updatedAt: (json['updated_at'] as num).toInt(), + closeAt: (json['close_at'] as num).toInt(), status: $enumDecode(_$PollStatusEnumMap, json['status']), - messageId: json['message_id'] as int?, + messageId: (json['message_id'] as num?)?.toInt(), data: json['data'] == null ? null : PollData.fromJson(json['data'] as Map), - voterCount: json['voter_count'] as int? ?? -1, + voterCount: (json['voter_count'] as num?)?.toInt() ?? -1, options: (json['options'] as List?) ?.map((e) => PollOption.fromJson(e as Map)) .toList() ?? @@ -26,7 +26,7 @@ Poll _$PollFromJson(Map json) => Poll( allowUserSuggestion: json['allow_user_suggestion'] as bool? ?? false, allowMultipleVotes: json['allow_multiple_votes'] as bool? ?? false, votedPollOptionIds: (json['voted_option_ids'] as List?) - ?.map((e) => e as int) + ?.map((e) => (e as num).toInt()) .toList() ?? [], ); diff --git a/lib/src/public/main/model/poll/poll_option.g.dart b/lib/src/public/main/model/poll/poll_option.g.dart index 0ef26609..fab0a296 100644 --- a/lib/src/public/main/model/poll/poll_option.g.dart +++ b/lib/src/public/main/model/poll/poll_option.g.dart @@ -7,13 +7,13 @@ part of 'poll_option.dart'; // ************************************************************************** PollOption _$PollOptionFromJson(Map json) => PollOption( - pollId: json['poll_id'] as int, - id: json['id'] as int, + pollId: (json['poll_id'] as num).toInt(), + id: (json['id'] as num).toInt(), text: json['text'] as String, createdBy: json['created_by'] as String?, - createdAt: json['created_at'] as int, - voteCount: json['vote_count'] as int, - updatedAt: json['updated_at'] as int, + createdAt: (json['created_at'] as num).toInt(), + voteCount: (json['vote_count'] as num).toInt(), + updatedAt: (json['updated_at'] as num).toInt(), ); Map _$PollOptionToJson(PollOption instance) => diff --git a/lib/src/public/main/model/reaction/reaction.g.dart b/lib/src/public/main/model/reaction/reaction.g.dart index e8d29054..c7c651fb 100644 --- a/lib/src/public/main/model/reaction/reaction.g.dart +++ b/lib/src/public/main/model/reaction/reaction.g.dart @@ -12,7 +12,7 @@ Reaction _$ReactionFromJson(Map json) => Reaction( ?.map((e) => e as String) .toList() ?? [], - updatedAt: json['updated_at'] as int, + updatedAt: (json['updated_at'] as num).toInt(), ); Map _$ReactionToJson(Reaction instance) => { diff --git a/lib/src/public/main/model/reaction/reaction_event.g.dart b/lib/src/public/main/model/reaction/reaction_event.g.dart index 66280478..89d5ac3a 100644 --- a/lib/src/public/main/model/reaction/reaction_event.g.dart +++ b/lib/src/public/main/model/reaction/reaction_event.g.dart @@ -13,13 +13,13 @@ ReactionEvent _$ReactionEventFromJson(Map json) => unknownValue: ChannelType.group) ?? ChannelType.group, channelUrl: json['channel_url'] as String? ?? '', - messageId: json['msg_id'] as int? ?? 0, + messageId: (json['msg_id'] as num?)?.toInt() ?? 0, key: json['reaction'] as String? ?? '', userId: json['user_id'] as String? ?? '', operation: $enumDecodeNullable( _$ReactionEventActionEnumMap, json['operation']) ?? ReactionEventAction.delete, - updatedAt: json['updated_at'] as int? ?? 0, + updatedAt: (json['updated_at'] as num?)?.toInt() ?? 0, ); const _$ChannelTypeEnumMap = { diff --git a/lib/src/public/main/model/thread/thread_info.g.dart b/lib/src/public/main/model/thread/thread_info.g.dart index 4253cbea..2eeac829 100644 --- a/lib/src/public/main/model/thread/thread_info.g.dart +++ b/lib/src/public/main/model/thread/thread_info.g.dart @@ -7,13 +7,13 @@ part of 'thread_info.dart'; // ************************************************************************** ThreadInfo _$ThreadInfoFromJson(Map json) => ThreadInfo( - replyCount: json['reply_count'] as int? ?? 0, + replyCount: (json['reply_count'] as num?)?.toInt() ?? 0, mostRepliesUsers: (json['most_replies'] as List?) ?.map((e) => User.fromJson(e as Map)) .toList() ?? const [], - lastRepliedAt: json['last_replied_at'] as int? ?? 0, - updatedAt: json['updated_at'] as int?, + lastRepliedAt: (json['last_replied_at'] as num?)?.toInt() ?? 0, + updatedAt: (json['updated_at'] as num?)?.toInt(), ); Map _$ThreadInfoToJson(ThreadInfo instance) => diff --git a/lib/src/public/main/model/thread/thread_info_updated_event.g.dart b/lib/src/public/main/model/thread/thread_info_updated_event.g.dart index 22072f1a..57a785cb 100644 --- a/lib/src/public/main/model/thread/thread_info_updated_event.g.dart +++ b/lib/src/public/main/model/thread/thread_info_updated_event.g.dart @@ -11,7 +11,7 @@ ThreadInfoUpdateEvent _$ThreadInfoUpdateEventFromJson( ThreadInfoUpdateEvent( threadInfo: ThreadInfo.fromJson(json['thread_info'] as Map), - targetMessageId: json['parent_message_id'] as int, + targetMessageId: (json['parent_message_id'] as num).toInt(), channelType: $enumDecode(_$ChannelTypeEnumMap, json['channel_type']), channelUrl: json['channel_url'] as String, ); diff --git a/lib/src/public/main/params/message/message_list_params.g.dart b/lib/src/public/main/params/message/message_list_params.g.dart index 5f0d515d..efd70a8b 100644 --- a/lib/src/public/main/params/message/message_list_params.g.dart +++ b/lib/src/public/main/params/message/message_list_params.g.dart @@ -14,8 +14,8 @@ MessageListParams _$MessageListParamsFromJson(Map json) => ..includeParentMessageInfo = json['include_parent_message_info'] as bool ..replyType = $enumDecodeNullable(_$ReplyTypeEnumMap, json['include_reply_type']) - ..previousResultSize = json['prev_limit'] as int - ..nextResultSize = json['next_limit'] as int + ..previousResultSize = (json['prev_limit'] as num).toInt() + ..nextResultSize = (json['next_limit'] as num).toInt() ..inclusive = json['include'] as bool ..reverse = json['reverse'] as bool ..messageType = diff --git a/lib/src/public/main/params/message/message_retrieval_params.g.dart b/lib/src/public/main/params/message/message_retrieval_params.g.dart index 49b64892..1aa96740 100644 --- a/lib/src/public/main/params/message/message_retrieval_params.g.dart +++ b/lib/src/public/main/params/message/message_retrieval_params.g.dart @@ -11,7 +11,7 @@ MessageRetrievalParams _$MessageRetrievalParamsFromJson( MessageRetrievalParams( channelType: $enumDecode(_$ChannelTypeEnumMap, json['channel_type']), channelUrl: json['channel_url'] as String, - messageId: json['message_id'] as int, + messageId: (json['message_id'] as num).toInt(), ) ..includeMetaArray = json['with_sorted_meta_array'] as bool ..includeReactions = json['include_reactions'] as bool diff --git a/lib/src/public/main/params/message/scheduled_file_message_update_params.g.dart b/lib/src/public/main/params/message/scheduled_file_message_update_params.g.dart index a8fd9803..959cdf58 100644 --- a/lib/src/public/main/params/message/scheduled_file_message_update_params.g.dart +++ b/lib/src/public/main/params/message/scheduled_file_message_update_params.g.dart @@ -11,9 +11,9 @@ ScheduledFileMessageUpdateParams _$ScheduledFileMessageUpdateParamsFromJson( ScheduledFileMessageUpdateParams( url: json['url'] as String?, fileName: json['file_name'] as String?, - fileSize: json['file_size'] as int?, + fileSize: (json['file_size'] as num?)?.toInt(), mimeType: json['mime_type'] as String?, - scheduledAt: json['scheduled_at'] as int?, + scheduledAt: (json['scheduled_at'] as num?)?.toInt(), customType: json['custom_type'] as String?, data: json['data'] as String?, mentionType: json['mention_type'] as String?, diff --git a/lib/src/public/main/params/message/scheduled_user_message_update_params.g.dart b/lib/src/public/main/params/message/scheduled_user_message_update_params.g.dart index 78a90a6a..cb43630b 100644 --- a/lib/src/public/main/params/message/scheduled_user_message_update_params.g.dart +++ b/lib/src/public/main/params/message/scheduled_user_message_update_params.g.dart @@ -10,7 +10,7 @@ ScheduledUserMessageUpdateParams _$ScheduledUserMessageUpdateParamsFromJson( Map json) => ScheduledUserMessageUpdateParams( message: json['message'] as String?, - scheduledAt: json['scheduled_at'] as int?, + scheduledAt: (json['scheduled_at'] as num?)?.toInt(), customType: json['custom_type'] as String?, data: json['data'] as String?, mentionType: diff --git a/lib/src/public/main/params/message/threaded_message_list_params.g.dart b/lib/src/public/main/params/message/threaded_message_list_params.g.dart index 266dcf36..8407edcd 100644 --- a/lib/src/public/main/params/message/threaded_message_list_params.g.dart +++ b/lib/src/public/main/params/message/threaded_message_list_params.g.dart @@ -15,8 +15,8 @@ ThreadedMessageListParams _$ThreadedMessageListParamsFromJson( ..includeParentMessageInfo = json['include_parent_message_info'] as bool ..replyType = $enumDecodeNullable(_$ReplyTypeEnumMap, json['include_reply_type']) - ..previousResultSize = json['prev_limit'] as int - ..nextResultSize = json['next_limit'] as int + ..previousResultSize = (json['prev_limit'] as num).toInt() + ..nextResultSize = (json['next_limit'] as num).toInt() ..inclusive = json['include'] as bool ..reverse = json['reverse'] as bool ..messageType = diff --git a/lib/src/public/main/params/poll/poll_create_params.g.dart b/lib/src/public/main/params/poll/poll_create_params.g.dart index 8ae216ae..76ddd6f6 100644 --- a/lib/src/public/main/params/poll/poll_create_params.g.dart +++ b/lib/src/public/main/params/poll/poll_create_params.g.dart @@ -16,7 +16,7 @@ PollCreateParams _$PollCreateParamsFromJson(Map json) => : PollData.fromJson(json['data'] as Map), allowUserSuggestion: json['allow_user_suggestion'] as bool?, allowMultipleVotes: json['allow_multiple_votes'] as bool?, - closeAt: json['close_at'] as int? ?? -1, + closeAt: (json['close_at'] as num?)?.toInt() ?? -1, ); Map _$PollCreateParamsToJson(PollCreateParams instance) => diff --git a/lib/src/public/main/params/poll/poll_update_params.g.dart b/lib/src/public/main/params/poll/poll_update_params.g.dart index ef2d7368..bc68f1a9 100644 --- a/lib/src/public/main/params/poll/poll_update_params.g.dart +++ b/lib/src/public/main/params/poll/poll_update_params.g.dart @@ -14,7 +14,7 @@ PollUpdateParams _$PollUpdateParamsFromJson(Map json) => : PollData.fromJson(json['data'] as Map), allowUserSuggestion: json['allow_user_suggestion'] as bool?, allowMultipleVotes: json['allow_multiple_votes'] as bool?, - closeAt: json['close_at'] as int? ?? -1, + closeAt: (json['close_at'] as num?)?.toInt() ?? -1, ); Map _$PollUpdateParamsToJson(PollUpdateParams instance) => diff --git a/pubspec.yaml b/pubspec.yaml index e16d7a11..14c44acd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.26 +version: 4.2.27 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