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
73a068e6ff
commit
5f3c7741a9
@ -2690,7 +2690,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateEditProgress(_ progress: Float) {
|
func updateEditProgress(_ progress: Float, cancel: @escaping () -> Void) {
|
||||||
guard let controller = self.controller else {
|
guard let controller = self.controller else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2708,6 +2708,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
} else {
|
} else {
|
||||||
let tooltipController = SaveProgressScreen(context: self.context, content: .progress(text, 0.0))
|
let tooltipController = SaveProgressScreen(context: self.context, content: .progress(text, 0.0))
|
||||||
tooltipController.cancelled = { [weak self] in
|
tooltipController.cancelled = { [weak self] in
|
||||||
|
cancel()
|
||||||
if let self, let controller = self.controller {
|
if let self, let controller = self.controller {
|
||||||
controller.cancelVideoExport()
|
controller.cancelVideoExport()
|
||||||
}
|
}
|
||||||
@ -4134,8 +4135,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func updateEditProgress(_ progress: Float) {
|
public func updateEditProgress(_ progress: Float, cancel: @escaping () -> Void) {
|
||||||
self.node.updateEditProgress(progress)
|
self.node.updateEditProgress(progress, cancel: cancel)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func dismissAllTooltips() {
|
fileprivate func dismissAllTooltips() {
|
||||||
|
@ -76,6 +76,7 @@ final class StoryAuthorInfoComponent: Component {
|
|||||||
|
|
||||||
let size = availableSize
|
let size = availableSize
|
||||||
let spacing: CGFloat = 0.0
|
let spacing: CGFloat = 0.0
|
||||||
|
let leftInset: CGFloat = 54.0
|
||||||
|
|
||||||
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 })
|
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 })
|
||||||
|
|
||||||
@ -83,7 +84,11 @@ final class StoryAuthorInfoComponent: Component {
|
|||||||
if component.peer?.id == component.context.account.peerId {
|
if component.peer?.id == component.context.account.peerId {
|
||||||
title = component.strings.Story_HeaderYourStory
|
title = component.strings.Story_HeaderYourStory
|
||||||
} else {
|
} else {
|
||||||
title = component.peer?.debugDisplayTitle ?? ""
|
if let _ = component.counters {
|
||||||
|
title = component.peer?.compactDisplayTitle ?? ""
|
||||||
|
} else {
|
||||||
|
title = component.peer?.debugDisplayTitle ?? ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let timestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970)
|
let timestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970)
|
||||||
@ -102,7 +107,7 @@ final class StoryAuthorInfoComponent: Component {
|
|||||||
maximumNumberOfLines: 1
|
maximumNumberOfLines: 1
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: availableSize
|
containerSize: CGSize(width: availableSize.width - leftInset, height: availableSize.height)
|
||||||
)
|
)
|
||||||
let subtitleSize = self.subtitle.update(
|
let subtitleSize = self.subtitle.update(
|
||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
@ -112,12 +117,12 @@ final class StoryAuthorInfoComponent: Component {
|
|||||||
maximumNumberOfLines: 1
|
maximumNumberOfLines: 1
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: availableSize
|
containerSize: CGSize(width: availableSize.width - leftInset, height: availableSize.height)
|
||||||
)
|
)
|
||||||
|
|
||||||
let contentHeight: CGFloat = titleSize.height + spacing + subtitleSize.height
|
let contentHeight: CGFloat = titleSize.height + spacing + subtitleSize.height
|
||||||
let titleFrame = CGRect(origin: CGPoint(x: 54.0, y: 2.0 + floor((availableSize.height - contentHeight) * 0.5)), size: titleSize)
|
let titleFrame = CGRect(origin: CGPoint(x: leftInset, y: 2.0 + floor((availableSize.height - contentHeight) * 0.5)), size: titleSize)
|
||||||
let subtitleFrame = CGRect(origin: CGPoint(x: 54.0, y: titleFrame.maxY + spacing + UIScreenPixel), size: subtitleSize)
|
let subtitleFrame = CGRect(origin: CGPoint(x: leftInset, y: titleFrame.maxY + spacing + UIScreenPixel), size: subtitleSize)
|
||||||
|
|
||||||
if let titleView = self.title.view {
|
if let titleView = self.title.view {
|
||||||
if titleView.superview == nil {
|
if titleView.superview == nil {
|
||||||
|
@ -613,6 +613,8 @@ private final class StoryContainerScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func beginHorizontalPan(translation: CGPoint) {
|
private func beginHorizontalPan(translation: CGPoint) {
|
||||||
|
self.dismissAllTooltips()
|
||||||
|
|
||||||
if self.layer.animation(forKey: "panState") != nil {
|
if self.layer.animation(forKey: "panState") != nil {
|
||||||
self.layer.removeAnimation(forKey: "panState")
|
self.layer.removeAnimation(forKey: "panState")
|
||||||
}
|
}
|
||||||
@ -876,6 +878,8 @@ private final class StoryContainerScreenComponent: Component {
|
|||||||
controller.forEachController { controller in
|
controller.forEachController { controller in
|
||||||
if let controller = controller as? UndoOverlayController {
|
if let controller = controller as? UndoOverlayController {
|
||||||
controller.dismissWithCommitAction()
|
controller.dismissWithCommitAction()
|
||||||
|
} else if let controller = controller as? TooltipScreen {
|
||||||
|
controller.dismiss()
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -2611,7 +2611,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
environment: {},
|
environment: {},
|
||||||
containerSize: CGSize(width: max(10.0, headerRightOffset), height: 44.0)
|
containerSize: CGSize(width: headerRightOffset - 10.0, height: 44.0)
|
||||||
)
|
)
|
||||||
if let view = currentCenterInfoItem.view.view {
|
if let view = currentCenterInfoItem.view.view {
|
||||||
var animateIn = false
|
var animateIn = false
|
||||||
@ -3203,13 +3203,15 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self.component?.presentController(UndoOverlayController(
|
let controller = UndoOverlayController(
|
||||||
presentationData: presentationData,
|
presentationData: presentationData,
|
||||||
content: .info(title: nil, text: text, timeout: nil),
|
content: .info(title: nil, text: text, timeout: nil),
|
||||||
elevatedLayout: false,
|
elevatedLayout: false,
|
||||||
animateInAsReplacement: false,
|
animateInAsReplacement: false,
|
||||||
action: { _ in return false }
|
action: { _ in return false }
|
||||||
), nil)
|
)
|
||||||
|
self.sendMessageContext.tooltipScreen = controller
|
||||||
|
self.component?.presentController(controller, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func openItemPrivacySettings(initialPrivacy: EngineStoryPrivacy? = nil) {
|
private func openItemPrivacySettings(initialPrivacy: EngineStoryPrivacy? = nil) {
|
||||||
@ -3460,7 +3462,8 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let updateDisposable = MetaDisposable()
|
||||||
var updateProgressImpl: ((Float) -> Void)?
|
var updateProgressImpl: ((Float) -> Void)?
|
||||||
let controller = MediaEditorScreen(
|
let controller = MediaEditorScreen(
|
||||||
context: context,
|
context: context,
|
||||||
@ -3493,7 +3496,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
updateProgressImpl?(0.0)
|
updateProgressImpl?(0.0)
|
||||||
|
|
||||||
if let imageData = compressImageToJPEG(image, quality: 0.7) {
|
if let imageData = compressImageToJPEG(image, quality: 0.7) {
|
||||||
let _ = (context.engine.messages.editStory(id: id, media: .image(dimensions: dimensions, data: imageData, stickers: stickers), text: updatedText, entities: updatedEntities, privacy: updatedPrivacy)
|
updateDisposable.set((context.engine.messages.editStory(id: id, media: .image(dimensions: dimensions, data: imageData, stickers: stickers), text: updatedText, entities: updatedEntities, privacy: updatedPrivacy)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] result in
|
|> deliverOnMainQueue).start(next: { [weak self] result in
|
||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
@ -3511,7 +3514,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
commit({})
|
commit({})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
case let .video(content, firstFrameImage, values, duration, dimensions):
|
case let .video(content, firstFrameImage, values, duration, dimensions):
|
||||||
updateProgressImpl?(0.0)
|
updateProgressImpl?(0.0)
|
||||||
@ -3541,7 +3544,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = (context.engine.messages.editStory(id: id, media: .video(dimensions: dimensions, duration: duration, resource: resource, firstFrameFile: firstFrameFile, stickers: stickers), text: updatedText, entities: updatedEntities, privacy: updatedPrivacy)
|
updateDisposable.set((context.engine.messages.editStory(id: id, media: .video(dimensions: dimensions, duration: duration, resource: resource, firstFrameFile: firstFrameFile, stickers: stickers), text: updatedText, entities: updatedEntities, privacy: updatedPrivacy)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] result in
|
|> deliverOnMainQueue).start(next: { [weak self] result in
|
||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
@ -3559,7 +3562,7 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
commit({})
|
commit({})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if updatedText != nil || updatedPrivacy != nil {
|
} else if updatedText != nil || updatedPrivacy != nil {
|
||||||
@ -3599,7 +3602,9 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
}
|
}
|
||||||
self.component?.controller()?.push(controller)
|
self.component?.controller()?.push(controller)
|
||||||
updateProgressImpl = { [weak controller] progress in
|
updateProgressImpl = { [weak controller] progress in
|
||||||
controller?.updateEditProgress(progress)
|
controller?.updateEditProgress(progress, cancel: {
|
||||||
|
updateDisposable.dispose()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,10 +94,6 @@ final class StoryItemSetContainerSendMessage {
|
|||||||
self.navigationActionDisposable.dispose()
|
self.navigationActionDisposable.dispose()
|
||||||
self.resolvePeerByNameDisposable.dispose()
|
self.resolvePeerByNameDisposable.dispose()
|
||||||
self.inputMediaNodeDataDisposable?.dispose()
|
self.inputMediaNodeDataDisposable?.dispose()
|
||||||
|
|
||||||
if let tooltipScreen = self.tooltipScreen {
|
|
||||||
tooltipScreen.dismiss()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setup(context: AccountContext, view: StoryItemSetContainerComponent.View, inputPanelExternalState: MessageInputPanelComponent.ExternalState, keyboardInputData: Signal<ChatEntityKeyboardInputNode.InputData, NoError>) {
|
func setup(context: AccountContext, view: StoryItemSetContainerComponent.View, inputPanelExternalState: MessageInputPanelComponent.ExternalState, keyboardInputData: Signal<ChatEntityKeyboardInputNode.InputData, NoError>) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user