mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
28 lines
867 B
Swift
28 lines
867 B
Swift
import Foundation
|
|
#if os(macOS)
|
|
import PostboxMac
|
|
import TelegramApiMac
|
|
#else
|
|
import Postbox
|
|
import TelegramApi
|
|
#endif
|
|
|
|
import SyncCore
|
|
|
|
extension MessageNotificationSettings {
|
|
init(apiSettings: Api.PeerNotifySettings) {
|
|
switch apiSettings {
|
|
case .peerNotifySettingsEmpty:
|
|
self = .defaultSettings
|
|
case let .peerNotifySettings(_, showPreviews, _, muteUntil, sound):
|
|
let displayPreviews: Bool
|
|
if let showPreviews = showPreviews, case .boolFalse = showPreviews {
|
|
displayPreviews = false
|
|
} else {
|
|
displayPreviews = true
|
|
}
|
|
self = MessageNotificationSettings(enabled: muteUntil == 0, displayPreviews: displayPreviews, sound: PeerMessageSound(apiSound: sound ?? "2"))
|
|
}
|
|
}
|
|
}
|