PeerNotifySettings.deserialize constructor
PeerNotifySettings.deserialize(
- BinaryReader reader
Deserialize.
Implementation
factory PeerNotifySettings.deserialize(BinaryReader reader) {
// Read [PeerNotifySettings] 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 hasIosSoundField = (flags & 8) != 0;
final iosSound =
hasIosSoundField ? reader.readObject() as NotificationSoundBase : null;
final hasAndroidSoundField = (flags & 16) != 0;
final androidSound = hasAndroidSoundField
? reader.readObject() as NotificationSoundBase
: null;
final hasOtherSoundField = (flags & 32) != 0;
final otherSound = hasOtherSoundField
? reader.readObject() as NotificationSoundBase
: null;
final storiesMuted = (flags & 64) != 0;
final storiesHideSender = (flags & 128) != 0;
final hasStoriesIosSoundField = (flags & 256) != 0;
final storiesIosSound = hasStoriesIosSoundField
? reader.readObject() as NotificationSoundBase
: null;
final hasStoriesAndroidSoundField = (flags & 512) != 0;
final storiesAndroidSound = hasStoriesAndroidSoundField
? reader.readObject() as NotificationSoundBase
: null;
final hasStoriesOtherSoundField = (flags & 1024) != 0;
final storiesOtherSound = hasStoriesOtherSoundField
? reader.readObject() as NotificationSoundBase
: null;
// Construct [PeerNotifySettings] object.
final returnValue = PeerNotifySettings(
showPreviews: showPreviews,
silent: silent,
muteUntil: muteUntil,
iosSound: iosSound,
androidSound: androidSound,
otherSound: otherSound,
storiesMuted: storiesMuted,
storiesHideSender: storiesHideSender,
storiesIosSound: storiesIosSound,
storiesAndroidSound: storiesAndroidSound,
storiesOtherSound: storiesOtherSound,
);
// Now return the deserialized [PeerNotifySettings].
return returnValue;
}