Cut displayed text on iOS as otherwise view crashes (displays only a white screen then)

This commit is contained in:
dankito 2024-09-26 06:33:02 +02:00
parent e896fbb3cc
commit 1970eff09a
1 changed files with 12 additions and 3 deletions

View File

@ -15,12 +15,16 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import net.codinux.banking.persistence.entities.AccountTransactionEntity
import net.codinux.banking.ui.IOorDefault
import net.codinux.banking.ui.PlatformType
import net.codinux.banking.ui.config.Colors
import net.codinux.banking.ui.config.DI
import net.codinux.banking.ui.extensions.horizontalScroll
import net.codinux.banking.ui.extensions.verticalScroll
import net.codinux.banking.ui.service.BankDataImporterAndExporter
private const val iOSMaxDisplayedDataLength = 20_000
@Composable
fun ExportScreen(onClosed: () -> Unit) {
var transactions: Collection<AccountTransactionEntity>
@ -29,6 +33,8 @@ fun ExportScreen(onClosed: () -> Unit) {
var exportedDataText by remember { mutableStateOf("") }
var exportedDataTextToDisplay by remember { mutableStateOf("") }
val importerExporter = BankDataImporterAndExporter()
val clipboardManager = LocalClipboardManager.current
@ -42,12 +48,15 @@ fun ExportScreen(onClosed: () -> Unit) {
withContext(Dispatchers.Main) {
exportedDataText = initiallyExportedData
exportedDataTextToDisplay = if (DI.platform.type == PlatformType.iOS && exportedDataText.length > iOSMaxDisplayedDataLength) exportedDataText.substring(0,
iOSMaxDisplayedDataLength) + "\r\n...\r\n(Wir mussten die Anzeige abschneiden, da iOS mit längeren Zeichenketten nicht klar kommt (iOS only bug)"
else exportedDataText
isLoadingExportedData = false
}
}
FullscreenViewBase("Umsätze exportieren", onClosed = onClosed) {
Column {
Column(Modifier.fillMaxWidth()) {
Text("Es gibt leider noch keinen \"Datei auswählen Dialog\", ist sehr schwierig plattformübergreifend umzusetzen, deshalb bitte folgenden Text kopieren und in eine Textdatei einfügen:")
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
@ -68,8 +77,8 @@ fun ExportScreen(onClosed: () -> Unit) {
}
} else {
Column(Modifier.verticalScroll().horizontalScroll()) {
SelectionContainer {
Text(exportedDataText, fontFamily = FontFamily.Monospace)
SelectionContainer(modifier = Modifier.fillMaxSize()) {
Text(exportedDataTextToDisplay, fontFamily = FontFamily.Monospace)
}
}
}