Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-08-28 02:05:21 +03:00
parent 23655097fc
commit 2cd063a1ea
7 changed files with 84 additions and 41 deletions

View File

@ -6674,7 +6674,7 @@ Sorry for the inconvenience.";
"Notification.YouChangedTheme" = "You changed chat theme to %@"; "Notification.YouChangedTheme" = "You changed chat theme to %@";
"Notification.YouDisabledTheme" = "You disabled chat theme"; "Notification.YouDisabledTheme" = "You disabled chat theme";
"Notification.ChannelChangedTheme" = "Channel theme changed to %2$@"; "Notification.ChannelChangedTheme" = "Channel theme changed to %1$@";
"Notification.ChannelDisabledTheme" = "Channel theme disabled"; "Notification.ChannelDisabledTheme" = "Channel theme disabled";
"Appstore.Cloud" = "**Cloud-based**\nUnlimited storage for chats,\nmedia and documents."; "Appstore.Cloud" = "**Cloud-based**\nUnlimited storage for chats,\nmedia and documents.";

View File

@ -11583,21 +11583,27 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if let strongSelf = self { if let strongSelf = self {
strongSelf.updateChatPresentationInterfaceState(animated: false, interactive: true, { $0.updatedInterfaceState({ $0.withoutSelectionState() }) }) strongSelf.updateChatPresentationInterfaceState(animated: false, interactive: true, { $0.updatedInterfaceState({ $0.withoutSelectionState() }) })
let ready = Promise<Bool>() let navigationController: NavigationController?
strongSelf.controllerNavigationDisposable.set((ready.get()
|> SwiftSignalKit.filter { $0 }
|> take(1)
|> deliverOnMainQueue).start(next: { _ in
if let strongController = controller {
strongController.dismiss()
}
}))
if let parentController = strongSelf.parentController { if let parentController = strongSelf.parentController {
(parentController.navigationController as? NavigationController)?.replaceTopController(ChatControllerImpl(context: strongSelf.context, chatLocation: .peer(peerId)), animated: false, ready: ready) navigationController = (parentController.navigationController as? NavigationController)
} else { } else {
strongSelf.effectiveNavigationController?.replaceTopController(ChatControllerImpl(context: strongSelf.context, chatLocation: .peer(peerId)), animated: false, ready: ready) navigationController = strongSelf.effectiveNavigationController
}
if let navigationController = navigationController {
let chatController = ChatControllerImpl(context: strongSelf.context, chatLocation: .peer(peerId))
var viewControllers = navigationController.viewControllers
viewControllers.insert(chatController, at: viewControllers.count - 1)
navigationController.setViewControllers(viewControllers, animated: false)
strongSelf.controllerNavigationDisposable.set((chatController.ready.get()
|> SwiftSignalKit.filter { $0 }
|> take(1)
|> deliverOnMainQueue).start(next: { _ in
if let strongController = controller {
strongController.dismiss()
}
}))
} }
} }
}) })
@ -11705,16 +11711,22 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|> deliverOnMainQueue).start(completed: { |> deliverOnMainQueue).start(completed: {
if let strongSelf = self { if let strongSelf = self {
strongSelf.updateChatPresentationInterfaceState(animated: false, interactive: true, { $0.updatedInterfaceState({ $0.withoutSelectionState() }) }) strongSelf.updateChatPresentationInterfaceState(animated: false, interactive: true, { $0.updatedInterfaceState({ $0.withoutSelectionState() }) })
let ready = Promise<Bool>() if let navigationController = strongSelf.effectiveNavigationController {
let chatController = ChatControllerImpl(context: strongSelf.context, chatLocation: .peer(peerId))
strongSelf.controllerNavigationDisposable.set((ready.get() |> filter { $0 } |> take(1) |> deliverOnMainQueue).start(next: { _ in var viewControllers = navigationController.viewControllers
if let strongController = controller { viewControllers.insert(chatController, at: viewControllers.count - 1)
strongController.dismiss() navigationController.setViewControllers(viewControllers, animated: false)
}
})) strongSelf.controllerNavigationDisposable.set((chatController.ready.get()
|> filter { $0 }
strongSelf.effectiveNavigationController?.replaceTopController(ChatControllerImpl(context: strongSelf.context, chatLocation: .peer(peerId)), animated: false, ready: ready) |> take(1)
|> deliverOnMainQueue).start(next: { _ in
if let strongController = controller {
strongController.dismiss()
}
}))
}
} }
}) })
} }

View File

