From c6026b6b7d81a2b90ad45f713d8938a6d7041abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Mon, 13 Nov 2023 15:04:01 +0100 Subject: [PATCH 1/6] feat: legal hold dialogs [WPB-5446] --- .../LearnMoreAboutLegalHoldButton.kt | 60 +++++++ .../legalhold/LegalHoldDeactivatedDialog.kt | 55 ++++++ .../LegalHoldInfoConnectionDialog.kt | 47 +++++ .../LegalHoldInfoConversationDialog.kt | 45 +++++ .../ui/legalhold/LegalHoldInfoDialog.kt | 91 ++++++++++ .../legalhold/LegalHoldInfoMessageDialog.kt | 47 +++++ .../legalhold/LegalHoldInfoProfileDialog.kt | 44 +++++ .../ui/legalhold/LegalHoldRequestedDialog.kt | 169 ++++++++++++++++++ .../ui/legalhold/LegalHoldRequestedState.kt | 37 ++++ .../legalhold/LegalHoldRequestedViewModel.kt | 76 ++++++++ app/src/main/res/values/strings.xml | 16 ++ 11 files changed, 687 insertions(+) create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LearnMoreAboutLegalHoldButton.kt create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldDeactivatedDialog.kt create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConnectionDialog.kt create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConversationDialog.kt create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedDialog.kt create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedState.kt create mode 100644 app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LearnMoreAboutLegalHoldButton.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LearnMoreAboutLegalHoldButton.kt new file mode 100644 index 00000000000..22e7e19aab2 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LearnMoreAboutLegalHoldButton.kt @@ -0,0 +1,60 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextDecoration +import com.wire.android.R +import com.wire.android.ui.theme.WireTheme +import com.wire.android.ui.theme.wireTypography +import com.wire.android.util.CustomTabsHelper +import com.wire.android.util.ui.PreviewMultipleThemes + +@Composable +fun LearnMoreAboutLegalHoldButton(modifier: Modifier = Modifier) { + val context = LocalContext.current + val learnMoreUrl = stringResource(id = R.string.url_legal_hold_learn_more) + Text( + text = stringResource(R.string.legal_hold_learn_more_button), + style = MaterialTheme.wireTypography.body02, + textDecoration = TextDecoration.Underline, + textAlign = TextAlign.Center, + modifier = modifier.clickable( + interactionSource = remember { MutableInteractionSource() }, + indication = null, + onClick = remember { { CustomTabsHelper.launchUrl(context, learnMoreUrl) } } + ) + ) +} + +@Composable +@PreviewMultipleThemes +fun PreviewLearnMoreAboutLegalHoldButton() { + WireTheme { + LearnMoreAboutLegalHoldButton() + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldDeactivatedDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldDeactivatedDialog.kt new file mode 100644 index 00000000000..8662320b4d7 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldDeactivatedDialog.kt @@ -0,0 +1,55 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import com.wire.android.R +import com.wire.android.ui.common.WireDialog +import com.wire.android.ui.common.WireDialogButtonProperties +import com.wire.android.ui.common.WireDialogButtonType +import com.wire.android.ui.theme.WireTheme +import com.wire.android.ui.theme.wireDimensions +import com.wire.android.util.ui.PreviewMultipleThemes + +@Composable +fun LegalHoldDeactivatedDialog(dialogDismissed: () -> Unit) { + WireDialog( + title = stringResource(id = R.string.legal_hold_deactivated_dialog_title), + text = stringResource(id = R.string.legal_hold_deactivated_dialog_description), + onDismiss = dialogDismissed, + optionButton1Properties = WireDialogButtonProperties( + onClick = dialogDismissed, + text = stringResource(id = R.string.label_ok), + type = WireDialogButtonType.Primary, + ) + ) { + LearnMoreAboutLegalHoldButton(modifier = Modifier.padding(bottom = MaterialTheme.wireDimensions.dialogTextsSpacing)) + } +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldDeactivatedDialog() { + WireTheme { + LegalHoldDeactivatedDialog {} + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConnectionDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConnectionDialog.kt new file mode 100644 index 00000000000..13d1138dd75 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConnectionDialog.kt @@ -0,0 +1,47 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource +import com.wire.android.R +import com.wire.android.ui.theme.WireTheme +import com.wire.android.util.ui.PreviewMultipleThemes + +@Composable +fun LegalHoldInfoConnectionDialog( + userName: String, + dialogDismissed: () -> Unit, + connectClicked: () -> Unit, +) { + LegalHoldInfoDialog( + name = userName, + isConversation = false, + cancelText = stringResource(id = R.string.label_cancel), + dialogDismissed = dialogDismissed, + action = stringResource(id = R.string.connection_label_connect) to connectClicked, + ) +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldInfoConnectionDialog() { + WireTheme { + LegalHoldInfoConnectionDialog("username", {}, {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConversationDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConversationDialog.kt new file mode 100644 index 00000000000..07a63002230 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConversationDialog.kt @@ -0,0 +1,45 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource +import com.wire.android.R +import com.wire.android.ui.theme.WireTheme +import com.wire.android.util.ui.PreviewMultipleThemes + +@Composable +fun LegalHoldInfoConversationDialog( + conversationName: String, + dialogDismissed: () -> Unit, +) { + LegalHoldInfoDialog( + name = conversationName, + isConversation = true, + cancelText = stringResource(id = R.string.label_close), + dialogDismissed = dialogDismissed + ) +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldInfoConversationDialog() { + WireTheme { + LegalHoldInfoConversationDialog("conversation name", {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt new file mode 100644 index 00000000000..b2e9703c3e5 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt @@ -0,0 +1,91 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import com.wire.android.R +import com.wire.android.ui.common.WireDialog +import com.wire.android.ui.common.WireDialogButtonProperties +import com.wire.android.ui.common.WireDialogButtonType +import com.wire.android.ui.theme.WireTheme +import com.wire.android.ui.theme.wireDimensions +import com.wire.android.ui.theme.wireTypography +import com.wire.android.util.ui.PreviewMultipleThemes + +@Composable +fun LegalHoldInfoDialog( + name: String, + isConversation: Boolean, + cancelText: String, + dialogDismissed: () -> Unit, + action: Pair Unit>? = null, + bottomDescriptionText: String? = null, +) { + val text = stringResource(id = R.string.legal_hold_subject_dialog_description_group).let { + if (isConversation) it + "\n\n" + stringResource(id = R.string.legal_hold_subject_dialog_description) + else it + } + WireDialog( + title = stringResource(id = R.string.legal_hold_subject_dialog_title, name), + text = text, + onDismiss = dialogDismissed, + buttonsHorizontalAlignment = false, + optionButton1Properties = WireDialogButtonProperties( + onClick = dialogDismissed, + text = cancelText, + type = WireDialogButtonType.Secondary, + ), + optionButton2Properties = action?.let { (actionText, actionClicked) -> + WireDialogButtonProperties( + onClick = actionClicked, + text = actionText, + type = WireDialogButtonType.Primary, + ) + }, + ) { + Column( + verticalArrangement = Arrangement.spacedBy(MaterialTheme.wireDimensions.dialogTextsSpacing), + modifier = Modifier.padding(bottom = MaterialTheme.wireDimensions.dialogTextsSpacing) + ) { + if (!bottomDescriptionText.isNullOrEmpty()) { + Text( + text = bottomDescriptionText, + style = MaterialTheme.wireTypography.body01, + modifier = Modifier.fillMaxWidth() + ) + } + LearnMoreAboutLegalHoldButton() + } + } +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldInfoDialog() { + WireTheme { + LegalHoldInfoDialog("username", true, "cancel", {}, Pair("send anyway", {}), "send anyway?") + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt new file mode 100644 index 00000000000..add64024d6d --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt @@ -0,0 +1,47 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource +import com.wire.android.R +import com.wire.android.ui.theme.WireTheme +import com.wire.android.util.ui.PreviewMultipleThemes + +@Composable +fun LegalHoldInfoMessageDialog( + userName: String, + dialogDismissed: () -> Unit, + sendAnywayClicked: () -> Unit, +) { + LegalHoldInfoDialog( + name = userName, + isConversation = true, + cancelText = stringResource(id = R.string.label_cancel), + dialogDismissed = dialogDismissed, + action = stringResource(id = R.string.legal_hold_subject_dialog_send_anyway_button) to sendAnywayClicked, + ) +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldInfoMessageDialog() { + WireTheme { + LegalHoldInfoMessageDialog("username", {}, {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt new file mode 100644 index 00000000000..c21eaa1a06d --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt @@ -0,0 +1,44 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource +import com.wire.android.R +import com.wire.android.ui.theme.WireTheme +import com.wire.android.util.ui.PreviewMultipleThemes + +@Composable +fun LegalHoldInfoProfileDialog( + userName: String, + dialogDismissed: () -> Unit, +) { + LegalHoldInfoDialog( + name = userName, + isConversation = false, + cancelText = stringResource(id = R.string.label_close), + dialogDismissed = dialogDismissed) +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldInfoProfileDialog() { + WireTheme { + LegalHoldInfoProfileDialog("conversation name", {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedDialog.kt new file mode 100644 index 00000000000..d4660c80c28 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedDialog.kt @@ -0,0 +1,169 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.text.KeyboardActions +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.ExperimentalComposeUiApi +import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.platform.LocalSoftwareKeyboardController +import androidx.compose.ui.platform.SoftwareKeyboardController +import androidx.compose.ui.platform.testTag +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.window.DialogProperties +import androidx.hilt.navigation.compose.hiltViewModel +import com.wire.android.R +import com.wire.android.ui.common.WireDialog +import com.wire.android.ui.common.WireDialogButtonProperties +import com.wire.android.ui.common.WireDialogButtonType +import com.wire.android.ui.common.button.WireButtonState +import com.wire.android.ui.common.textfield.WirePasswordTextField +import com.wire.android.ui.common.textfield.WireTextFieldState +import com.wire.android.ui.theme.WireTheme +import com.wire.android.ui.theme.wireDimensions +import com.wire.android.ui.theme.wireTypography +import com.wire.android.util.extension.formatAsFingerPrint +import com.wire.android.util.ui.PreviewMultipleThemes + +@Composable +fun LegalHoldRequestedDialog( + viewModel: LegalHoldRequestedViewModel = hiltViewModel() +) { + LegalHoldRequestedDialogContent( + state = viewModel.state, + passwordChanged = viewModel::passwordChanged, + notNowClicked = viewModel::notNowClicked, + acceptClicked = viewModel::acceptClicked, + ) +} + +@OptIn(ExperimentalComposeUiApi::class) +@Composable +fun LegalHoldRequestedDialogContent( + state: LegalHoldRequestedState, + passwordChanged: (TextFieldValue) -> Unit, + notNowClicked: () -> Unit, + acceptClicked: () -> Unit, +) { + var keyboardController: SoftwareKeyboardController? = null + WireDialog( + title = stringResource(R.string.legal_hold_requested_dialog_title), + properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false, usePlatformDefaultWidth = false), + onDismiss = { keyboardController?.hide() }, + dismissButtonProperties = WireDialogButtonProperties( + onClick = notNowClicked, + text = stringResource(id = R.string.legal_hold_requested_dialog_not_now_button), + state = WireButtonState.Default + ), + optionButton1Properties = WireDialogButtonProperties( + onClick = { + keyboardController?.hide() + acceptClicked() + }, + text = stringResource(R.string.legal_hold_requested_dialog_accept_button), + type = WireDialogButtonType.Primary, + loading = state.loading, + state = if (state.acceptEnabled) WireButtonState.Error else WireButtonState.Disabled + ), + content = { + Column( + verticalArrangement = Arrangement.spacedBy(MaterialTheme.wireDimensions.dialogTextsSpacing), + modifier = Modifier.padding(vertical = MaterialTheme.wireDimensions.dialogTextsSpacing) + ) { + Text( + text = stringResource(id = R.string.legal_hold_requested_dialog_description_device), + style = MaterialTheme.wireTypography.body01, + modifier = Modifier.fillMaxWidth() + ) + Text( + text = state.legalHoldDeviceFingerprint.formatAsFingerPrint(), + style = MaterialTheme.wireTypography.body01, + fontFamily = FontFamily.Monospace, + modifier = Modifier.fillMaxWidth() + ) + Text( + text = stringResource(id = R.string.legal_hold_requested_dialog_description_includes), + style = MaterialTheme.wireTypography.body01, + modifier = Modifier.fillMaxWidth() + ) + LearnMoreAboutLegalHoldButton() + if (state.requiresPassword) { + Text( + text = stringResource(id = R.string.legal_hold_requested_dialog_enter_password), + style = MaterialTheme.wireTypography.body01, + modifier = Modifier.fillMaxWidth() + ) + // keyboard controller from outside the Dialog doesn't work inside its content so we have to pass the state + // to the dialog's content and use keyboard controller from there + keyboardController = LocalSoftwareKeyboardController.current + val focusRequester = remember { FocusRequester() } + WirePasswordTextField( + value = state.password, + onValueChange = passwordChanged, + state = when { + state.error is LegalHoldRequestedError.InvalidCredentialsError -> + WireTextFieldState.Error(stringResource(id = R.string.remove_device_invalid_password)) + + state.loading -> WireTextFieldState.Disabled + else -> WireTextFieldState.Default + }, + imeAction = ImeAction.Done, + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), + modifier = Modifier + .focusRequester(focusRequester) + .padding(bottom = MaterialTheme.wireDimensions.spacing8x) + .testTag("remove device password field"), + autofill = true + ) + } + } + } + ) +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldRequestedDialogWithPassword() { + WireTheme { + LegalHoldRequestedDialogContent( + LegalHoldRequestedState(legalHoldDeviceFingerprint = "0123456789ABCDEF", requiresPassword = true), {}, {}, {} + ) + } +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldRequestedDialogWithoutPassword() { + WireTheme { + LegalHoldRequestedDialogContent( + LegalHoldRequestedState(legalHoldDeviceFingerprint = "0123456789ABCDEF", requiresPassword = false), {}, {}, {} + ) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedState.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedState.kt new file mode 100644 index 00000000000..94744af19d2 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedState.kt @@ -0,0 +1,37 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.ui.text.input.TextFieldValue +import com.wire.kalium.logic.CoreFailure + +data class LegalHoldRequestedState( + val done: Boolean = false, + val legalHoldDeviceFingerprint: String = "", + val password: TextFieldValue = TextFieldValue(""), + val requiresPassword: Boolean = false, + val loading: Boolean = false, + val acceptEnabled: Boolean = false, + val error: LegalHoldRequestedError = LegalHoldRequestedError.None, +) + +sealed class LegalHoldRequestedError { + data object None : LegalHoldRequestedError() + data object InvalidCredentialsError : LegalHoldRequestedError() + data class GenericError(val coreFailure: CoreFailure) : LegalHoldRequestedError() +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt new file mode 100644 index 00000000000..f10ff968126 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt @@ -0,0 +1,76 @@ +/* + * Wire + * Copyright (C) 2023 Wire Swiss GmbH + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ +package com.wire.android.ui.legalhold + +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.compose.ui.text.input.TextFieldValue +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.wire.kalium.logic.feature.auth.ValidatePasswordUseCase +import com.wire.kalium.logic.feature.user.IsPasswordRequiredUseCase +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.launch +import javax.inject.Inject + +@HiltViewModel +class LegalHoldRequestedViewModel @Inject constructor( + private val isPasswordRequired: IsPasswordRequiredUseCase, + private val validatePassword: ValidatePasswordUseCase, + ) : ViewModel() { + + var state: LegalHoldRequestedState by mutableStateOf(LegalHoldRequestedState()) + private set + + init { + state = state.copy(legalHoldDeviceFingerprint = "0123456789ABCDEF")// TODO get fingerprint + viewModelScope.launch { + isPasswordRequired().let { + state = state.copy(requiresPassword = (it as? IsPasswordRequiredUseCase.Result.Success)?.value ?: true) + } + } + } + + fun passwordChanged(password: TextFieldValue) { + state = state.copy(password = password) + validatePassword(password.text).let { + state = state.copy(acceptEnabled = it.isValid) + } + } + + fun notNowClicked() { + // TODO + } + + fun acceptClicked() { + state = state.copy(acceptEnabled = false, loading = true) + // the accept button is enabled if the password is valid, this check is for safety only + validatePassword(state.password.text).let { + if (!it.isValid) { + state = state.copy(loading = false, error = LegalHoldRequestedError.InvalidCredentialsError) + } + if (it.isValid) { + viewModelScope.launch { + // TODO + state = state.copy(loading = false, done = true) + } + } + } + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bdaec7b18b4..c712bab6a95 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1281,4 +1281,20 @@ Certificate copied to clipboard Conversation no longer verified The call was disconnected because at least one participant is no longer a verified contact. + + Legal hold requested + All future messages will be recorded by the device with fingerprint: + This includes deleted, edited and self-deleting messages in all conversations. + Enter your password to confirm. + Accept + Not Now + Learn more about legal hold + https://support.wire.com/hc/articles/360002018278-What-is-legal-hold- + Legal hold deactivated + Future messages will not be recorded. + %1$s is subject to legal hold + All messages, pictures, and documents will be preserved for future access. It includes deleted, edited, and self-deleting messages. + At least one person in this conversation is subject to legal hold. + Send Anyway + From b44ec66cf0a3ae25eeb2a44ac5e60c0c7cbf2cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Mon, 13 Nov 2023 15:16:23 +0100 Subject: [PATCH 2/6] update preview --- .../com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt index c21eaa1a06d..aa3332f2fa3 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt @@ -39,6 +39,6 @@ fun LegalHoldInfoProfileDialog( @PreviewMultipleThemes fun PreviewLegalHoldInfoProfileDialog() { WireTheme { - LegalHoldInfoProfileDialog("conversation name", {}) + LegalHoldInfoProfileDialog("username", {}) } } From 599760aa048d58f0319c6f1fde35766f1f09929f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Mon, 13 Nov 2023 15:17:55 +0100 Subject: [PATCH 3/6] update preview --- .../com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt index add64024d6d..ce485ecd505 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt @@ -42,6 +42,6 @@ fun LegalHoldInfoMessageDialog( @PreviewMultipleThemes fun PreviewLegalHoldInfoMessageDialog() { WireTheme { - LegalHoldInfoMessageDialog("username", {}, {}) + LegalHoldInfoMessageDialog("conversation name", {}, {}) } } From c1c178ec1eed9a2394d3fed131f3276a5486ed06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Mon, 13 Nov 2023 15:20:35 +0100 Subject: [PATCH 4/6] change order of texts inside dialogs --- .../com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt index b2e9703c3e5..542e65d6382 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt @@ -44,8 +44,8 @@ fun LegalHoldInfoDialog( action: Pair Unit>? = null, bottomDescriptionText: String? = null, ) { - val text = stringResource(id = R.string.legal_hold_subject_dialog_description_group).let { - if (isConversation) it + "\n\n" + stringResource(id = R.string.legal_hold_subject_dialog_description) + val text = stringResource(id = R.string.legal_hold_subject_dialog_description).let { + if (isConversation) stringResource(id = R.string.legal_hold_subject_dialog_description_group) + "\n\n" +it else it } WireDialog( @@ -70,6 +70,7 @@ fun LegalHoldInfoDialog( verticalArrangement = Arrangement.spacedBy(MaterialTheme.wireDimensions.dialogTextsSpacing), modifier = Modifier.padding(bottom = MaterialTheme.wireDimensions.dialogTextsSpacing) ) { + LearnMoreAboutLegalHoldButton() if (!bottomDescriptionText.isNullOrEmpty()) { Text( text = bottomDescriptionText, @@ -77,7 +78,6 @@ fun LegalHoldInfoDialog( modifier = Modifier.fillMaxWidth() ) } - LearnMoreAboutLegalHoldButton() } } } @@ -86,6 +86,6 @@ fun LegalHoldInfoDialog( @PreviewMultipleThemes fun PreviewLegalHoldInfoDialog() { WireTheme { - LegalHoldInfoDialog("username", true, "cancel", {}, Pair("send anyway", {}), "send anyway?") + LegalHoldInfoDialog("username", true, "cancel", {}, Pair("send anyway", {}), "Send anyway?") } } From cad832d094df12c1f01bba908af621753863e089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Mon, 13 Nov 2023 16:12:55 +0100 Subject: [PATCH 5/6] fix detekt --- .../com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt | 2 +- .../wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt index 542e65d6382..4414e56abeb 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt @@ -45,7 +45,7 @@ fun LegalHoldInfoDialog( bottomDescriptionText: String? = null, ) { val text = stringResource(id = R.string.legal_hold_subject_dialog_description).let { - if (isConversation) stringResource(id = R.string.legal_hold_subject_dialog_description_group) + "\n\n" +it + if (isConversation) stringResource(id = R.string.legal_hold_subject_dialog_description_group) + "\n\n" + it else it } WireDialog( diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt index f10ff968126..119fc12ad27 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt @@ -33,13 +33,13 @@ import javax.inject.Inject class LegalHoldRequestedViewModel @Inject constructor( private val isPasswordRequired: IsPasswordRequiredUseCase, private val validatePassword: ValidatePasswordUseCase, - ) : ViewModel() { +) : ViewModel() { var state: LegalHoldRequestedState by mutableStateOf(LegalHoldRequestedState()) private set init { - state = state.copy(legalHoldDeviceFingerprint = "0123456789ABCDEF")// TODO get fingerprint + state = state.copy(legalHoldDeviceFingerprint = "0123456789ABCDEF") // TODO get fingerprint viewModelScope.launch { isPasswordRequired().let { state = state.copy(requiresPassword = (it as? IsPasswordRequiredUseCase.Result.Success)?.value ?: true) From b044dd998d94accb5c83708668b3b1a9458bdbdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Tue, 14 Nov 2023 16:10:47 +0100 Subject: [PATCH 6/6] arrange into packages, rename Info to Subject --- .../common}/LearnMoreAboutLegalHoldButton.kt | 2 +- .../deactivated}/LegalHoldDeactivatedDialog.kt | 3 ++- .../{ => dialog/requested}/LegalHoldRequestedDialog.kt | 3 ++- .../{ => dialog/requested}/LegalHoldRequestedState.kt | 2 +- .../requested}/LegalHoldRequestedViewModel.kt | 2 +- .../subject/LegalHoldSubjectBaseDialog.kt} | 9 +++++---- .../subject/LegalHoldSubjectConnectionDialog.kt} | 10 +++++----- .../subject/LegalHoldSubjectConversationDialog.kt} | 10 +++++----- .../subject/LegalHoldSubjectMessageDialog.kt} | 10 +++++----- .../subject/LegalHoldSubjectProfileDialog.kt} | 10 +++++----- 10 files changed, 32 insertions(+), 29 deletions(-) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{ => dialog/common}/LearnMoreAboutLegalHoldButton.kt (97%) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{ => dialog/deactivated}/LegalHoldDeactivatedDialog.kt (93%) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{ => dialog/requested}/LegalHoldRequestedDialog.kt (98%) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{ => dialog/requested}/LegalHoldRequestedState.kt (96%) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{ => dialog/requested}/LegalHoldRequestedViewModel.kt (98%) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{LegalHoldInfoDialog.kt => dialog/subject/LegalHoldSubjectBaseDialog.kt} (91%) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{LegalHoldInfoConnectionDialog.kt => dialog/subject/LegalHoldSubjectConnectionDialog.kt} (85%) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{LegalHoldInfoConversationDialog.kt => dialog/subject/LegalHoldSubjectConversationDialog.kt} (83%) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{LegalHoldInfoMessageDialog.kt => dialog/subject/LegalHoldSubjectMessageDialog.kt} (85%) rename app/src/main/kotlin/com/wire/android/ui/legalhold/{LegalHoldInfoProfileDialog.kt => dialog/subject/LegalHoldSubjectProfileDialog.kt} (84%) diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LearnMoreAboutLegalHoldButton.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/LearnMoreAboutLegalHoldButton.kt similarity index 97% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LearnMoreAboutLegalHoldButton.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/LearnMoreAboutLegalHoldButton.kt index 22e7e19aab2..fde6d3e9578 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LearnMoreAboutLegalHoldButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/LearnMoreAboutLegalHoldButton.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.common import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldDeactivatedDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/deactivated/LegalHoldDeactivatedDialog.kt similarity index 93% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldDeactivatedDialog.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/deactivated/LegalHoldDeactivatedDialog.kt index 8662320b4d7..7b372b28e00 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldDeactivatedDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/deactivated/LegalHoldDeactivatedDialog.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.deactivated import androidx.compose.foundation.layout.padding import androidx.compose.material3.MaterialTheme @@ -26,6 +26,7 @@ import com.wire.android.R import com.wire.android.ui.common.WireDialog import com.wire.android.ui.common.WireDialogButtonProperties import com.wire.android.ui.common.WireDialogButtonType +import com.wire.android.ui.legalhold.dialog.common.LearnMoreAboutLegalHoldButton import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.util.ui.PreviewMultipleThemes diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedDialog.kt similarity index 98% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedDialog.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedDialog.kt index d4660c80c28..b2b1257734a 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedDialog.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.requested import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -46,6 +46,7 @@ import com.wire.android.ui.common.WireDialogButtonType import com.wire.android.ui.common.button.WireButtonState import com.wire.android.ui.common.textfield.WirePasswordTextField import com.wire.android.ui.common.textfield.WireTextFieldState +import com.wire.android.ui.legalhold.dialog.common.LearnMoreAboutLegalHoldButton import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.theme.wireTypography diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedState.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedState.kt similarity index 96% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedState.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedState.kt index 94744af19d2..abad9ff1fb1 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedState.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedState.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.requested import androidx.compose.ui.text.input.TextFieldValue import com.wire.kalium.logic.CoreFailure diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedViewModel.kt similarity index 98% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedViewModel.kt index 119fc12ad27..fba431e3964 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldRequestedViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedViewModel.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.requested import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectBaseDialog.kt similarity index 91% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectBaseDialog.kt index 4414e56abeb..e8fe22f1f96 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectBaseDialog.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.subject import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -30,13 +30,14 @@ import com.wire.android.R import com.wire.android.ui.common.WireDialog import com.wire.android.ui.common.WireDialogButtonProperties import com.wire.android.ui.common.WireDialogButtonType +import com.wire.android.ui.legalhold.dialog.common.LearnMoreAboutLegalHoldButton import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.theme.wireTypography import com.wire.android.util.ui.PreviewMultipleThemes @Composable -fun LegalHoldInfoDialog( +fun LegalHoldSubjectBaseDialog( name: String, isConversation: Boolean, cancelText: String, @@ -84,8 +85,8 @@ fun LegalHoldInfoDialog( @Composable @PreviewMultipleThemes -fun PreviewLegalHoldInfoDialog() { +fun PreviewLegalHoldSubjectBaseDialog() { WireTheme { - LegalHoldInfoDialog("username", true, "cancel", {}, Pair("send anyway", {}), "Send anyway?") + LegalHoldSubjectBaseDialog("username", true, "cancel", {}, Pair("send anyway", {}), "Send anyway?") } } diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConnectionDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConnectionDialog.kt similarity index 85% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConnectionDialog.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConnectionDialog.kt index 13d1138dd75..38ecafe0701 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConnectionDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConnectionDialog.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.subject import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -24,12 +24,12 @@ import com.wire.android.ui.theme.WireTheme import com.wire.android.util.ui.PreviewMultipleThemes @Composable -fun LegalHoldInfoConnectionDialog( +fun LegalHoldSubjectConnectionDialog( userName: String, dialogDismissed: () -> Unit, connectClicked: () -> Unit, ) { - LegalHoldInfoDialog( + LegalHoldSubjectBaseDialog( name = userName, isConversation = false, cancelText = stringResource(id = R.string.label_cancel), @@ -40,8 +40,8 @@ fun LegalHoldInfoConnectionDialog( @Composable @PreviewMultipleThemes -fun PreviewLegalHoldInfoConnectionDialog() { +fun PreviewLegalHoldSubjectConnectionDialog() { WireTheme { - LegalHoldInfoConnectionDialog("username", {}, {}) + LegalHoldSubjectConnectionDialog("username", {}, {}) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConversationDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConversationDialog.kt similarity index 83% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConversationDialog.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConversationDialog.kt index 07a63002230..9b804f13bdf 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoConversationDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConversationDialog.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.subject import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -24,11 +24,11 @@ import com.wire.android.ui.theme.WireTheme import com.wire.android.util.ui.PreviewMultipleThemes @Composable -fun LegalHoldInfoConversationDialog( +fun LegalHoldSubjectConversationDialog( conversationName: String, dialogDismissed: () -> Unit, ) { - LegalHoldInfoDialog( + LegalHoldSubjectBaseDialog( name = conversationName, isConversation = true, cancelText = stringResource(id = R.string.label_close), @@ -38,8 +38,8 @@ fun LegalHoldInfoConversationDialog( @Composable @PreviewMultipleThemes -fun PreviewLegalHoldInfoConversationDialog() { +fun PreviewLegalHoldSubjectConversationDialog() { WireTheme { - LegalHoldInfoConversationDialog("conversation name", {}) + LegalHoldSubjectConversationDialog("conversation name", {}) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectMessageDialog.kt similarity index 85% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectMessageDialog.kt index ce485ecd505..e13c22c854c 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoMessageDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectMessageDialog.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.subject import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -24,12 +24,12 @@ import com.wire.android.ui.theme.WireTheme import com.wire.android.util.ui.PreviewMultipleThemes @Composable -fun LegalHoldInfoMessageDialog( +fun LegalHoldSubjectMessageDialog( userName: String, dialogDismissed: () -> Unit, sendAnywayClicked: () -> Unit, ) { - LegalHoldInfoDialog( + LegalHoldSubjectBaseDialog( name = userName, isConversation = true, cancelText = stringResource(id = R.string.label_cancel), @@ -40,8 +40,8 @@ fun LegalHoldInfoMessageDialog( @Composable @PreviewMultipleThemes -fun PreviewLegalHoldInfoMessageDialog() { +fun PreviewLegalHoldSubjectMessageDialog() { WireTheme { - LegalHoldInfoMessageDialog("conversation name", {}, {}) + LegalHoldSubjectMessageDialog("conversation name", {}, {}) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectProfileDialog.kt similarity index 84% rename from app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt rename to app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectProfileDialog.kt index aa3332f2fa3..f0c6581164b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/LegalHoldInfoProfileDialog.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectProfileDialog.kt @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ -package com.wire.android.ui.legalhold +package com.wire.android.ui.legalhold.dialog.subject import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource @@ -24,11 +24,11 @@ import com.wire.android.ui.theme.WireTheme import com.wire.android.util.ui.PreviewMultipleThemes @Composable -fun LegalHoldInfoProfileDialog( +fun LegalHoldSubjectProfileDialog( userName: String, dialogDismissed: () -> Unit, ) { - LegalHoldInfoDialog( + LegalHoldSubjectBaseDialog( name = userName, isConversation = false, cancelText = stringResource(id = R.string.label_close), @@ -37,8 +37,8 @@ fun LegalHoldInfoProfileDialog( @Composable @PreviewMultipleThemes -fun PreviewLegalHoldInfoProfileDialog() { +fun PreviewLegalHoldSubjectProfileDialog() { WireTheme { - LegalHoldInfoProfileDialog("username", {}) + LegalHoldSubjectProfileDialog("username", {}) } }