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
ebe05a1e8a
commit
a59f9e1969
@ -178,12 +178,14 @@ public final class InviteLinkInviteController: ViewController {
|
|||||||
|
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
private let peerId: PeerId
|
private let peerId: PeerId
|
||||||
|
private weak var parentNavigationController: NavigationController?
|
||||||
|
|
||||||
private var presentationDataDisposable: Disposable?
|
private var presentationDataDisposable: Disposable?
|
||||||
|
|
||||||
public init(context: AccountContext, peerId: PeerId) {
|
public init(context: AccountContext, peerId: PeerId, parentNavigationController: NavigationController?) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
|
self.parentNavigationController = parentNavigationController
|
||||||
|
|
||||||
super.init(navigationBarPresentationData: nil)
|
super.init(navigationBarPresentationData: nil)
|
||||||
|
|
||||||
@ -389,7 +391,7 @@ public final class InviteLinkInviteController: ViewController {
|
|||||||
self?.controller?.present(shareController, in: .window(.root))
|
self?.controller?.present(shareController, in: .window(.root))
|
||||||
}, manageLinks: { [weak self] in
|
}, manageLinks: { [weak self] in
|
||||||
let controller = inviteLinkListController(context: context, peerId: peerId)
|
let controller = inviteLinkListController(context: context, peerId: peerId)
|
||||||
self?.controller?.push(controller)
|
self?.controller?.parentNavigationController?.pushViewController(controller)
|
||||||
self?.controller?.dismiss()
|
self?.controller?.dismiss()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -558,7 +560,7 @@ public final class InviteLinkInviteController: ViewController {
|
|||||||
let listTopInset = layoutTopInset + headerHeight
|
let listTopInset = layoutTopInset + headerHeight
|
||||||
let listNodeSize = CGSize(width: layout.size.width, height: layout.size.height - listTopInset)
|
let listNodeSize = CGSize(width: layout.size.width, height: layout.size.height - listTopInset)
|
||||||
|
|
||||||
insets.top = max(0.0, listNodeSize.height - visibleItemsHeight)
|
insets.top = max(0.0, listNodeSize.height - visibleItemsHeight - insets.bottom)
|
||||||
|
|
||||||
let (duration, curve) = listViewAnimationDurationAndCurve(transition: transition)
|
let (duration, curve) = listViewAnimationDurationAndCurve(transition: transition)
|
||||||
let updateSizeAndInsets = ListViewUpdateSizeAndInsets(size: listNodeSize, insets: insets, duration: duration, curve: curve)
|
let updateSizeAndInsets = ListViewUpdateSizeAndInsets(size: listNodeSize, insets: insets, duration: duration, curve: curve)
|
||||||
|
@ -209,7 +209,7 @@ public final class InviteLinkQRCodeController: ViewController {
|
|||||||
self.contentContainerNode.addSubnode(self.qrIconNode)
|
self.contentContainerNode.addSubnode(self.qrIconNode)
|
||||||
self.contentContainerNode.addSubnode(self.qrButtonNode)
|
self.contentContainerNode.addSubnode(self.qrButtonNode)
|
||||||
|
|
||||||
let textFont = Font.regular(16.0)
|
let textFont = Font.regular(13.0)
|
||||||
|
|
||||||
self.textNode.attributedText = NSAttributedString(string: self.presentationData.strings.InviteLink_QRCode_Info, font: textFont, textColor: secondaryTextColor)
|
self.textNode.attributedText = NSAttributedString(string: self.presentationData.strings.InviteLink_QRCode_Info, font: textFont, textColor: secondaryTextColor)
|
||||||
self.buttonNode.title = self.presentationData.strings.InviteLink_QRCode_Share
|
self.buttonNode.title = self.presentationData.strings.InviteLink_QRCode_Share
|
||||||
@ -352,7 +352,7 @@ public final class InviteLinkQRCodeController: ViewController {
|
|||||||
|
|
||||||
let _ = imageApply()
|
let _ = imageApply()
|
||||||
|
|
||||||
let imageFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - imageSize.width) / 2.0), y: insets.top + 24.0), size: imageSize)
|
let imageFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - imageSize.width) / 2.0), y: insets.top + 16.0), size: imageSize)
|
||||||
transition.updateFrame(node: self.qrImageNode, frame: imageFrame)
|
transition.updateFrame(node: self.qrImageNode, frame: imageFrame)
|
||||||
transition.updateFrame(node: self.qrButtonNode, frame: imageFrame)
|
transition.updateFrame(node: self.qrButtonNode, frame: imageFrame)
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ public final class InviteLinkQRCodeController: ViewController {
|
|||||||
|
|
||||||
let inset: CGFloat = 22.0
|
let inset: CGFloat = 22.0
|
||||||
let textSize = self.textNode.updateLayout(CGSize(width: layout.size.width - inset * 2.0, height: CGFloat.greatestFiniteMagnitude))
|
let textSize = self.textNode.updateLayout(CGSize(width: layout.size.width - inset * 2.0, height: CGFloat.greatestFiniteMagnitude))
|
||||||
let textFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - textSize.width) / 2.0), y: imageFrame.maxX + 20.0), size: textSize)
|
let textFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - textSize.width) / 2.0), y: imageFrame.maxY + 20.0), size: textSize)
|
||||||
transition.updateFrame(node: self.textNode, frame: textFrame)
|
transition.updateFrame(node: self.textNode, frame: textFrame)
|
||||||
|
|
||||||
let buttonSideInset: CGFloat = 16.0
|
let buttonSideInset: CGFloat = 16.0
|
||||||
@ -379,7 +379,7 @@ public final class InviteLinkQRCodeController: ViewController {
|
|||||||
|
|
||||||
|
|
||||||
let titleHeight: CGFloat = 54.0
|
let titleHeight: CGFloat = 54.0
|
||||||
let contentHeight = titleHeight + textSize.height + imageSize.height + bottomInset + 52.0 + 77.0
|
let contentHeight = titleHeight + textSize.height + imageSize.height + bottomInset + 121.0
|
||||||
|
|
||||||
let width = horizontalContainerFillingSizeForLayout(layout: layout, sideInset: layout.safeInsets.left)
|
let width = horizontalContainerFillingSizeForLayout(layout: layout, sideInset: layout.safeInsets.left)
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ public final class InviteLinkQRCodeController: ViewController {
|
|||||||
transition.updateFrame(node: self.titleNode, frame: titleFrame)
|
transition.updateFrame(node: self.titleNode, frame: titleFrame)
|
||||||
|
|
||||||
let cancelSize = self.cancelButton.measure(CGSize(width: width, height: titleHeight))
|
let cancelSize = self.cancelButton.measure(CGSize(width: width, height: titleHeight))
|
||||||
let cancelFrame = CGRect(origin: CGPoint(x: width - cancelSize.width - 16.0, y: 16.0), size: cancelSize)
|
let cancelFrame = CGRect(origin: CGPoint(x: width - cancelSize.width - 16.0, y: 18.0), size: cancelSize)
|
||||||
transition.updateFrame(node: self.cancelButton, frame: cancelFrame)
|
transition.updateFrame(node: self.cancelButton, frame: cancelFrame)
|
||||||
|
|
||||||
let buttonInset: CGFloat = 16.0
|
let buttonInset: CGFloat = 16.0
|
||||||
|
@ -342,6 +342,8 @@ public func channelMembersController(context: AccountContext, peerId: PeerId) ->
|
|||||||
var pushControllerImpl: ((ViewController) -> Void)?
|
var pushControllerImpl: ((ViewController) -> Void)?
|
||||||
var dismissInputImpl: (() -> Void)?
|
var dismissInputImpl: (() -> Void)?
|
||||||
|
|
||||||
|
var getControllerImpl: (() -> ViewController?)?
|
||||||
|
|
||||||
let actionsDisposable = DisposableSet()
|
let actionsDisposable = DisposableSet()
|
||||||
|
|
||||||
let addMembersDisposable = MetaDisposable()
|
let addMembersDisposable = MetaDisposable()
|
||||||
@ -462,7 +464,9 @@ public func channelMembersController(context: AccountContext, peerId: PeerId) ->
|
|||||||
pushControllerImpl?(controller)
|
pushControllerImpl?(controller)
|
||||||
}
|
}
|
||||||
}, inviteViaLink: {
|
}, inviteViaLink: {
|
||||||
presentControllerImpl?(InviteLinkInviteController(context: context, peerId: peerId), nil)
|
if let controller = getControllerImpl?() {
|
||||||
|
presentControllerImpl?(InviteLinkInviteController(context: context, peerId: peerId, parentNavigationController: controller.navigationController as? NavigationController), nil)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
let peerView = context.account.viewTracker.peerView(peerId)
|
let peerView = context.account.viewTracker.peerView(peerId)
|
||||||
@ -551,6 +555,9 @@ public func channelMembersController(context: AccountContext, peerId: PeerId) ->
|
|||||||
dismissInputImpl = { [weak controller] in
|
dismissInputImpl = { [weak controller] in
|
||||||
controller?.view.endEditing(true)
|
controller?.view.endEditing(true)
|
||||||
}
|
}
|
||||||
|
getControllerImpl = { [weak controller] in
|
||||||
|
return controller
|
||||||
|
}
|
||||||
controller.visibleBottomContentOffsetChanged = { offset in
|
controller.visibleBottomContentOffsetChanged = { offset in
|
||||||
if let loadMoreControl = loadMoreControl, case let .known(value) = offset, value < 40.0 {
|
if let loadMoreControl = loadMoreControl, case let .known(value) = offset, value < 40.0 {
|
||||||
context.peerChannelMemberCategoriesContextsManager.loadMore(peerId: peerId, control: loadMoreControl)
|
context.peerChannelMemberCategoriesContextsManager.loadMore(peerId: peerId, control: loadMoreControl)
|
||||||
|
@ -4551,7 +4551,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
|
|
||||||
contactsController?.push(visibilityController)
|
contactsController?.push(visibilityController)
|
||||||
} else {
|
} else {
|
||||||
contactsController?.present(InviteLinkInviteController(context: context, peerId: groupPeer.id), in: .window(.root))
|
contactsController?.present(InviteLinkInviteController(context: context, peerId: groupPeer.id, parentNavigationController: contactsController?.navigationController as? NavigationController), in: .window(.root))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user