mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
Merge commit '43ac53c1cb0791274e22007d3ca399c66329164c'
This commit is contained in:
commit
30dceb365b
@ -979,7 +979,7 @@ public func channelInfoController(context: AccountContext, peerId: PeerId) -> Vi
|
|||||||
(controller?.navigationController as? NavigationController)?.pushViewController(value)
|
(controller?.navigationController as? NavigationController)?.pushViewController(value)
|
||||||
}
|
}
|
||||||
presentControllerImpl = { [weak controller] value, presentationArguments in
|
presentControllerImpl = { [weak controller] value, presentationArguments in
|
||||||
controller?.present(value, in: .window(.root), with: presentationArguments)
|
controller?.present(value, in: .window(.root), with: presentationArguments, blockInteraction: true)
|
||||||
}
|
}
|
||||||
removePeerChatImpl = { [weak controller] peer, deleteGloballyIfPossible in
|
removePeerChatImpl = { [weak controller] peer, deleteGloballyIfPossible in
|
||||||
guard let controller = controller, let navigationController = controller.navigationController as? NavigationController else {
|
guard let controller = controller, let navigationController = controller.navigationController as? NavigationController else {
|
||||||
|
|||||||
@ -811,7 +811,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
strongSelf.chatDisplayNode.dismissInput()
|
strongSelf.chatDisplayNode.dismissInput()
|
||||||
strongSelf.present(shareController, in: .window(.root))
|
strongSelf.present(shareController, in: .window(.root), blockInteraction: true)
|
||||||
}
|
}
|
||||||
}, presentController: { [weak self] controller, arguments in
|
}, presentController: { [weak self] controller, arguments in
|
||||||
self?.present(controller, in: .window(.root), with: arguments)
|
self?.present(controller, in: .window(.root), with: arguments)
|
||||||
@ -4067,7 +4067,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
|||||||
self.navigationActionDisposable.set((peerView.get()
|
self.navigationActionDisposable.set((peerView.get()
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] peerView in
|
|> deliverOnMainQueue).start(next: { [weak self] peerView in
|
||||||
if let strongSelf = self, let peer = peerView.peers[peerView.peerId], peer.restrictionText == nil {
|
if let strongSelf = self, let peer = peerView.peers[peerView.peerId], peer.restrictionText == nil && !strongSelf.presentationInterfaceState.isNotAccessible {
|
||||||
if let infoController = peerInfoController(context: strongSelf.context, peer: peer) {
|
if let infoController = peerInfoController(context: strongSelf.context, peer: peer) {
|
||||||
(strongSelf.navigationController as? NavigationController)?.pushViewController(infoController)
|
(strongSelf.navigationController as? NavigationController)?.pushViewController(infoController)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -792,7 +792,6 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
if isSecret {
|
if isSecret {
|
||||||
currentSecretIconImage = PresentationResourcesChatList.secretIcon(item.presentationData.theme)
|
currentSecretIconImage = PresentationResourcesChatList.secretIcon(item.presentationData.theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isVerified {
|
if isVerified {
|
||||||
currentVerificationIconImage = PresentationResourcesChatList.verifiedIcon(item.presentationData.theme)
|
currentVerificationIconImage = PresentationResourcesChatList.verifiedIcon(item.presentationData.theme)
|
||||||
}
|
}
|
||||||
@ -827,6 +826,14 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
badgeSize += badgeLayout.width + 5.0
|
badgeSize += badgeLayout.width + 5.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let currentPinnedIconImage = currentPinnedIconImage {
|
||||||
|
if !badgeSize.isZero {
|
||||||
|
badgeSize += 4.0
|
||||||
|
} else {
|
||||||
|
badgeSize += 5.0
|
||||||
|
}
|
||||||
|
badgeSize += currentPinnedIconImage.size.width
|
||||||
|
}
|
||||||
badgeSize = max(badgeSize, reorderInset)
|
badgeSize = max(badgeSize, reorderInset)
|
||||||
|
|
||||||
let (authorLayout, authorApply) = authorLayout(TextNodeLayoutArguments(attributedString: hideAuthor ? nil : authorAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: rawContentRect.width - badgeSize, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets(top: 2.0, left: 1.0, bottom: 2.0, right: 1.0)))
|
let (authorLayout, authorApply) = authorLayout(TextNodeLayoutArguments(attributedString: hideAuthor ? nil : authorAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: rawContentRect.width - badgeSize, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets(top: 2.0, left: 1.0, bottom: 2.0, right: 1.0)))
|
||||||
@ -1311,22 +1318,19 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
let updatedBadgeFrame = CGRect(origin: CGPoint(x: contentRect.maxX - badgeFrame.size.width, y: contentRect.maxY - badgeFrame.size.height - 2.0), size: badgeFrame.size)
|
let updatedBadgeFrame = CGRect(origin: CGPoint(x: contentRect.maxX - badgeFrame.size.width, y: contentRect.maxY - badgeFrame.size.height - 2.0), size: badgeFrame.size)
|
||||||
transition.updateFrame(node: self.badgeNode, frame: updatedBadgeFrame)
|
transition.updateFrame(node: self.badgeNode, frame: updatedBadgeFrame)
|
||||||
|
|
||||||
let mentionBadgeSize = self.pinnedIconNode.bounds.size
|
let pinnedIconSize = self.pinnedIconNode.bounds.size
|
||||||
if mentionBadgeSize != CGSize.zero {
|
if pinnedIconSize != CGSize.zero {
|
||||||
let mentionBadgeOffset: CGFloat
|
let mentionBadgeOffset: CGFloat
|
||||||
if updatedBadgeFrame.size.width.isZero {
|
if updatedBadgeFrame.size.width.isZero {
|
||||||
mentionBadgeOffset = contentRect.maxX - mentionBadgeSize.width
|
mentionBadgeOffset = contentRect.maxX - pinnedIconSize.width
|
||||||
} else {
|
} else {
|
||||||
mentionBadgeOffset = contentRect.maxX - updatedBadgeFrame.size.width - 6.0 - mentionBadgeSize.width
|
mentionBadgeOffset = contentRect.maxX - updatedBadgeFrame.size.width - 6.0 - pinnedIconSize.width
|
||||||
}
|
}
|
||||||
|
|
||||||
let badgeBackgroundWidth = mentionBadgeSize.width
|
let badgeBackgroundWidth = pinnedIconSize.width
|
||||||
let badgeBackgroundFrame = CGRect(x: mentionBadgeOffset, y: self.pinnedIconNode.frame.origin.y, width: badgeBackgroundWidth, height: mentionBadgeSize.height)
|
let badgeBackgroundFrame = CGRect(x: mentionBadgeOffset, y: self.pinnedIconNode.frame.origin.y, width: badgeBackgroundWidth, height: pinnedIconSize.height)
|
||||||
transition.updateFrame(node: self.pinnedIconNode, frame: badgeBackgroundFrame)
|
transition.updateFrame(node: self.pinnedIconNode, frame: badgeBackgroundFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
// let badgeTextFrame = self.badgeTextNode.frame
|
|
||||||
// transition.updateFrame(node: self.badgeTextNode, frame: CGRect(origin: CGPoint(x: updatedBadgeFrame.midX - badgeTextFrame.size.width / 2.0, y: badgeTextFrame.minY), size: badgeTextFrame.size))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2084,7 +2084,7 @@ public func groupInfoController(context: AccountContext, peerId originalPeerId:
|
|||||||
}
|
}
|
||||||
presentControllerImpl = { [weak controller] value, presentationArguments in
|
presentControllerImpl = { [weak controller] value, presentationArguments in
|
||||||
controller?.view.endEditing(true)
|
controller?.view.endEditing(true)
|
||||||
controller?.present(value, in: .window(.root), with: presentationArguments)
|
controller?.present(value, in: .window(.root), with: presentationArguments, blockInteraction: true)
|
||||||
}
|
}
|
||||||
upgradedToSupergroupImpl = { [weak controller] upgradedPeerId, f in
|
upgradedToSupergroupImpl = { [weak controller] upgradedPeerId, f in
|
||||||
let _ = (context.account.postbox.transaction { transaction -> Peer? in
|
let _ = (context.account.postbox.transaction { transaction -> Peer? in
|
||||||
|
|||||||
@ -92,7 +92,7 @@ final class InstantPageController: ViewController {
|
|||||||
self.displayNode = InstantPageControllerNode(context: self.context, settings: self.settings, themeSettings: self.themeSettings, presentationTheme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, statusBar: self.statusBar, sourcePeerType: self.sourcePeerType, getNavigationController: { [weak self] in
|
self.displayNode = InstantPageControllerNode(context: self.context, settings: self.settings, themeSettings: self.themeSettings, presentationTheme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, statusBar: self.statusBar, sourcePeerType: self.sourcePeerType, getNavigationController: { [weak self] in
|
||||||
return self?.navigationController as? NavigationController
|
return self?.navigationController as? NavigationController
|
||||||
}, present: { [weak self] c, a in
|
}, present: { [weak self] c, a in
|
||||||
self?.present(c, in: .window(.root), with: a)
|
self?.present(c, in: .window(.root), with: a, blockInteraction: true)
|
||||||
}, pushController: { [weak self] c in
|
}, pushController: { [weak self] c in
|
||||||
(self?.navigationController as? NavigationController)?.pushViewController(c)
|
(self?.navigationController as? NavigationController)?.pushViewController(c)
|
||||||
}, openPeer: { [weak self] peerId in
|
}, openPeer: { [weak self] peerId in
|
||||||
|
|||||||
@ -78,9 +78,9 @@ private func allOpenInOptions(context: AccountContext, item: OpenInItem) -> [Ope
|
|||||||
return .none
|
return .none
|
||||||
}))
|
}))
|
||||||
|
|
||||||
options.append(OpenInOption(application: .other(title: "Opera Mini", identifier: 363729560, scheme: "opera-http"), action: {
|
options.append(OpenInOption(application: .other(title: "Opera Touch", identifier: 1411869974, scheme: "touch-http"), action: {
|
||||||
if let url = URL(string: url), var components = URLComponents(url: url, resolvingAgainstBaseURL: true) {
|
if let url = URL(string: url), var components = URLComponents(url: url, resolvingAgainstBaseURL: true) {
|
||||||
components.scheme = components.scheme == "https" ? "opera-https" : "opera-http"
|
components.scheme = components.scheme == "https" ? "touch-https" : "touch-http"
|
||||||
if let url = components.string {
|
if let url = components.string {
|
||||||
return .openUrl(url: url)
|
return .openUrl(url: url)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -219,7 +219,17 @@ public class PeerMediaCollectionController: TelegramController {
|
|||||||
ActionSheetButtonItem(title: openText, color: .accent, action: { [weak actionSheet] in
|
ActionSheetButtonItem(title: openText, color: .accent, action: { [weak actionSheet] in
|
||||||
actionSheet?.dismissAnimated()
|
actionSheet?.dismissAnimated()
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.context.sharedContext.applicationBindings.openUrl(url)
|
if canOpenIn {
|
||||||
|
let actionSheet = OpenInActionSheetController(context: strongSelf.context, item: .url(url: url), openUrl: { [weak self] url in
|
||||||
|
if let strongSelf = self, let navigationController = strongSelf.navigationController as? NavigationController {
|
||||||
|
openExternalUrl(context: strongSelf.context, url: url, forceExternal: true, presentationData: strongSelf.presentationData, navigationController: navigationController, dismissInput: {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
strongSelf.present(actionSheet, in: .window(.root))
|
||||||
|
} else {
|
||||||
|
strongSelf.context.sharedContext.applicationBindings.openUrl(url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
ActionSheetButtonItem(title: strongSelf.presentationData.strings.ShareMenu_CopyShareLink, color: .accent, action: { [weak actionSheet] in
|
ActionSheetButtonItem(title: strongSelf.presentationData.strings.ShareMenu_CopyShareLink, color: .accent, action: { [weak actionSheet] in
|
||||||
|
|||||||
@ -192,6 +192,6 @@ final class ShareControllerPeerGridItemNode: GridItemNode {
|
|||||||
|
|
||||||
let bounds = self.bounds
|
let bounds = self.bounds
|
||||||
self.peerNode.frame = bounds
|
self.peerNode.frame = bounds
|
||||||
self.onlineNode.frame = CGRect(origin: CGPoint(x: self.peerNode.frame.width - self.onlineNode.frame.width - 11.0, y: self.peerNode.frame.height - self.onlineNode.frame.height - 43.0), size: self.onlineNode.frame.size)
|
self.onlineNode.frame = CGRect(origin: CGPoint(x: self.peerNode.frame.width - self.onlineNode.frame.width - 13.0, y: self.peerNode.frame.height - self.onlineNode.frame.height - 45.0), size: self.onlineNode.frame.size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1158,7 +1158,7 @@ public func userInfoController(context: AccountContext, peerId: PeerId, mode: Us
|
|||||||
(controller?.navigationController as? NavigationController)?.pushViewController(value)
|
(controller?.navigationController as? NavigationController)?.pushViewController(value)
|
||||||
}
|
}
|
||||||
presentControllerImpl = { [weak controller] value, presentationArguments in
|
presentControllerImpl = { [weak controller] value, presentationArguments in
|
||||||
controller?.present(value, in: .window(.root), with: presentationArguments)
|
controller?.present(value, in: .window(.root), with: presentationArguments, blockInteraction: true)
|
||||||
}
|
}
|
||||||
dismissInputImpl = { [weak controller] in
|
dismissInputImpl = { [weak controller] in
|
||||||
controller?.view.endEditing(true)
|
controller?.view.endEditing(true)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user