Update API [skip ci]

This commit is contained in:
Ilya Laktyushin 2024-12-19 16:12:17 +04:00
parent 3095400114
commit 26ff9da7d1
3 changed files with 18 additions and 2 deletions

View File

@ -51,6 +51,7 @@ public enum ExternalJoiningChatState {
public let nameColor: PeerNameColor? public let nameColor: PeerNameColor?
public let subscriptionPricing: StarsSubscriptionPricing? public let subscriptionPricing: StarsSubscriptionPricing?
public let subscriptionFormId: Int64? public let subscriptionFormId: Int64?
public let verification: PeerVerification?
} }
case invite(Invite) case invite(Invite)
@ -109,10 +110,10 @@ func _internal_joinLinkInformation(_ hash: String, account: Account) -> Signal<E
|> mapToSignal { result -> Signal<ExternalJoiningChatState, JoinLinkInfoError> in |> mapToSignal { result -> Signal<ExternalJoiningChatState, JoinLinkInfoError> in
if let result = result { if let result = result {
switch result { switch result {
case let .chatInvite(flags, title, about, invitePhoto, participantsCount, participants, nameColor, subscriptionPricing, subscriptionFormId, _): case let .chatInvite(flags, title, about, invitePhoto, participantsCount, participants, nameColor, subscriptionPricing, subscriptionFormId, verification):
let photo = telegramMediaImageFromApiPhoto(invitePhoto).flatMap({ smallestImageRepresentation($0.representations) }) let photo = telegramMediaImageFromApiPhoto(invitePhoto).flatMap({ smallestImageRepresentation($0.representations) })
let flags: ExternalJoiningChatState.Invite.Flags = .init(isChannel: (flags & (1 << 0)) != 0, isBroadcast: (flags & (1 << 1)) != 0, isPublic: (flags & (1 << 2)) != 0, isMegagroup: (flags & (1 << 3)) != 0, requestNeeded: (flags & (1 << 6)) != 0, isVerified: (flags & (1 << 7)) != 0, isScam: (flags & (1 << 8)) != 0, isFake: (flags & (1 << 9)) != 0, canRefulfillSubscription: (flags & (1 << 11)) != 0) let flags: ExternalJoiningChatState.Invite.Flags = .init(isChannel: (flags & (1 << 0)) != 0, isBroadcast: (flags & (1 << 1)) != 0, isPublic: (flags & (1 << 2)) != 0, isMegagroup: (flags & (1 << 3)) != 0, requestNeeded: (flags & (1 << 6)) != 0, isVerified: (flags & (1 << 7)) != 0, isScam: (flags & (1 << 8)) != 0, isFake: (flags & (1 << 9)) != 0, canRefulfillSubscription: (flags & (1 << 11)) != 0)
return .single(.invite(ExternalJoiningChatState.Invite(flags: flags, title: title, about: about, photoRepresentation: photo, participantsCount: participantsCount, participants: participants?.map({ EnginePeer(TelegramUser(user: $0)) }), nameColor: PeerNameColor(rawValue: nameColor), subscriptionPricing: subscriptionPricing.flatMap { StarsSubscriptionPricing(apiStarsSubscriptionPricing: $0) }, subscriptionFormId: subscriptionFormId))) return .single(.invite(ExternalJoiningChatState.Invite(flags: flags, title: title, about: about, photoRepresentation: photo, participantsCount: participantsCount, participants: participants?.map({ EnginePeer(TelegramUser(user: $0)) }), nameColor: PeerNameColor(rawValue: nameColor), subscriptionPricing: subscriptionPricing.flatMap { StarsSubscriptionPricing(apiStarsSubscriptionPricing: $0) }, subscriptionFormId: subscriptionFormId, verification: verification.flatMap { PeerVerification(apiBotVerification: $0) })))
case let .chatInviteAlready(chat): case let .chatInviteAlready(chat):
if let peer = parseTelegramGroupOrChannel(chat: chat) { if let peer = parseTelegramGroupOrChannel(chat: chat) {
return account.postbox.transaction({ (transaction) -> ExternalJoiningChatState in return account.postbox.transaction({ (transaction) -> ExternalJoiningChatState in

View File

@ -536,6 +536,10 @@ public extension EnginePeer {
return self._asPeer().nameColor return self._asPeer().nameColor
} }
var verification: PeerVerification? {
return self._asPeer().verification
}
var profileColor: PeerNameColor? { var profileColor: PeerNameColor? {
return self._asPeer().profileColor return self._asPeer().profileColor
} }

View File

@ -269,6 +269,17 @@ public extension Peer {
} }
} }
var verification: PeerVerification? {
switch self {
case let user as TelegramUser:
return user.verification
case let channel as TelegramChannel:
return channel.verification
default:
return nil
}
}
var profileColor: PeerNameColor? { var profileColor: PeerNameColor? {
switch self { switch self {
case let user as TelegramUser: case let user as TelegramUser: