From 23aedd5bcb28b43ffc4527a47ffdf5c8b741849d Mon Sep 17 00:00:00 2001 From: David Perez Date: Fri, 7 Jun 2024 12:21:11 -0500 Subject: [PATCH] Update to latest version of the SDK (#1430) --- .../datasource/sdk/model/CipherViewUtil.kt | 18 +++++++++---- .../addedit/util/CipherViewExtensionsTest.kt | 19 ++------------ .../feature/item/util/VaultItemTestUtil.kt | 26 +++---------------- gradle/libs.versions.toml | 2 +- 4 files changed, 20 insertions(+), 45 deletions(-) diff --git a/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/CipherViewUtil.kt b/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/CipherViewUtil.kt index 0fb49d360..fff5c50ec 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/CipherViewUtil.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/CipherViewUtil.kt @@ -102,13 +102,21 @@ fun createMockLoginView( fido2Credentials = createMockSdkFido2CredentialList(number, clock), ) -fun createMockSdkFido2CredentialList(number: Int, clock: Clock = FIXED_CLOCK) = - listOf(createMockSdkFido2CredentialView(number, clock)) - -fun createMockSdkFido2CredentialView( +/** + * Create a list of mock [Fido2Credential] with a given [number]. + */ +fun createMockSdkFido2CredentialList( number: Int, clock: Clock = FIXED_CLOCK, -) = Fido2Credential( +): List = listOf(createMockSdkFido2Credential(number, clock)) + +/** + * Create a mock [Fido2Credential] with a given [number]. + */ +fun createMockSdkFido2Credential( + number: Int, + clock: Clock = FIXED_CLOCK, +): Fido2Credential = Fido2Credential( credentialId = "mockCredentialId-$number", keyType = "mockKeyType-$number", keyAlgorithm = "mockKeyAlgorithm-$number", diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt index 2d84eeff5..5f026ab23 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt @@ -21,6 +21,7 @@ import com.x8bit.bitwarden.data.platform.repository.model.Environment import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockCipherView import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockCollectionView import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockFolderView +import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockSdkFido2CredentialList import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.manager.resource.ResourceManager import com.x8bit.bitwarden.ui.vault.feature.addedit.VaultAddEditState @@ -556,23 +557,7 @@ private val DEFAULT_LOGIN_CIPHER_VIEW: CipherView = DEFAULT_BASE_CIPHER_VIEW.cop ), totp = "otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example", autofillOnPageLoad = false, - fido2Credentials = listOf( - Fido2Credential( - credentialId = "mockCredentialId", - keyType = "mockKeyType", - keyAlgorithm = "mockKeyAlgorithm", - keyCurve = "mockKeyCurve", - keyValue = "mockKeyValue", - rpId = "mockRpId", - userHandle = "mockUserHandle", - userName = "mockUserName", - counter = "mockCounter", - rpName = "mockRpName", - userDisplayName = "mockUserDisplayName", - discoverable = "mockDiscoverable", - creationDate = FIXED_CLOCK.instant(), - ), - ), + fido2Credentials = createMockSdkFido2CredentialList(number = 1, clock = FIXED_CLOCK), ), ) diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt index c4a012813..115eb59d2 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt @@ -4,7 +4,6 @@ import com.bitwarden.core.AttachmentView import com.bitwarden.core.CipherRepromptType import com.bitwarden.core.CipherType import com.bitwarden.core.CipherView -import com.bitwarden.core.Fido2Credential import com.bitwarden.core.FieldType import com.bitwarden.core.FieldView import com.bitwarden.core.IdentityView @@ -12,6 +11,7 @@ import com.bitwarden.core.LoginUriView import com.bitwarden.core.LoginView import com.bitwarden.core.PasswordHistoryView import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockSdkFido2CredentialList import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.vault.feature.item.VaultItemState import com.x8bit.bitwarden.ui.vault.feature.item.model.TotpCodeItemData @@ -46,23 +46,7 @@ fun createLoginView(isEmpty: Boolean): LoginView = totp = "otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example" .takeUnless { isEmpty }, autofillOnPageLoad = false, - fido2Credentials = listOf( - Fido2Credential( - credentialId = "mockCredentialId", - keyType = "mockKeyType", - keyAlgorithm = "mockKeyAlgorithm", - keyCurve = "mockKeyCurve", - keyValue = "mockKeyValue", - rpId = "mockRpId", - userHandle = "mockUserHandle", - userName = "mockUserName", - counter = "mockCounter", - rpName = "mockRpName", - userDisplayName = "mockUserDisplayName", - discoverable = "mockDiscoverable", - creationDate = Instant.ofEpochSecond(1_000L), - ), - ).takeUnless { isEmpty }, + fido2Credentials = createMockSdkFido2CredentialList(number = 1).takeUnless { isEmpty }, ) @Suppress("CyclomaticComplexMethod") @@ -253,10 +237,8 @@ fun createLoginContent(isEmpty: Boolean): VaultItemState.ViewState.Content.ItemT totpCode = "testCode", ) .takeUnless { isEmpty }, - fido2CredentialCreationDateText = R.string.created_xy.asText( - "1/1/70", - "12:16 AM", - ) + fido2CredentialCreationDateText = R.string.created_xy + .asText("10/27/23", "12:00 PM") .takeUnless { isEmpty }, ) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 14f919b74..fdb424dd8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,7 @@ androidxSplash = "1.1.0-rc01" androidXAppCompat = "1.7.0" androdixAutofill = "1.1.0" androidxWork = "2.9.0" -bitwardenSdk = "0.5.0-20240531.135208-67" +bitwardenSdk = "0.5.0-20240607.161329-78" crashlytics = "3.0.1" detekt = "1.23.6" firebaseBom = "33.1.0"