@ -2472,7 +2472,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
let isSelected = (self.controllerInteraction.selectionState?.selectedIds.contains(message.id) ?? false) let isSelected = (self.controllerInteraction.selectionState?.selectedIds.contains(message.id) ?? false)
if state.selecting != isSelected { if state.selecting != isSelected {
let messageIds = messages.filter { message -> Bool in let messageIds = messages.filter { message -> Bool in
for media in messages { for media in message.media {
if media is TelegramMediaAction { if media is TelegramMediaAction {
return false return false
} }

View File

@ -68,6 +68,8 @@ final class EditAccessoryPanelNode: AccessoryPanelNode {
var strings: PresentationStrings var strings: PresentationStrings
var nameDisplayOrder: PresentationPersonNameOrder var nameDisplayOrder: PresentationPersonNameOrder
private var validLayout: (size: CGSize, inset: CGFloat, interfaceState: ChatPresentationInterfaceState)?
init(context: AccountContext, messageId: MessageId, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat) { init(context: AccountContext, messageId: MessageId, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat) {
self.context = context self.context = context
self.messageId = messageId self.messageId = messageId
@ -296,7 +298,9 @@ final class EditAccessoryPanelNode: AccessoryPanelNode {
}) |> then(updateImageSignal)) }) |> then(updateImageSignal))
} }
self.setNeedsLayout() if let (size, inset, interfaceState) = self.validLayout {
self.updateState(size: size, inset: inset, interfaceState: interfaceState)
}
} }
override func updateThemeAndStrings(theme: PresentationTheme, strings: PresentationStrings) { override func updateThemeAndStrings(theme: PresentationTheme, strings: PresentationStrings) {
@ -316,7 +320,9 @@ final class EditAccessoryPanelNode: AccessoryPanelNode {
self.textNode.attributedText = NSAttributedString(string: text, font: Font.regular(15.0), textColor: self.theme.chat.inputPanel.primaryTextColor) self.textNode.attributedText = NSAttributedString(string: text, font: Font.regular(15.0), textColor: self.theme.chat.inputPanel.primaryTextColor)
} }
self.setNeedsLayout() if let (size, inset, interfaceState) = self.validLayout {
self.updateState(size: size, inset: inset, interfaceState: interfaceState)
}
} }
} }
@ -325,6 +331,8 @@ final class EditAccessoryPanelNode: AccessoryPanelNode {
} }
override func updateState(size: CGSize, inset: CGFloat, interfaceState: ChatPresentationInterfaceState) { override func updateState(size: CGSize, inset: CGFloat, interfaceState: ChatPresentationInterfaceState) {
self.validLayout = (size, inset, interfaceState)
let editMediaReference = interfaceState.editMessageState?.mediaReference let editMediaReference = interfaceState.editMessageState?.mediaReference
var updatedEditMedia = false var updatedEditMedia = false
if let currentEditMediaReference = self.currentEditMediaReference, let editMediaReference = editMediaReference { if let currentEditMediaReference = self.currentEditMediaReference, let editMediaReference = editMediaReference {

View File

@ -5805,14 +5805,21 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
if let strongSelf = self { if let strongSelf = self {
strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone) strongSelf.headerNode.navigationButtonContainer.performAction?(.selectionDone)
let ready = Promise<Bool>() if let navigationController = strongSelf.controller?.navigationController as? NavigationController {
strongSelf.activeActionDisposable.set((ready.get() |> filter { $0 } |> take(1) |> deliverOnMainQueue).start(next: { _ in let chatController = ChatControllerImpl(context: strongSelf.context, chatLocation: .peer(peerId))
if let peerSelectionController = peerSelectionController { var viewControllers = navigationController.viewControllers
peerSelectionController.dismiss() viewControllers.insert(chatController, at: viewControllers.count - 1)
} navigationController.setViewControllers(viewControllers, animated: false)
}))
strongSelf.activeActionDisposable.set((chatController.ready.get()
(strongSelf.controller?.navigationController as? NavigationController)?.replaceTopController(ChatControllerImpl(context: strongSelf.context, chatLocation: .peer(peerId)), animated: false, ready: ready) |> filter { $0 }
|> take(1)
|> deliverOnMainQueue).start(next: { _ in
if let peerSelectionController = peerSelectionController {
peerSelectionController.dismiss()
}
}))
}
} }
}) })
} }

View File

