no message

This commit is contained in:
overtake 2017-03-13 19:43:35 +03:00
parent 02269ab60e
commit edd14a8f41
3 changed files with 14 additions and 3 deletions

View File

@ -204,6 +204,7 @@ private var declaredEncodables: Void = {
declareEncodable(GlobalNotificationSettings.self, f: { GlobalNotificationSettings(decoder: $0) }) declareEncodable(GlobalNotificationSettings.self, f: { GlobalNotificationSettings(decoder: $0) })
declareEncodable(CloudChatRemoveChatOperation.self, f: { CloudChatRemoveChatOperation(decoder: $0) }) declareEncodable(CloudChatRemoveChatOperation.self, f: { CloudChatRemoveChatOperation(decoder: $0) })
declareEncodable(SynchronizePinnedChatsOperation.self, f: { SynchronizePinnedChatsOperation(decoder: $0) }) declareEncodable(SynchronizePinnedChatsOperation.self, f: { SynchronizePinnedChatsOperation(decoder: $0) })
declareEncodable(SynchronizeConsumeMessageContentsOperation.self, f: { SynchronizeConsumeMessageContentsOperation(decoder: $0) })
declareEncodable(RecentMediaItem.self, f: { RecentMediaItem(decoder: $0) }) declareEncodable(RecentMediaItem.self, f: { RecentMediaItem(decoder: $0) })
declareEncodable(RecentPeerItem.self, f: { RecentPeerItem(decoder: $0) }) declareEncodable(RecentPeerItem.self, f: { RecentPeerItem(decoder: $0) })
declareEncodable(LoggedOutAccountAttribute.self, f: { LoggedOutAccountAttribute(decoder: $0) }) declareEncodable(LoggedOutAccountAttribute.self, f: { LoggedOutAccountAttribute(decoder: $0) })
@ -529,6 +530,8 @@ public class Account {
self.managedOperationsDisposable.add(managedRecentGifs(postbox: self.postbox, network: self.network).start()) self.managedOperationsDisposable.add(managedRecentGifs(postbox: self.postbox, network: self.network).start())
self.managedOperationsDisposable.add(managedRecentlyUsedInlineBots(postbox: self.postbox, network: self.network).start()) self.managedOperationsDisposable.add(managedRecentlyUsedInlineBots(postbox: self.postbox, network: self.network).start())
self.managedOperationsDisposable.add(managedLocalTypingActivities(activities: self.localInputActivityManager.allActivities(), postbox: self.postbox, network: self.network).start()) self.managedOperationsDisposable.add(managedLocalTypingActivities(activities: self.localInputActivityManager.allActivities(), postbox: self.postbox, network: self.network).start())
self.managedOperationsDisposable.add(managedSynchronizeConsumeMessageContentOperations(postbox: self.postbox, network: self.network, stateManager : self.stateManager).start())
let updatedPresence = self.shouldKeepOnlinePresence.get() let updatedPresence = self.shouldKeepOnlinePresence.get()
|> distinctUntilChanged |> distinctUntilChanged

View File

@ -189,7 +189,14 @@ func enqueueMessages(modifier: Modifier, account: Account, peerId: PeerId, messa
} }
} }
storeMessages.append(StoreMessage(peerId: peerId, namespace: Namespaces.Message.Local, globallyUniqueId: randomId, timestamp: timestamp, flags: flags, tags: tagsForStoreMessage(media: mediaList, textEntities: entitiesAttribute?.entities), forwardInfo: nil, authorId: account.peerId, text: text, attributes: attributes, media: mediaList)) let authorId:PeerId?
if let peer = peer as? TelegramChannel, case let .broadcast(info) = peer.info, !info.flags.contains(.messagesShouldHaveSignatures) {
authorId = nil
} else {
authorId = account.peerId
}
storeMessages.append(StoreMessage(peerId: peerId, namespace: Namespaces.Message.Local, globallyUniqueId: randomId, timestamp: timestamp, flags: flags, tags: tagsForStoreMessage(media: mediaList, textEntities: entitiesAttribute?.entities), forwardInfo: nil, authorId: authorId, text: text, attributes: attributes, media: mediaList))
case let .forward(source): case let .forward(source):
if let sourceMessage = modifier.getMessage(source), let author = sourceMessage.author { if let sourceMessage = modifier.getMessage(source), let author = sourceMessage.author {
if let peer = peer as? TelegramSecretChat { if let peer = peer as? TelegramSecretChat {

View File

@ -345,10 +345,11 @@ extension StoreMessage {
} }
} }
if let file = media as? TelegramMediaFile { for case let file as TelegramMediaFile in medias {
if peerId.namespace == Namespaces.Peer.CloudUser || peerId.namespace == Namespaces.Peer.CloudGroup { if peerId.namespace == Namespaces.Peer.CloudUser || peerId.namespace == Namespaces.Peer.CloudGroup {
if file.isVoice { if file.isVoice {
attributes.append(ConsumableContentMessageAttribute(consumed: (flags & (1 << 5)) != 0)) attributes.append(ConsumableContentMessageAttribute(consumed: (flags & (1 << 5)) == 0))
break
} }
} }
} }