From 3fcfe7000f52387ca613e06327988606594e9722 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 9 Sep 2021 09:59:06 +0200 Subject: [PATCH] Update user agent: `MatrixAndroidSDK_X` is replaced by `MatrixAndroidSdk2` --- changelog.d/3994.misc | 1 + .../matrix/android/sdk/internal/network/UserAgentHolder.kt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog.d/3994.misc diff --git a/changelog.d/3994.misc b/changelog.d/3994.misc new file mode 100644 index 0000000000..63fbe55387 --- /dev/null +++ b/changelog.d/3994.misc @@ -0,0 +1 @@ +Better support for Sdk2 version. Also slight change in the default user agent: `MatrixAndroidSDK_X` is replaced by `MatrixAndroidSdk2` \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt index c0fb1d02f0..57eab6a8dd 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt @@ -36,7 +36,7 @@ internal class UserAgentHolder @Inject constructor(private val context: Context, /** * Create an user agent with the application version. - * Ex: Element/1.0.0 (Linux; U; Android 6.0.1; SM-A510F Build/MMB29; Flavour GPlay; MatrixAndroidSDK_X 1.0) + * Ex: Element/1.0.0 (Linux; U; Android 6.0.1; SM-A510F Build/MMB29; Flavour GPlay; MatrixAndroidSdk2 1.0) * * @param flavorDescription the flavor description */ @@ -74,13 +74,13 @@ internal class UserAgentHolder @Inject constructor(private val context: Context, // if there is no user agent or cannot parse it if (null == systemUserAgent || systemUserAgent.lastIndexOf(")") == -1 || !systemUserAgent.contains("(")) { userAgent = (appName + "/" + appVersion + " ( Flavour " + flavorDescription - + "; MatrixAndroidSDK_X " + BuildConfig.SDK_VERSION + ")") + + "; MatrixAndroidSdk2 " + BuildConfig.SDK_VERSION + ")") } else { // update userAgent = appName + "/" + appVersion + " " + systemUserAgent.substring(systemUserAgent.indexOf("("), systemUserAgent.lastIndexOf(")") - 1) + "; Flavour " + flavorDescription + - "; MatrixAndroidSDK_X " + BuildConfig.SDK_VERSION + ")" + "; MatrixAndroidSdk2 " + BuildConfig.SDK_VERSION + ")" } } }