Merge pull request #3414 from vector-im/feature/bma/wording_homeserver

Feature/bma/wording homeserver
This commit is contained in:
Benoit Marty 2021-05-27 17:32:27 +02:00 committed by GitHub
commit d2fd652fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 11 deletions

View File

@ -23,8 +23,11 @@ import org.matrix.android.sdk.api.session.content.ContentAttachmentData
import org.matrix.android.sdk.api.util.MimeTypes import org.matrix.android.sdk.api.util.MimeTypes
import timber.log.Timber import timber.log.Timber
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import javax.inject.Inject
internal object ThumbnailExtractor { internal class ThumbnailExtractor @Inject constructor(
private val context: Context
) {
class ThumbnailData( class ThumbnailData(
val width: Int, val width: Int,
@ -34,15 +37,15 @@ internal object ThumbnailExtractor {
val mimeType: String val mimeType: String
) )
fun extractThumbnail(context: Context, attachment: ContentAttachmentData): ThumbnailData? { fun extractThumbnail(attachment: ContentAttachmentData): ThumbnailData? {
return if (attachment.type == ContentAttachmentData.Type.VIDEO) { return if (attachment.type == ContentAttachmentData.Type.VIDEO) {
extractVideoThumbnail(context, attachment) extractVideoThumbnail(attachment)
} else { } else {
null null
} }
} }
private fun extractVideoThumbnail(context: Context, attachment: ContentAttachmentData): ThumbnailData? { private fun extractVideoThumbnail(attachment: ContentAttachmentData): ThumbnailData? {
var thumbnailData: ThumbnailData? = null var thumbnailData: ThumbnailData? = null
val mediaMetadataRetriever = MediaMetadataRetriever() val mediaMetadataRetriever = MediaMetadataRetriever()
try { try {

View File

@ -82,6 +82,7 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
@Inject lateinit var cancelSendTracker: CancelSendTracker @Inject lateinit var cancelSendTracker: CancelSendTracker
@Inject lateinit var imageCompressor: ImageCompressor @Inject lateinit var imageCompressor: ImageCompressor
@Inject lateinit var videoCompressor: VideoCompressor @Inject lateinit var videoCompressor: VideoCompressor
@Inject lateinit var thumbnailExtractor: ThumbnailExtractor
@Inject lateinit var localEchoRepository: LocalEchoRepository @Inject lateinit var localEchoRepository: LocalEchoRepository
@Inject lateinit var temporaryFileCreator: TemporaryFileCreator @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 * If appropriate, it will create and upload a thumbnail
*/ */
private suspend fun dealWithThumbnail(params: Params): UploadThumbnailResult? { private suspend fun dealWithThumbnail(params: Params): UploadThumbnailResult? {
return ThumbnailExtractor.extractThumbnail(context, params.attachment) return thumbnailExtractor.extractThumbnail(params.attachment)
?.let { thumbnailData -> ?.let { thumbnailData ->
val thumbnailProgressListener = object : ProgressRequestBody.Listener { val thumbnailProgressListener = object : ProgressRequestBody.Listener {
override fun onProgress(current: Long, total: Long) { override fun onProgress(current: Long, total: Long) {

View File

@ -73,6 +73,7 @@ internal class LocalEchoEventFactory @Inject constructor(
@UserId private val userId: String, @UserId private val userId: String,
private val markdownParser: MarkdownParser, private val markdownParser: MarkdownParser,
private val textPillsUtils: TextPillsUtils, private val textPillsUtils: TextPillsUtils,
private val thumbnailExtractor: ThumbnailExtractor,
private val localEchoRepository: LocalEchoRepository, private val localEchoRepository: LocalEchoRepository,
private val permalinkFactory: PermalinkFactory private val permalinkFactory: PermalinkFactory
) { ) {
@ -261,7 +262,7 @@ internal class LocalEchoEventFactory @Inject constructor(
val width = firstFrame?.width ?: 0 val width = firstFrame?.width ?: 0
mediaDataRetriever.release() mediaDataRetriever.release()
val thumbnailInfo = ThumbnailExtractor.extractThumbnail(context, attachment)?.let { val thumbnailInfo = thumbnailExtractor.extractThumbnail(attachment)?.let {
ThumbnailInfo( ThumbnailInfo(
width = it.width, width = it.width,
height = it.height, height = it.height,

View File

@ -0,0 +1 @@
Inconsistent usage of the term homeserver in Settings

View File

@ -537,7 +537,7 @@
<string name="create_account">Create Account</string> <string name="create_account">Create Account</string>
<string name="login">Log in</string> <string name="login">Log in</string>
<string name="logout">Sign out</string> <string name="logout">Sign out</string>
<string name="hs_url">Home Server URL</string> <string name="hs_url">Homeserver URL</string>
<string name="identity_url">Identity Server URL</string> <string name="identity_url">Identity Server URL</string>
<string name="search">Search</string> <string name="search">Search</string>
@ -625,9 +625,9 @@
<string name="auth_use_server_options">Use custom server options (advanced)</string> <string name="auth_use_server_options">Use custom server options (advanced)</string>
<string name="auth_email_validation_message">Please check your email to continue registration</string> <string name="auth_email_validation_message">Please check your email to continue registration</string>
<string name="auth_threepid_warning_message">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.</string> <string name="auth_threepid_warning_message">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.</string>
<string name="auth_recaptcha_message">This Home Server would like to make sure you are not a robot</string> <string name="auth_recaptcha_message">This homeserver would like to make sure you are not a robot</string>
<string name="auth_username_in_use">Username in use</string> <string name="auth_username_in_use">Username in use</string>
<string name="auth_home_server">Home Server:</string> <string name="auth_home_server">Homeserver:</string>
<string name="auth_identity_server">Identity Server:</string> <string name="auth_identity_server">Identity Server:</string>
<string name="auth_reset_password_next_step_button">I have verified my email address</string> <string name="auth_reset_password_next_step_button">I have verified my email address</string>
<string name="auth_reset_password_message">To reset your password, enter the email address linked to your account:</string> <string name="auth_reset_password_message">To reset your password, enter the email address linked to your account:</string>
@ -1314,7 +1314,7 @@
<string name="devices_delete_submit_button_label">Submit</string> <string name="devices_delete_submit_button_label">Submit</string>
<string name="settings_logged_in">Logged in as</string> <string name="settings_logged_in">Logged in as</string>
<string name="settings_home_server">Home Server</string> <string name="settings_home_server">Homeserver</string>
<string name="settings_identity_server">Identity Server</string> <string name="settings_identity_server">Identity Server</string>
<string name="settings_integration_allow">Allow integrations</string> <string name="settings_integration_allow">Allow integrations</string>
<string name="settings_integration_manager">Integration Manager</string> <string name="settings_integration_manager">Integration Manager</string>