Various fixes

This commit is contained in:
Ilya Laktyushin 2023-12-04 17:38:47 +04:00
parent f8baf6d69b
commit 4e0616011f
2 changed files with 12 additions and 6 deletions

View File

@ -2534,6 +2534,11 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
if location.x > self.view.frame.width - 44.0 && location.y > self.view.frame.height - 180.0 { if location.x > self.view.frame.width - 44.0 && location.y > self.view.frame.height - 180.0 {
return false return false
} }
if let reactionNode = self.view.subviews.last?.asyncdisplaykit_node as? ReactionContextNode {
if let hitTestResult = self.view.hitTest(location, with: nil), hitTestResult.isDescendant(of: reactionNode.view) {
return false
}
}
return true return true
} else { } else {
return true return true

View File

@ -715,6 +715,7 @@ public final class StoryItemSetContainerComponent: Component {
self.audioRecorderStatusDisposable?.dispose() self.audioRecorderStatusDisposable?.dispose()
self.audioRecorderStatusDisposable?.dispose() self.audioRecorderStatusDisposable?.dispose()
self.videoRecorderDisposable?.dispose() self.videoRecorderDisposable?.dispose()
self.updateDisposable.dispose()
} }
func allowsExternalGestures(point: CGPoint) -> Bool { func allowsExternalGestures(point: CGPoint) -> Bool {
@ -5161,6 +5162,7 @@ public final class StoryItemSetContainerComponent: Component {
StoryContainerScreen.openPeerStories(context: component.context, peerId: peer.id, parentController: controller, avatarNode: avatarNode) StoryContainerScreen.openPeerStories(context: component.context, peerId: peer.id, parentController: controller, avatarNode: avatarNode)
} }
private let updateDisposable = MetaDisposable()
func openStoryEditing(repost: Bool = false) { func openStoryEditing(repost: Bool = false) {
guard let component = self.component, let peerReference = PeerReference(component.slice.peer._asPeer()) else { guard let component = self.component, let peerReference = PeerReference(component.slice.peer._asPeer()) else {
return return
@ -5234,7 +5236,6 @@ public final class StoryItemSetContainerComponent: Component {
transitionOut: nil transitionOut: nil
) )
let updateDisposable = MetaDisposable()
var updateProgressImpl: ((Float) -> Void)? var updateProgressImpl: ((Float) -> Void)?
let controller = MediaEditorScreen( let controller = MediaEditorScreen(
context: context, context: context,
@ -5324,7 +5325,7 @@ public final class StoryItemSetContainerComponent: Component {
TempBox.shared.dispose(tempFile) TempBox.shared.dispose(tempFile)
} }
if let imageData = compressImageToJPEG(image, quality: 0.7, tempFilePath: tempFile.path) { if let imageData = compressImageToJPEG(image, quality: 0.7, tempFilePath: tempFile.path) {
updateDisposable.set((context.engine.messages.editStory(peerId: peerId, id: id, media: .image(dimensions: dimensions, data: imageData, stickers: result.stickers), mediaAreas: result.mediaAreas, text: updatedText, entities: updatedEntities, privacy: nil) self.updateDisposable.set((context.engine.messages.editStory(peerId: peerId, id: id, media: .image(dimensions: dimensions, data: imageData, stickers: result.stickers), mediaAreas: result.mediaAreas, text: updatedText, entities: updatedEntities, privacy: nil)
|> deliverOnMainQueue).startStrict(next: { [weak self] result in |> deliverOnMainQueue).startStrict(next: { [weak self] result in
guard let self else { guard let self else {
return return
@ -5378,7 +5379,7 @@ public final class StoryItemSetContainerComponent: Component {
} }
} }
updateDisposable.set((context.engine.messages.editStory(peerId: peerId, id: id, media: .video(dimensions: dimensions, duration: duration, resource: resource, firstFrameFile: firstFrameFile, stickers: result.stickers), mediaAreas: result.mediaAreas, text: updatedText, entities: updatedEntities, privacy: nil) self.updateDisposable.set((context.engine.messages.editStory(peerId: peerId, id: id, media: .video(dimensions: dimensions, duration: duration, resource: resource, firstFrameFile: firstFrameFile, stickers: result.stickers), mediaAreas: result.mediaAreas, text: updatedText, entities: updatedEntities, privacy: nil)
|> deliverOnMainQueue).startStrict(next: { [weak self] result in |> deliverOnMainQueue).startStrict(next: { [weak self] result in
guard let self else { guard let self else {
return return
@ -5441,9 +5442,9 @@ public final class StoryItemSetContainerComponent: Component {
self?.state?.updated(transition: .easeInOut(duration: 0.2)) self?.state?.updated(transition: .easeInOut(duration: 0.2))
} }
self.component?.controller()?.push(controller) self.component?.controller()?.push(controller)
updateProgressImpl = { [weak controller] progress in updateProgressImpl = { [weak controller, weak self] progress in
controller?.updateEditProgress(progress, cancel: { controller?.updateEditProgress(progress, cancel: { [weak self] in
updateDisposable.dispose() self?.updateDisposable.set(nil)
}) })
} }
} }