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
415164748f
commit
e739cd91ff
@ -1252,6 +1252,8 @@ private final class TimePickerNode: ASDisplayNode {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
self.update()
|
||||
}
|
||||
|
||||
override func didLoad() {
|
||||
|
@ -16,7 +16,7 @@ public final class TextFieldNodeView: UITextField {
|
||||
}
|
||||
|
||||
override public func placeholderRect(forBounds bounds: CGRect) -> CGRect {
|
||||
return self.editingRect(forBounds: bounds.offsetBy(dx: 0.0, dy: -1.0))
|
||||
return self.editingRect(forBounds: bounds.offsetBy(dx: 0.0, dy: 0.0))
|
||||
}
|
||||
|
||||
override public func deleteBackward() {
|
||||
|
@ -422,6 +422,10 @@ public func inviteLinkListController(context: AccountContext, peerId: PeerId, ad
|
||||
|
||||
let arguments = InviteLinkListControllerArguments(context: context, shareMainLink: { invite in
|
||||
let shareController = ShareController(context: context, subject: .url(invite.link))
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
presentControllerImpl?(shareController, nil)
|
||||
}, openMainLink: { invite in
|
||||
let controller = InviteLinkViewController(context: context, peerId: peerId, invite: invite, invitationsContext: nil, revokedInvitationsContext: revokedInvitesContext, importersContext: nil)
|
||||
@ -580,6 +584,10 @@ public func inviteLinkListController(context: AccountContext, peerId: PeerId, ad
|
||||
f(.default)
|
||||
|
||||
let shareController = ShareController(context: context, subject: .url(invite.link))
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})))
|
||||
|
||||
|
@ -435,6 +435,10 @@ public final class InviteLinkViewController: ViewController {
|
||||
self?.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}, shareLink: { [weak self] invite in
|
||||
let shareController = ShareController(context: context, subject: .url(invite.link))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self?.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
self?.controller?.present(shareController, in: .window(.root))
|
||||
}, editLink: { [weak self] invite in
|
||||
self?.editButtonPressed()
|
||||
|
@ -918,6 +918,10 @@ public func channelVisibilityController(context: AccountContext, peerId: PeerId,
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}, shareLink: { invite in
|
||||
let shareController = ShareController(context: context, subject: .url(invite.link))
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
presentControllerImpl?(shareController, nil)
|
||||
}, linkContextAction: { node in
|
||||
guard let node = node as? ContextExtractedContentContainingNode, let controller = getControllerImpl?() else {
|
||||
|
@ -304,6 +304,7 @@ public final class ShareController: ViewController {
|
||||
|
||||
private var defaultAction: ShareControllerAction?
|
||||
|
||||
public var actionCompleted: (() -> Void)?
|
||||
public var dismissed: ((Bool) -> Void)?
|
||||
public var completed: (([PeerId]) -> Void)? {
|
||||
didSet {
|
||||
@ -346,6 +347,8 @@ public final class ShareController: ViewController {
|
||||
self.defaultAction = ShareControllerAction(title: forcedActionTitle ?? self.presentationData.strings.ShareMenu_CopyShareLink, action: { [weak self] in
|
||||
UIPasteboard.general.string = text
|
||||
self?.controllerNode.cancel?()
|
||||
|
||||
self?.actionCompleted?()
|
||||
})
|
||||
case .text:
|
||||
break
|
||||
@ -355,6 +358,8 @@ public final class ShareController: ViewController {
|
||||
let url = "https://maps.apple.com/maps?ll=\(latLong)&q=\(latLong)&t=m"
|
||||
UIPasteboard.general.string = url
|
||||
self?.controllerNode.cancel?()
|
||||
|
||||
self?.actionCompleted?()
|
||||
})
|
||||
break
|
||||
case .quote:
|
||||
@ -363,6 +368,7 @@ public final class ShareController: ViewController {
|
||||
if case .saveToCameraRoll = preferredAction {
|
||||
self.defaultAction = ShareControllerAction(title: self.presentationData.strings.Preview_SaveToCameraRoll, action: { [weak self] in
|
||||
self?.saveToCameraRoll(representations: representations)
|
||||
self?.actionCompleted?()
|
||||
})
|
||||
}
|
||||
case let .media(mediaReference):
|
||||
@ -375,12 +381,14 @@ public final class ShareController: ViewController {
|
||||
if case .saveToCameraRoll = preferredAction, canSave {
|
||||
self.defaultAction = ShareControllerAction(title: self.presentationData.strings.Preview_SaveToCameraRoll, action: { [weak self] in
|
||||
self?.saveToCameraRoll(mediaReference: mediaReference)
|
||||
self?.actionCompleted?()
|
||||
})
|
||||
}
|
||||
case let .messages(messages):
|
||||
if case .saveToCameraRoll = preferredAction {
|
||||
self.defaultAction = ShareControllerAction(title: self.presentationData.strings.Preview_SaveToCameraRoll, action: { [weak self] in
|
||||
self?.saveToCameraRoll(messages: messages)
|
||||
self?.actionCompleted?()
|
||||
})
|
||||
} else if let message = messages.first {
|
||||
let groupingKey: Int64? = message.groupingKey
|
||||
@ -397,6 +405,7 @@ public final class ShareController: ViewController {
|
||||
self.defaultAction = ShareControllerAction(title: self.presentationData.strings.SharedMedia_ViewInChat, action: { [weak self] in
|
||||
self?.controllerNode.cancel?()
|
||||
showInChat(message)
|
||||
self?.actionCompleted?()
|
||||
})
|
||||
} else if let chatPeer = message.peers[message.id.peerId] as? TelegramChannel, messages.count == 1 || sameGroupingKey {
|
||||
if message.id.namespace == Namespaces.Message.Cloud {
|
||||
@ -414,6 +423,7 @@ public final class ShareController: ViewController {
|
||||
}
|
||||
})
|
||||
strongSelf.controllerNode.cancel?()
|
||||
strongSelf.actionCompleted?()
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -426,6 +436,7 @@ public final class ShareController: ViewController {
|
||||
self.defaultAction = ShareControllerAction(title: action.title, action: { [weak self] in
|
||||
self?.controllerNode.cancel?()
|
||||
action.action()
|
||||
self?.actionCompleted?()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -599,6 +599,7 @@ public final class VoiceChatController: ViewController {
|
||||
private var didSetContentsReady: Bool = false
|
||||
private var didSetDataReady: Bool = false
|
||||
|
||||
private var peer: Peer?
|
||||
private var currentTitle: String = ""
|
||||
private var currentSubtitle: String = ""
|
||||
private var currentCallMembers: ([GroupCallParticipantsContext.Participant], String?)?
|
||||
@ -1298,6 +1299,7 @@ public final class VoiceChatController: ViewController {
|
||||
}
|
||||
|
||||
if let peer = peerViewMainPeer(view) {
|
||||
strongSelf.peer = peer
|
||||
strongSelf.currentTitle = peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)
|
||||
}
|
||||
if !strongSelf.didSetDataReady {
|
||||
@ -2466,7 +2468,16 @@ public final class VoiceChatController: ViewController {
|
||||
|
||||
var processedPeerIds = Set<PeerId>()
|
||||
|
||||
var canInvite = true
|
||||
if let peer = self.peer as? TelegramChannel, peer.flags.contains(.isGigagroup) {
|
||||
if peer.flags.contains(.isCreator) || peer.adminRights != nil {
|
||||
} else {
|
||||
canInvite = false
|
||||
}
|
||||
}
|
||||
if canInvite {
|
||||
entries.append(.invite(self.presentationData.theme, self.presentationData.strings, self.presentationData.strings.VoiceChat_InviteMember))
|
||||
}
|
||||
|
||||
for member in callMembers.0 {
|
||||
if processedPeerIds.contains(member.peer.id) {
|
||||
|
@ -55,6 +55,13 @@ private func canEditMessage(accountPeerId: PeerId, limitsConfiguration: LimitsCo
|
||||
} else if let author = message.author, author.id == accountPeerId, let peer = message.peers[message.id.peerId] {
|
||||
hasEditRights = true
|
||||
if let peer = peer as? TelegramChannel {
|
||||
if peer.flags.contains(.isGigagroup) {
|
||||
if peer.flags.contains(.isCreator) || peer.adminRights != nil {
|
||||
hasEditRights = true
|
||||
} else {
|
||||
hasEditRights = false
|
||||
}
|
||||
}
|
||||
switch peer.info {
|
||||
case .broadcast:
|
||||
if peer.hasPermission(.editAllMessages) || !message.flags.contains(.Incoming) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user