mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Adjust input activation
This commit is contained in:
parent
f0809b0aae
commit
4a3292df29
@ -105,6 +105,9 @@ func telegramMediaFileAttributesFromApiAttributes(_ attributes: [Api.DocumentAtt
|
||||
if (flags & (1 << 1)) != 0 {
|
||||
videoFlags.insert(.supportsStreaming)
|
||||
}
|
||||
if (flags & (1 << 3)) != 0 {
|
||||
videoFlags.insert(.isSilent)
|
||||
}
|
||||
result.append(.Video(duration: Double(duration), size: PixelDimensions(width: w, height: h), flags: videoFlags, preloadSize: preloadSize))
|
||||
case let .documentAttributeAudio(flags, duration, title, performer, waveform):
|
||||
let isVoice = (flags & (1 << 10)) != 0
|
||||
|
@ -569,6 +569,9 @@ func inputDocumentAttributesFromFileAttributes(_ fileAttributes: [TelegramMediaF
|
||||
if preloadSize != nil {
|
||||
flags |= (1 << 2)
|
||||
}
|
||||
if videoFlags.contains(.isSilent) {
|
||||
flags |= (1 << 3)
|
||||
}
|
||||
|
||||
attributes.append(.documentAttributeVideo(flags: flags, duration: duration, w: Int32(size.width), h: Int32(size.height), preloadPrefixSize: preloadSize))
|
||||
case let .Audio(isVoice, duration, title, performer, waveform):
|
||||
|
@ -188,6 +188,7 @@ public struct TelegramMediaVideoFlags: OptionSet {
|
||||
|
||||
public static let instantRoundVideo = TelegramMediaVideoFlags(rawValue: 1 << 0)
|
||||
public static let supportsStreaming = TelegramMediaVideoFlags(rawValue: 1 << 1)
|
||||
public static let isSilent = TelegramMediaVideoFlags(rawValue: 1 << 3)
|
||||
}
|
||||
|
||||
public struct StickerMaskCoords: PostboxCoding, Equatable {
|
||||
|
@ -392,7 +392,22 @@ private final class StoryContainerScreenComponent: Component {
|
||||
let translation = recognizer.translation(in: self)
|
||||
self.verticalPanState = ItemSetPanState(fraction: max(-1.0, min(1.0, translation.y / self.bounds.height)), didBegin: true)
|
||||
self.state?.updated(transition: .immediate)
|
||||
|
||||
if translation.y < -40.0 {
|
||||
if let component = self.component, let stateValue = component.content.stateValue, let slice = stateValue.slice, let itemSetView = self.visibleItemSetViews[slice.peer.id] {
|
||||
if let itemSetComponentView = itemSetView.view.view as? StoryItemSetContainerComponent.View {
|
||||
if let activateInputWhileDragging = itemSetComponentView.activateInputWhileDragging() {
|
||||
activateInputWhileDragging()
|
||||
|
||||
self.verticalPanState = nil
|
||||
recognizer.state = .cancelled
|
||||
self.state?.updated(transition: Transition(animation: .curve(duration: 0.3, curve: .spring)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case .cancelled, .ended:
|
||||
if self.verticalPanState != nil {
|
||||
let translation = recognizer.translation(in: self)
|
||||
let velocity = recognizer.velocity(in: self)
|
||||
|
||||
@ -417,6 +432,7 @@ private final class StoryContainerScreenComponent: Component {
|
||||
} else {
|
||||
self.state?.updated(transition: Transition(animation: .curve(duration: 0.3, curve: .spring)))
|
||||
}
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -969,6 +969,22 @@ public final class StoryItemSetContainerComponent: Component {
|
||||
return false
|
||||
}
|
||||
|
||||
func activateInputWhileDragging() -> (() -> Void)? {
|
||||
guard let component = self.component else {
|
||||
return nil
|
||||
}
|
||||
if component.slice.peer.id == component.context.account.peerId {
|
||||
} else {
|
||||
if let inputPanelView = self.inputPanel.view as? MessageInputPanelComponent.View {
|
||||
return { [weak inputPanelView] in
|
||||
inputPanelView?.activateInput()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func animateIn(transitionIn: StoryContainerScreen.TransitionIn) {
|
||||
self.closeButton.layer.animateScale(from: 0.001, to: 1.0, duration: 0.2, delay: 0.12, timingFunction: kCAMediaTimingFunctionSpring)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user