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
9fcc3248fa
commit
7afa30f3d8
@ -872,7 +872,7 @@ public final class GiftItemComponent: Component {
|
|||||||
if range.location != NSNotFound {
|
if range.location != NSNotFound {
|
||||||
labelText.addAttribute(NSAttributedString.Key.font, value: Font.semibold(10.0), range: range)
|
labelText.addAttribute(NSAttributedString.Key.font, value: Font.semibold(10.0), range: range)
|
||||||
labelText.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: 0, file: nil, custom: .stars(tinted: true)), range: range)
|
labelText.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: 0, file: nil, custom: .stars(tinted: true)), range: range)
|
||||||
labelText.addAttribute(.kern, value: -2.0, range: NSRange(location: range.lowerBound, length: 1))
|
labelText.addAttribute(.kern, value: -1.5, range: NSRange(location: range.upperBound, length: 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
let resellSize = self.reselLabel.update(
|
let resellSize = self.reselLabel.update(
|
||||||
|
@ -230,7 +230,7 @@ public enum MediaCropOrientation: Int32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class MediaEditorValues: Codable, Equatable {
|
public final class MediaEditorValues: Codable, Equatable, CustomStringConvertible {
|
||||||
public static func == (lhs: MediaEditorValues, rhs: MediaEditorValues) -> Bool {
|
public static func == (lhs: MediaEditorValues, rhs: MediaEditorValues) -> Bool {
|
||||||
if lhs.peerId != rhs.peerId {
|
if lhs.peerId != rhs.peerId {
|
||||||
return false
|
return false
|
||||||
@ -1010,6 +1010,114 @@ public final class MediaEditorValues: Codable, Equatable {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var description: String {
|
||||||
|
var components: [String] = []
|
||||||
|
|
||||||
|
components.append("originalDimensions: \(self.originalDimensions.width)x\(self.originalDimensions.height)")
|
||||||
|
|
||||||
|
if self.cropOffset != .zero {
|
||||||
|
components.append("cropOffset: \(cropOffset)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let cropRect = self.cropRect {
|
||||||
|
components.append("cropRect: \(cropRect)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.cropScale != 1.0 {
|
||||||
|
components.append("cropScale: \(self.cropScale)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.cropRotation != 0.0 {
|
||||||
|
components.append("cropRotation: \(self.cropRotation)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.cropMirroring {
|
||||||
|
components.append("cropMirroring: true")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let cropOrientation = self.cropOrientation {
|
||||||
|
components.append("cropOrientation: \(cropOrientation)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let gradientColors = self.gradientColors, !gradientColors.isEmpty {
|
||||||
|
components.append("gradientColors: \(gradientColors.count) colors")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let videoTrimRange = self.videoTrimRange {
|
||||||
|
components.append("videoTrimRange: \(videoTrimRange.lowerBound) - \(videoTrimRange.upperBound)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.videoIsMuted {
|
||||||
|
components.append("videoIsMuted: true")
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.videoIsFullHd {
|
||||||
|
components.append("videoIsFullHd: true")
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.videoIsMirrored {
|
||||||
|
components.append("videoIsMirrored: true")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let videoVolume = self.videoVolume, videoVolume != 1.0 {
|
||||||
|
components.append("videoVolume: \(videoVolume)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let additionalVideoPath = self.additionalVideoPath {
|
||||||
|
components.append("additionalVideo: \(additionalVideoPath)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let position = self.additionalVideoPosition {
|
||||||
|
components.append("additionalVideoPosition: \(position)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let scale = self.additionalVideoScale {
|
||||||
|
components.append("additionalVideoScale: \(scale)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let rotation = self.additionalVideoRotation {
|
||||||
|
components.append("additionalVideoRotation: \(rotation)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.additionalVideoPositionChanges.isEmpty {
|
||||||
|
components.append("additionalVideoPositionChanges: \(additionalVideoPositionChanges.count) changes")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.collage.isEmpty {
|
||||||
|
components.append("collage: \(collage.count) items")
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.nightTheme {
|
||||||
|
components.append("nightTheme: true")
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.drawing != nil {
|
||||||
|
components.append("drawing: true")
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.maskDrawing != nil {
|
||||||
|
components.append("maskDrawing: true")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.entities.isEmpty {
|
||||||
|
components.append("entities: \(self.entities.count) items")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.toolValues.isEmpty {
|
||||||
|
components.append("toolValues: \(self.toolValues.count) tools")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let audioTrack = self.audioTrack {
|
||||||
|
components.append("audioTrack: \(audioTrack.path)")
|
||||||
|
}
|
||||||
|
|
||||||
|
if let qualityPreset = self.qualityPreset {
|
||||||
|
components.append("qualityPreset: \(qualityPreset)")
|
||||||
|
}
|
||||||
|
|
||||||
|
return "MediaEditorValues(\(components.joined(separator: ", ")))"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct TintValue: Equatable, Codable {
|
public struct TintValue: Equatable, Codable {
|
||||||
|
@ -264,6 +264,11 @@ public final class MediaEditorVideoExport {
|
|||||||
self.outputPath = outputPath
|
self.outputPath = outputPath
|
||||||
self.textScale = textScale
|
self.textScale = textScale
|
||||||
|
|
||||||
|
Logger.shared.log("VideoExport", "Init")
|
||||||
|
Logger.shared.log("VideoExport", "Subject: \(subject)")
|
||||||
|
Logger.shared.log("VideoExport", "Output Path: \(outputPath)")
|
||||||
|
Logger.shared.log("VideoExport", "Configuration: \(configuration)")
|
||||||
|
|
||||||
if FileManager.default.fileExists(atPath: outputPath) {
|
if FileManager.default.fileExists(atPath: outputPath) {
|
||||||
try? FileManager.default.removeItem(atPath: outputPath)
|
try? FileManager.default.removeItem(atPath: outputPath)
|
||||||
}
|
}
|
||||||
@ -297,6 +302,9 @@ public final class MediaEditorVideoExport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func setup() {
|
private func setup() {
|
||||||
|
Logger.shared.log("VideoExport", "Setting up")
|
||||||
|
|
||||||
|
|
||||||
var mainAsset: AVAsset?
|
var mainAsset: AVAsset?
|
||||||
|
|
||||||
var signals: [Signal<Input, NoError>] = []
|
var signals: [Signal<Input, NoError>] = []
|
||||||
@ -948,11 +956,6 @@ public final class MediaEditorVideoExport {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// if !writer.appendVideoBuffer(sampleBuffer) {
|
|
||||||
// writer.markVideoAsFinished()
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@ -983,17 +986,21 @@ public final class MediaEditorVideoExport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func start() {
|
private func start() {
|
||||||
|
Logger.shared.log("VideoExport", "Start")
|
||||||
guard self.internalStatus == .idle, let writer = self.writer else {
|
guard self.internalStatus == .idle, let writer = self.writer else {
|
||||||
|
Logger.shared.log("VideoExport", "Failed with invalid state")
|
||||||
self.statusValue = .failed(.invalid)
|
self.statusValue = .failed(.invalid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
guard writer.startWriting() else {
|
guard writer.startWriting() else {
|
||||||
|
Logger.shared.log("VideoExport", "Failed on startWriting")
|
||||||
self.statusValue = .failed(.writing(nil))
|
self.statusValue = .failed(.writing(nil))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if let reader = self.reader, !reader.startReading() {
|
if let reader = self.reader, !reader.startReading() {
|
||||||
|
Logger.shared.log("VideoExport", "Failed on startReading")
|
||||||
self.statusValue = .failed(.reading(nil))
|
self.statusValue = .failed(.reading(nil))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1067,6 +1074,7 @@ public final class MediaEditorVideoExport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if cancelled {
|
if cancelled {
|
||||||
|
Logger.shared.log("VideoExport", "Cancelled")
|
||||||
try? FileManager.default.removeItem(at: outputUrl)
|
try? FileManager.default.removeItem(at: outputUrl)
|
||||||
self.internalStatus = .finished
|
self.internalStatus = .finished
|
||||||
self.statusValue = .failed(.cancelled)
|
self.statusValue = .failed(.cancelled)
|
||||||
@ -1108,6 +1116,7 @@ public final class MediaEditorVideoExport {
|
|||||||
let exportDuration = end - self.startTimestamp
|
let exportDuration = end - self.startTimestamp
|
||||||
print("video processing took \(exportDuration)s")
|
print("video processing took \(exportDuration)s")
|
||||||
if duration.seconds > 0 {
|
if duration.seconds > 0 {
|
||||||
|
Logger.shared.log("VideoExport", "Completed with path \(self.outputPath)")
|
||||||
Logger.shared.log("VideoExport", "Video processing took \(exportDuration / duration.seconds)")
|
Logger.shared.log("VideoExport", "Video processing took \(exportDuration / duration.seconds)")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -828,7 +828,11 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let webView = self.webView {
|
if let webView = self.webView {
|
||||||
var scrollInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: layout.intrinsicInsets.bottom, right: 0.0)
|
let inputHeight = self.validLayout?.0.inputHeight ?? 0.0
|
||||||
|
|
||||||
|
let intrinsicBottomInset = layout.intrinsicInsets.bottom > 40.0 ? layout.intrinsicInsets.bottom : 0.0
|
||||||
|
|
||||||
|
var scrollInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: max(inputHeight, intrinsicBottomInset), right: 0.0)
|
||||||
var frameBottomInset: CGFloat = 0.0
|
var frameBottomInset: CGFloat = 0.0
|
||||||
if scrollInset.bottom > 40.0 {
|
if scrollInset.bottom > 40.0 {
|
||||||
frameBottomInset = scrollInset.bottom
|
frameBottomInset = scrollInset.bottom
|
||||||
@ -841,12 +845,12 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
if !webView.frame.width.isZero && webView.frame != webViewFrame {
|
if !webView.frame.width.isZero && webView.frame != webViewFrame {
|
||||||
self.updateWebViewWhenStable = true
|
self.updateWebViewWhenStable = true
|
||||||
}
|
}
|
||||||
|
|
||||||
var bottomInset = layout.intrinsicInsets.bottom + layout.additionalInsets.bottom
|
var viewportBottomInset = max(frameBottomInset, scrollInset.bottom)
|
||||||
if let inputHeight = self.validLayout?.0.inputHeight, inputHeight > 44.0 {
|
if (self.validLayout?.0.inputHeight ?? 0.0) < 44.0 {
|
||||||
bottomInset = max(bottomInset, inputHeight)
|
viewportBottomInset += layout.additionalInsets.bottom
|
||||||
}
|
}
|
||||||
let viewportFrame = CGRect(origin: CGPoint(x: layout.safeInsets.left, y: topInset), size: CGSize(width: layout.size.width - layout.safeInsets.left - layout.safeInsets.right, height: max(1.0, layout.size.height - topInset - bottomInset)))
|
let viewportFrame = CGRect(origin: CGPoint(x: layout.safeInsets.left, y: topInset), size: CGSize(width: layout.size.width - layout.safeInsets.left - layout.safeInsets.right, height: max(1.0, layout.size.height - topInset - viewportBottomInset)))
|
||||||
|
|
||||||
if webView.scrollView.contentInset != scrollInset {
|
if webView.scrollView.contentInset != scrollInset {
|
||||||
webView.scrollView.contentInset = scrollInset
|
webView.scrollView.contentInset = scrollInset
|
||||||
@ -1061,6 +1065,10 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
|||||||
} else {
|
} else {
|
||||||
self.lastExpansionTimestamp = currentTimestamp
|
self.lastExpansionTimestamp = currentTimestamp
|
||||||
controller.requestAttachmentMenuExpansion()
|
controller.requestAttachmentMenuExpansion()
|
||||||
|
|
||||||
|
Queue.mainQueue().after(0.4) {
|
||||||
|
self.webView?.setNeedsLayout()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case "web_app_close":
|
case "web_app_close":
|
||||||
controller.dismiss()
|
controller.dismiss()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user