mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various fixes
This commit is contained in:
@@ -916,7 +916,7 @@ final class MediaEditorScreenComponent: Component {
|
||||
var audioData: VideoScrubberComponent.AudioData?
|
||||
if let audioTrack = mediaEditor?.values.audioTrack {
|
||||
let trimRange = mediaEditor?.values.audioTrackTrimRange
|
||||
let offset = mediaEditor?.values.audioTrackStart
|
||||
let offset = mediaEditor?.values.audioTrackOffset
|
||||
let audioSamples = mediaEditor?.values.audioTrackSamples
|
||||
audioData = VideoScrubberComponent.AudioData(
|
||||
artist: audioTrack.artist,
|
||||
@@ -1318,8 +1318,26 @@ final class MediaEditorScreenComponent: Component {
|
||||
audioTrimUpdated: { [weak mediaEditor] start, end, _, done in
|
||||
if let mediaEditor {
|
||||
mediaEditor.setAudioTrackTrimRange(start..<end, apply: done)
|
||||
if done && isAudioOnly {
|
||||
mediaEditor.seek(start, andPlay: true)
|
||||
if isAudioOnly {
|
||||
if done {
|
||||
mediaEditor.seek(start, andPlay: true)
|
||||
}
|
||||
} else {
|
||||
if done {
|
||||
mediaEditor.play()
|
||||
} else {
|
||||
mediaEditor.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
audioOffsetUpdated: { [weak mediaEditor] offset, done in
|
||||
if let mediaEditor {
|
||||
mediaEditor.setAudioTrackOffset(offset, apply: done)
|
||||
if done {
|
||||
mediaEditor.play()
|
||||
} else {
|
||||
mediaEditor.stop()
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3071,7 +3089,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
|
||||
let path = url.path
|
||||
let fileName = "audio_\(url.lastPathComponent)"
|
||||
let copyPath = fullDraftPath(engine: self.context.engine, path: fileName)
|
||||
let copyPath = fullDraftPath(peerId: self.context.account.peerId, path: fileName)
|
||||
try? FileManager.default.copyItem(atPath: path, toPath: copyPath)
|
||||
|
||||
let audioAsset = AVURLAsset(url: URL(fileURLWithPath: copyPath))
|
||||
@@ -5129,8 +5147,8 @@ func draftPath(engine: TelegramEngine) -> String {
|
||||
return NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] + "/storyDrafts_\(engine.account.peerId.toInt64())"
|
||||
}
|
||||
|
||||
private func fullDraftPath(engine: TelegramEngine, path: String) -> String {
|
||||
return NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] + "/storyDrafts_\(engine.account.peerId.toInt64())/" + path
|
||||
private func fullDraftPath(peerId: EnginePeer.Id, path: String) -> String {
|
||||
return NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] + "/storyDrafts_\(peerId.toInt64())/" + path
|
||||
}
|
||||
|
||||
func hasFirstResponder(_ view: UIView) -> Bool {
|
||||
|
||||
Reference in New Issue
Block a user