Small refactoring.
This commit is contained in:
parent
8b3eaf10e1
commit
ea78f504d7
@ -56,6 +56,11 @@ 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()) {
|
||||||
|
userAgent = tryOrNull { System.getProperty("http.agent") } ?: ("Java" + System.getProperty("java.version"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val deviceManufacturer = Build.MANUFACTURER
|
val deviceManufacturer = Build.MANUFACTURER
|
||||||
val deviceModel = Build.MODEL
|
val deviceModel = Build.MODEL
|
||||||
@ -63,11 +68,6 @@ internal class UserAgentHolder @Inject constructor(
|
|||||||
val deviceBuildId = Build.DISPLAY
|
val deviceBuildId = Build.DISPLAY
|
||||||
val matrixSdkVersion = BuildConfig.SDK_VERSION
|
val matrixSdkVersion = BuildConfig.SDK_VERSION
|
||||||
|
|
||||||
if (appName.isNullOrEmpty() || appVersion.isNullOrEmpty()) {
|
|
||||||
userAgent = tryOrNull { System.getProperty("http.agent") } ?: ("Java" + System.getProperty("java.version"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
userAgent = buildString {
|
userAgent = buildString {
|
||||||
append(appName)
|
append(appName)
|
||||||
append("/")
|
append("/")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user