diff --git a/common/src/commonMain/composeResources/values/strings.xml b/common/src/commonMain/composeResources/values/strings.xml index 8fcd668..8373d26 100644 --- a/common/src/commonMain/composeResources/values/strings.xml +++ b/common/src/commonMain/composeResources/values/strings.xml @@ -243,12 +243,15 @@ Change name Change names Merge into… + Are you sure you want to merge these folders? + Create a folder Delete the folder? Delete the folders? This item(s) will be deleted immediately. You can not undo this action. Recently opened Often opened + No history yet View details Save to Add to favourites @@ -268,7 +271,10 @@ Change passwords View password history Trash + Move to trash? + Items that have been in Trash more than 30 days will be automatically deleted. Restore + Restore from trash? Delete forever Delete forever? Configure Watchtower alerts diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/folders/FoldersStateProducer.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/folders/FoldersStateProducer.kt index 2a5e012..28e54ee 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/folders/FoldersStateProducer.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/folders/FoldersStateProducer.kt @@ -157,7 +157,7 @@ fun foldersScreenState( } ?.id - fun onAdd() { + suspend fun onAdd() { accountId ?: // Should not happen, we should not // call this function if the account id @@ -166,11 +166,11 @@ fun foldersScreenState( val intent = createConfirmationDialogIntent( item = ConfirmationRoute.Args.Item.StringItem( key = "name", - title = "Folder name", + title = translate(Res.string.generic_name), // Folder must have a non-empty name! canBeEmpty = false, ), - title = "Create a folder", + title = translate(Res.string.folder_action_create_title), ) { name -> val accountIdsToNames = mapOf( AccountId(accountId) to name, @@ -218,7 +218,7 @@ fun foldersScreenState( navigate(intent) } - fun onMerge( + suspend fun onMerge( folderName: String, folderIds: Set, ) { @@ -226,7 +226,7 @@ fun foldersScreenState( val folderNameItem = ConfirmationRoute.Args.Item.StringItem( key = folderNameKey, value = folderName, - title = "Folder name", + title = translate(Res.string.generic_name), type = ConfirmationRoute.Args.Item.StringItem.Type.Text, canBeEmpty = false, ) @@ -235,7 +235,7 @@ fun foldersScreenState( route = ConfirmationRoute( args = ConfirmationRoute.Args( icon = icon(Icons.Outlined.Merge), - title = "Are you sure you want to merge these folders?", + title = translate(Res.string.folder_action_merge_confirmation_title), items = listOfNotNull( folderNameItem, ), @@ -382,9 +382,9 @@ fun foldersScreenState( this += FlatItemAction( icon = Icons.Outlined.Merge, title = Res.string.folder_action_merge_title.wrap(), - onClick = ::onMerge - .partially1(folderName) - .partially1(selectedFolderIds), + onClick = onClick { + onMerge(folderName, selectedFolderIds) + }, ) } } @@ -511,7 +511,9 @@ fun foldersScreenState( FoldersState( selection = selection, content = Loadable.Ok(content), - onAdd = ::onAdd.takeUnless { selection != null || accountId == null }, + onAdd = onClick { + onAdd() + }.takeUnless { selection != null || accountId == null }, ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/screen/AutofillWindow.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/screen/AutofillWindow.kt index af2a843..d922707 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/screen/AutofillWindow.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/screen/AutofillWindow.kt @@ -30,6 +30,7 @@ import androidx.compose.ui.unit.dp import com.artemchep.keyguard.common.model.DSecret import com.artemchep.keyguard.common.model.fold import com.artemchep.keyguard.feature.home.vault.component.VaultListItem +import com.artemchep.keyguard.res.* import com.artemchep.keyguard.ui.LeMOdelBottomSheet import com.artemchep.keyguard.ui.Placeholder import com.artemchep.keyguard.ui.icons.IconBox @@ -38,6 +39,7 @@ import com.artemchep.keyguard.ui.skeleton.SkeletonSegmented import com.artemchep.keyguard.ui.tabs.SegmentedButtonGroup import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach +import org.jetbrains.compose.resources.stringResource @Composable fun RecentsButton( @@ -221,7 +223,7 @@ fun ColumnScope.RecentsWindowOk( ) { Placeholder( icon = Icons.Outlined.HistoryToggleOff, - title = "No recently opened items yet.", + title = stringResource(Res.string.ciphers_history_empty), ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/util/changePasswordAction.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/util/changePasswordAction.kt index 3aa809c..301016c 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/util/changePasswordAction.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/util/changePasswordAction.kt @@ -584,15 +584,15 @@ fun RememberStateFlowScope.cipherTrashAction( FlatItemAction( leading = icon, title = title, - onClick = { + onClick = onClick { before?.invoke() val route = registerRouteResultReceiver( route = ConfirmationRoute( args = ConfirmationRoute.Args( icon = icon(Icons.Outlined.Delete), - title = "Move to trash?", - message = "Items that have been in Trash more than 30 days will be automatically deleted.", + title = translate(Res.string.ciphers_action_trash_confirmation_title.wrap()), + message = translate(Res.string.ciphers_action_trash_confirmation_text.wrap()), ), ), ) { result -> @@ -630,14 +630,14 @@ fun RememberStateFlowScope.cipherRestoreAction( FlatItemAction( leading = icon, title = title, - onClick = { + onClick = onClick { before?.invoke() val route = registerRouteResultReceiver( route = ConfirmationRoute( args = ConfirmationRoute.Args( icon = icon(Icons.Outlined.RestoreFromTrash), - title = "Restore from trash?", + title = translate(Res.string.ciphers_action_restore_confirmation_title.wrap()), ), ), ) { result ->