mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Update API
This commit is contained in:
parent
e9228cb9fa
commit
d3b3d991bd
@ -361,7 +361,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) }
|
dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) }
|
||||||
dict[-571955892] = { return Api.InputPeer.parse_inputPeerUser($0) }
|
dict[-571955892] = { return Api.InputPeer.parse_inputPeerUser($0) }
|
||||||
dict[-1468331492] = { return Api.InputPeer.parse_inputPeerUserFromMessage($0) }
|
dict[-1468331492] = { return Api.InputPeer.parse_inputPeerUserFromMessage($0) }
|
||||||
dict[-551616469] = { return Api.InputPeerNotifySettings.parse_inputPeerNotifySettings($0) }
|
dict[-505078139] = { return Api.InputPeerNotifySettings.parse_inputPeerNotifySettings($0) }
|
||||||
dict[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) }
|
dict[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) }
|
||||||
dict[1001634122] = { return Api.InputPhoto.parse_inputPhoto($0) }
|
dict[1001634122] = { return Api.InputPhoto.parse_inputPhoto($0) }
|
||||||
dict[483901197] = { return Api.InputPhoto.parse_inputPhotoEmpty($0) }
|
dict[483901197] = { return Api.InputPhoto.parse_inputPhotoEmpty($0) }
|
||||||
@ -528,7 +528,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-156940077] = { return Api.MessageMedia.parse_messageMediaInvoice($0) }
|
dict[-156940077] = { return Api.MessageMedia.parse_messageMediaInvoice($0) }
|
||||||
dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) }
|
dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) }
|
||||||
dict[1272375192] = { return Api.MessageMedia.parse_messageMediaPoll($0) }
|
dict[1272375192] = { return Api.MessageMedia.parse_messageMediaPoll($0) }
|
||||||
dict[-946147823] = { return Api.MessageMedia.parse_messageMediaStory($0) }
|
dict[-877523576] = { return Api.MessageMedia.parse_messageMediaStory($0) }
|
||||||
dict[-1618676578] = { return Api.MessageMedia.parse_messageMediaUnsupported($0) }
|
dict[-1618676578] = { return Api.MessageMedia.parse_messageMediaUnsupported($0) }
|
||||||
dict[784356159] = { return Api.MessageMedia.parse_messageMediaVenue($0) }
|
dict[784356159] = { return Api.MessageMedia.parse_messageMediaVenue($0) }
|
||||||
dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) }
|
dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) }
|
||||||
@ -619,7 +619,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-386039788] = { return Api.PeerBlocked.parse_peerBlocked($0) }
|
dict[-386039788] = { return Api.PeerBlocked.parse_peerBlocked($0) }
|
||||||
dict[-901375139] = { return Api.PeerLocated.parse_peerLocated($0) }
|
dict[-901375139] = { return Api.PeerLocated.parse_peerLocated($0) }
|
||||||
dict[-118740917] = { return Api.PeerLocated.parse_peerSelfLocated($0) }
|
dict[-118740917] = { return Api.PeerLocated.parse_peerSelfLocated($0) }
|
||||||
dict[-1472527322] = { return Api.PeerNotifySettings.parse_peerNotifySettings($0) }
|
dict[1826385490] = { return Api.PeerNotifySettings.parse_peerNotifySettings($0) }
|
||||||
dict[-1525149427] = { return Api.PeerSettings.parse_peerSettings($0) }
|
dict[-1525149427] = { return Api.PeerSettings.parse_peerSettings($0) }
|
||||||
dict[-1770029977] = { return Api.PhoneCall.parse_phoneCall($0) }
|
dict[-1770029977] = { return Api.PhoneCall.parse_phoneCall($0) }
|
||||||
dict[912311057] = { return Api.PhoneCall.parse_phoneCallAccepted($0) }
|
dict[912311057] = { return Api.PhoneCall.parse_phoneCallAccepted($0) }
|
||||||
|
@ -744,7 +744,7 @@ public extension Api {
|
|||||||
case messageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.WebDocument?, receiptMsgId: Int32?, currency: String, totalAmount: Int64, startParam: String, extendedMedia: Api.MessageExtendedMedia?)
|
case messageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.WebDocument?, receiptMsgId: Int32?, currency: String, totalAmount: Int64, startParam: String, extendedMedia: Api.MessageExtendedMedia?)
|
||||||
case messageMediaPhoto(flags: Int32, photo: Api.Photo?, ttlSeconds: Int32?)
|
case messageMediaPhoto(flags: Int32, photo: Api.Photo?, ttlSeconds: Int32?)
|
||||||
case messageMediaPoll(poll: Api.Poll, results: Api.PollResults)
|
case messageMediaPoll(poll: Api.Poll, results: Api.PollResults)
|
||||||
case messageMediaStory(userId: Int64, id: Int32)
|
case messageMediaStory(flags: Int32, userId: Int64, id: Int32, story: Api.StoryItem?)
|
||||||
case messageMediaUnsupported
|
case messageMediaUnsupported
|
||||||
case messageMediaVenue(geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String)
|
case messageMediaVenue(geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String)
|
||||||
case messageMediaWebPage(webpage: Api.WebPage)
|
case messageMediaWebPage(webpage: Api.WebPage)
|
||||||
@ -834,12 +834,14 @@ public extension Api {
|
|||||||
poll.serialize(buffer, true)
|
poll.serialize(buffer, true)
|
||||||
results.serialize(buffer, true)
|
results.serialize(buffer, true)
|
||||||
break
|
break
|
||||||
case .messageMediaStory(let userId, let id):
|
case .messageMediaStory(let flags, let userId, let id, let story):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-946147823)
|
buffer.appendInt32(-877523576)
|
||||||
}
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt64(userId, buffer: buffer, boxed: false)
|
serializeInt64(userId, buffer: buffer, boxed: false)
|
||||||
serializeInt32(id, buffer: buffer, boxed: false)
|
serializeInt32(id, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {story!.serialize(buffer, true)}
|
||||||
break
|
break
|
||||||
case .messageMediaUnsupported:
|
case .messageMediaUnsupported:
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -889,8 +891,8 @@ public extension Api {
|
|||||||
return ("messageMediaPhoto", [("flags", flags as Any), ("photo", photo as Any), ("ttlSeconds", ttlSeconds as Any)])
|
return ("messageMediaPhoto", [("flags", flags as Any), ("photo", photo as Any), ("ttlSeconds", ttlSeconds as Any)])
|
||||||
case .messageMediaPoll(let poll, let results):
|
case .messageMediaPoll(let poll, let results):
|
||||||
return ("messageMediaPoll", [("poll", poll as Any), ("results", results as Any)])
|
return ("messageMediaPoll", [("poll", poll as Any), ("results", results as Any)])
|
||||||
case .messageMediaStory(let userId, let id):
|
case .messageMediaStory(let flags, let userId, let id, let story):
|
||||||
return ("messageMediaStory", [("userId", userId as Any), ("id", id as Any)])
|
return ("messageMediaStory", [("flags", flags as Any), ("userId", userId as Any), ("id", id as Any), ("story", story as Any)])
|
||||||
case .messageMediaUnsupported:
|
case .messageMediaUnsupported:
|
||||||
return ("messageMediaUnsupported", [])
|
return ("messageMediaUnsupported", [])
|
||||||
case .messageMediaVenue(let geo, let title, let address, let provider, let venueId, let venueType):
|
case .messageMediaVenue(let geo, let title, let address, let provider, let venueId, let venueType):
|
||||||
@ -1092,14 +1094,22 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_messageMediaStory(_ reader: BufferReader) -> MessageMedia? {
|
public static func parse_messageMediaStory(_ reader: BufferReader) -> MessageMedia? {
|
||||||
var _1: Int64?
|
var _1: Int32?
|
||||||
_1 = reader.readInt64()
|
_1 = reader.readInt32()
|
||||||
var _2: Int32?
|
var _2: Int64?
|
||||||
_2 = reader.readInt32()
|
_2 = reader.readInt64()
|
||||||
|
var _3: Int32?
|
||||||
|
_3 = reader.readInt32()
|
||||||
|
var _4: Api.StoryItem?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_4 = Api.parse(reader, signature: signature) as? Api.StoryItem
|
||||||
|
} }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
if _c1 && _c2 {
|
let _c3 = _3 != nil
|
||||||
return Api.MessageMedia.messageMediaStory(userId: _1!, id: _2!)
|
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 {
|
||||||
|
return Api.MessageMedia.messageMediaStory(flags: _1!, userId: _2!, id: _3!, story: _4)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -754,13 +754,13 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
enum PeerNotifySettings: TypeConstructorDescription {
|
enum PeerNotifySettings: TypeConstructorDescription {
|
||||||
case peerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, iosSound: Api.NotificationSound?, androidSound: Api.NotificationSound?, otherSound: Api.NotificationSound?)
|
case peerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, iosSound: Api.NotificationSound?, androidSound: Api.NotificationSound?, otherSound: Api.NotificationSound?, storiesMuted: Api.Bool?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .peerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let iosSound, let androidSound, let otherSound):
|
case .peerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let iosSound, let androidSound, let otherSound, let storiesMuted):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-1472527322)
|
buffer.appendInt32(1826385490)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 0) != 0 {showPreviews!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 0) != 0 {showPreviews!.serialize(buffer, true)}
|
||||||
@ -769,14 +769,15 @@ public extension Api {
|
|||||||
if Int(flags) & Int(1 << 3) != 0 {iosSound!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 3) != 0 {iosSound!.serialize(buffer, true)}
|
||||||
if Int(flags) & Int(1 << 4) != 0 {androidSound!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 4) != 0 {androidSound!.serialize(buffer, true)}
|
||||||
if Int(flags) & Int(1 << 5) != 0 {otherSound!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 5) != 0 {otherSound!.serialize(buffer, true)}
|
||||||
|
if Int(flags) & Int(1 << 6) != 0 {storiesMuted!.serialize(buffer, true)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .peerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let iosSound, let androidSound, let otherSound):
|
case .peerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let iosSound, let androidSound, let otherSound, let storiesMuted):
|
||||||
return ("peerNotifySettings", [("flags", flags as Any), ("showPreviews", showPreviews as Any), ("silent", silent as Any), ("muteUntil", muteUntil as Any), ("iosSound", iosSound as Any), ("androidSound", androidSound as Any), ("otherSound", otherSound as Any)])
|
return ("peerNotifySettings", [("flags", flags as Any), ("showPreviews", showPreviews as Any), ("silent", silent as Any), ("muteUntil", muteUntil as Any), ("iosSound", iosSound as Any), ("androidSound", androidSound as Any), ("otherSound", otherSound as Any), ("storiesMuted", storiesMuted as Any)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,6 +806,10 @@ public extension Api {
|
|||||||
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
|
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
|
||||||
_7 = Api.parse(reader, signature: signature) as? Api.NotificationSound
|
_7 = Api.parse(reader, signature: signature) as? Api.NotificationSound
|
||||||
} }
|
} }
|
||||||
|
var _8: Api.Bool?
|
||||||
|
if Int(_1!) & Int(1 << 6) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_8 = Api.parse(reader, signature: signature) as? Api.Bool
|
||||||
|
} }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
||||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||||
@ -812,8 +817,9 @@ public extension Api {
|
|||||||
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
|
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
|
||||||
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
|
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
|
||||||
let _c7 = (Int(_1!) & Int(1 << 5) == 0) || _7 != nil
|
let _c7 = (Int(_1!) & Int(1 << 5) == 0) || _7 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
let _c8 = (Int(_1!) & Int(1 << 6) == 0) || _8 != nil
|
||||||
return Api.PeerNotifySettings.peerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, iosSound: _5, androidSound: _6, otherSound: _7)
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||||
|
return Api.PeerNotifySettings.peerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, iosSound: _5, androidSound: _6, otherSound: _7, storiesMuted: _8)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -278,27 +278,28 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
enum InputPeerNotifySettings: TypeConstructorDescription {
|
enum InputPeerNotifySettings: TypeConstructorDescription {
|
||||||
case inputPeerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, sound: Api.NotificationSound?)
|
case inputPeerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, sound: Api.NotificationSound?, storiesMuted: Api.Bool?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound):
|
case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound, let storiesMuted):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-551616469)
|
buffer.appendInt32(-505078139)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 0) != 0 {showPreviews!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 0) != 0 {showPreviews!.serialize(buffer, true)}
|
||||||
if Int(flags) & Int(1 << 1) != 0 {silent!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 1) != 0 {silent!.serialize(buffer, true)}
|
||||||
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(muteUntil!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(muteUntil!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 3) != 0 {sound!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 3) != 0 {sound!.serialize(buffer, true)}
|
||||||
|
if Int(flags) & Int(1 << 6) != 0 {storiesMuted!.serialize(buffer, true)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound):
|
case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound, let storiesMuted):
|
||||||
return ("inputPeerNotifySettings", [("flags", flags as Any), ("showPreviews", showPreviews as Any), ("silent", silent as Any), ("muteUntil", muteUntil as Any), ("sound", sound as Any)])
|
return ("inputPeerNotifySettings", [("flags", flags as Any), ("showPreviews", showPreviews as Any), ("silent", silent as Any), ("muteUntil", muteUntil as Any), ("sound", sound as Any), ("storiesMuted", storiesMuted as Any)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,13 +320,18 @@ public extension Api {
|
|||||||
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
|
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
|
||||||
_5 = Api.parse(reader, signature: signature) as? Api.NotificationSound
|
_5 = Api.parse(reader, signature: signature) as? Api.NotificationSound
|
||||||
} }
|
} }
|
||||||
|
var _6: Api.Bool?
|
||||||
|
if Int(_1!) & Int(1 << 6) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_6 = Api.parse(reader, signature: signature) as? Api.Bool
|
||||||
|
} }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
||||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||||
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
|
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
|
||||||
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
|
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
let _c6 = (Int(_1!) & Int(1 << 6) == 0) || _6 != nil
|
||||||
return Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, sound: _5)
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||||
|
return Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, sound: _5, storiesMuted: _6)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -380,7 +380,7 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI
|
|||||||
}
|
}
|
||||||
case let .messageMediaDice(value, emoticon):
|
case let .messageMediaDice(value, emoticon):
|
||||||
return (TelegramMediaDice(emoji: emoticon, value: value), nil, nil, nil)
|
return (TelegramMediaDice(emoji: emoticon, value: value), nil, nil, nil)
|
||||||
case let .messageMediaStory(userId, id):
|
case let .messageMediaStory(_, userId, id, _):
|
||||||
return (TelegramMediaStory(storyId: StoryId(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), id: id)), nil, nil, nil)
|
return (TelegramMediaStory(storyId: StoryId(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), id: id)), nil, nil, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import TelegramApi
|
|||||||
extension TelegramPeerNotificationSettings {
|
extension TelegramPeerNotificationSettings {
|
||||||
convenience init(apiSettings: Api.PeerNotifySettings) {
|
convenience init(apiSettings: Api.PeerNotifySettings) {
|
||||||
switch apiSettings {
|
switch apiSettings {
|
||||||
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound):
|
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound, storiesMuted):
|
||||||
let sound: Api.NotificationSound?
|
let sound: Api.NotificationSound?
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
sound = iosSound
|
sound = iosSound
|
||||||
@ -34,7 +34,13 @@ extension TelegramPeerNotificationSettings {
|
|||||||
} else {
|
} else {
|
||||||
displayPreviews = .default
|
displayPreviews = .default
|
||||||
}
|
}
|
||||||
self.init(muteState: muteState, messageSound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault), displayPreviews: displayPreviews)
|
|
||||||
|
var storiesMutedValue: Bool?
|
||||||
|
if let storiesMuted = storiesMuted {
|
||||||
|
storiesMutedValue = storiesMuted == .boolTrue
|
||||||
|
}
|
||||||
|
|
||||||
|
self.init(muteState: muteState, messageSound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault), displayPreviews: displayPreviews, storiesMuted: storiesMutedValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import TelegramApi
|
|||||||
extension MessageNotificationSettings {
|
extension MessageNotificationSettings {
|
||||||
init(apiSettings: Api.PeerNotifySettings) {
|
init(apiSettings: Api.PeerNotifySettings) {
|
||||||
switch apiSettings {
|
switch apiSettings {
|
||||||
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound):
|
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound, storiesMuted):
|
||||||
let sound: Api.NotificationSound?
|
let sound: Api.NotificationSound?
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
sound = iosSound
|
sound = iosSound
|
||||||
@ -19,7 +19,11 @@ extension MessageNotificationSettings {
|
|||||||
} else {
|
} else {
|
||||||
displayPreviews = true
|
displayPreviews = true
|
||||||
}
|
}
|
||||||
self = MessageNotificationSettings(enabled: muteUntil == 0, displayPreviews: displayPreviews, sound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault))
|
var storiesMutedValue: Bool?
|
||||||
|
if let storiesMuted = storiesMuted {
|
||||||
|
storiesMutedValue = storiesMuted == .boolTrue
|
||||||
|
}
|
||||||
|
self = MessageNotificationSettings(enabled: muteUntil == 0, displayPreviews: displayPreviews, sound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault), storiesMuted: storiesMutedValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ private func fetchedNotificationSettings(network: Network) -> Signal<GlobalNotif
|
|||||||
|> map { chats, users, channels, contactsJoinedMuted in
|
|> map { chats, users, channels, contactsJoinedMuted in
|
||||||
let chatsSettings: MessageNotificationSettings
|
let chatsSettings: MessageNotificationSettings
|
||||||
switch chats {
|
switch chats {
|
||||||
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound):
|
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound, storiesMuted):
|
||||||
let sound: Api.NotificationSound?
|
let sound: Api.NotificationSound?
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
sound = iosSound
|
sound = iosSound
|
||||||
@ -136,12 +136,18 @@ private func fetchedNotificationSettings(network: Network) -> Signal<GlobalNotif
|
|||||||
} else {
|
} else {
|
||||||
displayPreviews = true
|
displayPreviews = true
|
||||||
}
|
}
|
||||||
chatsSettings = MessageNotificationSettings(enabled: enabled, displayPreviews: displayPreviews, sound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault))
|
|
||||||
|
var storiesMutedValue: Bool?
|
||||||
|
if let storiesMuted = storiesMuted {
|
||||||
|
storiesMutedValue = storiesMuted == .boolTrue
|
||||||
|
}
|
||||||
|
|
||||||
|
chatsSettings = MessageNotificationSettings(enabled: enabled, displayPreviews: displayPreviews, sound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault), storiesMuted: storiesMutedValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
let userSettings: MessageNotificationSettings
|
let userSettings: MessageNotificationSettings
|
||||||
switch users {
|
switch users {
|
||||||
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound):
|
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound, storiesMuted):
|
||||||
let sound: Api.NotificationSound?
|
let sound: Api.NotificationSound?
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
sound = iosSound
|
sound = iosSound
|
||||||
@ -161,12 +167,18 @@ private func fetchedNotificationSettings(network: Network) -> Signal<GlobalNotif
|
|||||||
} else {
|
} else {
|
||||||
displayPreviews = true
|
displayPreviews = true
|
||||||
}
|
}
|
||||||
userSettings = MessageNotificationSettings(enabled: enabled, displayPreviews: displayPreviews, sound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault))
|
|
||||||
|
var storiesMutedValue: Bool?
|
||||||
|
if let storiesMuted = storiesMuted {
|
||||||
|
storiesMutedValue = storiesMuted == .boolTrue
|
||||||
|
}
|
||||||
|
|
||||||
|
userSettings = MessageNotificationSettings(enabled: enabled, displayPreviews: displayPreviews, sound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault), storiesMuted: storiesMutedValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
let channelSettings: MessageNotificationSettings
|
let channelSettings: MessageNotificationSettings
|
||||||
switch channels {
|
switch channels {
|
||||||
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound):
|
case let .peerNotifySettings(_, showPreviews, _, muteUntil, iosSound, _, desktopSound, storiesMuted):
|
||||||
let sound: Api.NotificationSound?
|
let sound: Api.NotificationSound?
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
sound = iosSound
|
sound = iosSound
|
||||||
@ -186,7 +198,13 @@ private func fetchedNotificationSettings(network: Network) -> Signal<GlobalNotif
|
|||||||
} else {
|
} else {
|
||||||
displayPreviews = true
|
displayPreviews = true
|
||||||
}
|
}
|
||||||
channelSettings = MessageNotificationSettings(enabled: enabled, displayPreviews: displayPreviews, sound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault))
|
|
||||||
|
var storiesMutedValue: Bool?
|
||||||
|
if let storiesMuted = storiesMuted {
|
||||||
|
storiesMutedValue = storiesMuted == .boolTrue
|
||||||
|
}
|
||||||
|
|
||||||
|
channelSettings = MessageNotificationSettings(enabled: enabled, displayPreviews: displayPreviews, sound: PeerMessageSound(apiSound: sound ?? .notificationSoundDefault), storiesMuted: storiesMutedValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
return GlobalNotificationSettingsSet(privateChats: userSettings, groupChats: chatsSettings, channels: channelSettings, contactsJoined: contactsJoinedMuted == .boolFalse)
|
return GlobalNotificationSettingsSet(privateChats: userSettings, groupChats: chatsSettings, channels: channelSettings, contactsJoined: contactsJoinedMuted == .boolFalse)
|
||||||
@ -209,7 +227,14 @@ private func apiInputPeerNotifySettings(_ settings: MessageNotificationSettings)
|
|||||||
if sound != nil {
|
if sound != nil {
|
||||||
flags |= (1 << 3)
|
flags |= (1 << 3)
|
||||||
}
|
}
|
||||||
return .inputPeerNotifySettings(flags: flags, showPreviews: settings.displayPreviews ? .boolTrue : .boolFalse, silent: nil, muteUntil: muteUntil, sound: sound)
|
|
||||||
|
var storiesMuted: Api.Bool?
|
||||||
|
if let storiesMutedValue = settings.storiesMuted {
|
||||||
|
flags |= (1 << 6)
|
||||||
|
storiesMuted = storiesMutedValue ? .boolTrue : .boolFalse
|
||||||
|
}
|
||||||
|
|
||||||
|
return .inputPeerNotifySettings(flags: flags, showPreviews: settings.displayPreviews ? .boolTrue : .boolFalse, silent: nil, muteUntil: muteUntil, sound: sound, storiesMuted: storiesMuted)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func pushedNotificationSettings(network: Network, settings: GlobalNotificationSettingsSet) -> Signal<Void, NoError> {
|
private func pushedNotificationSettings(network: Network, settings: GlobalNotificationSettingsSet) -> Signal<Void, NoError> {
|
||||||
|
@ -130,7 +130,13 @@ func pushPeerNotificationSettings(postbox: Postbox, network: Network, peerId: Pe
|
|||||||
if sound != nil {
|
if sound != nil {
|
||||||
flags |= (1 << 3)
|
flags |= (1 << 3)
|
||||||
}
|
}
|
||||||
let inputSettings = Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: flags, showPreviews: showPreviews, silent: nil, muteUntil: muteUntil, sound: sound)
|
var storiesMuted: Api.Bool?
|
||||||
|
if let storiesMutedValue = settings.storiesMuted {
|
||||||
|
flags |= (1 << 6)
|
||||||
|
storiesMuted = storiesMutedValue ? .boolTrue : .boolFalse
|
||||||
|
}
|
||||||
|
|
||||||
|
let inputSettings = Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: flags, showPreviews: showPreviews, silent: nil, muteUntil: muteUntil, sound: sound, storiesMuted: storiesMuted)
|
||||||
return network.request(Api.functions.account.updateNotifySettings(peer: .inputNotifyForumTopic(peer: inputPeer, topMsgId: Int32(clamping: threadId)), settings: inputSettings))
|
return network.request(Api.functions.account.updateNotifySettings(peer: .inputNotifyForumTopic(peer: inputPeer, topMsgId: Int32(clamping: threadId)), settings: inputSettings))
|
||||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||||
return .single(.boolFalse)
|
return .single(.boolFalse)
|
||||||
@ -173,7 +179,12 @@ func pushPeerNotificationSettings(postbox: Postbox, network: Network, peerId: Pe
|
|||||||
if sound != nil {
|
if sound != nil {
|
||||||
flags |= (1 << 3)
|
flags |= (1 << 3)
|
||||||
}
|
}
|
||||||
let inputSettings = Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: flags, showPreviews: showPreviews, silent: nil, muteUntil: muteUntil, sound: sound)
|
var storiesMuted: Api.Bool?
|
||||||
|
if let storiesMutedValue = settings.storiesMuted {
|
||||||
|
flags |= (1 << 6)
|
||||||
|
storiesMuted = storiesMutedValue ? .boolTrue : .boolFalse
|
||||||
|
}
|
||||||
|
let inputSettings = Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: flags, showPreviews: showPreviews, silent: nil, muteUntil: muteUntil, sound: sound, storiesMuted: storiesMuted)
|
||||||
return network.request(Api.functions.account.updateNotifySettings(peer: .inputNotifyPeer(peer: inputPeer), settings: inputSettings))
|
return network.request(Api.functions.account.updateNotifySettings(peer: .inputNotifyPeer(peer: inputPeer), settings: inputSettings))
|
||||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||||
return .single(.boolFalse)
|
return .single(.boolFalse)
|
||||||
|
@ -4,15 +4,17 @@ public struct MessageNotificationSettings: Codable, Equatable {
|
|||||||
public var enabled: Bool
|
public var enabled: Bool
|
||||||
public var displayPreviews: Bool
|
public var displayPreviews: Bool
|
||||||
public var sound: PeerMessageSound
|
public var sound: PeerMessageSound
|
||||||
|
public var storiesMuted: Bool?
|
||||||
|
|
||||||
public static var defaultSettings: MessageNotificationSettings {
|
public static var defaultSettings: MessageNotificationSettings {
|
||||||
return MessageNotificationSettings(enabled: true, displayPreviews: true, sound: defaultCloudPeerNotificationSound)
|
return MessageNotificationSettings(enabled: true, displayPreviews: true, sound: defaultCloudPeerNotificationSound, storiesMuted: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(enabled: Bool, displayPreviews: Bool, sound: PeerMessageSound) {
|
public init(enabled: Bool, displayPreviews: Bool, sound: PeerMessageSound, storiesMuted: Bool?) {
|
||||||
self.enabled = enabled
|
self.enabled = enabled
|
||||||
self.displayPreviews = displayPreviews
|
self.displayPreviews = displayPreviews
|
||||||
self.sound = sound
|
self.sound = sound
|
||||||
|
self.storiesMuted = storiesMuted
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
@ -22,6 +24,8 @@ public struct MessageNotificationSettings: Codable, Equatable {
|
|||||||
self.displayPreviews = ((try? container.decode(Int32.self, forKey: "p")) ?? 0) != 0
|
self.displayPreviews = ((try? container.decode(Int32.self, forKey: "p")) ?? 0) != 0
|
||||||
|
|
||||||
self.sound = try PeerMessageSound.decodeInline(container)
|
self.sound = try PeerMessageSound.decodeInline(container)
|
||||||
|
|
||||||
|
self.storiesMuted = try? container.decodeIfPresent(Bool.self, forKey: "st")
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
@ -30,6 +34,7 @@ public struct MessageNotificationSettings: Codable, Equatable {
|
|||||||
try container.encode((self.enabled ? 1 : 0) as Int32, forKey: "e")
|
try container.encode((self.enabled ? 1 : 0) as Int32, forKey: "e")
|
||||||
try container.encode((self.displayPreviews ? 1 : 0) as Int32, forKey: "p")
|
try container.encode((self.displayPreviews ? 1 : 0) as Int32, forKey: "p")
|
||||||
try self.sound.encodeInline(&container)
|
try self.sound.encodeInline(&container)
|
||||||
|
try container.encodeIfPresent(self.storiesMuted, forKey: "st")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,9 +392,10 @@ public final class TelegramPeerNotificationSettings: PeerNotificationSettings, C
|
|||||||
public let muteState: PeerMuteState
|
public let muteState: PeerMuteState
|
||||||
public let messageSound: PeerMessageSound
|
public let messageSound: PeerMessageSound
|
||||||
public let displayPreviews: PeerNotificationDisplayPreviews
|
public let displayPreviews: PeerNotificationDisplayPreviews
|
||||||
|
public let storiesMuted: Bool?
|
||||||
|
|
||||||
public static var defaultSettings: TelegramPeerNotificationSettings {
|
public static var defaultSettings: TelegramPeerNotificationSettings {
|
||||||
return TelegramPeerNotificationSettings(muteState: .unmuted, messageSound: .default, displayPreviews: .default)
|
return TelegramPeerNotificationSettings(muteState: .unmuted, messageSound: .default, displayPreviews: .default, storiesMuted: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func isRemovedFromTotalUnreadCount(`default`: Bool) -> Bool {
|
public func isRemovedFromTotalUnreadCount(`default`: Bool) -> Bool {
|
||||||
@ -416,16 +417,18 @@ public final class TelegramPeerNotificationSettings: PeerNotificationSettings, C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(muteState: PeerMuteState, messageSound: PeerMessageSound, displayPreviews: PeerNotificationDisplayPreviews) {
|
public init(muteState: PeerMuteState, messageSound: PeerMessageSound, displayPreviews: PeerNotificationDisplayPreviews, storiesMuted: Bool?) {
|
||||||
self.muteState = muteState
|
self.muteState = muteState
|
||||||
self.messageSound = messageSound
|
self.messageSound = messageSound
|
||||||
self.displayPreviews = displayPreviews
|
self.displayPreviews = displayPreviews
|
||||||
|
self.storiesMuted = storiesMuted
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
self.muteState = PeerMuteState.decodeInline(decoder)
|
self.muteState = PeerMuteState.decodeInline(decoder)
|
||||||
self.messageSound = PeerMessageSound.decodeInline(decoder)
|
self.messageSound = PeerMessageSound.decodeInline(decoder)
|
||||||
self.displayPreviews = PeerNotificationDisplayPreviews.decodeInline(decoder)
|
self.displayPreviews = PeerNotificationDisplayPreviews.decodeInline(decoder)
|
||||||
|
self.storiesMuted = decoder.decodeOptionalBoolForKey("stm")
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
@ -434,6 +437,7 @@ public final class TelegramPeerNotificationSettings: PeerNotificationSettings, C
|
|||||||
self.muteState = try container.decode(PeerMuteState.self, forKey: "muteState")
|
self.muteState = try container.decode(PeerMuteState.self, forKey: "muteState")
|
||||||
self.messageSound = try container.decode(PeerMessageSound.self, forKey: "messageSound")
|
self.messageSound = try container.decode(PeerMessageSound.self, forKey: "messageSound")
|
||||||
self.displayPreviews = try container.decode(PeerNotificationDisplayPreviews.self, forKey: "displayPreviews")
|
self.displayPreviews = try container.decode(PeerNotificationDisplayPreviews.self, forKey: "displayPreviews")
|
||||||
|
self.storiesMuted = try? container.decodeIfPresent(Bool.self, forKey: "stm")
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
@ -442,12 +446,18 @@ public final class TelegramPeerNotificationSettings: PeerNotificationSettings, C
|
|||||||
try container.encode(self.muteState, forKey: "muteState")
|
try container.encode(self.muteState, forKey: "muteState")
|
||||||
try container.encode(self.messageSound, forKey: "messageSound")
|
try container.encode(self.messageSound, forKey: "messageSound")
|
||||||
try container.encode(self.displayPreviews, forKey: "displayPreviews")
|
try container.encode(self.displayPreviews, forKey: "displayPreviews")
|
||||||
|
try container.encodeIfPresent(self.storiesMuted, forKey: "stm")
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(_ encoder: PostboxEncoder) {
|
public func encode(_ encoder: PostboxEncoder) {
|
||||||
self.muteState.encodeInline(encoder)
|
self.muteState.encodeInline(encoder)
|
||||||
self.messageSound.encodeInline(encoder)
|
self.messageSound.encodeInline(encoder)
|
||||||
self.displayPreviews.encodeInline(encoder)
|
self.displayPreviews.encodeInline(encoder)
|
||||||
|
if let storiesMuted = self.storiesMuted {
|
||||||
|
encoder.encodeBool(storiesMuted, forKey: "stm")
|
||||||
|
} else {
|
||||||
|
encoder.encodeNil(forKey: "stm")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func isEqual(to: PeerNotificationSettings) -> Bool {
|
public func isEqual(to: PeerNotificationSettings) -> Bool {
|
||||||
@ -459,18 +469,22 @@ public final class TelegramPeerNotificationSettings: PeerNotificationSettings, C
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedMuteState(_ muteState: PeerMuteState) -> TelegramPeerNotificationSettings {
|
public func withUpdatedMuteState(_ muteState: PeerMuteState) -> TelegramPeerNotificationSettings {
|
||||||
return TelegramPeerNotificationSettings(muteState: muteState, messageSound: self.messageSound, displayPreviews: self.displayPreviews)
|
return TelegramPeerNotificationSettings(muteState: muteState, messageSound: self.messageSound, displayPreviews: self.displayPreviews, storiesMuted: self.storiesMuted)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedMessageSound(_ messageSound: PeerMessageSound) -> TelegramPeerNotificationSettings {
|
public func withUpdatedMessageSound(_ messageSound: PeerMessageSound) -> TelegramPeerNotificationSettings {
|
||||||
return TelegramPeerNotificationSettings(muteState: self.muteState, messageSound: messageSound, displayPreviews: self.displayPreviews)
|
return TelegramPeerNotificationSettings(muteState: self.muteState, messageSound: messageSound, displayPreviews: self.displayPreviews, storiesMuted: self.storiesMuted)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdatedDisplayPreviews(_ displayPreviews: PeerNotificationDisplayPreviews) -> TelegramPeerNotificationSettings {
|
public func withUpdatedDisplayPreviews(_ displayPreviews: PeerNotificationDisplayPreviews) -> TelegramPeerNotificationSettings {
|
||||||
return TelegramPeerNotificationSettings(muteState: self.muteState, messageSound: self.messageSound, displayPreviews: displayPreviews)
|
return TelegramPeerNotificationSettings(muteState: self.muteState, messageSound: self.messageSound, displayPreviews: displayPreviews, storiesMuted: self.storiesMuted)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func withUpdatedStoriesMuted(_ storiesMuted: Bool?) -> TelegramPeerNotificationSettings {
|
||||||
|
return TelegramPeerNotificationSettings(muteState: self.muteState, messageSound: self.messageSound, displayPreviews: self.displayPreviews, storiesMuted: storiesMuted)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func ==(lhs: TelegramPeerNotificationSettings, rhs: TelegramPeerNotificationSettings) -> Bool {
|
public static func ==(lhs: TelegramPeerNotificationSettings, rhs: TelegramPeerNotificationSettings) -> Bool {
|
||||||
return lhs.muteState == rhs.muteState && lhs.messageSound == rhs.messageSound && lhs.displayPreviews == rhs.displayPreviews
|
return lhs.muteState == rhs.muteState && lhs.messageSound == rhs.messageSound && lhs.displayPreviews == rhs.displayPreviews && lhs.storiesMuted == rhs.storiesMuted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,15 +88,18 @@ public enum EnginePeer: Equatable {
|
|||||||
public var muteState: MuteState
|
public var muteState: MuteState
|
||||||
public var messageSound: MessageSound
|
public var messageSound: MessageSound
|
||||||
public var displayPreviews: DisplayPreviews
|
public var displayPreviews: DisplayPreviews
|
||||||
|
public var storiesMuted: Bool?
|
||||||
|
|
||||||
public init(
|
public init(
|
||||||
muteState: MuteState,
|
muteState: MuteState,
|
||||||
messageSound: MessageSound,
|
messageSound: MessageSound,
|
||||||
displayPreviews: DisplayPreviews
|
displayPreviews: DisplayPreviews,
|
||||||
|
storiesMuted: Bool?
|
||||||
) {
|
) {
|
||||||
self.muteState = muteState
|
self.muteState = muteState
|
||||||
self.messageSound = messageSound
|
self.messageSound = messageSound
|
||||||
self.displayPreviews = displayPreviews
|
self.displayPreviews = displayPreviews
|
||||||
|
self.storiesMuted = storiesMuted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,11 +219,13 @@ public struct EngineGlobalNotificationSettings: Equatable {
|
|||||||
public var enabled: Bool
|
public var enabled: Bool
|
||||||
public var displayPreviews: Bool
|
public var displayPreviews: Bool
|
||||||
public var sound: EnginePeer.NotificationSettings.MessageSound
|
public var sound: EnginePeer.NotificationSettings.MessageSound
|
||||||
|
public var storiesMuted: Bool
|
||||||
|
|
||||||
public init(enabled: Bool, displayPreviews: Bool, sound: EnginePeer.NotificationSettings.MessageSound) {
|
public init(enabled: Bool, displayPreviews: Bool, sound: EnginePeer.NotificationSettings.MessageSound, storiesMuted: Bool) {
|
||||||
self.enabled = enabled
|
self.enabled = enabled
|
||||||
self.displayPreviews = displayPreviews
|
self.displayPreviews = displayPreviews
|
||||||
self.sound = sound
|
self.sound = sound
|
||||||
|
self.storiesMuted = storiesMuted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +332,8 @@ public extension EnginePeer.NotificationSettings {
|
|||||||
self.init(
|
self.init(
|
||||||
muteState: MuteState(notificationSettings.muteState),
|
muteState: MuteState(notificationSettings.muteState),
|
||||||
messageSound: MessageSound(notificationSettings.messageSound),
|
messageSound: MessageSound(notificationSettings.messageSound),
|
||||||
displayPreviews: DisplayPreviews(notificationSettings.displayPreviews)
|
displayPreviews: DisplayPreviews(notificationSettings.displayPreviews),
|
||||||
|
storiesMuted: notificationSettings.storiesMuted
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +341,8 @@ public extension EnginePeer.NotificationSettings {
|
|||||||
return TelegramPeerNotificationSettings(
|
return TelegramPeerNotificationSettings(
|
||||||
muteState: self.muteState._asMuteState(),
|
muteState: self.muteState._asMuteState(),
|
||||||
messageSound: self.messageSound._asMessageSound(),
|
messageSound: self.messageSound._asMessageSound(),
|
||||||
displayPreviews: self.displayPreviews._asDisplayPreviews()
|
displayPreviews: self.displayPreviews._asDisplayPreviews(),
|
||||||
|
storiesMuted: self.storiesMuted
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -594,7 +601,8 @@ public extension EngineGlobalNotificationSettings.CategorySettings {
|
|||||||
self.init(
|
self.init(
|
||||||
enabled: categorySettings.enabled,
|
enabled: categorySettings.enabled,
|
||||||
displayPreviews: categorySettings.displayPreviews,
|
displayPreviews: categorySettings.displayPreviews,
|
||||||
sound: EnginePeer.NotificationSettings.MessageSound(categorySettings.sound)
|
sound: EnginePeer.NotificationSettings.MessageSound(categorySettings.sound),
|
||||||
|
storiesMuted: categorySettings.storiesMuted ?? false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,7 +610,8 @@ public extension EngineGlobalNotificationSettings.CategorySettings {
|
|||||||
return MessageNotificationSettings(
|
return MessageNotificationSettings(
|
||||||
enabled: self.enabled,
|
enabled: self.enabled,
|
||||||
displayPreviews: self.displayPreviews,
|
displayPreviews: self.displayPreviews,
|
||||||
sound: self.sound._asMessageSound()
|
sound: self.sound._asMessageSound(),
|
||||||
|
storiesMuted: self.storiesMuted
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,11 @@ float sRGB_nonLinearNormToLinear(float normV)
|
|||||||
|
|
||||||
static inline
|
static inline
|
||||||
float4 sRGB_gamma_decode(const float4 rgba) {
|
float4 sRGB_gamma_decode(const float4 rgba) {
|
||||||
rgba.r = sRGB_nonLinearNormToLinear(rgba.r);
|
float4 tmp = rgba;
|
||||||
rgba.g = sRGB_nonLinearNormToLinear(rgba.g);
|
tmp.r = sRGB_nonLinearNormToLinear(rgba.r);
|
||||||
rgba.b = sRGB_nonLinearNormToLinear(rgba.b);
|
tmp.g = sRGB_nonLinearNormToLinear(rgba.g);
|
||||||
return rgba;
|
tmp.b = sRGB_nonLinearNormToLinear(rgba.b);
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline float4 BT709_decode(const float Y, const float Cb, const float Cr) {
|
static inline float4 BT709_decode(const float Y, const float Cb, const float Cr) {
|
||||||
|
@ -113,7 +113,7 @@ public enum NotificationExceptionMode : Equatable {
|
|||||||
case .default:
|
case .default:
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
values[peerId] = NotificationExceptionWrapper(settings: TelegramPeerNotificationSettings(muteState: .default, messageSound: sound, displayPreviews: .default), peer: peer, date: Date().timeIntervalSince1970)
|
values[peerId] = NotificationExceptionWrapper(settings: TelegramPeerNotificationSettings(muteState: .default, messageSound: sound, displayPreviews: .default, storiesMuted: nil), peer: peer, date: Date().timeIntervalSince1970)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return values
|
return values
|
||||||
@ -149,7 +149,7 @@ public enum NotificationExceptionMode : Equatable {
|
|||||||
case .default:
|
case .default:
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
values[peerId] = NotificationExceptionWrapper(settings: TelegramPeerNotificationSettings(muteState: muteState, messageSound: .default, displayPreviews: .default), peer: peer, date: Date().timeIntervalSince1970)
|
values[peerId] = NotificationExceptionWrapper(settings: TelegramPeerNotificationSettings(muteState: muteState, messageSound: .default, displayPreviews: .default, storiesMuted: nil), peer: peer, date: Date().timeIntervalSince1970)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return values
|
return values
|
||||||
@ -201,7 +201,7 @@ public enum NotificationExceptionMode : Equatable {
|
|||||||
case .default:
|
case .default:
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
values[peerId] = NotificationExceptionWrapper(settings: TelegramPeerNotificationSettings(muteState: .unmuted, messageSound: .default, displayPreviews: displayPreviews), peer: peer, date: Date().timeIntervalSince1970)
|
values[peerId] = NotificationExceptionWrapper(settings: TelegramPeerNotificationSettings(muteState: .unmuted, messageSound: .default, displayPreviews: displayPreviews, storiesMuted: nil), peer: peer, date: Date().timeIntervalSince1970)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return values
|
return values
|
||||||
|
Loading…
x
Reference in New Issue
Block a user