mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix sequential audio playback
This commit is contained in:
parent
5f7f674e61
commit
f9e2e7a0a1
@ -616,7 +616,7 @@ public final class ListMessageFileItemNode: ListMessageNode {
|
|||||||
|
|
||||||
let (titleNodeLayout, titleNodeApply) = titleNodeMakeLayout(TextNodeLayoutArguments(attributedString: titleText, backgroundColor: nil, maximumNumberOfLines: 2, truncationType: .middle, constrainedSize: CGSize(width: params.width - leftInset - leftOffset - rightInset - dateNodeLayout.size.width - 4.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (titleNodeLayout, titleNodeApply) = titleNodeMakeLayout(TextNodeLayoutArguments(attributedString: titleText, backgroundColor: nil, maximumNumberOfLines: 2, truncationType: .middle, constrainedSize: CGSize(width: params.width - leftInset - leftOffset - rightInset - dateNodeLayout.size.width - 4.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
|
|
||||||
let (textNodeLayout, textNodeApply) = textNodeMakeLayout(TextNodeLayoutArguments(attributedString: captionText, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - rightInset - 30.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (textNodeLayout, textNodeApply) = textNodeMakeLayout(TextNodeLayoutArguments(attributedString: captionText, backgroundColor: nil, maximumNumberOfLines: 3, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - rightInset - 30.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
|
|
||||||
let (descriptionNodeLayout, descriptionNodeApply) = descriptionNodeMakeLayout(TextNodeLayoutArguments(attributedString: descriptionText, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - rightInset - 30.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (descriptionNodeLayout, descriptionNodeApply) = descriptionNodeMakeLayout(TextNodeLayoutArguments(attributedString: descriptionText, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - rightInset - 30.0, height: CGFloat.infinity), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
|
|
||||||
|
@ -490,6 +490,8 @@ private final class MediaPlayerContext {
|
|||||||
case .playing:
|
case .playing:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.stoppedAtEnd = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func playOnceWithSound(playAndRecord: Bool, seek: MediaPlayerSeek = .start) {
|
fileprivate func playOnceWithSound(playAndRecord: Bool, seek: MediaPlayerSeek = .start) {
|
||||||
@ -537,6 +539,8 @@ private final class MediaPlayerContext {
|
|||||||
self.play()
|
self.play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.stoppedAtEnd = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func continuePlayingWithoutSound() {
|
fileprivate func continuePlayingWithoutSound() {
|
||||||
@ -892,7 +896,7 @@ private final class MediaPlayerContext {
|
|||||||
let _ = self.playerStatusValue.swap(status)
|
let _ = self.playerStatusValue.swap(status)
|
||||||
}
|
}
|
||||||
|
|
||||||
if performActionAtEndNow {
|
if performActionAtEndNow && !self.stoppedAtEnd {
|
||||||
switch self.actionAtEnd {
|
switch self.actionAtEnd {
|
||||||
case let .loop(f):
|
case let .loop(f):
|
||||||
self.stoppedAtEnd = false
|
self.stoppedAtEnd = false
|
||||||
|
@ -676,6 +676,7 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist {
|
|||||||
case .random:
|
case .random:
|
||||||
var playbackStack = self.playbackStack
|
var playbackStack = self.playbackStack
|
||||||
inputIndex = messages
|
inputIndex = messages
|
||||||
|
|> take(1)
|
||||||
|> map { messages, _, _ -> MessageIndex in
|
|> map { messages, _, _ -> MessageIndex in
|
||||||
if case let .random(previous) = navigation, previous {
|
if case let .random(previous) = navigation, previous {
|
||||||
let _ = playbackStack.pop()
|
let _ = playbackStack.pop()
|
||||||
@ -695,6 +696,7 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist {
|
|||||||
let historySignal = inputIndex
|
let historySignal = inputIndex
|
||||||
|> mapToSignal { inputIndex -> Signal<(Message, [Message])?, NoError> in
|
|> mapToSignal { inputIndex -> Signal<(Message, [Message])?, NoError> in
|
||||||
return messages
|
return messages
|
||||||
|
|> take(1)
|
||||||
|> mapToSignal { messages, _, loadMore -> Signal<(Message, [Message])?, NoError> in
|
|> mapToSignal { messages, _, loadMore -> Signal<(Message, [Message])?, NoError> in
|
||||||
let position: NavigatedMessageFromViewPosition
|
let position: NavigatedMessageFromViewPosition
|
||||||
switch navigation {
|
switch navigation {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user