mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 08:15:02 +00:00
Get the media optimization config only once when sharing media
The config is the same for all the files and all the rooms, so there is no need to read it for each file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -50,7 +50,8 @@ class DefaultShareDataSender(
|
||||
if (filesToShare.isEmpty()) {
|
||||
false
|
||||
} else {
|
||||
val mediaOptimizationConfigProvider = mediaOptimizationConfigProviderFactory.create(client)
|
||||
// The media optimization config is the same for all the files and all the rooms
|
||||
val mediaOptimizationConfig = mediaOptimizationConfigProviderFactory.create(client).get()
|
||||
roomIds
|
||||
.map { roomId ->
|
||||
val room = client.findJoinedRoom(roomId) ?: return@map false
|
||||
@@ -61,7 +62,7 @@ class DefaultShareDataSender(
|
||||
caption = shareIntentData.text,
|
||||
uri = fileToShare.uri,
|
||||
mimeType = fileToShare.mimeType,
|
||||
mediaOptimizationConfig = mediaOptimizationConfigProvider.get(),
|
||||
mediaOptimizationConfig = mediaOptimizationConfig,
|
||||
)
|
||||
// If the coroutine was cancelled, destroy the room and rethrow the exception
|
||||
val cancellationException = result.exceptionOrNull() as? CancellationException
|
||||
|
||||
Reference in New Issue
Block a user