Merge commit '458e6bd9009f6a84c6d914057ee7a4e22d032259'

This commit is contained in:
Ali 2021-02-12 12:44:26 +04:00
commit afad8495f1
4 changed files with 27 additions and 3 deletions

View File

@ -376,6 +376,10 @@ public final class InviteLinkInviteController: ViewController {
ActionSheetButtonItem(title: presentationData.strings.GroupInfo_InviteLink_RevokeLink, color: .destructive, action: {
dismissAction()
if let invite = invite {
let _ = (revokePeerExportedInvitation(account: context.account, peerId: peerId, link: invite.link) |> deliverOnMainQueue).start(completed: {
})
}
})
]),
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])

View File

@ -326,7 +326,7 @@ private func inviteLinkListControllerEntries(presentationData: PresentationData,
hasLinks = true
}
if hasLinks {
if hasLinks || admin == nil {
entries.append(.linksHeader(presentationData.theme, presentationData.strings.InviteLink_AdditionalLinks.uppercased()))
}
if admin == nil {

View File

@ -158,7 +158,27 @@ public func revokePeerExportedInvitation(account: Account, peerId: PeerId, link:
updatePeers(transaction: transaction, peers: peers, update: { _, updated -> Peer in
return updated
})
return .replace(ExportedInvitation(apiExportedInvite: invite), ExportedInvitation(apiExportedInvite: newInvite))
let previous = ExportedInvitation(apiExportedInvite: invite)
let new = ExportedInvitation(apiExportedInvite: newInvite)
if previous.isPermanent && new.isPermanent {
transaction.updatePeerCachedData(peerIds: [peerId]) { peerId, current -> CachedPeerData? in
if peerId.namespace == Namespaces.Peer.CloudGroup {
var current = current as? CachedGroupData ?? CachedGroupData()
current = current.withUpdatedExportedInvitation(new)
return current
} else if peerId.namespace == Namespaces.Peer.CloudChannel {
var current = current as? CachedChannelData ?? CachedChannelData()
current = current.withUpdatedExportedInvitation(new)
return current
} else {
return current
}
}
}
return .replace(previous, new)
} else {
return nil
}

View File

@ -224,7 +224,7 @@ public class ComposeControllerImpl: ViewController, ComposeController {
if let strongSelf = self {
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
let controller = PermissionController(context: strongSelf.context, splashScreen: true)
controller.setState(.custom(icon: .animation("Channels"), title: presentationData.strings.ChannelIntro_ChannelsTitle, subtitle: nil, text: presentationData.strings.ChannelIntro_ChannelsText, buttonTitle: presentationData.strings.ChannelIntro_CreateChannel, secondaryButtonTitle: nil, footerText: nil), animated: false)
controller.setState(.custom(icon: .animation("Channels"), title: presentationData.strings.ChannelIntro_Title, subtitle: nil, text: presentationData.strings.ChannelIntro_Text, buttonTitle: presentationData.strings.ChannelIntro_CreateChannel, secondaryButtonTitle: nil, footerText: nil), animated: false)
controller.proceed = { [weak self] result in
if let strongSelf = self {
(strongSelf.navigationController as? NavigationController)?.replaceTopController(createChannelController(context: strongSelf.context), animated: true)