mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-17 11:00:07 +00:00
32 lines
1.1 KiB
Swift
32 lines
1.1 KiB
Swift
import Foundation
|
|
#if os(macOS)
|
|
import PostboxMac
|
|
#else
|
|
import Postbox
|
|
#endif
|
|
|
|
public struct AutomaticDownloadSettings {
|
|
public let downloadPhotos: Bool
|
|
public let downloadVoiceMessages: Bool
|
|
public let downloadGifs: Bool
|
|
}
|
|
|
|
public struct AccountSettings {
|
|
public let oneToOneChatsAutomaticDownloadSettings: AutomaticDownloadSettings
|
|
public let groupChatsAutomaticDownloadSettings: AutomaticDownloadSettings
|
|
}
|
|
|
|
func defaultAccountSettings() -> AccountSettings {
|
|
return AccountSettings(oneToOneChatsAutomaticDownloadSettings: AutomaticDownloadSettings(downloadPhotos: true, downloadVoiceMessages: true, downloadGifs: true), groupChatsAutomaticDownloadSettings: AutomaticDownloadSettings(downloadPhotos: true, downloadVoiceMessages: true, downloadGifs: true))
|
|
}
|
|
|
|
public extension AccountSettings {
|
|
public func automaticDownloadSettingsForPeerId(_ peerId: PeerId) -> AutomaticDownloadSettings {
|
|
if peerId.namespace == Namespaces.Peer.CloudUser {
|
|
return self.oneToOneChatsAutomaticDownloadSettings
|
|
} else {
|
|
return self.groupChatsAutomaticDownloadSettings
|
|
}
|
|
}
|
|
}
|