mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Invite Links Fixes
This commit is contained in:
parent
172aa38270
commit
7feaede53e
@ -376,6 +376,10 @@ public final class InviteLinkInviteController: ViewController {
|
|||||||
ActionSheetButtonItem(title: presentationData.strings.GroupInfo_InviteLink_RevokeLink, color: .destructive, action: {
|
ActionSheetButtonItem(title: presentationData.strings.GroupInfo_InviteLink_RevokeLink, color: .destructive, action: {
|
||||||
dismissAction()
|
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() })])
|
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
|
||||||
|
@ -326,7 +326,7 @@ private func inviteLinkListControllerEntries(presentationData: PresentationData,
|
|||||||
hasLinks = true
|
hasLinks = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasLinks {
|
if hasLinks || admin == nil {
|
||||||
entries.append(.linksHeader(presentationData.theme, presentationData.strings.InviteLink_AdditionalLinks.uppercased()))
|
entries.append(.linksHeader(presentationData.theme, presentationData.strings.InviteLink_AdditionalLinks.uppercased()))
|
||||||
}
|
}
|
||||||
if admin == nil {
|
if admin == nil {
|
||||||
|
@ -158,7 +158,27 @@ public func revokePeerExportedInvitation(account: Account, peerId: PeerId, link:
|
|||||||
updatePeers(transaction: transaction, peers: peers, update: { _, updated -> Peer in
|
updatePeers(transaction: transaction, peers: peers, update: { _, updated -> Peer in
|
||||||
return updated
|
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 {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ public class ComposeControllerImpl: ViewController, ComposeController {
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let controller = PermissionController(context: strongSelf.context, splashScreen: true)
|
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
|
controller.proceed = { [weak self] result in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
(strongSelf.navigationController as? NavigationController)?.replaceTopController(createChannelController(context: strongSelf.context), animated: true)
|
(strongSelf.navigationController as? NavigationController)?.replaceTopController(createChannelController(context: strongSelf.context), animated: true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user