Replace AppSettings with UserSettings from the UserSessionFlow and below.

Remove some redundant injections when passed alongside a user session too.

# Conflicts:
#	ElementX/Sources/Screens/PinnedEventsTimelineScreen/View/PinnedEventsTimelineScreen.swift
#	ElementX/Sources/Screens/Timeline/TimelineViewModel.swift
This commit is contained in:
Doug
2026-09-25 13:51:33 +01:00
committed by Stefan Ceriu
parent 54cc1cba60
commit fccad5fc30
117 changed files with 554 additions and 594 deletions
@@ -86,7 +86,7 @@ private struct VideoProcessingInfo {
}
struct MediaUploadingPreprocessor {
let appSettings: AppSettings
let userSettings: UserSettings
enum Constants {
static let maximumThumbnailSize = CGSize(width: 800, height: 600)
@@ -171,7 +171,7 @@ struct MediaUploadingPreprocessor {
try stripLocationFromImage(at: url, type: type)
var mimeType = mimeType
if appSettings.optimizeMediaUploads, !type.conforms(to: .gif) {
if userSettings.optimizeMediaUploads, !type.conforms(to: .gif) {
let outputType = type.conforms(to: .png) ? UTType.png : .jpeg
mimeType = outputType.preferredMIMEType ?? "application/octet-stream"
try resizeImage(at: url, maxPixelSize: Constants.optimizedMaxPixelSize, destination: url, type: outputType)
@@ -439,7 +439,7 @@ struct MediaUploadingPreprocessor {
/// - Returns: the URL for the resulting video and its media info as a `VideoProcessingResult`
private func convertVideoToMP4(_ url: URL, targetFileSize: UInt) async throws(MediaUploadingPreprocessorError) -> VideoProcessingInfo {
let asset = AVURLAsset(url: url)
let presetName = appSettings.optimizeMediaUploads ? AVAssetExportPreset1280x720 : AVAssetExportPreset1920x1080
let presetName = userSettings.optimizeMediaUploads ? AVAssetExportPreset1280x720 : AVAssetExportPreset1920x1080
guard let exportSession = AVAssetExportSession(asset: asset, presetName: presetName) else {
throw .failedConvertingVideo