Small cleanup

This commit is contained in:
Benoit Marty 2021-04-09 16:58:41 +02:00
parent bec6cfc46d
commit 37226a1641
6 changed files with 9 additions and 11 deletions

View File

@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest package="org.matrix.android.sdk.rx" />
package="org.matrix.android.sdk.rx" />

View File

@ -44,7 +44,7 @@ data class CryptoDeviceInfo(
*/ */
fun fingerprint(): String? { fun fingerprint(): String? {
return keys return keys
?.takeIf { !deviceId.isBlank() } ?.takeIf { deviceId.isNotBlank() }
?.get("ed25519:$deviceId") ?.get("ed25519:$deviceId")
} }
@ -53,7 +53,7 @@ data class CryptoDeviceInfo(
*/ */
fun identityKey(): String? { fun identityKey(): String? {
return keys return keys
?.takeIf { !deviceId.isBlank() } ?.takeIf { deviceId.isNotBlank() }
?.get("curve25519:$deviceId") ?.get("curve25519:$deviceId")
} }

View File

@ -103,7 +103,7 @@ data class MXDeviceInfo(
*/ */
fun fingerprint(): String? { fun fingerprint(): String? {
return keys return keys
?.takeIf { !deviceId.isBlank() } ?.takeIf { deviceId.isNotBlank() }
?.get("ed25519:$deviceId") ?.get("ed25519:$deviceId")
} }
@ -112,7 +112,7 @@ data class MXDeviceInfo(
*/ */
fun identityKey(): String? { fun identityKey(): String? {
return keys return keys
?.takeIf { !deviceId.isBlank() } ?.takeIf { deviceId.isNotBlank() }
?.get("curve25519:$deviceId") ?.get("curve25519:$deviceId")
} }

View File

@ -23,7 +23,7 @@ import javax.inject.Inject
class AppNameProvider @Inject constructor(private val context: Context) { class AppNameProvider @Inject constructor(private val context: Context) {
fun getAppName(): String { fun getAppName(): String {
try { return try {
val appPackageName = context.applicationContext.packageName val appPackageName = context.applicationContext.packageName
val pm = context.packageManager val pm = context.packageManager
val appInfo = pm.getApplicationInfo(appPackageName, 0) val appInfo = pm.getApplicationInfo(appPackageName, 0)
@ -33,10 +33,10 @@ class AppNameProvider @Inject constructor(private val context: Context) {
if (!appName.matches("\\A\\p{ASCII}*\\z".toRegex())) { if (!appName.matches("\\A\\p{ASCII}*\\z".toRegex())) {
appName = appPackageName appName = appPackageName
} }
return appName appName
} catch (e: Exception) { } catch (e: Exception) {
Timber.e(e, "## AppNameProvider() : failed") Timber.e(e, "## AppNameProvider() : failed")
return "ElementAndroid" "ElementAndroid"
} }
} }
} }

View File

@ -146,7 +146,7 @@ class DialPadFragment : Fragment() {
} }
private fun poll() { private fun poll() {
if (!input.isEmpty()) { if (input.isNotEmpty()) {
input = input.substring(0, input.length - 1) input = input.substring(0, input.length - 1)
formatter = PhoneNumberUtil.getInstance().getAsYouTypeFormatter(regionCode) formatter = PhoneNumberUtil.getInstance().getAsYouTypeFormatter(regionCode)
if (formatAsYouType) { if (formatAsYouType) {

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_root" android:id="@+id/layout_root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"