diff --git a/submodules/DrawingUI/Sources/DrawingTextEntity.swift b/submodules/DrawingUI/Sources/DrawingTextEntity.swift index aa034277fa..7a9859ba88 100644 --- a/submodules/DrawingUI/Sources/DrawingTextEntity.swift +++ b/submodules/DrawingUI/Sources/DrawingTextEntity.swift @@ -635,7 +635,7 @@ public final class DrawingTextEntityView: DrawingEntityView, UITextViewDelegate func getRenderImage() -> UIImage? { let rect = self.bounds - UIGraphicsBeginImageContextWithOptions(rect.size, false, 1.0) + UIGraphicsBeginImageContextWithOptions(rect.size, false, 2.0) self.textView.drawHierarchy(in: rect, afterScreenUpdates: true) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift index a2b418b7e3..f0350e1920 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift @@ -257,7 +257,7 @@ public extension TelegramEngine { ) } - guard let message else { + guard let message = message else { return .complete() } diff --git a/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditorComposer.swift b/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditorComposer.swift index b5baaf3e57..d0afbe9468 100644 --- a/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditorComposer.swift +++ b/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditorComposer.swift @@ -267,7 +267,9 @@ private func makeEditorImageFrameComposition(context: CIContext, inputImage: CII image = image.transformed(by: resetTransform) var baseScale: CGFloat = 1.0 - if let baseSize = entity.baseSize { + if let entityBaseScale = entity.baseScale { + baseScale = entityBaseScale + } else if let baseSize = entity.baseSize { baseScale = baseSize.width / image.extent.width if baseSize.width != baseSize.height { baseScale *= min(baseSize.width, baseSize.height) / max(baseSize.width, baseSize.height) diff --git a/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditorComposerEntity.swift b/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditorComposerEntity.swift index 6535e6c85b..f9c060543d 100644 --- a/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditorComposerEntity.swift +++ b/submodules/TelegramUI/Components/MediaEditor/Sources/MediaEditorComposerEntity.swift @@ -28,14 +28,14 @@ func composerEntitiesForDrawingEntity(account: Account, entity: DrawingEntity, c return [MediaEditorComposerStickerEntity(account: account, content: content, position: entity.position, scale: entity.scale, rotation: entity.rotation, baseSize: entity.baseSize, mirrored: entity.mirrored, colorSpace: colorSpace, isStatic: entity.isExplicitlyStatic)] } else if let renderImage = entity.renderImage, let image = CIImage(image: renderImage, options: [.colorSpace: colorSpace]) { if let entity = entity as? DrawingBubbleEntity { - return [MediaEditorComposerStaticEntity(image: image, position: entity.position, scale: 1.0, rotation: entity.rotation, baseSize: entity.size, mirrored: false)] + return [MediaEditorComposerStaticEntity(image: image, position: entity.position, scale: 1.0, rotation: entity.rotation, baseSize: entity.size, baseScale: nil, mirrored: false)] } else if let entity = entity as? DrawingSimpleShapeEntity { - return [MediaEditorComposerStaticEntity(image: image, position: entity.position, scale: 1.0, rotation: entity.rotation, baseSize: entity.size, mirrored: false)] + return [MediaEditorComposerStaticEntity(image: image, position: entity.position, scale: 1.0, rotation: entity.rotation, baseSize: entity.size, baseScale: nil, mirrored: false)] } else if let entity = entity as? DrawingVectorEntity { - return [MediaEditorComposerStaticEntity(image: image, position: CGPoint(x: entity.drawingSize.width * 0.5, y: entity.drawingSize.height * 0.5), scale: 1.0, rotation: 0.0, baseSize: entity.drawingSize, mirrored: false)] + return [MediaEditorComposerStaticEntity(image: image, position: CGPoint(x: entity.drawingSize.width * 0.5, y: entity.drawingSize.height * 0.5), scale: 1.0, rotation: 0.0, baseSize: entity.drawingSize, baseScale: nil, mirrored: false)] } else if let entity = entity as? DrawingTextEntity { var entities: [MediaEditorComposerEntity] = [] - entities.append(MediaEditorComposerStaticEntity(image: image, position: entity.position, scale: entity.scale, rotation: entity.rotation, baseSize: nil, mirrored: false)) + entities.append(MediaEditorComposerStaticEntity(image: image, position: entity.position, scale: entity.scale, rotation: entity.rotation, baseSize: nil, baseScale: 0.5, mirrored: false)) if let renderSubEntities = entity.renderSubEntities { for subEntity in renderSubEntities { entities.append(contentsOf: composerEntitiesForDrawingEntity(account: account, entity: subEntity, colorSpace: colorSpace)) @@ -53,14 +53,16 @@ private class MediaEditorComposerStaticEntity: MediaEditorComposerEntity { let scale: CGFloat let rotation: CGFloat let baseSize: CGSize? + let baseScale: CGFloat? let mirrored: Bool - init(image: CIImage, position: CGPoint, scale: CGFloat, rotation: CGFloat, baseSize: CGSize?, mirrored: Bool) { + init(image: CIImage, position: CGPoint, scale: CGFloat, rotation: CGFloat, baseSize: CGSize?, baseScale: CGFloat?, mirrored: Bool) { self.image = image self.position = position self.scale = scale self.rotation = rotation self.baseSize = baseSize + self.baseScale = baseScale self.mirrored = mirrored } @@ -88,6 +90,7 @@ private class MediaEditorComposerStickerEntity: MediaEditorComposerEntity { let scale: CGFloat let rotation: CGFloat let baseSize: CGSize? + let baseScale: CGFloat? = nil let mirrored: Bool let colorSpace: CGColorSpace let isStatic: Bool @@ -433,6 +436,7 @@ protocol MediaEditorComposerEntity { var scale: CGFloat { get } var rotation: CGFloat { get } var baseSize: CGSize? { get } + var baseScale: CGFloat? { get } var mirrored: Bool { get } func image(for time: CMTime, frameRate: Float, context: CIContext, completion: @escaping (CIImage?) -> Void) diff --git a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift index 81a218d6ca..8d0fa3cfbb 100644 --- a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift +++ b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift @@ -3638,7 +3638,9 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate let codableEntities = DrawingEntitiesView.encodeEntities(entities, entitiesView: self.node.entitiesView) mediaEditor.setDrawingAndEntities(data: nil, image: mediaEditor.values.drawing, entities: codableEntities) - let caption = self.getCaption() + var caption = self.getCaption() + caption = convertMarkdownToAttributes(caption) + let randomId: Int64 if case let .draft(_, id) = subject, let id { randomId = id diff --git a/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreen.swift b/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreen.swift index 799e845ffe..a1d1028200 100644 --- a/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreen.swift +++ b/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreen.swift @@ -1335,7 +1335,7 @@ final class ShareWithPeersScreenComponent: Component { sideInset: sideInset, title: "Name", peer: nil, - subtitle: nil, + subtitle: "sub", subtitleAccessory: .none, presence: nil, selectionState: .editing(isSelected: false, isTinted: false), diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift index c5c8be7f30..028eb41b74 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryItemSetContainerComponent.swift @@ -3548,12 +3548,12 @@ public final class StoryItemSetContainerComponent: Component { var tip: ContextController.Tip? var tipSignal: Signal? - if hasLinkedStickers { + if hasLinkedStickers, let peerReference = PeerReference(component.slice.peer._asPeer()) { let context = component.context tip = .animatedEmoji(text: nil, arguments: nil, file: nil, action: nil) let packsPromise = Promise<[StickerPackReference]>() - packsPromise.set(context.engine.stickers.stickerPacksAttachedToMedia(media: .standalone(media: media))) + packsPromise.set(context.engine.stickers.stickerPacksAttachedToMedia(media: .story(peer: peerReference, id: component.slice.item.storyItem.id, media: media))) let action: () -> Void = { [weak self] in if let self {