mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-06 13:12:49 +00:00
Merge commit '96fab482b844cc0ba550fd9ea3dafdd0e1007539'
This commit is contained in:
@@ -6,8 +6,8 @@ import MtProtoKit
|
||||
|
||||
import SyncCore
|
||||
|
||||
public func ensuredExistingPeerExportedInvitation(account: Account, peerId: PeerId, revokeExisted: Bool = false) -> Signal<Void, NoError> {
|
||||
return account.postbox.transaction { transaction -> Signal<Void, NoError> in
|
||||
public func ensuredExistingPeerExportedInvitation(account: Account, peerId: PeerId, revokeExisted: Bool = false) -> Signal<String?, NoError> {
|
||||
return account.postbox.transaction { transaction -> Signal<String?, NoError> in
|
||||
if let peer = transaction.getPeer(peerId), let inputPeer = apiInputPeer(peer) {
|
||||
if let _ = peer as? TelegramChannel {
|
||||
if let cachedData = transaction.getPeerCachedData(peerId: peerId) as? CachedChannelData, cachedData.exportedInvitation != nil && !revokeExisted {
|
||||
@@ -15,8 +15,8 @@ public func ensuredExistingPeerExportedInvitation(account: Account, peerId: Peer
|
||||
} else {
|
||||
return account.network.request(Api.functions.messages.exportChatInvite(peer: inputPeer))
|
||||
|> retryRequest
|
||||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
return account.postbox.transaction { transaction -> Void in
|
||||
|> mapToSignal { result -> Signal<String?, NoError> in
|
||||
return account.postbox.transaction { transaction -> String? in
|
||||
if let invitation = ExportedInvitation(apiExportedInvite: result) {
|
||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
||||
if let current = current as? CachedChannelData {
|
||||
@@ -25,6 +25,9 @@ public func ensuredExistingPeerExportedInvitation(account: Account, peerId: Peer
|
||||
return CachedChannelData().withUpdatedExportedInvitation(invitation)
|
||||
}
|
||||
})
|
||||
return invitation.link
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,8 +38,8 @@ public func ensuredExistingPeerExportedInvitation(account: Account, peerId: Peer
|
||||
} else {
|
||||
return account.network.request(Api.functions.messages.exportChatInvite(peer: inputPeer))
|
||||
|> retryRequest
|
||||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
return account.postbox.transaction { transaction -> Void in
|
||||
|> mapToSignal { result -> Signal<String?, NoError> in
|
||||
return account.postbox.transaction { transaction -> String? in
|
||||
if let invitation = ExportedInvitation(apiExportedInvite: result) {
|
||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
||||
if let current = current as? CachedGroupData {
|
||||
@@ -45,6 +48,9 @@ public func ensuredExistingPeerExportedInvitation(account: Account, peerId: Peer
|
||||
return current
|
||||
}
|
||||
})
|
||||
return invitation.link
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
third-party/webrtc/webrtc-ios
vendored
2
third-party/webrtc/webrtc-ios
vendored
Submodule third-party/webrtc/webrtc-ios updated: 982b3456d0...db98670d64
Reference in New Issue
Block a user