Skip to content

Commit

Permalink
Merge branch 'release/2.17.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Feb 28, 2025
2 parents 3892fc5 + 615cfed commit f35259a
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 27 deletions.
11 changes: 11 additions & 0 deletions TCHAP_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Changes in Tchap 2.17.2 (2025-02-28)
====================================

Bugfixes 🐛
----------
- Correction du crash sur android 6 et 7 à l'ouverture d'un salon. ([#1155](https://github.com/tchapgouv/tchap-android/issues/1155))

SDK API changes ⚠️
------------------
- Support des API de medias authentifiés avec l'anti-virus. ([#1152](https://github.com/tchapgouv/tchap-android/issues/1152))

Changes in Tchap 2.17.1 (2025-02-20)
====================================

Expand Down
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ ext.libs = [
],
element : [
'opusencoder' : "io.element.android:opusencoder:1.1.0",
'wysiwyg' : "io.element.android:wysiwyg:2.38.2"
'wysiwyg' : "io.element.android:wysiwyg:2.37.6"
],
squareup : [
'moshi' : "com.squareup.moshi:moshi:$moshi",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import org.matrix.android.sdk.internal.di.UnauthenticatedWithCertificateWithProg
import org.matrix.android.sdk.internal.network.httpclient.addAuthenticationHeader
import org.matrix.android.sdk.internal.network.token.AccessTokenProvider
import org.matrix.android.sdk.internal.session.download.DownloadProgressInterceptor.Companion.DOWNLOAD_PROGRESS_INTERCEPTOR_HEADER
import org.matrix.android.sdk.internal.session.media.IsAuthenticatedMediaSupported
import org.matrix.android.sdk.internal.util.file.AtomicFileCreator
import org.matrix.android.sdk.internal.util.file.safeFileName
import org.matrix.android.sdk.internal.util.time.Clock
Expand All @@ -55,6 +56,7 @@ internal class DefaultFileService @Inject constructor(
private val contentUrlResolver: ContentUrlResolver,
@UnauthenticatedWithCertificateWithProgress
private val okHttpClient: OkHttpClient,
private val isAuthenticatedMediaSupported: IsAuthenticatedMediaSupported,
private val coroutineDispatchers: MatrixCoroutineDispatchers,
private val clock: Clock,
@Authenticated private val accessTokenProvider: AccessTokenProvider,
Expand Down Expand Up @@ -144,11 +146,15 @@ internal class DefaultFileService @Inject constructor(
}

is ContentUrlResolver.ResolvedMethod.POST -> {
Request.Builder()
val requestBuilder = Request.Builder()
.url(resolvedMethod.url)
.header(DOWNLOAD_PROGRESS_INTERCEPTOR_HEADER, url)
.post(resolvedMethod.jsonBody.toRequestBody("application/json".toMediaType()))
.build()

if (contentUrlResolver.requiresAuthentication(resolvedMethod.url)) {
val accessToken = accessTokenProvider.getToken()
requestBuilder.addAuthenticationHeader(accessToken)
}
requestBuilder.post(resolvedMethod.jsonBody.toRequestBody("application/json".toMediaType())).build()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ internal class DefaultContentUrlResolver @Inject constructor(

override fun resolveForDownload(contentUrl: String?, elementToDecrypt: ElementToDecrypt?): ContentUrlResolver.ResolvedMethod? {
return if (scannerService.isScannerEnabled() && elementToDecrypt != null) {
val baseUrl = scannerService.getContentScannerServer()
val sep = if (baseUrl?.endsWith("/") == true) "" else "/"

val url = baseUrl + sep + NetworkConstants.URI_API_PREFIX_PATH_MEDIA_PROXY_UNSTABLE + "download_encrypted"

val baseUrl = scannerService.getContentScannerServer()!!.ensureTrailingSlash()
ContentUrlResolver.ResolvedMethod.POST(
url = url,
url = "$baseUrl${NetworkConstants.URI_API_PREFIX_PATH_MEDIA_PROXY_UNSTABLE}download_encrypted",
jsonBody = ScanEncryptorUtils
.getDownloadBodyAndEncryptIfNeeded(scannerService.serverPublicKey, contentUrl ?: "", elementToDecrypt)
.toJson()
Expand Down Expand Up @@ -82,9 +78,8 @@ internal class DefaultContentUrlResolver @Inject constructor(
}
}

override fun requiresAuthentication(resolvedUrl: String): Boolean {
return resolvedUrl.startsWith(authenticatedMediaApiPath)
}
override fun requiresAuthentication(resolvedUrl: String) =
scannerService.isScannerEnabled() && isAuthenticatedMediaSupported() || resolvedUrl.startsWith(authenticatedMediaApiPath)

private fun resolve(
contentUrl: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ import org.matrix.android.sdk.api.session.contentscanner.ScanState
import org.matrix.android.sdk.api.session.contentscanner.ScanStatusInfo
import org.matrix.android.sdk.api.session.crypto.attachments.ElementToDecrypt
import org.matrix.android.sdk.api.util.Optional
import org.matrix.android.sdk.internal.di.Authenticated
import org.matrix.android.sdk.internal.di.Unauthenticated
import org.matrix.android.sdk.internal.network.RetrofitFactory
import org.matrix.android.sdk.internal.session.SessionScope
import org.matrix.android.sdk.internal.session.contentscanner.data.ContentScannerStore
import org.matrix.android.sdk.internal.session.contentscanner.tasks.GetServerPublicKeyTask
import org.matrix.android.sdk.internal.session.contentscanner.tasks.ScanEncryptedTask
import org.matrix.android.sdk.internal.session.contentscanner.tasks.ScanMediaTask
import org.matrix.android.sdk.internal.session.media.IsAuthenticatedMediaSupported
import org.matrix.android.sdk.internal.task.TaskExecutor
import org.matrix.android.sdk.internal.util.time.Clock
import timber.log.Timber
Expand All @@ -42,6 +44,9 @@ internal class DefaultContentScannerService @Inject constructor(
private val retrofitFactory: RetrofitFactory,
@Unauthenticated
private val okHttpClient: Lazy<OkHttpClient>,
@Authenticated
private val authenticatedOkHttpClient: Lazy<OkHttpClient>,
private val isAuthenticatedMediaSupported: IsAuthenticatedMediaSupported,
private val contentScannerApiProvider: ContentScannerApiProvider,
private val contentScannerStore: ContentScannerStore,
private val getServerPublicKeyTask: GetServerPublicKeyTask,
Expand Down Expand Up @@ -96,6 +101,7 @@ internal class DefaultContentScannerService @Inject constructor(
contentScannerApiProvider.contentScannerApi = null
serverPublicKey = null
} else {
val okHttpClient = if (isAuthenticatedMediaSupported()) authenticatedOkHttpClient else okHttpClient
val api = retrofitFactory
.create(okHttpClient, url)
.create(ContentScannerApi::class.java)
Expand Down
2 changes: 1 addition & 1 deletion towncrier.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.towncrier]
version = "2.17.1"
version = "2.17.2"
directory = "changelog.d"
filename = "TCHAP_CHANGES.md"
name = "Changes in Tchap"
Expand Down
2 changes: 1 addition & 1 deletion vector-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ext.versionMinor = 17
// Note: even values are reserved for regular release, odd values for hotfix release.
// When creating a hotfix, you should decrease the value, since the current value
// is the value for the next regular release.
ext.versionPatch = 1
ext.versionPatch = 2

static def getGitTimestamp() {
def cmd = 'git show -s --format=%ct'
Expand Down
4 changes: 2 additions & 2 deletions vector-config/src/tchap/res/values/config-features.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<bool name="tchap_is_cross_signing_enabled">true</bool>
<bool name="tchap_is_key_backup_enabled">true</bool>
<bool name="tchap_is_thread_enabled">false</bool>
<bool name="tchap_is_secure_backup_required">true</bool>
<bool name="tchap_is_sso_enabled">true</bool>
<bool name="tchap_is_secure_backup_required">false</bool>
<bool name="tchap_is_sso_enabled">false</bool>

<string-array name="tchap_is_visio_supported_homeservers" translatable="false" />
</resources>
10 changes: 0 additions & 10 deletions vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,6 @@ class AvatarRenderer @Inject constructor(
}
}

@AnyThread
fun getSpacePlaceholderDrawable(matrixItem: MatrixItem): Drawable {
val avatarColor = matrixItemColorProvider.getColor(matrixItem)
return TextDrawable.builder()
.beginConfig()
.bold()
.endConfig()
.buildRoundRect(matrixItem.firstLetterOfDisplayName(), avatarColor, dimensionConverter.dpToPx(8))
}

// PRIVATE API *********************************************************************************

private fun GlideRequests.loadResolvedUrl(avatarUrl: String?): GlideRequest<Drawable> {
Expand Down

0 comments on commit f35259a

Please sign in to comment.