public bool ShouldDownload(AutoDownloadMode mode, AutoDownloadChat chat, NetworkType networkType) { bool isWiFi = networkType is NetworkTypeWiFi; bool isCellular = !isWiFi && !(networkType is NetworkTypeNone); bool shouldDownload = false; switch (chat) { case AutoDownloadChat.Contact: if (isCellular) { shouldDownload = (mode & AutoDownloadMode.CellularContacts) != 0; } else if (isWiFi) { shouldDownload = (mode & AutoDownloadMode.WifiContacts) != 0; } break; case AutoDownloadChat.OtherPrivateChat: if (isCellular) { shouldDownload = (mode & AutoDownloadMode.CellularPrivateChats) != 0; } else if (isWiFi) { shouldDownload = (mode & AutoDownloadMode.WifiPrivateChats) != 0; } break; case AutoDownloadChat.Group: if (isCellular) { shouldDownload = (mode & AutoDownloadMode.CellularGroups) != 0; } else if (isWiFi) { shouldDownload = (mode & AutoDownloadMode.WifiGroups) != 0; } break; case AutoDownloadChat.Channel: if (isCellular) { shouldDownload = (mode & AutoDownloadMode.CellularChannels) != 0; } else if (isWiFi) { shouldDownload = (mode & AutoDownloadMode.WifiChannels) != 0; } break; default: break; } return(shouldDownload); }
public bool ShouldDownloadPhoto(AutoDownloadChat chat, NetworkType networkType = null) { if (_disabled) { return(false); } return(ShouldDownload(_photos, chat, networkType)); }
public bool ShouldDownloadAnimation(AutoDownloadChat chat, NetworkType networkType) { if (_disabled) { return(false); } return(ShouldDownload(_animations, chat, networkType)); }
public bool ShouldDownloadVideoNote(AutoDownloadChat chat, NetworkType networkType) { if (_disabled) { return(false); } return(ShouldDownload(_videoNotes, chat, networkType)); }
public bool ShouldDownloadVoiceMessages(AutoDownloadChat chat, NetworkType networkType = null) { if (_disabled) { return(false); } return(ShouldDownload(VoiceMessages, chat, networkType)); }
public bool ShouldDownloadAudio(AutoDownloadChat chat, NetworkType networkType) { if (_disabled) { return(false); } return(ShouldDownload(_audios, chat, networkType)); }
public bool ShouldDownloadDocument(AutoDownloadChat chat, long size, NetworkType networkType = null) { if (_disabled) { return(false); } if (size > _maximumDocumentSize) { return(false); } return(ShouldDownload(_documents, chat, networkType)); }
public bool ShouldDownloadVideo(AutoDownloadChat chat, long size, NetworkType networkType = null) { if (_disabled) { return(false); } if (size > _maximumVideoSize) { return(false); } return(ShouldDownload(_videos, chat, networkType)); }
public bool ShouldDownloadDocument(AutoDownloadChat chat, NetworkType networkType, int size) { if (_disabled) { return(false); } if ((size / 1024f) / 1024f > _maximumDocumentSize) { return(false); } return(ShouldDownload(_documents, chat, networkType)); }
public bool ShouldDownloadVideo(AutoDownloadChat chat, NetworkType networkType, int size) { if (_disabled) { return(false); } if ((size / 1024f) / 1024f > _maximumVideoSize) { return(false); } return(ShouldDownload(_videos, chat, networkType)); }