mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various improvements
This commit is contained in:
@@ -10653,6 +10653,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if case .standard(false) = self.presentationInterfaceState.mode, self.raiseToListen == nil {
|
||||
self.raiseToListen = RaiseToListenManager(shouldActivate: { [weak self] in
|
||||
if let strongSelf = self, strongSelf.isNodeLoaded && strongSelf.canReadHistoryValue, strongSelf.presentationInterfaceState.interfaceState.editMessage == nil, strongSelf.playlistStateAndType == nil {
|
||||
if !strongSelf.context.sharedContext.currentMediaInputSettings.with({ $0.enableRaiseToSpeak }) {
|
||||
return false
|
||||
}
|
||||
|
||||
if strongSelf.presentationInterfaceState.inputTextPanelState.mediaRecordingState != nil {
|
||||
return false
|
||||
}
|
||||
@@ -10670,13 +10674,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
return false
|
||||
}
|
||||
|
||||
if case let .media(_, expanded, _) = strongSelf.presentationInterfaceState.inputMode, expanded != nil {
|
||||
if case .media = strongSelf.presentationInterfaceState.inputMode {
|
||||
return false
|
||||
}
|
||||
|
||||
if !strongSelf.context.sharedContext.currentMediaInputSettings.with({ $0.enableRaiseToSpeak }) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -10712,14 +10714,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
|
||||
strongSelf.chatDisplayNode.historyNode.voicePlaylistItemChanged(previousItem, currentItem)
|
||||
// if let currentItem = currentItem?.id as? PeerMessagesMediaPlaylistItemId {
|
||||
// self.controllerInteraction?.currentlyPlayingMessageId = currentItem.messageId
|
||||
// if let previousItem = previousItem?.id as? PeerMessagesMediaPlaylistItemId, previousItem.messageId.peerId == peerId, currentItem.messageId.peerId == peerId, currentItem.messageId != previousItem.messageId {
|
||||
// if strongSelf.chatDisplayNode.historyNode.isMessageVisibleOnScreen(currentItem.messageId) {
|
||||
// strongSelf.navigateToMessage(from: nil, to: .id(currentItem.messageId, nil), scrollPosition: .center(.bottom), rememberInStack: false, animated: true, completion: nil)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12630,8 +12624,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
let inputText = strongSelf.presentationInterfaceState.interfaceState.effectiveInputState.inputText
|
||||
|
||||
let currentMediaController = Atomic<MediaPickerScreen?>(value: nil)
|
||||
let currentFilesController = Atomic<AttachmentContainable?>(value: nil)
|
||||
let currentLocationController = Atomic<AttachmentContainable?>(value: nil)
|
||||
let currentFilesController = Atomic<AttachmentFileControllerImpl?>(value: nil)
|
||||
let currentLocationController = Atomic<LocationPickerController?>(value: nil)
|
||||
|
||||
let attachmentController = AttachmentController(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, chatLocation: strongSelf.chatLocation, buttons: buttons, initialButton: initialButton, makeEntityInputView: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
@@ -12680,7 +12674,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
strongSelf.controllerNavigationDisposable.set(nil)
|
||||
let existingController = currentFilesController.with { $0 }
|
||||
if let controller = existingController {
|
||||
completion(controller, nil)
|
||||
completion(controller, controller.mediaPickerContext)
|
||||
controller.prepareForReuse()
|
||||
return
|
||||
}
|
||||
@@ -12703,12 +12697,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
})
|
||||
})
|
||||
let _ = currentFilesController.swap(controller)
|
||||
completion(controller, nil)
|
||||
completion(controller, controller.mediaPickerContext)
|
||||
case .location:
|
||||
strongSelf.controllerNavigationDisposable.set(nil)
|
||||
let existingController = currentLocationController.with { $0 }
|
||||
if let controller = existingController {
|
||||
completion(controller, nil)
|
||||
completion(controller, controller.mediaPickerContext)
|
||||
controller.prepareForReuse()
|
||||
return
|
||||
}
|
||||
@@ -12743,7 +12737,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}, nil)
|
||||
strongSelf.sendMessages([message])
|
||||
})
|
||||
completion(controller, nil)
|
||||
completion(controller, controller.mediaPickerContext)
|
||||
|
||||
let _ = currentLocationController.swap(controller)
|
||||
})
|
||||
@@ -12909,7 +12903,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}))
|
||||
case .poll:
|
||||
let controller = strongSelf.configurePollCreation()
|
||||
completion(controller, nil)
|
||||
completion(controller, controller?.mediaPickerContext)
|
||||
strongSelf.controllerNavigationDisposable.set(nil)
|
||||
case let .app(bot, botName, _):
|
||||
let params = WebAppParameters(peerId: peer.id, botId: bot.id, botName: botName, url: nil, queryId: nil, payload: botPayload, buttonText: nil, keepAliveSignal: nil, fromMenu: false, isSimple: false)
|
||||
@@ -13398,8 +13392,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
controller.openCamera = { [weak self] cameraView in
|
||||
self?.openCamera(cameraView: cameraView)
|
||||
}
|
||||
controller.presentWebSearch = { [weak self, weak controller] mediaGroups in
|
||||
self?.presentWebSearch(editingMessage: false, attachment: true, present: { [weak controller] c, a in
|
||||
controller.presentWebSearch = { [weak self, weak controller] mediaGroups, activateOnDisplay in
|
||||
self?.presentWebSearch(editingMessage: false, attachment: true, activateOnDisplay: activateOnDisplay, present: { [weak controller] c, a in
|
||||
controller?.present(c, in: .current)
|
||||
if let webSearchController = c as? WebSearchController {
|
||||
webSearchController.searchingUpdated = { [weak mediaGroups] searching in
|
||||
@@ -13560,7 +13554,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
})
|
||||
}
|
||||
|
||||
private func presentWebSearch(editingMessage: Bool, attachment: Bool, present: @escaping (ViewController, Any?) -> Void) {
|
||||
private func presentWebSearch(editingMessage: Bool, attachment: Bool, activateOnDisplay: Bool = true, present: @escaping (ViewController, Any?) -> Void) {
|
||||
guard let peer = self.presentationInterfaceState.renderedPeer?.peer else {
|
||||
return
|
||||
}
|
||||
@@ -13583,7 +13577,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
}
|
||||
})
|
||||
}))
|
||||
}), activateOnDisplay: activateOnDisplay)
|
||||
controller.attemptItemSelection = { [weak strongSelf] item in
|
||||
guard let strongSelf, let peer = strongSelf.presentationInterfaceState.renderedPeer?.peer else {
|
||||
return false
|
||||
@@ -14158,7 +14152,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
self.present(tooltipScreen, in: .current)
|
||||
}
|
||||
|
||||
private func configurePollCreation(isQuiz: Bool? = nil) -> AttachmentContainable? {
|
||||
private func configurePollCreation(isQuiz: Bool? = nil) -> CreatePollControllerImpl? {
|
||||
guard let peer = self.presentationInterfaceState.renderedPeer?.peer else {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user