|
| 1 | +/* |
| 2 | + * Infomaniak SwissTransfer - Android |
| 3 | + * Copyright (C) 2025 Infomaniak Network SA |
| 4 | + * |
| 5 | + * This program is free software: you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU General Public License as published by |
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
| 8 | + * (at your option) any later version. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License |
| 16 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | + */ |
| 18 | +package com.infomaniak.swisstransfer.ui.screen.main.received |
| 19 | + |
| 20 | +import androidx.compose.foundation.Image |
| 21 | +import androidx.compose.foundation.layout.* |
| 22 | +import androidx.compose.material3.Surface |
| 23 | +import androidx.compose.material3.Text |
| 24 | +import androidx.compose.runtime.Composable |
| 25 | +import androidx.compose.ui.Alignment |
| 26 | +import androidx.compose.ui.Modifier |
| 27 | +import androidx.compose.ui.res.stringResource |
| 28 | +import androidx.compose.ui.text.style.TextAlign |
| 29 | +import com.infomaniak.swisstransfer.R |
| 30 | +import com.infomaniak.swisstransfer.ui.components.ActionsOnlyTopAppBar |
| 31 | +import com.infomaniak.swisstransfer.ui.components.EmptyTopAppBar |
| 32 | +import com.infomaniak.swisstransfer.ui.components.TopAppBarButtons |
| 33 | +import com.infomaniak.swisstransfer.ui.images.AppImages.AppIllus |
| 34 | +import com.infomaniak.swisstransfer.ui.images.illus.mascotDead.MascotDead |
| 35 | +import com.infomaniak.swisstransfer.ui.screen.main.components.SwissTransferScaffold |
| 36 | +import com.infomaniak.swisstransfer.ui.theme.Margin |
| 37 | +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme |
| 38 | +import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows |
| 39 | + |
| 40 | +@Composable |
| 41 | +fun TransferExpiredDownloadCreditScreen(onCloseClicked: (() -> Unit)? = null) { |
| 42 | + SwissTransferScaffold( |
| 43 | + topBar = { |
| 44 | + onCloseClicked?.let { |
| 45 | + ActionsOnlyTopAppBar(actions = { TopAppBarButtons.Close(onClick = it) }) |
| 46 | + } ?: EmptyTopAppBar() |
| 47 | + }, |
| 48 | + ) { |
| 49 | + Column( |
| 50 | + modifier = Modifier.fillMaxSize(), |
| 51 | + horizontalAlignment = Alignment.CenterHorizontally, |
| 52 | + verticalArrangement = Arrangement.Center, |
| 53 | + ) { |
| 54 | + |
| 55 | + val paddedModifier = Modifier.padding(horizontal = Margin.Medium) |
| 56 | + |
| 57 | + Image( |
| 58 | + modifier = paddedModifier, |
| 59 | + imageVector = AppIllus.MascotDead.image(), |
| 60 | + contentDescription = null |
| 61 | + ) |
| 62 | + |
| 63 | + Spacer(Modifier.height(Margin.Large)) |
| 64 | + |
| 65 | + Text( |
| 66 | + text = stringResource(R.string.transferExpiredTitle), |
| 67 | + textAlign = TextAlign.Center, |
| 68 | + style = SwissTransferTheme.typography.bodyMedium, |
| 69 | + color = SwissTransferTheme.colors.primaryTextColor, |
| 70 | + modifier = paddedModifier, |
| 71 | + ) |
| 72 | + |
| 73 | + Spacer(Modifier.height(Margin.Large)) |
| 74 | + |
| 75 | + // TODO: Waiting for a general string. |
| 76 | + Text( |
| 77 | + text = stringResource(R.string.deeplinkTransferExpired), |
| 78 | + textAlign = TextAlign.Center, |
| 79 | + style = SwissTransferTheme.typography.bodyRegular, |
| 80 | + color = SwissTransferTheme.colors.secondaryTextColor, |
| 81 | + modifier = paddedModifier, |
| 82 | + ) |
| 83 | + } |
| 84 | + } |
| 85 | +} |
| 86 | + |
| 87 | +@PreviewAllWindows |
| 88 | +@Composable |
| 89 | +private fun Preview() { |
| 90 | + SwissTransferTheme { |
| 91 | + Surface { |
| 92 | + TransferExpiredDownloadCreditScreen(onCloseClicked = {}) |
| 93 | + } |
| 94 | + } |
| 95 | +} |
0 commit comments