mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various fixes
This commit is contained in:
parent
d4408c2bb0
commit
40c2c1b620
@ -9847,6 +9847,8 @@ Sorry for the inconvenience.";
|
||||
"Story.StealthMode.CooldownAction" = "Available in %@";
|
||||
"Story.StealthMode.UpgradeAction" = "Unlock Stealth Mode";
|
||||
|
||||
"Story.ViewLocation" = "View Location";
|
||||
|
||||
"Location.AddThisLocation" = "Add This Location";
|
||||
"Location.AddMyLocation" = "Add My Current Location";
|
||||
"Location.TypeCity" = "City";
|
||||
|
@ -460,7 +460,7 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
}
|
||||
|
||||
func duplicate(_ entity: DrawingEntity) -> DrawingEntity {
|
||||
let newEntity = entity.duplicate()
|
||||
let newEntity = entity.duplicate(copy: false)
|
||||
self.prepareNewEntity(newEntity, setup: false, relativeTo: entity)
|
||||
|
||||
guard let view = makeEntityView(context: self.context, entity: newEntity) else {
|
||||
|
@ -210,7 +210,7 @@ public final class DrawingTextEntityView: DrawingEntityView, UITextViewDelegate
|
||||
func beginEditing(accessoryView: UIView?) {
|
||||
self._isEditing = true
|
||||
if !self.textEntity.text.string.isEmpty {
|
||||
let previousEntity = self.textEntity.duplicate() as? DrawingTextEntity
|
||||
let previousEntity = self.textEntity.duplicate(copy: false) as? DrawingTextEntity
|
||||
previousEntity?.uuid = self.textEntity.uuid
|
||||
self.previousEntity = previousEntity
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public final class DrawingBubbleEntity: DrawingEntity, Codable {
|
||||
case stroke
|
||||
}
|
||||
|
||||
public let uuid: UUID
|
||||
public var uuid: UUID
|
||||
public let isAnimated: Bool
|
||||
|
||||
public var drawType: DrawType
|
||||
@ -96,8 +96,11 @@ public final class DrawingBubbleEntity: DrawingEntity, Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public func duplicate() -> DrawingEntity {
|
||||
public func duplicate(copy: Bool) -> DrawingEntity {
|
||||
let newEntity = DrawingBubbleEntity(drawType: self.drawType, color: self.color, lineWidth: self.lineWidth)
|
||||
if copy {
|
||||
newEntity.uuid = self.uuid
|
||||
}
|
||||
newEntity.referenceDrawingSize = self.referenceDrawingSize
|
||||
newEntity.position = self.position
|
||||
newEntity.size = self.size
|
||||
|
@ -2,7 +2,7 @@ import Foundation
|
||||
import UIKit
|
||||
|
||||
public protocol DrawingEntity: AnyObject {
|
||||
var uuid: UUID { get }
|
||||
var uuid: UUID { get set }
|
||||
var isAnimated: Bool { get }
|
||||
var center: CGPoint { get }
|
||||
|
||||
@ -13,7 +13,7 @@ public protocol DrawingEntity: AnyObject {
|
||||
|
||||
var scale: CGFloat { get set }
|
||||
|
||||
func duplicate() -> DrawingEntity
|
||||
func duplicate(copy: Bool) -> DrawingEntity
|
||||
|
||||
var renderImage: UIImage? { get set }
|
||||
var renderSubEntities: [DrawingEntity]? { get set }
|
||||
|
@ -161,8 +161,11 @@ public final class DrawingLocationEntity: DrawingEntity, Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public func duplicate() -> DrawingEntity {
|
||||
public func duplicate(copy: Bool) -> DrawingEntity {
|
||||
let newEntity = DrawingLocationEntity(title: self.title, style: self.style, location: self.location, icon: self.icon, queryId: self.queryId, resultId: self.resultId)
|
||||
if copy {
|
||||
newEntity.uuid = self.uuid
|
||||
}
|
||||
newEntity.referenceDrawingSize = self.referenceDrawingSize
|
||||
newEntity.position = self.position
|
||||
newEntity.width = self.width
|
||||
|
@ -60,7 +60,7 @@ public final class DrawingMediaEntity: DrawingEntity, Codable {
|
||||
case mirrored
|
||||
}
|
||||
|
||||
public let uuid: UUID
|
||||
public var uuid: UUID
|
||||
public let content: Content
|
||||
public let size: CGSize
|
||||
|
||||
@ -157,7 +157,7 @@ public final class DrawingMediaEntity: DrawingEntity, Codable {
|
||||
try container.encode(self.mirrored, forKey: .mirrored)
|
||||
}
|
||||
|
||||
public func duplicate() -> DrawingEntity {
|
||||
public func duplicate(copy: Bool) -> DrawingEntity {
|
||||
let newEntity = DrawingMediaEntity(content: self.content, size: self.size)
|
||||
newEntity.referenceDrawingSize = self.referenceDrawingSize
|
||||
newEntity.position = self.position
|
||||
|
@ -28,7 +28,7 @@ public final class DrawingSimpleShapeEntity: DrawingEntity, Codable {
|
||||
case stroke
|
||||
}
|
||||
|
||||
public let uuid: UUID
|
||||
public var uuid: UUID
|
||||
public let isAnimated: Bool
|
||||
|
||||
public var shapeType: ShapeType
|
||||
@ -102,8 +102,11 @@ public final class DrawingSimpleShapeEntity: DrawingEntity, Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public func duplicate() -> DrawingEntity {
|
||||
public func duplicate(copy: Bool) -> DrawingEntity {
|
||||
let newEntity = DrawingSimpleShapeEntity(shapeType: self.shapeType, drawType: self.drawType, color: self.color, lineWidth: self.lineWidth)
|
||||
if copy {
|
||||
newEntity.uuid = self.uuid
|
||||
}
|
||||
newEntity.referenceDrawingSize = self.referenceDrawingSize
|
||||
newEntity.position = self.position
|
||||
newEntity.size = self.size
|
||||
|
@ -69,7 +69,7 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
case isExplicitlyStatic
|
||||
}
|
||||
|
||||
public let uuid: UUID
|
||||
public var uuid: UUID
|
||||
public let content: Content
|
||||
|
||||
public var referenceDrawingSize: CGSize
|
||||
@ -221,8 +221,11 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
try container.encode(self.isExplicitlyStatic, forKey: .isExplicitlyStatic)
|
||||
}
|
||||
|
||||
public func duplicate() -> DrawingEntity {
|
||||
public func duplicate(copy: Bool) -> DrawingEntity {
|
||||
let newEntity = DrawingStickerEntity(content: self.content)
|
||||
if copy {
|
||||
newEntity.uuid = self.uuid
|
||||
}
|
||||
newEntity.referenceDrawingSize = self.referenceDrawingSize
|
||||
newEntity.position = self.position
|
||||
newEntity.scale = self.scale
|
||||
|
@ -247,8 +247,11 @@ public final class DrawingTextEntity: DrawingEntity, Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public func duplicate() -> DrawingEntity {
|
||||
public func duplicate(copy: Bool) -> DrawingEntity {
|
||||
let newEntity = DrawingTextEntity(text: self.text, style: self.style, animation: self.animation, font: self.font, alignment: self.alignment, fontSize: self.fontSize, color: self.color)
|
||||
if copy {
|
||||
newEntity.uuid = self.uuid
|
||||
}
|
||||
newEntity.referenceDrawingSize = self.referenceDrawingSize
|
||||
newEntity.position = self.position
|
||||
newEntity.width = self.width
|
||||
|
@ -23,7 +23,7 @@ public final class DrawingVectorEntity: DrawingEntity, Codable {
|
||||
case twoSidedArrow
|
||||
}
|
||||
|
||||
public let uuid: UUID
|
||||
public var uuid: UUID
|
||||
public let isAnimated: Bool
|
||||
|
||||
public var type: VectorType
|
||||
@ -98,8 +98,11 @@ public final class DrawingVectorEntity: DrawingEntity, Codable {
|
||||
}
|
||||
}
|
||||
|
||||
public func duplicate() -> DrawingEntity {
|
||||
public func duplicate(copy: Bool) -> DrawingEntity {
|
||||
let newEntity = DrawingVectorEntity(type: self.type, color: self.color, lineWidth: self.lineWidth)
|
||||
if copy {
|
||||
newEntity.uuid = self.uuid
|
||||
}
|
||||
newEntity.drawingSize = self.drawingSize
|
||||
newEntity.referenceDrawingSize = self.referenceDrawingSize
|
||||
newEntity.start = self.start
|
||||
|
@ -1857,7 +1857,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
initialValues = draft.values
|
||||
|
||||
for entity in draft.values.entities {
|
||||
self.entitiesView.add(entity.entity, announce: false)
|
||||
self.entitiesView.add(entity.entity.duplicate(copy: true), announce: false)
|
||||
}
|
||||
|
||||
if let drawingData = initialValues?.drawing?.pngData() {
|
||||
@ -3974,6 +3974,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
var caption = self.getCaption()
|
||||
caption = convertMarkdownToAttributes(caption)
|
||||
|
||||
var hasEntityChanges = false
|
||||
let randomId: Int64
|
||||
if case let .draft(_, id) = subject, let id {
|
||||
randomId = id
|
||||
@ -3982,7 +3983,10 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
}
|
||||
|
||||
var mediaAreas: [MediaArea] = []
|
||||
if case .draft = subject {
|
||||
if case let .draft(draft, _) = subject {
|
||||
if draft.values.entities != codableEntities {
|
||||
hasEntityChanges = true
|
||||
}
|
||||
} else {
|
||||
mediaAreas = self.initialMediaAreas ?? []
|
||||
}
|
||||
@ -4010,7 +4014,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
}
|
||||
}
|
||||
|
||||
if self.isEditingStory && !self.node.hasAnyChanges {
|
||||
if self.isEditingStory && !(self.node.hasAnyChanges || hasEntityChanges) {
|
||||
self.completion(randomId, nil, [], caption, self.state.privacy, stickers, { [weak self] finished in
|
||||
self?.node.animateOut(finished: true, saveDraft: false, completion: { [weak self] in
|
||||
self?.dismiss()
|
||||
|
@ -3233,7 +3233,7 @@ final class StoryItemSetContainerSendMessage {
|
||||
let subject = EngineMessage(stableId: 0, stableVersion: 0, id: EngineMessage.Id(peerId: PeerId(0), namespace: 0, id: 0), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 0, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: nil, text: "", attributes: [], media: [.geo(TelegramMediaMap(latitude: venue.latitude, longitude: venue.longitude, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: venue.venue, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil))], peers: [:], associatedMessages: [:], associatedMessageIds: [], associatedMedia: [:], associatedThreadInfo: nil, associatedStories: [:])
|
||||
|
||||
let context = component.context
|
||||
actions.append(ContextMenuAction(content: .textWithIcon(title: "View Location", icon: generateTintedImage(image: UIImage(bundleImageName: "Settings/TextArrowRight"), color: .white)), action: { [weak controller, weak view] in
|
||||
actions.append(ContextMenuAction(content: .textWithIcon(title: updatedPresentationData.initial.strings.Story_ViewLocation, icon: generateTintedImage(image: UIImage(bundleImageName: "Settings/TextArrowRight"), color: .white)), action: { [weak controller, weak view] in
|
||||
let locationController = LocationViewController(
|
||||
context: context,
|
||||
updatedPresentationData: updatedPresentationData,
|
||||
|
@ -1075,7 +1075,11 @@ public class TranslateScreen: ViewController {
|
||||
self.component = AnyComponent(component)
|
||||
self.theme = theme
|
||||
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: context.sharedContext.currentPresentationData.with { $0 }))
|
||||
var presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
if let theme {
|
||||
presentationData = presentationData.withUpdated(theme: theme)
|
||||
}
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: presentationData))
|
||||
}
|
||||
|
||||
required public init(coder aDecoder: NSCoder) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user