Small refactoring.

This commit is contained in:
Onuray Sahin 2022-09-22 15:28:26 +03:00
parent 8b3eaf10e1
commit ea78f504d7
1 changed files with 5 additions and 5 deletions

View File

@ -56,6 +56,11 @@ internal class UserAgentHolder @Inject constructor(
appPackageName
}
val appVersion = tryOrNull { pm.getPackageInfo(context.applicationContext.packageName, 0).versionName }
if (appName.isNullOrEmpty() || appVersion.isNullOrEmpty()) {
userAgent = tryOrNull { System.getProperty("http.agent") } ?: ("Java" + System.getProperty("java.version"))
return
}
val deviceManufacturer = Build.MANUFACTURER
val deviceModel = Build.MODEL
@ -63,11 +68,6 @@ internal class UserAgentHolder @Inject constructor(
val deviceBuildId = Build.DISPLAY
val matrixSdkVersion = BuildConfig.SDK_VERSION
if (appName.isNullOrEmpty() || appVersion.isNullOrEmpty()) {
userAgent = tryOrNull { System.getProperty("http.agent") } ?: ("Java" + System.getProperty("java.version"))
return
}
userAgent = buildString {
append(appName)
append("/")