mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-18 19:40:19 +00:00
28 lines
1007 B
Swift
28 lines
1007 B
Swift
import Foundation
|
|
import Postbox
|
|
|
|
struct AutomaticDownloadSettings {
|
|
let downloadPhoto: Bool
|
|
let downloadVideo: Bool
|
|
let downloadAudio: Bool
|
|
}
|
|
|
|
struct AccountSettings {
|
|
let oneToOneChatsAutomaticDownloadSettings: AutomaticDownloadSettings
|
|
let groupChatsAutomaticDownloadSettings: AutomaticDownloadSettings
|
|
}
|
|
|
|
func defaultAccountSettings() -> AccountSettings {
|
|
return AccountSettings(oneToOneChatsAutomaticDownloadSettings: AutomaticDownloadSettings(downloadPhoto: true, downloadVideo: false, downloadAudio: true), groupChatsAutomaticDownloadSettings: AutomaticDownloadSettings(downloadPhoto: true, downloadVideo: false, downloadAudio: true))
|
|
}
|
|
|
|
extension AccountSettings {
|
|
func automaticDownloadSettingsForPeerId(_ peerId: PeerId) -> AutomaticDownloadSettings {
|
|
if peerId.namespace == Namespaces.Peer.CloudUser {
|
|
return self.oneToOneChatsAutomaticDownloadSettings
|
|
} else {
|
|
return self.groupChatsAutomaticDownloadSettings
|
|
}
|
|
}
|
|
}
|