From 44a4c5b1b826909f68073f7045992fc775d496e4 Mon Sep 17 00:00:00 2001 From: Yamil Medina Date: Fri, 22 Sep 2023 10:18:46 -0300 Subject: [PATCH] fix: max accounts dialog prevent dismiss (WPB-4818) (#2260) --- .../dialogs/MaxAccountsReachedDialog.kt | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 app/src/main/kotlin/com/wire/android/ui/common/dialogs/MaxAccountsReachedDialog.kt diff --git a/app/src/main/kotlin/com/wire/android/ui/common/dialogs/MaxAccountsReachedDialog.kt b/app/src/main/kotlin/com/wire/android/ui/common/dialogs/MaxAccountsReachedDialog.kt new file mode 100644 index 00000000000..3c7cdb29a6a --- /dev/null +++ b/app/src/main/kotlin/com/wire/android/ui/common/dialogs/MaxAccountsReachedDialog.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.common.dialogs + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource +import com.wire.android.R +import com.wire.android.ui.common.VisibilityState +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.visbility.VisibilityState +import com.wire.android.ui.common.wireDialogPropertiesBuilder + +// todo: parametrize the dialog with the number of accounts using BuildConfig +@Composable +fun MaxAccountsReachedDialogContent( + dialogState: VisibilityState, + onActionButtonClicked: () -> Unit +) { + VisibilityState(dialogState) { state -> + WireDialog( + title = stringResource(id = R.string.max_account_reached_dialog_title), + text = stringResource(id = R.string.max_account_reached_dialog_message), + onDismiss = dialogState::dismiss, + optionButton1Properties = WireDialogButtonProperties( + text = stringResource(R.string.label_ok), + onClick = onActionButtonClicked, + type = WireDialogButtonType.Primary + ), + properties = wireDialogPropertiesBuilder( + dismissOnBackPress = false, + dismissOnClickOutside = false + ) + ) + } +}