mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Link preview update
This commit is contained in:
@@ -25,6 +25,7 @@ public enum ExternalJoiningChatState {
|
||||
case invite(title: String, photoRepresentation: TelegramMediaImageRepresentation?, participantsCount: Int32, participants: [Peer]?)
|
||||
case alreadyJoined(PeerId)
|
||||
case invalidHash
|
||||
case peek(PeerId, Int32)
|
||||
}
|
||||
|
||||
public func joinChatInteractively(with hash: String, account: Account) -> Signal <PeerId?, JoinLinkError> {
|
||||
@@ -66,7 +67,7 @@ public func joinLinkInformation(_ hash: String, account: Account) -> Signal<Exte
|
||||
case let .chatInvite(invite):
|
||||
let photo = telegramMediaImageFromApiPhoto(invite.photo).flatMap({ smallestImageRepresentation($0.representations) })
|
||||
return .single(.invite(title: invite.title, photoRepresentation: photo, participantsCount: invite.participantsCount, participants: invite.participants?.map({TelegramUser(user: $0)})))
|
||||
case let .chatInviteAlready(chat: chat):
|
||||
case let .chatInviteAlready(chat):
|
||||
if let peer = parseTelegramGroupOrChannel(chat: chat) {
|
||||
return account.postbox.transaction({ (transaction) -> ExternalJoiningChatState in
|
||||
updatePeers(transaction: transaction, peers: [peer], update: { (previous, updated) -> Peer? in
|
||||
@@ -77,6 +78,17 @@ public func joinLinkInformation(_ hash: String, account: Account) -> Signal<Exte
|
||||
})
|
||||
}
|
||||
return .single(.invalidHash)
|
||||
case let .chatInvitePeek(chat, expires):
|
||||
if let peer = parseTelegramGroupOrChannel(chat: chat) {
|
||||
return account.postbox.transaction({ (transaction) -> ExternalJoiningChatState in
|
||||
updatePeers(transaction: transaction, peers: [peer], update: { (previous, updated) -> Peer? in
|
||||
return updated
|
||||
})
|
||||
|
||||
return .peek(peer.id, expires)
|
||||
})
|
||||
}
|
||||
return .single(.invalidHash)
|
||||
}
|
||||
} else {
|
||||
return .single(.invalidHash)
|
||||
|
||||
@@ -210,7 +210,7 @@ public class BoxedMessage: NSObject {
|
||||
|
||||
public class Serialization: NSObject, MTSerialization {
|
||||
public func currentLayer() -> UInt {
|
||||
return 114
|
||||
return 115
|
||||
}
|
||||
|
||||
public func parseMessage(_ data: Data!) -> Any! {
|
||||
|
||||
Reference in New Issue
Block a user