ReactionsNotifySettings.deserialize constructor

ReactionsNotifySettings.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory ReactionsNotifySettings.deserialize(BinaryReader reader) {
  // Read [ReactionsNotifySettings] fields.
  final flags = reader.readInt32();
  final hasMessagesNotifyFromField = (flags & 1) != 0;
  final messagesNotifyFrom = hasMessagesNotifyFromField
      ? reader.readObject() as ReactionNotificationsFromBase
      : null;
  final hasStoriesNotifyFromField = (flags & 2) != 0;
  final storiesNotifyFrom = hasStoriesNotifyFromField
      ? reader.readObject() as ReactionNotificationsFromBase
      : null;
  final hasPollVotesNotifyFromField = (flags & 4) != 0;
  final pollVotesNotifyFrom = hasPollVotesNotifyFromField
      ? reader.readObject() as ReactionNotificationsFromBase
      : null;
  final sound = reader.readObject() as NotificationSoundBase;
  final showPreviews = reader.readBool();

  // Construct [ReactionsNotifySettings] object.
  final returnValue = ReactionsNotifySettings(
    messagesNotifyFrom: messagesNotifyFrom,
    storiesNotifyFrom: storiesNotifyFrom,
    pollVotesNotifyFrom: pollVotesNotifyFrom,
    sound: sound,
    showPreviews: showPreviews,
  );

  // Now return the deserialized [ReactionsNotifySettings].
  return returnValue;
}