From 1c1db6fa1ea222e55a9684d1dd459e546950c5fb Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 24 Apr 2025 18:10:52 -0400 Subject: [PATCH] Removes unused copytext dialog --- .../ui/components/SelectTextDialog.kt | 88 ------------------- .../amethyst/ui/note/NoteQuickActionMenu.kt | 16 ---- 2 files changed, 104 deletions(-) delete mode 100644 amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/SelectTextDialog.kt diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/SelectTextDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/SelectTextDialog.kt deleted file mode 100644 index db8f877e6d..0000000000 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/SelectTextDialog.kt +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) 2024 Vitor Pamplona - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the - * Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package com.vitorpamplona.amethyst.ui.components - -import android.content.res.Configuration -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.heightIn -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.text.selection.SelectionContainer -import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.Card -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.IconButton -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalConfiguration -import androidx.compose.ui.unit.dp -import androidx.compose.ui.window.Dialog -import com.vitorpamplona.amethyst.R -import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon -import com.vitorpamplona.amethyst.ui.stringRes -import com.vitorpamplona.amethyst.ui.theme.DividerThickness -import com.vitorpamplona.amethyst.ui.theme.Size24dp - -@Composable -fun SelectTextDialog( - text: String, - onDismiss: () -> Unit, -) { - val screenHeight = LocalConfiguration.current.screenHeightDp.dp - val maxHeight = - if (LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT) { - screenHeight * 0.6f - } else { - screenHeight * 0.9f - } - - Dialog( - onDismissRequest = onDismiss, - ) { - Card { - Column( - modifier = Modifier.heightIn(Size24dp, maxHeight), - ) { - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.End, - ) { - IconButton( - onClick = onDismiss, - ) { - ArrowBackIcon() - } - Text(text = stringRes(R.string.select_text_dialog_top)) - } - HorizontalDivider(thickness = DividerThickness) - Column( - modifier = Modifier.verticalScroll(rememberScrollState()), - ) { - Row(modifier = Modifier.padding(16.dp)) { SelectionContainer { Text(text) } } - } - } - } - } -} diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt index 8331e93a78..52f841e167 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt @@ -59,7 +59,6 @@ import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.material3.VerticalDivider import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.MutableState import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -84,7 +83,6 @@ import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.AddressableNote import com.vitorpamplona.amethyst.model.Note import com.vitorpamplona.amethyst.model.User -import com.vitorpamplona.amethyst.ui.components.SelectTextDialog import com.vitorpamplona.amethyst.ui.navigation.EmptyNav import com.vitorpamplona.amethyst.ui.navigation.INav import com.vitorpamplona.amethyst.ui.navigation.Route @@ -190,7 +188,6 @@ fun NoteQuickActionMenu( accountViewModel: AccountViewModel, nav: INav, ) { - val showSelectTextDialog = remember { mutableStateOf(false) } val showDeleteAlertDialog = remember { mutableStateOf(false) } val showBlockAlertDialog = remember { mutableStateOf(false) } val showReportDialog = remember { mutableStateOf(false) } @@ -205,19 +202,6 @@ fun NoteQuickActionMenu( onWantsToEditDraft, ) - if (showSelectTextDialog.value) { - val decryptedNote = remember { mutableStateOf(null) } - - LaunchedEffect(key1 = Unit) { accountViewModel.decrypt(note) { decryptedNote.value = it } } - - decryptedNote.value?.let { - SelectTextDialog(it) { - showSelectTextDialog.value = false - decryptedNote.value = null - } - } - } - if (showDeleteAlertDialog.value) { DeleteAlertDialog(note, accountViewModel) { showDeleteAlertDialog.value = false