mirror of
https://github.com/bitwarden/android.git
synced 2024-11-21 17:05:44 +03:00
Update detekt and fix minor warnings (#955)
This commit is contained in:
parent
28f805418d
commit
61212c3628
5 changed files with 6 additions and 60 deletions
|
@ -18,5 +18,6 @@ inline fun <reified T> Intent.getSafeParcelableExtra(name: String): T? =
|
|||
T::class.java,
|
||||
)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
getParcelableExtra(name)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ private const val IP_REGEX: String =
|
|||
* Parses the base domain from the URL. Returns null if unavailable.
|
||||
*/
|
||||
fun URI.parseDomainOrNull(context: Context): String? {
|
||||
val host = this?.host ?: return null
|
||||
val host = this.host ?: return null
|
||||
val isIpAddress = host.matches(IP_REGEX.toRegex())
|
||||
|
||||
return if (host == "localhost" || isIpAddress) {
|
||||
|
@ -38,7 +38,7 @@ fun URI.parseDomainOrNull(context: Context): String? {
|
|||
fun URI.parseDomainNameOrNull(context: Context): DomainName? =
|
||||
this
|
||||
// URI is a platform type and host can be null.
|
||||
?.host
|
||||
.host
|
||||
?.let { nonNullHost ->
|
||||
parseDomainNameOrNullInternal(
|
||||
context = context,
|
||||
|
|
|
@ -3335,9 +3335,6 @@ class VaultRepositoryTest {
|
|||
fakeAuthDiskSource.userState = MOCK_USER_STATE
|
||||
|
||||
val attachmentId = "mockId-1"
|
||||
val attachment = mockk<Attachment> {
|
||||
every { id } returns attachmentId
|
||||
}
|
||||
val cipher = mockk<Cipher> {
|
||||
every { attachments } returns emptyList()
|
||||
every { id } returns "mockId-1"
|
||||
|
@ -5366,58 +5363,6 @@ class VaultRepositoryTest {
|
|||
coEvery { vaultDiskSource.getSends(MOCK_USER_STATE.activeUserId) } returns sendsFlow
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to ensures that the vault for the user with the given [userId] is unlocked.
|
||||
*/
|
||||
private suspend fun verifyUnlockedVault(userId: String) {
|
||||
val kdf = MOCK_PROFILE.toSdkParams()
|
||||
val email = MOCK_PROFILE.email
|
||||
val masterPassword = "drowssap"
|
||||
val userKey = "12345"
|
||||
val privateKey = "54321"
|
||||
val organizationKeys = null
|
||||
coEvery {
|
||||
vaultSdkSource.initializeCrypto(
|
||||
userId = userId,
|
||||
request = InitUserCryptoRequest(
|
||||
kdfParams = kdf,
|
||||
email = email,
|
||||
privateKey = privateKey,
|
||||
method = InitUserCryptoMethod.Password(
|
||||
password = masterPassword,
|
||||
userKey = userKey,
|
||||
),
|
||||
),
|
||||
)
|
||||
} returns InitializeCryptoResult.Success.asSuccess()
|
||||
|
||||
val result = vaultRepository.unlockVault(
|
||||
userId = userId,
|
||||
masterPassword = masterPassword,
|
||||
kdf = kdf,
|
||||
email = email,
|
||||
userKey = userKey,
|
||||
privateKey = privateKey,
|
||||
organizationKeys = organizationKeys,
|
||||
)
|
||||
|
||||
assertEquals(VaultUnlockResult.Success, result)
|
||||
coVerify(exactly = 1) {
|
||||
vaultSdkSource.initializeCrypto(
|
||||
userId = userId,
|
||||
request = InitUserCryptoRequest(
|
||||
kdfParams = kdf,
|
||||
email = email,
|
||||
privateKey = privateKey,
|
||||
method = InitUserCryptoMethod.Password(
|
||||
password = masterPassword,
|
||||
userKey = userKey,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun setupDataStateFlow(userId: String) {
|
||||
coEvery {
|
||||
vaultSdkSource.decryptCipherList(
|
||||
|
|
|
@ -417,7 +417,7 @@ naming:
|
|||
packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*'
|
||||
TopLevelPropertyNaming:
|
||||
active: true
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/compose/**']
|
||||
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/compose/**' ]
|
||||
constantPattern: '[A-Z][_A-Z0-9]*'
|
||||
propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
|
||||
privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
|
||||
|
@ -584,7 +584,7 @@ style:
|
|||
active: true
|
||||
OptionalUnit:
|
||||
active: false
|
||||
OptionalWhenBraces:
|
||||
BracesOnWhenStatements:
|
||||
active: false
|
||||
PreferToOverPairSyntax:
|
||||
active: false
|
||||
|
|
|
@ -29,7 +29,7 @@ androdixAutofill = "1.1.0"
|
|||
androidxWork = "2.9.0"
|
||||
bitwardenSdk = "0.4.0-20240205.155354-106"
|
||||
crashlytics = "2.9.9"
|
||||
detekt = "1.23.1"
|
||||
detekt = "1.23.5"
|
||||
firebaseBom = "32.7.0"
|
||||
glide = "1.0.0-beta01"
|
||||
googleServices = "4.4.0"
|
||||
|
|
Loading…
Reference in a new issue