This commit is contained in:
Ali 2023-07-18 13:02:32 +04:00
parent 6f3e4f3931
commit 1adee04eae
4 changed files with 16 additions and 3 deletions

View File

@ -1274,7 +1274,7 @@ open class TextNode: ASDisplayNode {
coreTextLine = originalLine
}
} else {
coreTextLine = CTLineCreateTruncatedLine(originalLine, Double(lineConstrainedSize.width), truncationType, truncationToken) ?? truncationToken
coreTextLine = CTLineCreateTruncatedLine(originalLine, max(1.0, Double(lineConstrainedSize.width) - truncationTokenWidth), truncationType, truncationToken) ?? truncationToken
let runs = (CTLineGetGlyphRuns(coreTextLine) as [AnyObject]) as! [CTRun]
for run in runs {
let runAttributes: NSDictionary = CTRunGetAttributes(run)

View File

@ -1022,7 +1022,6 @@ private final class MediaPlayerContext {
if isPaused && self.fadeTimer != nil {
playbackStatus = .paused
} else if reportRate.isZero {
//playbackStatus = .buffering(initial: false, whilePlaying: true)
playbackStatus = .playing
statusTimestamp = 0.0
} else {

View File

@ -82,6 +82,8 @@ final class StoryItemContentComponent: Component {
private var currentProgressTimerValue: Double = 0.0
private var videoProgressDisposable: Disposable?
private var ignoreBufferingTimestamp: Double = 0.0
private var markedAsSeen: Bool = false
private var contentLoaded: Bool = false
@ -252,6 +254,7 @@ final class StoryItemContentComponent: Component {
override func leaveAmbientMode() {
if let videoNode = self.videoNode {
self.ignoreBufferingTimestamp = CFAbsoluteTimeGetCurrent()
videoNode.setSoundEnabled(true)
videoNode.continueWithOverridingAmbientMode(isAmbient: false)
}
@ -259,6 +262,7 @@ final class StoryItemContentComponent: Component {
override func enterAmbientMode(ambient: Bool) {
if let videoNode = self.videoNode {
self.ignoreBufferingTimestamp = CFAbsoluteTimeGetCurrent()
if ambient {
videoNode.continueWithOverridingAmbientMode(isAmbient: true)
} else {
@ -369,6 +373,16 @@ final class StoryItemContentComponent: Component {
isBuffering = true
}
if isBuffering {
if CFAbsoluteTimeGetCurrent() - self.ignoreBufferingTimestamp < 0.3 {
isBuffering = false
} else {
self.ignoreBufferingTimestamp = 0.0
}
} else {
self.ignoreBufferingTimestamp = 0.0
}
if case .buffering(true, _, _, _) = videoPlaybackStatus.status {
timestampAndDuration = (nil, effectiveDuration)
} else if effectiveDuration > 0.0 {

View File

@ -3886,7 +3886,7 @@ public final class StoryItemSetContainerComponent: Component {
self.requestSave()
})))
if component.slice.item.storyItem.isPublic && (component.slice.peer.addressName != nil || !component.slice.peer._asPeer().usernames.isEmpty) && component.slice.item.storyItem.expirationTimestamp > Int32(Date().timeIntervalSince1970) {
if component.slice.item.storyItem.isPublic && (component.slice.peer.addressName != nil || !component.slice.peer._asPeer().usernames.isEmpty) && (component.slice.item.storyItem.expirationTimestamp > Int32(Date().timeIntervalSince1970) || component.slice.item.storyItem.isPinned) {
items.append(.action(ContextMenuActionItem(text: component.strings.Story_Context_CopyLink, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Link"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] _, a in