mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
42be53c03a
commit
1f1d8d90c0
@ -392,6 +392,7 @@ final class MediaEditorScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var nextTransitionUserData: Any?
|
||||||
@objc private func deactivateInput() {
|
@objc private func deactivateInput() {
|
||||||
guard let view = self.inputPanel.view as? MessageInputPanelComponent.View else {
|
guard let view = self.inputPanel.view as? MessageInputPanelComponent.View else {
|
||||||
return
|
return
|
||||||
@ -400,7 +401,12 @@ final class MediaEditorScreenComponent: Component {
|
|||||||
self.currentInputMode = .text
|
self.currentInputMode = .text
|
||||||
if hasFirstResponder(self) {
|
if hasFirstResponder(self) {
|
||||||
if let view = self.inputPanel.view as? MessageInputPanelComponent.View {
|
if let view = self.inputPanel.view as? MessageInputPanelComponent.View {
|
||||||
|
self.nextTransitionUserData = TextFieldComponent.AnimationHint(kind: .textFocusChanged)
|
||||||
|
if view.isActive {
|
||||||
view.deactivateInput()
|
view.deactivateInput()
|
||||||
|
} else {
|
||||||
|
self.endEditing(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.state?.updated(transition: .spring(duration: 0.4).withUserData(TextFieldComponent.AnimationHint(kind: .textFocusChanged)))
|
self.state?.updated(transition: .spring(duration: 0.4).withUserData(TextFieldComponent.AnimationHint(kind: .textFocusChanged)))
|
||||||
@ -644,6 +650,12 @@ final class MediaEditorScreenComponent: Component {
|
|||||||
let environment = environment[ViewControllerComponentContainer.Environment.self].value
|
let environment = environment[ViewControllerComponentContainer.Environment.self].value
|
||||||
self.environment = environment
|
self.environment = environment
|
||||||
|
|
||||||
|
var transition = transition
|
||||||
|
if let nextTransitionUserData = self.nextTransitionUserData {
|
||||||
|
self.nextTransitionUserData = nil
|
||||||
|
transition = transition.withUserData(nextTransitionUserData)
|
||||||
|
}
|
||||||
|
|
||||||
var isEditingStory = false
|
var isEditingStory = false
|
||||||
if let controller = environment.controller() as? MediaEditorScreen {
|
if let controller = environment.controller() as? MediaEditorScreen {
|
||||||
isEditingStory = controller.isEditingStory
|
isEditingStory = controller.isEditingStory
|
||||||
@ -1077,8 +1089,6 @@ final class MediaEditorScreenComponent: Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboardHeight = inputHeight
|
|
||||||
|
|
||||||
let nextInputMode: MessageInputPanelComponent.InputMode
|
let nextInputMode: MessageInputPanelComponent.InputMode
|
||||||
switch self.currentInputMode {
|
switch self.currentInputMode {
|
||||||
case .text:
|
case .text:
|
||||||
@ -1209,6 +1219,7 @@ final class MediaEditorScreenComponent: Component {
|
|||||||
inputHeight = max(inputHeight, environment.deviceMetrics.standardInputHeight(inLandscape: false))
|
inputHeight = max(inputHeight, environment.deviceMetrics.standardInputHeight(inLandscape: false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
keyboardHeight = inputHeight
|
||||||
|
|
||||||
let fadeTransition = Transition(animation: .curve(duration: 0.3, curve: .easeInOut))
|
let fadeTransition = Transition(animation: .curve(duration: 0.3, curve: .easeInOut))
|
||||||
if self.inputPanelExternalState.isEditing {
|
if self.inputPanelExternalState.isEditing {
|
||||||
|
@ -400,6 +400,14 @@ public final class MessageInputPanelComponent: Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var isActive: Bool {
|
||||||
|
if let textFieldView = self.textField.view as? TextFieldComponent.View {
|
||||||
|
return textFieldView.isActive
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public func deactivateInput() {
|
public func deactivateInput() {
|
||||||
if self.canDeactivateInput() {
|
if self.canDeactivateInput() {
|
||||||
if let textFieldView = self.textField.view as? TextFieldComponent.View {
|
if let textFieldView = self.textField.view as? TextFieldComponent.View {
|
||||||
|
@ -1944,6 +1944,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
containerSize: CGSize(width: inputPanelAvailableWidth, height: 200.0)
|
containerSize: CGSize(width: inputPanelAvailableWidth, height: 200.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var inputPanelInset: CGFloat = component.containerInsets.bottom
|
||||||
var inputHeight = component.inputHeight
|
var inputHeight = component.inputHeight
|
||||||
if self.inputPanelExternalState.isEditing {
|
if self.inputPanelExternalState.isEditing {
|
||||||
if self.sendMessageContext.currentInputMode == .media || (inputHeight.isZero && keyboardWasHidden) {
|
if self.sendMessageContext.currentInputMode == .media || (inputHeight.isZero && keyboardWasHidden) {
|
||||||
@ -1954,6 +1955,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
let inputMediaNodeHeight = self.sendMessageContext.updateInputMediaNode(inputPanel: self.inputPanel, availableSize: availableSize, bottomInset: component.safeInsets.bottom, bottomContainerInset: component.containerInsets.bottom, inputHeight: component.inputHeight, effectiveInputHeight: inputHeight, metrics: component.metrics, deviceMetrics: component.deviceMetrics, transition: transition)
|
let inputMediaNodeHeight = self.sendMessageContext.updateInputMediaNode(inputPanel: self.inputPanel, availableSize: availableSize, bottomInset: component.safeInsets.bottom, bottomContainerInset: component.containerInsets.bottom, inputHeight: component.inputHeight, effectiveInputHeight: inputHeight, metrics: component.metrics, deviceMetrics: component.deviceMetrics, transition: transition)
|
||||||
if inputMediaNodeHeight > 0.0 {
|
if inputMediaNodeHeight > 0.0 {
|
||||||
inputHeight = inputMediaNodeHeight
|
inputHeight = inputMediaNodeHeight
|
||||||
|
inputPanelInset = 0.0
|
||||||
}
|
}
|
||||||
keyboardHeight = inputHeight
|
keyboardHeight = inputHeight
|
||||||
|
|
||||||
@ -1982,11 +1984,12 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let inputPanelBackgroundHeight = keyboardHeight + 60.0 - inputPanelInset
|
||||||
let inputPanelBackgroundSize = self.inputPanelBackground.update(
|
let inputPanelBackgroundSize = self.inputPanelBackground.update(
|
||||||
transition: transition,
|
transition: transition,
|
||||||
component: AnyComponent(BlurredGradientComponent(position: .bottom, dark: true, tag: nil)),
|
component: AnyComponent(BlurredGradientComponent(position: .bottom, dark: true, tag: nil)),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: availableSize.width, height: max(0.0, keyboardHeight + 100.0 - component.containerInsets.bottom))
|
containerSize: CGSize(width: availableSize.width, height: max(0.0, inputPanelBackgroundHeight))
|
||||||
)
|
)
|
||||||
if let inputPanelBackgroundView = self.inputPanelBackground.view {
|
if let inputPanelBackgroundView = self.inputPanelBackground.view {
|
||||||
if inputPanelBackgroundView.superview == nil {
|
if inputPanelBackgroundView.superview == nil {
|
||||||
@ -2012,7 +2015,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
inputPanelIsOverlay = false
|
inputPanelIsOverlay = false
|
||||||
} else {
|
} else {
|
||||||
bottomContentInset += 44.0
|
bottomContentInset += 44.0
|
||||||
inputPanelBottomInset = inputHeight - component.containerInsets.bottom
|
inputPanelBottomInset = inputHeight - inputPanelInset
|
||||||
inputPanelIsOverlay = true
|
inputPanelIsOverlay = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2466,7 +2466,7 @@ final class StoryItemSetContainerSendMessage {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func openPeerMention(view: StoryItemSetContainerComponent.View, name: String, navigation: ChatControllerInteractionNavigateToPeer = .default, sourceMessageId: MessageId? = nil) {
|
func openPeerMention(view: StoryItemSetContainerComponent.View, name: String, sourceMessageId: MessageId? = nil) {
|
||||||
guard let component = view.component, let parentController = component.controller() else {
|
guard let component = view.component, let parentController = component.controller() else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2512,12 +2512,12 @@ final class StoryItemSetContainerSendMessage {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if let peer = peer {
|
if let peer = peer {
|
||||||
var navigation = navigation
|
var navigation: ChatControllerInteractionNavigateToPeer
|
||||||
if case .default = navigation {
|
if let peer = peer as? TelegramUser, peer.botInfo == nil {
|
||||||
if let peer = peer as? TelegramUser, peer.botInfo != nil {
|
navigation = .info
|
||||||
|
} else {
|
||||||
navigation = .chat(textInputState: nil, subject: nil, peekData: nil)
|
navigation = .chat(textInputState: nil, subject: nil, peekData: nil)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
self.openResolved(view: view, result: .peer(peer, navigation))
|
self.openResolved(view: view, result: .peer(peer, navigation))
|
||||||
} else {
|
} else {
|
||||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
@ -505,6 +505,10 @@ public final class TextFieldComponent: Component {
|
|||||||
self.textView.resignFirstResponder()
|
self.textView.resignFirstResponder()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var isActive: Bool {
|
||||||
|
return self.textView.isFirstResponder
|
||||||
|
}
|
||||||
|
|
||||||
private var spoilersRevealed = false
|
private var spoilersRevealed = false
|
||||||
private var spoilerIsDisappearing = false
|
private var spoilerIsDisappearing = false
|
||||||
private func updateSpoilersRevealed(animated: Bool = true) {
|
private func updateSpoilersRevealed(animated: Bool = true) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user