Small refactoring.
This commit is contained in:
parent
8b3eaf10e1
commit
ea78f504d7
|
@ -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("/")
|
||||
|
|
Loading…
Reference in New Issue