mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
no message
This commit is contained in:
@@ -148,6 +148,8 @@
|
|||||||
D0223A9C1EA5654D00211D94 /* TelegramMediaResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0223A9A1EA5654D00211D94 /* TelegramMediaResource.swift */; };
|
D0223A9C1EA5654D00211D94 /* TelegramMediaResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0223A9A1EA5654D00211D94 /* TelegramMediaResource.swift */; };
|
||||||
D02395D61F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */; };
|
D02395D61F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */; };
|
||||||
D02395D71F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */; };
|
D02395D71F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */; };
|
||||||
|
D023E67821540624008C27D1 /* UpdateMessageMedia.swift in Sources */ = {isa = PBXBuildFile; fileRef = D023E67721540624008C27D1 /* UpdateMessageMedia.swift */; };
|
||||||
|
D023E67921540624008C27D1 /* UpdateMessageMedia.swift in Sources */ = {isa = PBXBuildFile; fileRef = D023E67721540624008C27D1 /* UpdateMessageMedia.swift */; };
|
||||||
D026099E20C695AF006C34AC /* Wallpapers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D026099D20C695AF006C34AC /* Wallpapers.swift */; };
|
D026099E20C695AF006C34AC /* Wallpapers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D026099D20C695AF006C34AC /* Wallpapers.swift */; };
|
||||||
D026099F20C695AF006C34AC /* Wallpapers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D026099D20C695AF006C34AC /* Wallpapers.swift */; };
|
D026099F20C695AF006C34AC /* Wallpapers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D026099D20C695AF006C34AC /* Wallpapers.swift */; };
|
||||||
D02609BF20C6EC08006C34AC /* Crypto.m in Sources */ = {isa = PBXBuildFile; fileRef = D02609BE20C6EC08006C34AC /* Crypto.m */; };
|
D02609BF20C6EC08006C34AC /* Crypto.m in Sources */ = {isa = PBXBuildFile; fileRef = D02609BE20C6EC08006C34AC /* Crypto.m */; };
|
||||||
@@ -816,6 +818,7 @@
|
|||||||
D0223A971EA564BD00211D94 /* MediaResourceNetworkStatsTag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaResourceNetworkStatsTag.swift; sourceTree = "<group>"; };
|
D0223A971EA564BD00211D94 /* MediaResourceNetworkStatsTag.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaResourceNetworkStatsTag.swift; sourceTree = "<group>"; };
|
||||||
D0223A9A1EA5654D00211D94 /* TelegramMediaResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaResource.swift; sourceTree = "<group>"; };
|
D0223A9A1EA5654D00211D94 /* TelegramMediaResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaResource.swift; sourceTree = "<group>"; };
|
||||||
D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelHistoryAvailabilitySettings.swift; sourceTree = "<group>"; };
|
D02395D51F8D09A50070F5C2 /* ChannelHistoryAvailabilitySettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelHistoryAvailabilitySettings.swift; sourceTree = "<group>"; };
|
||||||
|
D023E67721540624008C27D1 /* UpdateMessageMedia.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateMessageMedia.swift; sourceTree = "<group>"; };
|
||||||
D026099D20C695AF006C34AC /* Wallpapers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Wallpapers.swift; sourceTree = "<group>"; };
|
D026099D20C695AF006C34AC /* Wallpapers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Wallpapers.swift; sourceTree = "<group>"; };
|
||||||
D02609BB20C6EB97006C34AC /* Crypto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Crypto.h; sourceTree = "<group>"; };
|
D02609BB20C6EB97006C34AC /* Crypto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Crypto.h; sourceTree = "<group>"; };
|
||||||
D02609BE20C6EC08006C34AC /* Crypto.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Crypto.m; sourceTree = "<group>"; };
|
D02609BE20C6EC08006C34AC /* Crypto.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Crypto.m; sourceTree = "<group>"; };
|
||||||
@@ -1567,6 +1570,7 @@
|
|||||||
D0B85AC41F6B2B9400B8B5CE /* RecentlyUsedHashtags.swift */,
|
D0B85AC41F6B2B9400B8B5CE /* RecentlyUsedHashtags.swift */,
|
||||||
D0E8B8B22044706300605593 /* ForwardGame.swift */,
|
D0E8B8B22044706300605593 /* ForwardGame.swift */,
|
||||||
D0119CAF20CA9EA800895300 /* MarkAllChatsAsRead.swift */,
|
D0119CAF20CA9EA800895300 /* MarkAllChatsAsRead.swift */,
|
||||||
|
D023E67721540624008C27D1 /* UpdateMessageMedia.swift */,
|
||||||
);
|
);
|
||||||
name = Messages;
|
name = Messages;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -2089,6 +2093,7 @@
|
|||||||
D00D343F1E6ED6E50057B307 /* ConsumableContentMessageAttribute.swift in Sources */,
|
D00D343F1E6ED6E50057B307 /* ConsumableContentMessageAttribute.swift in Sources */,
|
||||||
D03B0CE01D62249100955575 /* StoreMessage_Telegram.swift in Sources */,
|
D03B0CE01D62249100955575 /* StoreMessage_Telegram.swift in Sources */,
|
||||||
D08774FE1E3E3A3500A97350 /* GlobalNotificationSettings.swift in Sources */,
|
D08774FE1E3E3A3500A97350 /* GlobalNotificationSettings.swift in Sources */,
|
||||||
|
D023E67821540624008C27D1 /* UpdateMessageMedia.swift in Sources */,
|
||||||
D0EE7FC420986C5300981319 /* SecureIdPassportRegistrationValue.swift in Sources */,
|
D0EE7FC420986C5300981319 /* SecureIdPassportRegistrationValue.swift in Sources */,
|
||||||
D00C7CCF1E3628180080C3D5 /* UpdateCachedChannelParticipants.swift in Sources */,
|
D00C7CCF1E3628180080C3D5 /* UpdateCachedChannelParticipants.swift in Sources */,
|
||||||
D03B0CB91D62233400955575 /* Either.swift in Sources */,
|
D03B0CB91D62233400955575 /* Either.swift in Sources */,
|
||||||
@@ -2730,6 +2735,7 @@
|
|||||||
D0575AF21E9FFA5D006F2541 /* SynchronizeSavedGifsOperation.swift in Sources */,
|
D0575AF21E9FFA5D006F2541 /* SynchronizeSavedGifsOperation.swift in Sources */,
|
||||||
D0528E661E65C82400E2FEF5 /* UpdateContactName.swift in Sources */,
|
D0528E661E65C82400E2FEF5 /* UpdateContactName.swift in Sources */,
|
||||||
D0EE7FC82098853100981319 /* SecureIdTemporaryRegistrationValue.swift in Sources */,
|
D0EE7FC82098853100981319 /* SecureIdTemporaryRegistrationValue.swift in Sources */,
|
||||||
|
D023E67921540624008C27D1 /* UpdateMessageMedia.swift in Sources */,
|
||||||
D053B4191F18DE5000E2D58A /* AuthorSignatureMessageAttribute.swift in Sources */,
|
D053B4191F18DE5000E2D58A /* AuthorSignatureMessageAttribute.swift in Sources */,
|
||||||
D0F7B1E81E045C87007EB8A5 /* PeerParticipants.swift in Sources */,
|
D0F7B1E81E045C87007EB8A5 /* PeerParticipants.swift in Sources */,
|
||||||
D0C48F3A1E8138DF0075317D /* ArchivedStickerPacksInfo.swift in Sources */,
|
D0C48F3A1E8138DF0075317D /* ArchivedStickerPacksInfo.swift in Sources */,
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ enum AccountStateMutationOperation {
|
|||||||
case UpdateIsContact(PeerId, Bool)
|
case UpdateIsContact(PeerId, Bool)
|
||||||
case UpdateCachedPeerData(PeerId, (CachedPeerData?) -> CachedPeerData?)
|
case UpdateCachedPeerData(PeerId, (CachedPeerData?) -> CachedPeerData?)
|
||||||
case MergeApiUsers([Api.User])
|
case MergeApiUsers([Api.User])
|
||||||
case MergePeerPresences([PeerId: PeerPresence], Bool)
|
case MergePeerPresences([PeerId: Api.UserStatus], Bool)
|
||||||
case UpdateSecretChat(chat: Api.EncryptedChat, timestamp: Int32)
|
case UpdateSecretChat(chat: Api.EncryptedChat, timestamp: Int32)
|
||||||
case AddSecretMessages([Api.EncryptedMessage])
|
case AddSecretMessages([Api.EncryptedMessage])
|
||||||
case ReadSecretOutbox(peerId: PeerId, maxTimestamp: Int32, actionTimestamp: Int32)
|
case ReadSecretOutbox(peerId: PeerId, maxTimestamp: Int32, actionTimestamp: Int32)
|
||||||
@@ -268,12 +268,12 @@ struct AccountMutableState {
|
|||||||
mutating func mergeUsers(_ users: [Api.User]) {
|
mutating func mergeUsers(_ users: [Api.User]) {
|
||||||
self.addOperation(.MergeApiUsers(users))
|
self.addOperation(.MergeApiUsers(users))
|
||||||
|
|
||||||
var presences: [PeerId: PeerPresence] = [:]
|
var presences: [PeerId: Api.UserStatus] = [:]
|
||||||
for user in users {
|
for user in users {
|
||||||
switch user {
|
switch user {
|
||||||
case let .user(_, id, _, _, _, _, _, _, status, _, _, _, _):
|
case let .user(_, id, _, _, _, _, _, _, status, _, _, _, _):
|
||||||
if let status = status {
|
if let status = status {
|
||||||
presences[PeerId(namespace: Namespaces.Peer.CloudUser, id: id)] = TelegramUserPresence(apiStatus: status)
|
presences[PeerId(namespace: Namespaces.Peer.CloudUser, id: id)] = status
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case .userEmpty:
|
case .userEmpty:
|
||||||
@@ -285,7 +285,7 @@ struct AccountMutableState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mutating func mergePeerPresences(_ presences: [PeerId: PeerPresence], explicit: Bool) {
|
mutating func mergePeerPresences(_ presences: [PeerId: Api.UserStatus], explicit: Bool) {
|
||||||
self.addOperation(.MergePeerPresences(presences, explicit))
|
self.addOperation(.MergePeerPresences(presences, explicit))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1055,7 +1055,7 @@ private func finalStateWithUpdatesAndServerTime(account: Account, state: Account
|
|||||||
return previous.withUpdatedIsBlocked(blocked == .boolTrue)
|
return previous.withUpdatedIsBlocked(blocked == .boolTrue)
|
||||||
})
|
})
|
||||||
case let .updateUserStatus(userId, status):
|
case let .updateUserStatus(userId, status):
|
||||||
updatedState.mergePeerPresences([PeerId(namespace: Namespaces.Peer.CloudUser, id: userId): TelegramUserPresence(apiStatus: status)], explicit: true)
|
updatedState.mergePeerPresences([PeerId(namespace: Namespaces.Peer.CloudUser, id: userId): status], explicit: true)
|
||||||
case let .updateUserName(userId, firstName, lastName, username):
|
case let .updateUserName(userId, firstName, lastName, username):
|
||||||
//TODO add contact checking for apply first and last name
|
//TODO add contact checking for apply first and last name
|
||||||
updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), { peer in
|
updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: userId), { peer in
|
||||||
@@ -2040,10 +2040,10 @@ func replayFinalState(accountPeerId: PeerId, mediaBox: MediaBox, transaction: Tr
|
|||||||
return .update(message.withUpdatedLocalTags(updatedLocalTags).withUpdatedFlags(updatedFlags))
|
return .update(message.withUpdatedLocalTags(updatedLocalTags).withUpdatedFlags(updatedFlags))
|
||||||
})
|
})
|
||||||
case let .UpdateMedia(id, media):
|
case let .UpdateMedia(id, media):
|
||||||
transaction.updateMedia(id, update: media)
|
|
||||||
if let media = media as? TelegramMediaWebpage {
|
if let media = media as? TelegramMediaWebpage {
|
||||||
updatedWebpages[id] = media
|
updatedWebpages[id] = media
|
||||||
}
|
}
|
||||||
|
updateMessageMedia(transaction: transaction, id: id, media: media)
|
||||||
case let .ReadInbox(messageId):
|
case let .ReadInbox(messageId):
|
||||||
transaction.applyIncomingReadMaxId(messageId)
|
transaction.applyIncomingReadMaxId(messageId)
|
||||||
case let .ReadOutbox(messageId):
|
case let .ReadOutbox(messageId):
|
||||||
@@ -2143,15 +2143,27 @@ func replayFinalState(accountPeerId: PeerId, mediaBox: MediaBox, transaction: Tr
|
|||||||
transaction.updatePeerCachedData(peerIds: Set([id]), update: { _, current in
|
transaction.updatePeerCachedData(peerIds: Set([id]), update: { _, current in
|
||||||
return f(current)
|
return f(current)
|
||||||
})
|
})
|
||||||
case let .MergePeerPresences(presences, explicit):
|
case let .MergePeerPresences(statuses, explicit):
|
||||||
var filteredPresences = presences
|
var presences: [PeerId: PeerPresence] = [:]
|
||||||
if let accountPresence = presences[accountPeerId] {
|
for (peerId, status) in statuses {
|
||||||
filteredPresences.removeValue(forKey: accountPeerId)
|
if peerId == accountPeerId {
|
||||||
if explicit, let presence = accountPresence as? TelegramUserPresence, case let .present(until) = presence.status {
|
if explicit {
|
||||||
delayNotificatonsUntil = until + 30
|
switch status {
|
||||||
|
case let .userStatusOnline(timestamp):
|
||||||
|
delayNotificatonsUntil = timestamp + 30
|
||||||
|
case let .userStatusOffline(timestamp):
|
||||||
|
delayNotificatonsUntil = timestamp
|
||||||
|
default:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
transaction.updatePeerPresences(filteredPresences)
|
} else {
|
||||||
|
let presence = TelegramUserPresence(apiStatus: status)
|
||||||
|
presences[peerId] = presence
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
transaction.updatePeerPresences(presences)
|
||||||
case let .UpdateSecretChat(chat, _):
|
case let .UpdateSecretChat(chat, _):
|
||||||
updateSecretChat(accountPeerId: accountPeerId, transaction: transaction, chat: chat, requestData: nil)
|
updateSecretChat(accountPeerId: accountPeerId, transaction: transaction, chat: chat, requestData: nil)
|
||||||
case let .AddSecretMessages(messages):
|
case let .AddSecretMessages(messages):
|
||||||
|
|||||||
@@ -113,12 +113,12 @@ private func fetchWebpage(account: Account, messageId: MessageId) -> Signal<Void
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let webpage = webpage {
|
if let webpage = webpage {
|
||||||
transaction.updateMedia(webpage.webpageId, update: webpage)
|
updateMessageMedia(transaction: transaction, id: webpage.webpageId, media: webpage)
|
||||||
} else {
|
} else {
|
||||||
if let previousMessage = transaction.getMessage(messageId) {
|
if let previousMessage = transaction.getMessage(messageId) {
|
||||||
for media in previousMessage.media {
|
for media in previousMessage.media {
|
||||||
if let media = media as? TelegramMediaWebpage {
|
if let media = media as? TelegramMediaWebpage {
|
||||||
transaction.updateMedia(media.webpageId, update: nil)
|
updateMessageMedia(transaction: transaction, id: media.webpageId, media: nil)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,13 @@ func enqueueMessages(transaction: Transaction, account: Account, peerId: PeerId,
|
|||||||
}
|
}
|
||||||
case let .forward(sourceId, _):
|
case let .forward(sourceId, _):
|
||||||
if let sourceMessage = forwardedMessageToBeReuploaded(transaction: transaction, id: sourceId) {
|
if let sourceMessage = forwardedMessageToBeReuploaded(transaction: transaction, id: sourceId) {
|
||||||
updatedMessages.append((transformedMedia, .message(text: sourceMessage.text, attributes: sourceMessage.attributes, mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil)))
|
var mediaReference: AnyMediaReference?
|
||||||
|
if sourceMessage.id.peerId.namespace == Namespaces.Peer.SecretChat {
|
||||||
|
if let media = sourceMessage.media.first {
|
||||||
|
mediaReference = .standalone(media: media)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updatedMessages.append((transformedMedia, .message(text: sourceMessage.text, attributes: sourceMessage.attributes, mediaReference: mediaReference, replyToMessageId: nil, localGroupingKey: nil)))
|
||||||
continue outer
|
continue outer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ private func uploadedMediaImageContent(network: Network, postbox: Postbox, trans
|
|||||||
return postbox.transaction { transaction -> UploadedMediaTransform in
|
return postbox.transaction { transaction -> UploadedMediaTransform in
|
||||||
if let media = mediaReference?.media {
|
if let media = mediaReference?.media {
|
||||||
if let id = media.id {
|
if let id = media.id {
|
||||||
transaction.updateMedia(id, update: media)
|
let _ = transaction.updateMedia(id, update: media)
|
||||||
transaction.updateMessage(messageId, update: { currentMessage in
|
transaction.updateMessage(messageId, update: { currentMessage in
|
||||||
var storeForwardInfo: StoreMessageForwardInfo?
|
var storeForwardInfo: StoreMessageForwardInfo?
|
||||||
if let forwardInfo = currentMessage.forwardInfo {
|
if let forwardInfo = currentMessage.forwardInfo {
|
||||||
@@ -522,7 +522,7 @@ private func uploadedMediaFileContent(network: Network, postbox: Postbox, auxili
|
|||||||
return postbox.transaction { transaction -> UploadedMediaTransform in
|
return postbox.transaction { transaction -> UploadedMediaTransform in
|
||||||
if let media = mediaReference?.media {
|
if let media = mediaReference?.media {
|
||||||
if let id = media.id {
|
if let id = media.id {
|
||||||
transaction.updateMedia(id, update: media)
|
let _ = transaction.updateMedia(id, update: media)
|
||||||
transaction.updateMessage(messageId, update: { currentMessage in
|
transaction.updateMessage(messageId, update: { currentMessage in
|
||||||
var storeForwardInfo: StoreMessageForwardInfo?
|
var storeForwardInfo: StoreMessageForwardInfo?
|
||||||
if let forwardInfo = currentMessage.forwardInfo {
|
if let forwardInfo = currentMessage.forwardInfo {
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ public func tagsForStoreMessage(incoming: Bool, attributes: [MessageAttribute],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !incoming {
|
||||||
|
assert(true)
|
||||||
|
}
|
||||||
return (tags, globalTags)
|
return (tags, globalTags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
31
TelegramCore/UpdateMessageMedia.swift
Normal file
31
TelegramCore/UpdateMessageMedia.swift
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import Foundation
|
||||||
|
#if os(macOS)
|
||||||
|
import PostboxMac
|
||||||
|
#else
|
||||||
|
import Postbox
|
||||||
|
#endif
|
||||||
|
|
||||||
|
func updateMessageMedia(transaction: Transaction, id: MediaId, media: Media?) {
|
||||||
|
let updatedMessageIndices = transaction.updateMedia(id, update: media)
|
||||||
|
for index in updatedMessageIndices {
|
||||||
|
transaction.updateMessage(index.id, update: { currentMessage in
|
||||||
|
var textEntities: [MessageTextEntity]?
|
||||||
|
for attribute in currentMessage.attributes {
|
||||||
|
if let attribute = attribute as? TextEntitiesMessageAttribute {
|
||||||
|
textEntities = attribute.entities
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let (tags, _) = tagsForStoreMessage(incoming: currentMessage.flags.contains(.Incoming), attributes: currentMessage.attributes, media: currentMessage.media, textEntities: textEntities)
|
||||||
|
if tags == currentMessage.tags {
|
||||||
|
return .skip
|
||||||
|
}
|
||||||
|
|
||||||
|
var storeForwardInfo: StoreMessageForwardInfo?
|
||||||
|
if let forwardInfo = currentMessage.forwardInfo {
|
||||||
|
storeForwardInfo = StoreMessageForwardInfo(authorId: forwardInfo.author.id, sourceId: forwardInfo.source?.id, sourceMessageId: forwardInfo.sourceMessageId, date: forwardInfo.date, authorSignature: forwardInfo.authorSignature)
|
||||||
|
}
|
||||||
|
return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: currentMessage.attributes, media: currentMessage.media))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ public func actualizedWebpage(postbox: Postbox, network: Network, webpage: Teleg
|
|||||||
|> mapToSignal { result -> Signal<TelegramMediaWebpage, NoError> in
|
|> mapToSignal { result -> Signal<TelegramMediaWebpage, NoError> in
|
||||||
if let updatedWebpage = telegramMediaWebpageFromApiWebpage(result, url: nil), case .Loaded = updatedWebpage.content, updatedWebpage.webpageId == webpage.webpageId {
|
if let updatedWebpage = telegramMediaWebpageFromApiWebpage(result, url: nil), case .Loaded = updatedWebpage.content, updatedWebpage.webpageId == webpage.webpageId {
|
||||||
return postbox.transaction { transaction -> TelegramMediaWebpage in
|
return postbox.transaction { transaction -> TelegramMediaWebpage in
|
||||||
transaction.updateMedia(webpage.webpageId, update: updatedWebpage)
|
updateMessageMedia(transaction: transaction, id: webpage.webpageId, media: updatedWebpage)
|
||||||
return updatedWebpage
|
return updatedWebpage
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -69,7 +69,7 @@ func updatedRemoteWebpage(postbox: Postbox, network: Network, webPage: WebpageRe
|
|||||||
if let updatedWebpage = telegramMediaWebpageFromApiWebpage(result, url: nil), case .Loaded = updatedWebpage.content, updatedWebpage.webpageId.id == id {
|
if let updatedWebpage = telegramMediaWebpageFromApiWebpage(result, url: nil), case .Loaded = updatedWebpage.content, updatedWebpage.webpageId.id == id {
|
||||||
return postbox.transaction { transaction -> TelegramMediaWebpage? in
|
return postbox.transaction { transaction -> TelegramMediaWebpage? in
|
||||||
if transaction.getMedia(updatedWebpage.webpageId) != nil {
|
if transaction.getMedia(updatedWebpage.webpageId) != nil {
|
||||||
transaction.updateMedia(updatedWebpage.webpageId, update: updatedWebpage)
|
updateMessageMedia(transaction: transaction, id: updatedWebpage.webpageId, media: updatedWebpage)
|
||||||
}
|
}
|
||||||
return updatedWebpage
|
return updatedWebpage
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user