diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/LearnMoreAboutLegalHoldButton.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/LearnMoreAboutLegalHoldButton.kt new file mode 100644 index 00000000000..fde6d3e9578 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/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.dialog.common + +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/dialog/deactivated/LegalHoldDeactivatedDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/deactivated/LegalHoldDeactivatedDialog.kt new file mode 100644 index 00000000000..7b372b28e00 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/deactivated/LegalHoldDeactivatedDialog.kt @@ -0,0 +1,56 @@ +/* + * 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.dialog.deactivated + +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.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 + +@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/dialog/requested/LegalHoldRequestedDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedDialog.kt new file mode 100644 index 00000000000..b2b1257734a --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedDialog.kt @@ -0,0 +1,170 @@ +/* + * 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.dialog.requested + +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.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.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/dialog/requested/LegalHoldRequestedState.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedState.kt new file mode 100644 index 00000000000..abad9ff1fb1 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/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.dialog.requested + +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/dialog/requested/LegalHoldRequestedViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/LegalHoldRequestedViewModel.kt new file mode 100644 index 00000000000..fba431e3964 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/requested/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.dialog.requested + +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/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectBaseDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectBaseDialog.kt new file mode 100644 index 00000000000..e8fe22f1f96 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectBaseDialog.kt @@ -0,0 +1,92 @@ +/* + * 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.dialog.subject + +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.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 LegalHoldSubjectBaseDialog( + 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).let { + if (isConversation) stringResource(id = R.string.legal_hold_subject_dialog_description_group) + "\n\n" + it + 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) + ) { + LearnMoreAboutLegalHoldButton() + if (!bottomDescriptionText.isNullOrEmpty()) { + Text( + text = bottomDescriptionText, + style = MaterialTheme.wireTypography.body01, + modifier = Modifier.fillMaxWidth() + ) + } + } + } +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldSubjectBaseDialog() { + WireTheme { + LegalHoldSubjectBaseDialog("username", true, "cancel", {}, Pair("send anyway", {}), "Send anyway?") + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConnectionDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConnectionDialog.kt new file mode 100644 index 00000000000..38ecafe0701 --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConnectionDialog.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.dialog.subject + +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 LegalHoldSubjectConnectionDialog( + userName: String, + dialogDismissed: () -> Unit, + connectClicked: () -> Unit, +) { + LegalHoldSubjectBaseDialog( + 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 PreviewLegalHoldSubjectConnectionDialog() { + WireTheme { + LegalHoldSubjectConnectionDialog("username", {}, {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConversationDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConversationDialog.kt new file mode 100644 index 00000000000..9b804f13bdf --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectConversationDialog.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.dialog.subject + +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 LegalHoldSubjectConversationDialog( + conversationName: String, + dialogDismissed: () -> Unit, +) { + LegalHoldSubjectBaseDialog( + name = conversationName, + isConversation = true, + cancelText = stringResource(id = R.string.label_close), + dialogDismissed = dialogDismissed + ) +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldSubjectConversationDialog() { + WireTheme { + LegalHoldSubjectConversationDialog("conversation name", {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectMessageDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectMessageDialog.kt new file mode 100644 index 00000000000..e13c22c854c --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectMessageDialog.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.dialog.subject + +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 LegalHoldSubjectMessageDialog( + userName: String, + dialogDismissed: () -> Unit, + sendAnywayClicked: () -> Unit, +) { + LegalHoldSubjectBaseDialog( + 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 PreviewLegalHoldSubjectMessageDialog() { + WireTheme { + LegalHoldSubjectMessageDialog("conversation name", {}, {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectProfileDialog.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectProfileDialog.kt new file mode 100644 index 00000000000..f0c6581164b --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/subject/LegalHoldSubjectProfileDialog.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.dialog.subject + +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 LegalHoldSubjectProfileDialog( + userName: String, + dialogDismissed: () -> Unit, +) { + LegalHoldSubjectBaseDialog( + name = userName, + isConversation = false, + cancelText = stringResource(id = R.string.label_close), + dialogDismissed = dialogDismissed) +} + +@Composable +@PreviewMultipleThemes +fun PreviewLegalHoldSubjectProfileDialog() { + WireTheme { + LegalHoldSubjectProfileDialog("username", {}) + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fef837e1d8b..f1e1256e2d9 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 +