mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
webrtc mac specific fix + return exported link [skip ci]
This commit is contained in:
parent
2805b1715c
commit
7ed25d43f1
@ -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
@ -1 +1 @@
|
||||
Subproject commit 982b3456d0b18369f36e2b1e1438f40235a12eae
|
||||
Subproject commit 15ce8b1b99dce2d1404f21f9e974f564bdbf4165
|
Loading…
x
Reference in New Issue
Block a user