mirror of
https://github.com/bitwarden/android.git
synced 2026-03-11 20:54:58 -05:00
Address several small lint warning throughout the app (#6233)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.bitwarden.authenticator.data.authenticator.repository.util
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.core.net.toUri
|
||||
import com.bitwarden.authenticator.data.authenticator.manager.TotpCodeManager
|
||||
import com.bitwarden.authenticator.data.authenticator.repository.model.AuthenticatorItem
|
||||
import com.bitwarden.authenticatorbridge.model.SharedAccountData
|
||||
@@ -12,7 +12,7 @@ fun List<SharedAccountData.Account>.toAuthenticatorItems(): List<AuthenticatorIt
|
||||
flatMap { sharedAccount ->
|
||||
sharedAccount.totpUris.mapNotNull { totpUriString ->
|
||||
runCatching {
|
||||
val uri = Uri.parse(totpUriString)
|
||||
val uri = totpUriString.toUri()
|
||||
val issuer = uri.getQueryParameter(TotpCodeManager.ISSUER_PARAM)
|
||||
val label = uri.pathSegments
|
||||
.firstOrNull()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.bitwarden.authenticator.data.platform.manager.imports.parsers
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.core.net.toUri
|
||||
import com.bitwarden.authenticator.data.authenticator.datasource.disk.entity.AuthenticatorItemAlgorithm
|
||||
import com.bitwarden.authenticator.data.authenticator.datasource.disk.entity.AuthenticatorItemEntity
|
||||
import com.bitwarden.authenticator.data.authenticator.datasource.disk.entity.AuthenticatorItemType
|
||||
@@ -53,22 +53,16 @@ class BitwardenExportParser(
|
||||
it.toAuthenticatorItemEntity()
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength", "CyclomaticComplexMethod", "LongMethod")
|
||||
@Suppress("CyclomaticComplexMethod", "LongMethod")
|
||||
private fun ExportJsonData.ExportItem.toAuthenticatorItemEntity(): AuthenticatorItemEntity {
|
||||
val otpString = requireNotNull(login?.totp)
|
||||
|
||||
val otpUri = when {
|
||||
otpString.startsWith(TotpCodeManager.TOTP_CODE_PREFIX) -> {
|
||||
Uri.parse(otpString)
|
||||
}
|
||||
|
||||
otpString.startsWith(TotpCodeManager.STEAM_CODE_PREFIX) -> {
|
||||
Uri.parse(otpString)
|
||||
}
|
||||
|
||||
otpString.startsWith(TotpCodeManager.TOTP_CODE_PREFIX) -> otpString.toUri()
|
||||
otpString.startsWith(TotpCodeManager.STEAM_CODE_PREFIX) -> otpString.toUri()
|
||||
else -> {
|
||||
val uriString = "${TotpCodeManager.TOTP_CODE_PREFIX}/$name?${TotpCodeManager.SECRET_PARAM}=$otpString"
|
||||
Uri.parse(uriString)
|
||||
val prefix = TotpCodeManager.TOTP_CODE_PREFIX
|
||||
"$prefix/$name?${TotpCodeManager.SECRET_PARAM}=$otpString".toUri()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -235,11 +235,11 @@ private fun ManualCodeEntryDialogs(
|
||||
dialog: ManualCodeEntryState.DialogState?,
|
||||
onDismissRequest: () -> Unit,
|
||||
) {
|
||||
when (val dialogString = dialog) {
|
||||
when (dialog) {
|
||||
is ManualCodeEntryState.DialogState.Error -> {
|
||||
BitwardenBasicDialog(
|
||||
title = dialogString.title?.invoke(),
|
||||
message = dialogString.message(),
|
||||
title = dialog.title?.invoke(),
|
||||
message = dialog.message(),
|
||||
onDismissRequest = onDismissRequest,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class BiometricsManagerImpl(
|
||||
BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED,
|
||||
BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE,
|
||||
BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED,
|
||||
-> false
|
||||
-> false
|
||||
|
||||
else -> false
|
||||
}
|
||||
@@ -71,13 +71,13 @@ class BiometricsManagerImpl(
|
||||
BiometricPrompt.ERROR_NO_BIOMETRICS,
|
||||
BiometricPrompt.ERROR_HW_NOT_PRESENT,
|
||||
BiometricPrompt.ERROR_NO_DEVICE_CREDENTIAL,
|
||||
-> onError()
|
||||
-> onError()
|
||||
|
||||
BiometricPrompt.ERROR_NEGATIVE_BUTTON -> onCancel()
|
||||
|
||||
BiometricPrompt.ERROR_LOCKOUT,
|
||||
BiometricPrompt.ERROR_LOCKOUT_PERMANENT,
|
||||
-> onLockOut()
|
||||
-> onLockOut()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user