From cd66e62454a2a0ecbea2f78e7f5a0f0a622ef1cc Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 26 May 2021 12:43:34 +0200 Subject: [PATCH 1/2] "home server" -> "homeserver" (#3404) --- newsfragment/3404.feature | 1 + vector/src/main/res/values/strings.xml | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 newsfragment/3404.feature diff --git a/newsfragment/3404.feature b/newsfragment/3404.feature new file mode 100644 index 0000000000..e51974f4c5 --- /dev/null +++ b/newsfragment/3404.feature @@ -0,0 +1 @@ +Inconsistent usage of the term homeserver in Settings \ No newline at end of file diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 8649b14ca3..1e3d246e64 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -537,7 +537,7 @@ Create Account Log in Sign out - Home Server URL + Homeserver URL Identity Server URL Search @@ -625,9 +625,9 @@ Use custom server options (advanced) Please check your email to continue registration Registration with email and phone number at once is not supported yet until the api exists. Only the phone number will be taken into account.\n\nYou may add your email to your profile in settings. - This Home Server would like to make sure you are not a robot + This homeserver would like to make sure you are not a robot Username in use - Home Server: + Homeserver: Identity Server: I have verified my email address To reset your password, enter the email address linked to your account: @@ -713,7 +713,7 @@ Use default ${app_name} ringtone for incoming calls Allow fallback call assist server - Will use "%s" as assist when your home server does not offer one (your IP address will be shared during a call) + Will use "%s" as assist when your homeserver does not offer one (your IP address will be shared during a call) Incoming call ringtone Select ringtone for calls: @@ -1314,7 +1314,7 @@ Submit Logged in as - Home Server + Homeserver Identity Server Allow integrations Integration Manager From 898c8cc3a7493995a6c5b198a60dda955abbd14e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 26 May 2021 13:55:29 +0200 Subject: [PATCH 2/2] Refact: inject ThumbnailExtractor --- .../internal/session/content/ThumbnailExtractor.kt | 11 +++++++---- .../internal/session/content/UploadContentWorker.kt | 3 ++- .../session/room/send/LocalEchoEventFactory.kt | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ThumbnailExtractor.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ThumbnailExtractor.kt index c28668a53e..fde3dd906c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ThumbnailExtractor.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/ThumbnailExtractor.kt @@ -23,8 +23,11 @@ import org.matrix.android.sdk.api.session.content.ContentAttachmentData import org.matrix.android.sdk.api.util.MimeTypes import timber.log.Timber import java.io.ByteArrayOutputStream +import javax.inject.Inject -internal object ThumbnailExtractor { +internal class ThumbnailExtractor @Inject constructor( + private val context: Context +) { class ThumbnailData( val width: Int, @@ -34,15 +37,15 @@ internal object ThumbnailExtractor { val mimeType: String ) - fun extractThumbnail(context: Context, attachment: ContentAttachmentData): ThumbnailData? { + fun extractThumbnail(attachment: ContentAttachmentData): ThumbnailData? { return if (attachment.type == ContentAttachmentData.Type.VIDEO) { - extractVideoThumbnail(context, attachment) + extractVideoThumbnail(attachment) } else { null } } - private fun extractVideoThumbnail(context: Context, attachment: ContentAttachmentData): ThumbnailData? { + private fun extractVideoThumbnail(attachment: ContentAttachmentData): ThumbnailData? { var thumbnailData: ThumbnailData? = null val mediaMetadataRetriever = MediaMetadataRetriever() try { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt index 06cbf1ba90..237411db53 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/content/UploadContentWorker.kt @@ -82,6 +82,7 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter @Inject lateinit var cancelSendTracker: CancelSendTracker @Inject lateinit var imageCompressor: ImageCompressor @Inject lateinit var videoCompressor: VideoCompressor + @Inject lateinit var thumbnailExtractor: ThumbnailExtractor @Inject lateinit var localEchoRepository: LocalEchoRepository @Inject lateinit var temporaryFileCreator: TemporaryFileCreator @@ -302,7 +303,7 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter * If appropriate, it will create and upload a thumbnail */ private suspend fun dealWithThumbnail(params: Params): UploadThumbnailResult? { - return ThumbnailExtractor.extractThumbnail(context, params.attachment) + return thumbnailExtractor.extractThumbnail(params.attachment) ?.let { thumbnailData -> val thumbnailProgressListener = object : ProgressRequestBody.Listener { override fun onProgress(current: Long, total: Long) { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt index c1ad6205c3..f505b13b33 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt @@ -73,6 +73,7 @@ internal class LocalEchoEventFactory @Inject constructor( @UserId private val userId: String, private val markdownParser: MarkdownParser, private val textPillsUtils: TextPillsUtils, + private val thumbnailExtractor: ThumbnailExtractor, private val localEchoRepository: LocalEchoRepository, private val permalinkFactory: PermalinkFactory ) { @@ -261,7 +262,7 @@ internal class LocalEchoEventFactory @Inject constructor( val width = firstFrame?.width ?: 0 mediaDataRetriever.release() - val thumbnailInfo = ThumbnailExtractor.extractThumbnail(context, attachment)?.let { + val thumbnailInfo = thumbnailExtractor.extractThumbnail(attachment)?.let { ThumbnailInfo( width = it.width, height = it.height,