Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-08-27 02:36:32 +03:00
parent 7f192986e8
commit 09179b81d1
3 changed files with 69 additions and 44 deletions

View File

@ -5486,11 +5486,16 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if let strongSelf = self, case let .peer(peerId) = strongSelf.chatLocation {
let presentationData = strongSelf.presentationData
let hideNames = strongSelf.presentationInterfaceStatePromise.get()
let hideNames: Signal<Bool, NoError>
if peerId.namespace == Namespaces.Peer.SecretChat {
hideNames = .single(true)
} else {
hideNames = strongSelf.presentationInterfaceStatePromise.get()
|> map { state -> Bool in
return state.interfaceState.forwardOptionsState?.hideNames ?? false
}
|> distinctUntilChanged
}
let hideCaptions = strongSelf.presentationInterfaceStatePromise.get()
|> map { state -> Bool in
@ -5520,9 +5525,14 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
let hideNames = presentationInterfaceState.interfaceState.forwardOptionsState?.hideNames == true
let hideCaptions = presentationInterfaceState.interfaceState.forwardOptionsState?.hideNames == true
if case let .peer(peerId) = strongSelf.chatLocation, peerId.namespace == Namespaces.Peer.SecretChat {
} else {
items.append(.action(ContextMenuActionItem(text: uniquePeerIds.count == 1 ? presentationData.strings.Conversation_ForwardOptions_ShowSendersName : presentationData.strings.Conversation_ForwardOptions_ShowSendersNames, icon: { theme in
if presentationInterfaceState.interfaceState.forwardOptionsState?.hideNames == true {
if hideNames {
return nil
} else {
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
@ -5537,7 +5547,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
})))
items.append(.action(ContextMenuActionItem(text: uniquePeerIds.count == 1 ? presentationData.strings.Conversation_ForwardOptions_HideSendersName : presentationData.strings.Conversation_ForwardOptions_HideSendersNames, icon: { theme in
if presentationInterfaceState.interfaceState.forwardOptionsState?.hideNames == true {
if hideNames {
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
} else {
return nil
@ -5550,11 +5560,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
})
})))
items.append(.separator)
if hasCaptions {
items.append(.separator)
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Conversation_ForwardOptions_ShowCaption, icon: { theme in
if presentationInterfaceState.interfaceState.forwardOptionsState?.hideCaptions == true {
if hideCaptions {
return nil
} else {
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
@ -5569,7 +5581,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
})))
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Conversation_ForwardOptions_HideCaption, icon: { theme in
if presentationInterfaceState.interfaceState.forwardOptionsState?.hideCaptions == true {
if hideCaptions {
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Check"), color: theme.contextMenu.primaryColor)
} else {
return nil
@ -5583,8 +5595,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
})
})))
}
items.append(.separator)
}
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Conversation_ForwardOptions_ChangeRecipient, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor) }, action: { c, f in
self?.interfaceInteraction?.forwardCurrentForwardMessages()

View File

@ -556,6 +556,15 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
if let _ = strongSelf.chatPresentationInterfaceState.inputTextPanelState.mediaRecordingState {
return true
}
var hasChatThemeScreen = false
strongSelf.controller?.window?.forEachController { c in
if c is ChatThemeScreen {
hasChatThemeScreen = true
}
}
if hasChatThemeScreen {
return true
}
return false
}

View File

@ -440,8 +440,11 @@ final class ChatThemeScreen: ViewController {
return
}
strongSelf.dismiss()
if strongSelf.initiallySelectedEmoticon == nil && emoticon == nil {
} else {
strongSelf.completion(emoticon)
}
}
self.controllerNode.dismiss = { [weak self] in
self?.presentingViewController?.dismiss(animated: false, completion: nil)
}
@ -456,6 +459,8 @@ final class ChatThemeScreen: ViewController {
override public func loadView() {
super.loadView()
self.view.disablesInteractiveTransitionGestureRecognizer = true
}
override public func viewDidAppear(_ animated: Bool) {