Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit c0b0469

Browse files
authored
Release prep and refinement (#64)
1 parent dd4a0a5 commit c0b0469

File tree

12 files changed

+165
-116
lines changed

12 files changed

+165
-116
lines changed

app/src/main/kotlin/com/bitwarden/authenticator/ui/auth/unlock/UnlockScreen.kt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@ import androidx.compose.foundation.layout.fillMaxSize
1010
import androidx.compose.foundation.layout.fillMaxWidth
1111
import androidx.compose.foundation.layout.height
1212
import androidx.compose.foundation.layout.padding
13+
import androidx.compose.foundation.layout.width
1314
import androidx.compose.material3.ExperimentalMaterial3Api
15+
import androidx.compose.material3.MaterialTheme
1416
import androidx.compose.runtime.Composable
1517
import androidx.compose.runtime.getValue
1618
import androidx.compose.runtime.mutableStateOf
1719
import androidx.compose.runtime.remember
1820
import androidx.compose.runtime.setValue
1921
import androidx.compose.ui.Alignment
2022
import androidx.compose.ui.Modifier
23+
import androidx.compose.ui.graphics.ColorFilter
2124
import androidx.compose.ui.platform.LocalContext
2225
import androidx.compose.ui.res.painterResource
2326
import androidx.compose.ui.res.stringResource
@@ -27,7 +30,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
2730
import com.bitwarden.authenticator.R
2831
import com.bitwarden.authenticator.ui.platform.base.util.EventsEffect
2932
import com.bitwarden.authenticator.ui.platform.base.util.asText
30-
import com.bitwarden.authenticator.ui.platform.components.button.BitwardenOutlinedButton
33+
import com.bitwarden.authenticator.ui.platform.components.button.BitwardenFilledTonalButton
3134
import com.bitwarden.authenticator.ui.platform.components.dialog.BasicDialogState
3235
import com.bitwarden.authenticator.ui.platform.components.dialog.BitwardenBasicDialog
3336
import com.bitwarden.authenticator.ui.platform.components.dialog.BitwardenLoadingDialog
@@ -107,7 +110,7 @@ fun UnlockScreen(
107110

108111
BitwardenScaffold(
109112
modifier = Modifier
110-
.fillMaxSize()
113+
.fillMaxSize(),
111114
) { innerPadding ->
112115
Box {
113116
Column(
@@ -118,11 +121,17 @@ fun UnlockScreen(
118121
horizontalAlignment = Alignment.CenterHorizontally
119122
) {
120123
Image(
124+
modifier = Modifier
125+
.padding(horizontal = 16.dp)
126+
.width(220.dp)
127+
.height(74.dp)
128+
.fillMaxWidth(),
129+
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.primary),
121130
painter = painterResource(id = R.drawable.ic_logo_horizontal),
122-
contentDescription = stringResource(R.string.bitwarden_authenticator)
131+
contentDescription = stringResource(R.string.bitwarden_authenticator),
123132
)
124-
Spacer(modifier = Modifier.height(12.dp))
125-
BitwardenOutlinedButton(
133+
Spacer(modifier = Modifier.height(32.dp))
134+
BitwardenFilledTonalButton(
126135
label = stringResource(id = R.string.use_biometrics_to_unlock),
127136
onClick = {
128137
biometricsManager.promptBiometrics(

app/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/edititem/EditItemScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ fun EditItemContent(
249249
modifier = Modifier
250250
.fillMaxSize()
251251
.padding(horizontal = 16.dp),
252-
label = stringResource(id = R.string.secret_key),
252+
label = stringResource(id = R.string.key),
253253
value = viewState.itemData.totpCode,
254254
onValueChange = onTotpCodeTextChange,
255255
singleLine = true,

app/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingScreen.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ private fun ItemListingContent(
320320
onScanQrCodeClick = onScanQrCodeClick,
321321
),
322322
ItemListingExpandableFabAction.EnterSetupKey(
323-
label = R.string.enter_a_setup_key.asText(),
323+
label = R.string.enter_key_manually.asText(),
324324
icon = IconResource(
325325
iconPainter = painterResource(id = R.drawable.ic_keyboard_24px),
326-
contentDescription = stringResource(id = R.string.enter_a_setup_key),
326+
contentDescription = stringResource(id = R.string.enter_key_manually),
327327
testTag = "EnterSetupKeyButton",
328328
),
329329
onEnterSetupKeyClick = onEnterSetupKeyClick
@@ -413,10 +413,10 @@ fun EmptyItemListingContent(
413413
onScanQrCodeClick = onScanQuCodeClick
414414
),
415415
ItemListingExpandableFabAction.EnterSetupKey(
416-
label = R.string.enter_a_setup_key.asText(),
416+
label = R.string.enter_key_manually.asText(),
417417
icon = IconResource(
418418
iconPainter = painterResource(id = R.drawable.ic_keyboard_24px),
419-
contentDescription = stringResource(id = R.string.enter_a_setup_key),
419+
contentDescription = stringResource(id = R.string.enter_key_manually),
420420
testTag = "EnterSetupKeyButton",
421421
),
422422
onEnterSetupKeyClick = onEnterSetupKeyClick,

app/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/manualcodeentry/ManualCodeEntryScreen.kt

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ import com.bitwarden.authenticator.ui.platform.base.util.EventsEffect
3535
import com.bitwarden.authenticator.ui.platform.base.util.toAnnotatedString
3636
import com.bitwarden.authenticator.ui.platform.components.appbar.BitwardenTopAppBar
3737
import com.bitwarden.authenticator.ui.platform.components.button.BitwardenFilledTonalButton
38+
import com.bitwarden.authenticator.ui.platform.components.dialog.BasicDialogState
39+
import com.bitwarden.authenticator.ui.platform.components.dialog.BitwardenBasicDialog
40+
import com.bitwarden.authenticator.ui.platform.components.dialog.BitwardenLoadingDialog
3841
import com.bitwarden.authenticator.ui.platform.components.dialog.BitwardenTwoButtonDialog
42+
import com.bitwarden.authenticator.ui.platform.components.dialog.LoadingDialogState
3943
import com.bitwarden.authenticator.ui.platform.components.field.BitwardenTextField
4044
import com.bitwarden.authenticator.ui.platform.components.scaffold.BitwardenScaffold
4145
import com.bitwarden.authenticator.ui.platform.manager.intent.IntentManager
@@ -108,11 +112,38 @@ fun ManualCodeEntryScreen(
108112
)
109113
}
110114

115+
when (val dialog = state.dialog) {
116+
117+
is ManualCodeEntryState.DialogState.Error -> {
118+
BitwardenBasicDialog(
119+
visibilityState = BasicDialogState.Shown(
120+
title = dialog.title,
121+
message = dialog.message
122+
),
123+
onDismissRequest = remember(state) {
124+
{ viewModel.trySendAction(ManualCodeEntryAction.DismissDialog) }
125+
}
126+
)
127+
}
128+
129+
is ManualCodeEntryState.DialogState.Loading -> {
130+
BitwardenLoadingDialog(
131+
visibilityState = LoadingDialogState.Shown(
132+
dialog.message
133+
)
134+
)
135+
}
136+
137+
null -> {
138+
Unit
139+
}
140+
}
141+
111142
BitwardenScaffold(
112143
modifier = Modifier.fillMaxSize(),
113144
topBar = {
114145
BitwardenTopAppBar(
115-
title = stringResource(id = R.string.authenticator_key_scanner),
146+
title = stringResource(id = R.string.create_verification_code),
116147
navigationIcon = painterResource(id = R.drawable.ic_close),
117148
navigationIconContentDescription = stringResource(id = R.string.close),
118149
onNavigationIconClick = remember(viewModel) {
@@ -133,22 +164,22 @@ fun ManualCodeEntryScreen(
133164
Spacer(modifier = Modifier.height(8.dp))
134165
BitwardenTextField(
135166
label = stringResource(id = R.string.name),
136-
value = state.issuer,
137-
onValueChange = remember(viewModel) {
138-
{
139-
viewModel.trySendAction(
140-
ManualCodeEntryAction.IssuerTextChange(it),
141-
)
142-
}
143-
},
144-
modifier = Modifier
145-
.fillMaxWidth()
146-
.padding(horizontal = 16.dp),
167+
value = state.issuer,
168+
onValueChange = remember(viewModel) {
169+
{
170+
viewModel.trySendAction(
171+
ManualCodeEntryAction.IssuerTextChange(it),
172+
)
173+
}
174+
},
175+
modifier = Modifier
176+
.fillMaxWidth()
177+
.padding(horizontal = 16.dp),
147178
)
148179
Spacer(modifier = Modifier.height(8.dp))
149180
BitwardenTextField(
150181
singleLine = false,
151-
label = stringResource(id = R.string.authenticator_key_scanner),
182+
label = stringResource(id = R.string.key),
152183
value = state.code,
153184
onValueChange = remember(viewModel) {
154185
{
@@ -164,7 +195,7 @@ fun ManualCodeEntryScreen(
164195

165196
Spacer(modifier = Modifier.height(16.dp))
166197
BitwardenFilledTonalButton(
167-
label = stringResource(id = R.string.add_totp),
198+
label = stringResource(id = R.string.add_code),
168199
onClick = remember(viewModel) {
169200
{ viewModel.trySendAction(ManualCodeEntryAction.CodeSubmit) }
170201
},
@@ -185,7 +216,7 @@ fun ManualCodeEntryScreen(
185216
)
186217

187218
Text(
188-
text = stringResource(id = R.string.cannot_add_authenticator_key),
219+
text = stringResource(id = R.string.cannot_add_key),
189220
style = MaterialTheme.typography.bodyMedium,
190221
modifier = Modifier
191222
.fillMaxWidth()

app/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/manualcodeentry/ManualCodeEntryViewModel.kt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@ class ManualCodeEntryViewModel @Inject constructor(
4343
is ManualCodeEntryAction.Internal.CreateItemResultReceive -> {
4444
handleCreateItemReceive(action)
4545
}
46+
47+
ManualCodeEntryAction.DismissDialog -> {
48+
handleDialogDismiss()
49+
}
4650
}
4751
}
4852

53+
private fun handleDialogDismiss() {
54+
mutableStateFlow.update { it.copy(dialog = null) }
55+
}
56+
4957
private fun handleIssuerTextChange(action: ManualCodeEntryAction.IssuerTextChange) {
5058
mutableStateFlow.update {
5159
it.copy(issuer = action.issuer)
@@ -63,6 +71,27 @@ class ManualCodeEntryViewModel @Inject constructor(
6371
}
6472

6573
private fun handleCodeSubmit() {
74+
if (state.code.isBlank()) {
75+
mutableStateFlow.update {
76+
it.copy(
77+
dialog = ManualCodeEntryState.DialogState.Error(
78+
message = R.string.key_is_required.asText()
79+
)
80+
)
81+
}
82+
return
83+
}
84+
85+
if (state.issuer.isBlank()) {
86+
mutableStateFlow.update {
87+
it.copy(
88+
dialog = ManualCodeEntryState.DialogState.Error(
89+
message = R.string.name_is_required.asText()
90+
)
91+
)
92+
}
93+
return
94+
}
6695
viewModelScope.launch {
6796
val result = authenticatorRepository.createItem(
6897
AuthenticatorItemEntity(
@@ -216,4 +245,9 @@ sealed class ManualCodeEntryAction {
216245
* The action for the user clicking the settings button.
217246
*/
218247
data object SettingsClick : ManualCodeEntryAction()
248+
249+
/**
250+
* The user has dismissed the dialog.
251+
*/
252+
data object DismissDialog : ManualCodeEntryAction()
219253
}
Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,21 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:aapt="http://schemas.android.com/aapt"
32
android:width="108dp"
43
android:height="108dp"
5-
android:viewportWidth="108"
6-
android:viewportHeight="108">
7-
<group>
8-
<clip-path
9-
android:pathData="M0,0h108v108h-108z"/>
10-
<path
11-
android:pathData="M71.57,34.63L113,76.06L89.71,119.08L40.65,70.02L53.53,77.45L70.88,60.11L71.57,34.63Z">
12-
<aapt:attr name="android:fillColor">
13-
<gradient
14-
android:startX="37.85"
15-
android:startY="38.81"
16-
android:endX="89.01"
17-
android:endY="89.97"
18-
android:type="linear">
19-
<item android:offset="0" android:color="#3F000000"/>
20-
<item android:offset="1" android:color="#00000000"/>
21-
</gradient>
22-
</aapt:attr>
23-
</path>
24-
<path
25-
android:pathData="M71.51,34.56C71.15,34.19 70.71,34 70.21,34H36.85C36.35,34 35.92,34.19 35.56,34.56C35.19,34.92 35,35.35 35,35.85V58.09C35,59.75 35.33,61.4 35.97,63.03C36.62,64.66 37.42,66.11 38.38,67.37C39.33,68.64 40.47,69.87 41.8,71.06C43.12,72.26 44.35,73.25 45.47,74.04C46.59,74.83 47.76,75.58 48.97,76.28C50.19,76.98 51.06,77.46 51.57,77.72C52.09,77.97 52.49,78.16 52.8,78.29C53.03,78.41 53.29,78.47 53.55,78.47C53.82,78.47 54.08,78.41 54.31,78.29C54.61,78.15 55.03,77.97 55.54,77.72C56.05,77.47 56.91,76.98 58.13,76.28C59.35,75.58 60.52,74.82 61.64,74.04C62.76,73.25 63.98,72.26 65.31,71.06C66.63,69.86 67.77,68.63 68.73,67.37C69.68,66.1 70.48,64.65 71.13,63.03C71.77,61.39 72.1,59.75 72.1,58.09V35.85C72.07,35.35 71.88,34.92 71.51,34.56ZM67.21,58.3C67.21,66.35 53.53,73.29 53.53,73.29V38.76H67.21C67.21,38.76 67.21,50.25 67.21,58.3Z"
26-
android:fillColor="#ffffff"/>
27-
<path
28-
android:pathData="M55,49C55,47.34 56.34,46 58,46H107C108.66,46 110,47.34 110,49V60C110,61.66 108.66,63 107,63H58C56.34,63 55,61.66 55,60V49Z"
29-
android:fillColor="#2DA49D"/>
30-
<path
31-
android:pathData="M64.22,54.63C64.22,55.6 64.04,56.41 63.67,57.05C63.3,57.7 62.77,58.19 62.07,58.51C61.37,58.84 60.53,59 59.54,59H57.12V50.43H59.81C60.7,50.43 61.48,50.59 62.14,50.91C62.8,51.23 63.32,51.7 63.68,52.33C64.04,52.95 64.22,53.72 64.22,54.63ZM62.34,54.68C62.34,54.05 62.24,53.53 62.06,53.12C61.87,52.71 61.6,52.41 61.24,52.21C60.88,52.02 60.43,51.92 59.9,51.92H58.93V57.5H59.71C60.6,57.5 61.26,57.26 61.69,56.79C62.12,56.32 62.34,55.62 62.34,54.68ZM70.93,59H66V50.43H70.93V51.92H67.82V53.8H70.72V55.29H67.82V57.5H70.93V59ZM79.45,50.43L76.53,59H74.55L71.65,50.43H73.48L75.09,55.53C75.12,55.62 75.16,55.78 75.23,56.02C75.29,56.25 75.35,56.5 75.41,56.77C75.48,57.03 75.53,57.25 75.55,57.42C75.57,57.25 75.61,57.03 75.67,56.77C75.74,56.51 75.8,56.26 75.85,56.02C75.92,55.79 75.96,55.62 75.99,55.53L77.61,50.43H79.45Z"
32-
android:fillColor="#212529"/>
33-
</group>
4+
android:viewportHeight="108"
5+
android:viewportWidth="108">
6+
<path
7+
android:fillColor="#ffffff"
8+
android:pathData="M63.95,56.33V43H54.5V66.69C56.17,65.81 57.67,64.86 58.99,63.83C62.3,61.28 63.95,58.78 63.95,56.33ZM68,40.33V56.33C68,57.53 67.76,58.71 67.29,59.89C66.82,61.06 66.24,62.1 65.54,63.01C64.85,63.92 64.02,64.81 63.05,65.67C62.09,66.53 61.2,67.24 60.39,67.81C59.57,68.38 58.72,68.92 57.83,69.43C56.95,69.93 56.32,70.28 55.94,70.46C55.57,70.64 55.27,70.78 55.05,70.88C54.88,70.96 54.7,71 54.5,71C54.3,71 54.12,70.96 53.95,70.88C53.73,70.78 53.43,70.64 53.06,70.46C52.68,70.28 52.05,69.93 51.17,69.43C50.28,68.92 49.43,68.38 48.61,67.81C47.8,67.24 46.91,66.53 45.95,65.67C44.98,64.81 44.15,63.92 43.46,63.01C42.76,62.1 42.18,61.06 41.71,59.89C41.24,58.71 41,57.53 41,56.33V40.33C41,39.97 41.13,39.66 41.4,39.4C41.67,39.13 41.98,39 42.35,39H66.65C67.02,39 67.33,39.13 67.6,39.4C67.87,39.66 68,39.97 68,40.33Z" />
9+
<path
10+
android:fillColor="#2CDDE9"
11+
android:pathData="M38.02,32C34.69,32 32,34.63 32,37.87V45.91C32,46.57 32.55,47.11 33.23,47.11C33.9,47.11 34.45,46.57 34.45,45.91V37.87C34.45,35.95 36.05,34.39 38.02,34.39H46.26C46.94,34.39 47.48,33.86 47.48,33.2C47.48,32.54 46.94,32 46.26,32H38.02Z" />
12+
<path
13+
android:fillColor="#2CDDE9"
14+
android:pathData="M69.98,32C73.31,32 76,34.63 76,37.87V45.91C76,46.57 75.45,47.11 74.77,47.11C74.1,47.11 73.55,46.57 73.55,45.91V37.87C73.55,35.95 71.95,34.39 69.98,34.39H61.74C61.06,34.39 60.52,33.86 60.52,33.2C60.52,32.54 61.06,32 61.74,32H69.98Z" />
15+
<path
16+
android:fillColor="#2CDDE9"
17+
android:pathData="M32,70.13C32,73.37 34.69,76 38.02,76H46.26C46.94,76 47.48,75.46 47.48,74.8C47.48,74.14 46.94,73.61 46.26,73.61H38.02C36.05,73.61 34.45,72.05 34.45,70.13V62.09C34.45,61.43 33.9,60.89 33.23,60.89C32.55,60.89 32,61.43 32,62.09V70.13Z" />
18+
<path
19+
android:fillColor="#2CDDE9"
20+
android:pathData="M69.98,76C73.31,76 76,73.37 76,70.13V62.09C76,61.43 75.45,60.89 74.77,60.89C74.1,60.89 73.55,61.43 73.55,62.09V70.13C73.55,72.05 71.95,73.61 69.98,73.61H61.74C61.06,73.61 60.52,74.14 60.52,74.8C60.52,75.46 61.06,76 61.74,76H69.98Z" />
3421
</vector>

0 commit comments

Comments
 (0)