InputPeerNotifySettings.deserialize constructor

InputPeerNotifySettings.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory InputPeerNotifySettings.deserialize(BinaryReader reader) {
  // Read [InputPeerNotifySettings] fields.
  final flags = reader.readInt32();
  final showPreviews = (flags & 1) != 0;
  final silent = (flags & 2) != 0;
  final hasMuteUntilField = (flags & 4) != 0;
  final muteUntil = hasMuteUntilField ? reader.readDateTime() : null;
  final hasSoundField = (flags & 8) != 0;
  final sound =
      hasSoundField ? reader.readObject() as NotificationSoundBase : null;
  final storiesMuted = (flags & 64) != 0;
  final storiesHideSender = (flags & 128) != 0;
  final hasStoriesSoundField = (flags & 256) != 0;
  final storiesSound = hasStoriesSoundField
      ? reader.readObject() as NotificationSoundBase
      : null;

  // Construct [InputPeerNotifySettings] object.
  final returnValue = InputPeerNotifySettings(
    showPreviews: showPreviews,
    silent: silent,
    muteUntil: muteUntil,
    sound: sound,
    storiesMuted: storiesMuted,
    storiesHideSender: storiesHideSender,
    storiesSound: storiesSound,
  );

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