no message

This commit is contained in:
Peter 2018-09-07 14:26:46 +03:00
parent ba7ec36e0c
commit 1bde567623
3 changed files with 1833 additions and 1835 deletions

View File

@ -2,7 +2,24 @@ import Foundation
import Postbox import Postbox
import TelegramCore import TelegramCore
enum MessageContentKind: Equatable { public enum MessageContentKindKey {
case text
case image
case video
case videoMessage
case audioMessage
case sticker
case animation
case file
case contact
case game
case location
case liveLocation
case expiredImage
case expiredVideo
}
public enum MessageContentKind: Equatable {
case text(String) case text(String)
case image case image
case video case video
@ -18,97 +35,41 @@ enum MessageContentKind: Equatable {
case expiredImage case expiredImage
case expiredVideo case expiredVideo
static func ==(lhs: MessageContentKind, rhs: MessageContentKind) -> Bool { public var key: MessageContentKindKey {
switch lhs { switch self {
case let .text(text): case .text:
if case .text(text) = rhs { return .text
return true
} else {
return false
}
case .image: case .image:
if case .image = rhs { return .image
return true
} else {
return false
}
case .video: case .video:
if case .video = rhs { return .video
return true
} else {
return false
}
case .videoMessage: case .videoMessage:
if case .videoMessage = rhs { return .videoMessage
return true
} else {
return false
}
case .audioMessage: case .audioMessage:
if case .audioMessage = rhs { return .audioMessage
return true case .sticker:
} else { return .sticker
return false
}
case let .sticker(text):
if case .sticker(text) = rhs {
return true
} else {
return false
}
case .animation: case .animation:
if case .animation = rhs { return .animation
return true case .file:
} else { return .file
return false
}
case let .file(text):
if case .file(text) = rhs {
return true
} else {
return false
}
case .contact: case .contact:
if case .contact = rhs { return .contact
return true case .game:
} else { return .game
return false
}
case let .game(text):
if case .game(text) = rhs {
return true
} else {
return false
}
case .location: case .location:
if case .location = rhs { return .location
return true
} else {
return false
}
case .liveLocation: case .liveLocation:
if case .liveLocation = rhs { return .liveLocation
return true
} else {
return false
}
case .expiredImage: case .expiredImage:
if case .expiredImage = rhs { return .expiredImage
return true
} else {
return false
}
case .expiredVideo: case .expiredVideo:
if case .expiredVideo = rhs { return .expiredVideo
return true
} else {
return false
}
} }
} }
} }
func messageContentKind(_ message: Message, strings: PresentationStrings, accountPeerId: PeerId) -> MessageContentKind { public func messageContentKind(_ message: Message, strings: PresentationStrings, accountPeerId: PeerId) -> MessageContentKind {
for media in message.media { for media in message.media {
switch media { switch media {
case let expiredMedia as TelegramMediaExpiredContent: case let expiredMedia as TelegramMediaExpiredContent:

View File

@ -3,11 +3,24 @@ import Postbox
import TelegramCore import TelegramCore
import SwiftSignalKit import SwiftSignalKit
enum PeerChannelMemberContextKey: Hashable { enum PeerChannelMemberContextKey: Equatable, Hashable {
case recent case recent
case recentSearch(String) case recentSearch(String)
case admins(String?) case admins(String?)
case restrictedAndBanned(String?) case restrictedAndBanned(String?)
var hashValue: Int {
switch self {
case .recent:
return 1
case let .recentSearch(query):
return query.hashValue
case let .admins(query):
return query?.hashValue ?? 2
case let .restrictedAndBanned(query):
return query?.hashValue ?? 3
}
}
} }
private final class PeerChannelMemberCategoriesContextsManagerImpl { private final class PeerChannelMemberCategoriesContextsManagerImpl {

File diff suppressed because it is too large Load Diff