Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Add email field in login cipher
Browse files Browse the repository at this point in the history
  • Loading branch information
M3DZIK committed Apr 9, 2024
1 parent 8104646 commit a787758
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Notes
import androidx.compose.material.icons.filled.CreditCard
import androidx.compose.material.icons.filled.MoreHoriz
import androidx.compose.material.icons.filled.Notes
import androidx.compose.material.icons.filled.Person
import androidx.compose.material3.Card
import androidx.compose.material3.Icon
Expand Down Expand Up @@ -101,7 +100,12 @@ fun CipherCard(
when (cipher.type) {
CipherType.Login -> {
title = cipher.loginData!!.name
subtitle = cipher.loginData!!.username

if (!cipher.loginData!!.email.isNullOrEmpty()) {
subtitle = cipher.loginData!!.email
} else if (!cipher.loginData!!.username.isNullOrEmpty()) {
subtitle = cipher.loginData!!.username
}
}
CipherType.SecureNote -> {
title = cipher.secureNoteData!!.title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ fun CipherEditFieldsLogin(
modifier = Modifier.padding(top = 8.dp)
)

TextInputFieldBase(
label = stringResource(R.string.Email),
modifier =
Modifier
.fillMaxWidth()
.padding(vertical = 4.dp),
value = cipherData.email,
onValueChange = { cipherData = cipherData.copy(email = it) }
)

TextInputFieldBase(
label = stringResource(R.string.Username),
modifier =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,21 @@ fun CipherViewScreen(
value = cipherData.name
)

if (!cipherData.username.isNullOrEmpty() || !cipherData.password.isNullOrEmpty()) {
if (!cipherData.email.isNullOrEmpty() ||
!cipherData.username.isNullOrEmpty() ||
!cipherData.password.isNullOrEmpty()
) {
SecondaryText(
stringResource(R.string.LoginDetails),
modifier = Modifier.padding(top = 8.dp)
)

CipherField(
title = stringResource(R.string.Email),
value = cipherData.email,
copy = true
)

CipherField(
title = stringResource(R.string.Username),
value = cipherData.username,
Expand Down

0 comments on commit a787758

Please sign in to comment.