@ -30,6 +30,8 @@ final class ReplyAccessoryPanelNode: AccessoryPanelNode {
var theme: PresentationTheme var theme: PresentationTheme
var strings: PresentationStrings var strings: PresentationStrings
private var validLayout: (size: CGSize, inset: CGFloat, interfaceState: ChatPresentationInterfaceState)?
init(context: AccountContext, messageId: MessageId, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat) { init(context: AccountContext, messageId: MessageId, theme: PresentationTheme, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat) {
self.messageId = messageId self.messageId = messageId
@ -204,7 +206,9 @@ final class ReplyAccessoryPanelNode: AccessoryPanelNode {
strongSelf.imageNode.setSignal(updateImageSignal) strongSelf.imageNode.setSignal(updateImageSignal)
} }
strongSelf.setNeedsLayout() if let (size, inset, interfaceState) = strongSelf.validLayout {
strongSelf.updateState(size: size, inset: inset, interfaceState: interfaceState)
}
} }
})) }))
} }
@ -236,7 +240,9 @@ final class ReplyAccessoryPanelNode: AccessoryPanelNode {
self.textNode.attributedText = NSAttributedString(string: text, font: Font.regular(15.0), textColor: self.theme.chat.inputPanel.primaryTextColor) self.textNode.attributedText = NSAttributedString(string: text, font: Font.regular(15.0), textColor: self.theme.chat.inputPanel.primaryTextColor)
} }
self.setNeedsLayout() if let (size, inset, interfaceState) = self.validLayout {
self.updateState(size: size, inset: inset, interfaceState: interfaceState)
}
} }
} }
@ -245,7 +251,9 @@ final class ReplyAccessoryPanelNode: AccessoryPanelNode {
} }
override func updateState(size: CGSize, inset: CGFloat, interfaceState: ChatPresentationInterfaceState) { override func updateState(size: CGSize, inset: CGFloat, interfaceState: ChatPresentationInterfaceState) {
let bounds = self.bounds self.validLayout = (size, inset, interfaceState)
let bounds = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 45.0))
let leftInset: CGFloat = 55.0 let leftInset: CGFloat = 55.0
let textLineInset: CGFloat = 10.0 let textLineInset: CGFloat = 10.0
let rightInset: CGFloat = 55.0 let rightInset: CGFloat = 55.0

View File

@ -27,6 +27,8 @@ final class WebpagePreviewAccessoryPanelNode: AccessoryPanelNode {
var theme: PresentationTheme var theme: PresentationTheme
var strings: PresentationStrings var strings: PresentationStrings
private var validLayout: (size: CGSize, inset: CGFloat, interfaceState: ChatPresentationInterfaceState)?
init(context: AccountContext, url: String, webpage: TelegramMediaWebpage, theme: PresentationTheme, strings: PresentationStrings) { init(context: AccountContext, url: String, webpage: TelegramMediaWebpage, theme: PresentationTheme, strings: PresentationStrings) {
self.url = url self.url = url
self.webpage = webpage self.webpage = webpage
@ -92,7 +94,9 @@ final class WebpagePreviewAccessoryPanelNode: AccessoryPanelNode {
self.updateWebpage() self.updateWebpage()
self.setNeedsLayout() if let (size, inset, interfaceState) = self.validLayout {
self.updateState(size: size, inset: inset, interfaceState: interfaceState)
}
} }
} }
@ -143,7 +147,9 @@ final class WebpagePreviewAccessoryPanelNode: AccessoryPanelNode {
self.titleString = NSAttributedString(string: authorName, font: Font.medium(15.0), textColor: self.theme.chat.inputPanel.panelControlAccentColor) self.titleString = NSAttributedString(string: authorName, font: Font.medium(15.0), textColor: self.theme.chat.inputPanel.panelControlAccentColor)
self.textString = NSAttributedString(string: text, font: Font.regular(15.0), textColor: self.theme.chat.inputPanel.primaryTextColor) self.textString = NSAttributedString(string: text, font: Font.regular(15.0), textColor: self.theme.chat.inputPanel.primaryTextColor)
self.setNeedsLayout() if let (size, inset, interfaceState) = self.validLayout {
self.updateState(size: size, inset: inset, interfaceState: interfaceState)
}
} }
override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize { override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
@ -151,7 +157,9 @@ final class WebpagePreviewAccessoryPanelNode: AccessoryPanelNode {
} }
override func updateState(size: CGSize, inset: CGFloat, interfaceState: ChatPresentationInterfaceState) { override func updateState(size: CGSize, inset: CGFloat, interfaceState: ChatPresentationInterfaceState) {
let bounds = self.bounds self.validLayout = (size, inset, interfaceState)
let bounds = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 45.0))
let leftInset: CGFloat = 55.0 let leftInset: CGFloat = 55.0
let textLineInset: CGFloat = 10.0 let textLineInset: CGFloat = 10.0
let rightInset: CGFloat = 55.0 let rightInset: CGFloat = 55.0