mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Stories
This commit is contained in:
parent
6f3e4f3931
commit
1adee04eae
@ -1274,7 +1274,7 @@ open class TextNode: ASDisplayNode {
|
|||||||
coreTextLine = originalLine
|
coreTextLine = originalLine
|
||||||
}
|
}
|
||||||
} else {
|
} 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]
|
let runs = (CTLineGetGlyphRuns(coreTextLine) as [AnyObject]) as! [CTRun]
|
||||||
for run in runs {
|
for run in runs {
|
||||||
let runAttributes: NSDictionary = CTRunGetAttributes(run)
|
let runAttributes: NSDictionary = CTRunGetAttributes(run)
|
||||||
|
@ -1022,7 +1022,6 @@ private final class MediaPlayerContext {
|
|||||||
if isPaused && self.fadeTimer != nil {
|
if isPaused && self.fadeTimer != nil {
|
||||||
playbackStatus = .paused
|
playbackStatus = .paused
|
||||||
} else if reportRate.isZero {
|
} else if reportRate.isZero {
|
||||||
//playbackStatus = .buffering(initial: false, whilePlaying: true)
|
|
||||||
playbackStatus = .playing
|
playbackStatus = .playing
|
||||||
statusTimestamp = 0.0
|
statusTimestamp = 0.0
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,6 +82,8 @@ final class StoryItemContentComponent: Component {
|
|||||||
private var currentProgressTimerValue: Double = 0.0
|
private var currentProgressTimerValue: Double = 0.0
|
||||||
private var videoProgressDisposable: Disposable?
|
private var videoProgressDisposable: Disposable?
|
||||||
|
|
||||||
|
private var ignoreBufferingTimestamp: Double = 0.0
|
||||||
|
|
||||||
private var markedAsSeen: Bool = false
|
private var markedAsSeen: Bool = false
|
||||||
private var contentLoaded: Bool = false
|
private var contentLoaded: Bool = false
|
||||||
|
|
||||||
@ -252,6 +254,7 @@ final class StoryItemContentComponent: Component {
|
|||||||
|
|
||||||
override func leaveAmbientMode() {
|
override func leaveAmbientMode() {
|
||||||
if let videoNode = self.videoNode {
|
if let videoNode = self.videoNode {
|
||||||
|
self.ignoreBufferingTimestamp = CFAbsoluteTimeGetCurrent()
|
||||||
videoNode.setSoundEnabled(true)
|
videoNode.setSoundEnabled(true)
|
||||||
videoNode.continueWithOverridingAmbientMode(isAmbient: false)
|
videoNode.continueWithOverridingAmbientMode(isAmbient: false)
|
||||||
}
|
}
|
||||||
@ -259,6 +262,7 @@ final class StoryItemContentComponent: Component {
|
|||||||
|
|
||||||
override func enterAmbientMode(ambient: Bool) {
|
override func enterAmbientMode(ambient: Bool) {
|
||||||
if let videoNode = self.videoNode {
|
if let videoNode = self.videoNode {
|
||||||
|
self.ignoreBufferingTimestamp = CFAbsoluteTimeGetCurrent()
|
||||||
if ambient {
|
if ambient {
|
||||||
videoNode.continueWithOverridingAmbientMode(isAmbient: true)
|
videoNode.continueWithOverridingAmbientMode(isAmbient: true)
|
||||||
} else {
|
} else {
|
||||||
@ -369,6 +373,16 @@ final class StoryItemContentComponent: Component {
|
|||||||
isBuffering = true
|
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 {
|
if case .buffering(true, _, _, _) = videoPlaybackStatus.status {
|
||||||
timestampAndDuration = (nil, effectiveDuration)
|
timestampAndDuration = (nil, effectiveDuration)
|
||||||
} else if effectiveDuration > 0.0 {
|
} else if effectiveDuration > 0.0 {
|
||||||
|
@ -3886,7 +3886,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
self.requestSave()
|
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
|
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)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Link"), color: theme.contextMenu.primaryColor)
|
||||||
}, action: { [weak self] _, a in
|
}, action: { [weak self] _, a in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user