Update format to be consistent with Element iOS.

This commit is contained in:
Onuray Sahin 2022-09-22 15:53:29 +03:00
parent ea78f504d7
commit c37a6842fe

View File

@ -39,7 +39,7 @@ internal class UserAgentHolder @Inject constructor(
/** /**
* Create an user agent with the application version. * Create an user agent with the application version.
* Ex: Element/1.5.0 (Xiaomi; Mi 9T; Android 11; RKQ1.200826.002; Flavour GooglePlay; MatrixAndroidSdk2 1.5.0) * Ex: Element/1.5.0 (Xiaomi Mi 9T; Android 11; RKQ1.200826.002; Flavour GooglePlay; MatrixAndroidSdk2 1.5.0)
* *
* @param flavorDescription the flavor description * @param flavorDescription the flavor description
*/ */
@ -56,7 +56,7 @@ internal class UserAgentHolder @Inject constructor(
appPackageName appPackageName
} }
val appVersion = tryOrNull { pm.getPackageInfo(context.applicationContext.packageName, 0).versionName } val appVersion = tryOrNull { pm.getPackageInfo(context.applicationContext.packageName, 0).versionName }
if (appName.isNullOrEmpty() || appVersion.isNullOrEmpty()) { if (appName.isNullOrEmpty() || appVersion.isNullOrEmpty()) {
userAgent = tryOrNull { System.getProperty("http.agent") } ?: ("Java" + System.getProperty("java.version")) userAgent = tryOrNull { System.getProperty("http.agent") } ?: ("Java" + System.getProperty("java.version"))
return return
@ -74,7 +74,7 @@ internal class UserAgentHolder @Inject constructor(
append(appVersion) append(appVersion)
append(" (") append(" (")
append(deviceManufacturer) append(deviceManufacturer)
append("; ") append(" ")
append(deviceModel) append(deviceModel)
append("; ") append("; ")
append("Android ") append("Android ")