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
999f8c8032
commit
d5139b6363
@ -2020,11 +2020,15 @@ final class MediaEditorScreenComponent: Component {
|
|||||||
minDuration = 1.0
|
minDuration = 1.0
|
||||||
if case .avatarEditor = controller.mode {
|
if case .avatarEditor = controller.mode {
|
||||||
maxDuration = 9.9
|
maxDuration = 9.9
|
||||||
|
} else {
|
||||||
|
if controller.node.items.count > 0 {
|
||||||
|
maxDuration = storyMaxVideoDuration
|
||||||
} else {
|
} else {
|
||||||
maxDuration = storyMaxCombinedVideoDuration
|
maxDuration = storyMaxCombinedVideoDuration
|
||||||
segmentDuration = storyMaxVideoDuration
|
segmentDuration = storyMaxVideoDuration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let previousTrackCount = self.currentVisibleTracks?.count
|
let previousTrackCount = self.currentVisibleTracks?.count
|
||||||
let visibleTracks = playerState.tracks.filter { $0.visibleInTimeline }.map { MediaScrubberComponent.Track($0) }
|
let visibleTracks = playerState.tracks.filter { $0.visibleInTimeline }.map { MediaScrubberComponent.Track($0) }
|
||||||
@ -3506,7 +3510,10 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
|||||||
values: initialValues,
|
values: initialValues,
|
||||||
hasHistogram: true
|
hasHistogram: true
|
||||||
)
|
)
|
||||||
|
if case .storyEditor = controller.mode, self.items.isEmpty {
|
||||||
mediaEditor.maxDuration = storyMaxCombinedVideoDuration
|
mediaEditor.maxDuration = storyMaxCombinedVideoDuration
|
||||||
|
}
|
||||||
|
|
||||||
if case .avatarEditor = controller.mode {
|
if case .avatarEditor = controller.mode {
|
||||||
mediaEditor.setVideoIsMuted(true)
|
mediaEditor.setVideoIsMuted(true)
|
||||||
} else if case let .coverEditor(dimensions) = controller.mode {
|
} else if case let .coverEditor(dimensions) = controller.mode {
|
||||||
@ -6801,9 +6808,26 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
|||||||
coverImage = nil
|
coverImage = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var storyCount: Int32 = 0
|
||||||
|
if self.node.items.count > 0 {
|
||||||
|
storyCount = Int32(self.node.items.count(where: { $0.isEnabled }))
|
||||||
|
} else {
|
||||||
|
if case let .asset(asset) = self.node.subject {
|
||||||
|
let duration: Double
|
||||||
|
if let playerDuration = mediaEditor.duration {
|
||||||
|
duration = playerDuration
|
||||||
|
} else {
|
||||||
|
duration = asset.duration
|
||||||
|
}
|
||||||
|
if duration > storyMaxVideoDuration {
|
||||||
|
storyCount = Int32(min(storyMaxCombinedVideoCount, Int(ceil(duration / storyMaxVideoDuration))))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let stateContext = ShareWithPeersScreen.StateContext(
|
let stateContext = ShareWithPeersScreen.StateContext(
|
||||||
context: self.context,
|
context: self.context,
|
||||||
subject: .stories(editing: false, count: Int32(self.node.items.count(where: { $0.isEnabled }))),
|
subject: .stories(editing: false, count: storyCount),
|
||||||
editing: false,
|
editing: false,
|
||||||
initialPeerIds: Set(privacy.privacy.additionallyIncludePeers),
|
initialPeerIds: Set(privacy.privacy.additionallyIncludePeers),
|
||||||
closeFriends: self.closeFriends.get(),
|
closeFriends: self.closeFriends.get(),
|
||||||
@ -8151,7 +8175,7 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
|||||||
|
|
||||||
let storyCount = min(storyMaxCombinedVideoCount, Int(ceil(duration / storyMaxVideoDuration)))
|
let storyCount = min(storyMaxCombinedVideoCount, Int(ceil(duration / storyMaxVideoDuration)))
|
||||||
var start = values.videoTrimRange?.lowerBound ?? 0
|
var start = values.videoTrimRange?.lowerBound ?? 0
|
||||||
for _ in 0 ..< storyCount {
|
for i in 0 ..< storyCount {
|
||||||
let trimmedValues = values.withUpdatedVideoTrimRange(start ..< min(start + storyMaxVideoDuration, originalDuration))
|
let trimmedValues = values.withUpdatedVideoTrimRange(start ..< min(start + storyMaxVideoDuration, originalDuration))
|
||||||
|
|
||||||
var editingItem = EditingItem(asset: asset)
|
var editingItem = EditingItem(asset: asset)
|
||||||
|
@ -1510,7 +1510,7 @@ private class TrackView: UIView, UIScrollViewDelegate, UIGestureRecognizerDelega
|
|||||||
|
|
||||||
var validIds = Set<Int32>()
|
var validIds = Set<Int32>()
|
||||||
var segmentFrame = CGRect(x: segmentOrigin + segmentWidth, y: 0.0, width: 1.0, height: containerFrame.size.height)
|
var segmentFrame = CGRect(x: segmentOrigin + segmentWidth, y: 0.0, width: 1.0, height: containerFrame.size.height)
|
||||||
for i in 0 ..< segmentCount {
|
for i in 0 ..< min(segmentCount, 2) {
|
||||||
let id = Int32(i)
|
let id = Int32(i)
|
||||||
validIds.insert(id)
|
validIds.insert(id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user