mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Update API
This commit is contained in:
parent
7f230afa79
commit
f72f2e3c60
@ -516,7 +516,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-1387279939] = { return Api.MessageInteractionCounters.parse_messageInteractionCounters($0) }
|
||||
dict[1882335561] = { return Api.MessageMedia.parse_messageMediaContact($0) }
|
||||
dict[1065280907] = { return Api.MessageMedia.parse_messageMediaDice($0) }
|
||||
dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
|
||||
dict[1291114285] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
|
||||
dict[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) }
|
||||
dict[-38694904] = { return Api.MessageMedia.parse_messageMediaGame($0) }
|
||||
dict[1457575028] = { return Api.MessageMedia.parse_messageMediaGeo($0) }
|
||||
|
@ -736,7 +736,7 @@ public extension Api {
|
||||
indirect enum MessageMedia: TypeConstructorDescription {
|
||||
case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int64)
|
||||
case messageMediaDice(value: Int32, emoticon: String)
|
||||
case messageMediaDocument(flags: Int32, document: Api.Document?, ttlSeconds: Int32?)
|
||||
case messageMediaDocument(flags: Int32, document: Api.Document?, altDocument: Api.Document?, ttlSeconds: Int32?)
|
||||
case messageMediaEmpty
|
||||
case messageMediaGame(game: Api.Game)
|
||||
case messageMediaGeo(geo: Api.GeoPoint)
|
||||
@ -767,12 +767,13 @@ public extension Api {
|
||||
serializeInt32(value, buffer: buffer, boxed: false)
|
||||
serializeString(emoticon, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .messageMediaDocument(let flags, let document, let ttlSeconds):
|
||||
case .messageMediaDocument(let flags, let document, let altDocument, let ttlSeconds):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1666158377)
|
||||
buffer.appendInt32(1291114285)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 0) != 0 {document!.serialize(buffer, true)}
|
||||
if Int(flags) & Int(1 << 5) != 0 {altDocument!.serialize(buffer, true)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(ttlSeconds!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
case .messageMediaEmpty:
|
||||
@ -864,8 +865,8 @@ public extension Api {
|
||||
return ("messageMediaContact", [("phoneNumber", phoneNumber as Any), ("firstName", firstName as Any), ("lastName", lastName as Any), ("vcard", vcard as Any), ("userId", userId as Any)])
|
||||
case .messageMediaDice(let value, let emoticon):
|
||||
return ("messageMediaDice", [("value", value as Any), ("emoticon", emoticon as Any)])
|
||||
case .messageMediaDocument(let flags, let document, let ttlSeconds):
|
||||
return ("messageMediaDocument", [("flags", flags as Any), ("document", document as Any), ("ttlSeconds", ttlSeconds as Any)])
|
||||
case .messageMediaDocument(let flags, let document, let altDocument, let ttlSeconds):
|
||||
return ("messageMediaDocument", [("flags", flags as Any), ("document", document as Any), ("altDocument", altDocument as Any), ("ttlSeconds", ttlSeconds as Any)])
|
||||
case .messageMediaEmpty:
|
||||
return ("messageMediaEmpty", [])
|
||||
case .messageMediaGame(let game):
|
||||
@ -933,13 +934,18 @@ public extension Api {
|
||||
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.Document
|
||||
} }
|
||||
var _3: Int32?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {_3 = reader.readInt32() }
|
||||
var _3: Api.Document?
|
||||
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
|
||||
_3 = Api.parse(reader, signature: signature) as? Api.Document
|
||||
} }
|
||||
var _4: Int32?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt32() }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.MessageMedia.messageMediaDocument(flags: _1!, document: _2, ttlSeconds: _3)
|
||||
let _c3 = (Int(_1!) & Int(1 << 5) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.MessageMedia.messageMediaDocument(flags: _1!, document: _2, altDocument: _3, ttlSeconds: _4)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -292,7 +292,7 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI
|
||||
case let .messageMediaGeoLive(_, geo, heading, period, proximityNotificationRadius):
|
||||
let mediaMap = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: period, liveProximityNotificationRadius: proximityNotificationRadius, heading: heading)
|
||||
return (mediaMap, nil, nil, nil)
|
||||
case let .messageMediaDocument(flags, document, ttlSeconds):
|
||||
case let .messageMediaDocument(flags, document, _, ttlSeconds):
|
||||
if let document = document {
|
||||
if let mediaFile = telegramMediaFileFromApiDocument(document) {
|
||||
return (mediaFile, ttlSeconds, (flags & (1 << 3)) != 0, (flags & (1 << 4)) != 0)
|
||||
|
@ -846,7 +846,7 @@ private func uploadedMediaFileContent(network: Network, postbox: Postbox, auxili
|
||||
|> mapError { _ -> PendingMessageUploadError in return .generic }
|
||||
|> mapToSignal { result -> Signal<PendingMessageUploadedContentResult, PendingMessageUploadError> in
|
||||
switch result {
|
||||
case let .messageMediaDocument(_, document, _):
|
||||
case let .messageMediaDocument(_, document, _, _):
|
||||
if let document = document, let mediaFile = telegramMediaFileFromApiDocument(document), let resource = mediaFile.resource as? CloudDocumentMediaResource, let fileReference = resource.fileReference {
|
||||
var flags: Int32 = 0
|
||||
if hasSpoiler {
|
||||
|
@ -162,7 +162,7 @@ public func standaloneUploadedFile(account: Account, peerId: PeerId, text: Strin
|
||||
|> mapError { _ -> StandaloneUploadMediaError in return .generic }
|
||||
|> mapToSignal { media -> Signal<StandaloneUploadMediaEvent, StandaloneUploadMediaError> in
|
||||
switch media {
|
||||
case let .messageMediaDocument(_, document, _):
|
||||
case let .messageMediaDocument(_, document, _, _):
|
||||
if let document = document {
|
||||
if let mediaFile = telegramMediaFileFromApiDocument(document) {
|
||||
return .single(.result(.media(.standalone(media: mediaFile))))
|
||||
|
@ -52,7 +52,7 @@ extension Api.MessageMedia {
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
case let .messageMediaDocument(_, document, _):
|
||||
case let .messageMediaDocument(_, document, _, _):
|
||||
if let document = document {
|
||||
return collectPreCachedResources(for: document)
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ func _internal_uploadSticker(account: Account, peer: Peer, resource: MediaResour
|
||||
|> mapError { _ -> UploadStickerError in return .generic }
|
||||
|> mapToSignal { media -> Signal<UploadStickerStatus, UploadStickerError> in
|
||||
switch media {
|
||||
case let .messageMediaDocument(_, document, _):
|
||||
case let .messageMediaDocument(_, document, _, _):
|
||||
if let document = document, let file = telegramMediaFileFromApiDocument(document), let resource = file.resource as? CloudDocumentMediaResource {
|
||||
return .single(.complete(resource, file.mimeType))
|
||||
}
|
||||
|
@ -133,6 +133,8 @@ private final class StoryContainerScreenComponent: Component {
|
||||
|
||||
super.init(frame: frame)
|
||||
|
||||
self.layer.addSublayer(self.backgroundLayer)
|
||||
|
||||
let horizontalPanRecognizer = InteractiveTransitionGestureRecognizer(target: self, action: #selector(self.panGesture(_:)), allowedDirections: { [weak self] point in
|
||||
guard let self, let focusedItemSet = self.focusedItemSet, let itemSetView = self.visibleItemSetViews[focusedItemSet], let itemSetComponentView = itemSetView.view.view as? StoryItemSetContainerComponent.View else {
|
||||
return []
|
||||
@ -417,6 +419,8 @@ private final class StoryContainerScreenComponent: Component {
|
||||
self.itemSets = component.initialContent
|
||||
}
|
||||
|
||||
transition.setFrame(layer: self.backgroundLayer, frame: CGRect(origin: CGPoint(), size: availableSize))
|
||||
|
||||
var isProgressPaused = false
|
||||
if self.itemSetPanState != nil {
|
||||
isProgressPaused = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user