parent
df5099dd30
commit
8f61562355
|
@ -48,7 +48,7 @@ extension UIImage {
|
|||
guard let outputImage = filter.outputImage else { return nil }
|
||||
|
||||
var bitmap = [UInt8](repeating: 0, count: 4)
|
||||
let context = CIContext(options: [.workingColorSpace: kCFNull])
|
||||
let context = CIContext(options: [.workingColorSpace: kCFNull!])
|
||||
context.render(outputImage, toBitmap: &bitmap, rowBytes: 4, bounds: CGRect(x: 0, y: 0, width: 1, height: 1), format: .RGBA8, colorSpace: nil)
|
||||
|
||||
return UIColor(red: CGFloat(bitmap[0]) / 255, green: CGFloat(bitmap[1]) / 255, blue: CGFloat(bitmap[2]) / 255, alpha: CGFloat(bitmap[3]) / 255)
|
||||
|
|
|
@ -12,7 +12,7 @@ import SessionExporter
|
|||
import MastodonCore
|
||||
|
||||
extension AttachmentViewModel {
|
||||
func comporessVideo(url: URL) async throws -> URL {
|
||||
func compressVideo(url: URL) async throws -> URL {
|
||||
let urlAsset = AVURLAsset(url: url)
|
||||
let exporter = NextLevelSessionExporter(withAsset: urlAsset)
|
||||
exporter.outputFileType = .mp4
|
||||
|
|
|
@ -199,7 +199,7 @@ extension AttachmentViewModel {
|
|||
|
||||
} else {
|
||||
AttachmentViewModel.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): attachment processing. Retry \(waitProcessRetryCount)/\(waitProcessRetryLimit)")
|
||||
await Task.sleep(1_000_000_000 * 3) // 3s
|
||||
try await Task.sleep(nanoseconds: 1_000_000_000 * 3) // 3s
|
||||
}
|
||||
} while waitProcessRetryCount < waitProcessRetryLimit
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ final public class AttachmentViewModel: NSObject, ObservableObject, Identifiable
|
|||
case .video(let fileURL, let mimeType):
|
||||
self.output = output
|
||||
self.update(uploadState: .compressing)
|
||||
let compressedFileURL = try await comporessVideo(url: fileURL)
|
||||
let compressedFileURL = try await compressVideo(url: fileURL)
|
||||
output = .video(compressedFileURL, mimeType: mimeType)
|
||||
try? FileManager.default.removeItem(at: fileURL) // remove old file
|
||||
default:
|
||||
|
|
|
@ -304,9 +304,14 @@ extension StatusView.ViewModel {
|
|||
}
|
||||
|
||||
let paragraphStyle = statusView.contentMetaText.paragraphStyle
|
||||
if let language = language {
|
||||
let direction = Locale.characterDirection(forLanguage: language)
|
||||
paragraphStyle.alignment = direction == .rightToLeft ? .right : .left
|
||||
if let language = language {
|
||||
if #available(iOS 16, *) {
|
||||
let direction = Locale.Language(identifier: language).characterDirection
|
||||
paragraphStyle.alignment = direction == .rightToLeft ? .right : .left
|
||||
} else {
|
||||
let direction = Locale.characterDirection(forLanguage: language)
|
||||
paragraphStyle.alignment = direction == .rightToLeft ? .right : .left
|
||||
};
|
||||
} else {
|
||||
paragraphStyle.alignment = .natural
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue