Version 10.13

This commit is contained in:
Kylmakalle
2024-07-02 19:58:37 +03:00
parent c0c8d86c14
commit 27f17e3297
634 changed files with 31053 additions and 1247 deletions

View File

@@ -1,3 +1,4 @@
import SGSimpleSettings
import Foundation
import UIKit
import Photos
@@ -121,7 +122,8 @@ public func fetchPhotoLibraryResource(localIdentifier: String, width: Int32?, he
if let width, let height {
size = CGSize(width: CGFloat(width), height: CGFloat(height))
} else {
size = CGSize(width: 1280.0, height: 1280.0)
// MARK: Swiftgram
size = SGSimpleSettings.shared.sendLargePhotos ? CGSize(width: 2560.0, height: 2560.0) : CGSize(width: 1280.0, height: 1280.0)
}
var targetSize = PHImageManagerMaximumSize
@@ -178,7 +180,7 @@ public func fetchPhotoLibraryResource(localIdentifier: String, width: Int32?, he
defer {
TempBox.shared.dispose(tempFile)
}
if let scaledImage = scaledImage, let data = compressImageToJPEG(scaledImage, quality: 0.6, tempFilePath: tempFile.path) {
if let scaledImage = scaledImage, let data = compressImageToJPEG(scaledImage, quality: Float(SGSimpleSettings.shared.outgoingPhotoQuality) / 100.0, tempFilePath: tempFile.path) {
#if DEBUG
print("compression completion \((CACurrentMediaTime() - startTime) * 1000.0) ms")
#endif
@@ -188,7 +190,7 @@ public func fetchPhotoLibraryResource(localIdentifier: String, width: Int32?, he
subscriber.putCompletion()
}
case .jxl:
if let scaledImage = scaledImage, let data = compressImageToJPEGXL(scaledImage, quality: Int(quality ?? 75)) {
if let scaledImage = scaledImage, let data = compressImageToJPEGXL(scaledImage, quality: Int(SGSimpleSettings.shared.outgoingPhotoQuality)) {
#if DEBUG
print("jpegxl compression completion \((CACurrentMediaTime() - startTime) * 1000.0) ms")
#endif