Showing MessageLog in FeedbackScreen
This commit is contained in:
parent
9c9d52f03e
commit
fe3a97377f
|
@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material.Icon
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.automirrored.filled.Message
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.SaveAs
|
import androidx.compose.material.icons.filled.SaveAs
|
||||||
import androidx.compose.material.icons.outlined.Key
|
import androidx.compose.material.icons.outlined.Key
|
||||||
|
@ -120,6 +121,15 @@ fun SideMenuContent() {
|
||||||
drawerState.close()
|
drawerState.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NavigationMenuItem(itemModifier, "Feedback", textColor, horizontalPadding = ItemHorizontalPadding,
|
||||||
|
icon = { Icon(Icons.AutoMirrored.Filled.Message, "Feedback an die Entwickler geben", Modifier.size(iconSize), tint = textColor) }) {
|
||||||
|
uiState.showFeedbackScreen.value = true
|
||||||
|
|
||||||
|
coroutineScope.launch {
|
||||||
|
drawerState.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ fun StateHandler(uiState: UiState, snackbarHostState: SnackbarHostState) {
|
||||||
val showBankAccountSettingsScreenForAccount by uiState.showBankAccountSettingsScreenForAccount.collectAsState()
|
val showBankAccountSettingsScreenForAccount by uiState.showBankAccountSettingsScreenForAccount.collectAsState()
|
||||||
|
|
||||||
val showExportScreen by uiState.showExportScreen.collectAsState()
|
val showExportScreen by uiState.showExportScreen.collectAsState()
|
||||||
|
val showFeedbackScreen by uiState.showFeedbackScreen.collectAsState()
|
||||||
val showProtectAppSettingsScreen by uiState.showProtectAppSettingsScreen.collectAsState()
|
val showProtectAppSettingsScreen by uiState.showProtectAppSettingsScreen.collectAsState()
|
||||||
|
|
||||||
val tanChallengeReceived by uiState.tanChallengeReceived.collectAsState()
|
val tanChallengeReceived by uiState.tanChallengeReceived.collectAsState()
|
||||||
|
@ -68,6 +69,10 @@ fun StateHandler(uiState: UiState, snackbarHostState: SnackbarHostState) {
|
||||||
ExportScreen { uiState.showExportScreen.value = false }
|
ExportScreen { uiState.showExportScreen.value = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showFeedbackScreen) {
|
||||||
|
FeedbackScreen { uiState.showFeedbackScreen.value = false }
|
||||||
|
}
|
||||||
|
|
||||||
if (showProtectAppSettingsScreen) {
|
if (showProtectAppSettingsScreen) {
|
||||||
ProtectAppSettingsDialog(uiState.appSettings.value) { uiState.showProtectAppSettingsScreen.value = false }
|
ProtectAppSettingsDialog(uiState.appSettings.value) { uiState.showProtectAppSettingsScreen.value = false }
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
package net.codinux.banking.ui.screens
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.material.TextButton
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.platform.LocalClipboardManager
|
||||||
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import net.codinux.banking.ui.IOorDefault
|
||||||
|
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.model.Config.NewLine
|
||||||
|
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun FeedbackScreen(onClosed: () -> Unit) {
|
||||||
|
|
||||||
|
val messageLog by remember { mutableStateOf(DI.bankingService.getMessageLog()) }
|
||||||
|
|
||||||
|
val displayedLogEntries by remember { derivedStateOf { messageLog } }
|
||||||
|
|
||||||
|
val displayedLogEntriesText by remember(displayedLogEntries) {
|
||||||
|
derivedStateOf { displayedLogEntries.map {
|
||||||
|
"${it.messageNumberString} ${it.type} ${it.messageCategory} ${it.messageSubCategory}${NewLine}${it.message}"
|
||||||
|
}.joinToString(NewLine + NewLine) }
|
||||||
|
}
|
||||||
|
|
||||||
|
val clipboardManager = LocalClipboardManager.current
|
||||||
|
|
||||||
|
val coroutineScope = rememberCoroutineScope()
|
||||||
|
|
||||||
|
coroutineScope.launch(Dispatchers.IOorDefault) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FullscreenViewBase("Feedback", onClosed = onClosed) {
|
||||||
|
Column(Modifier.fillMaxWidth()) {
|
||||||
|
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
|
||||||
|
TextButton({ clipboardManager.setText(AnnotatedString(displayedLogEntriesText))}) {
|
||||||
|
Text("Kopieren", color = Colors.CodinuxSecondaryColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column(Modifier.verticalScroll().horizontalScroll()) {
|
||||||
|
SelectionContainer(modifier = Modifier.fillMaxSize()) {
|
||||||
|
Text(displayedLogEntriesText, fontFamily = FontFamily.Monospace)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -79,6 +79,8 @@ class UiState : ViewModel() {
|
||||||
|
|
||||||
val showExportScreen = MutableStateFlow(false)
|
val showExportScreen = MutableStateFlow(false)
|
||||||
|
|
||||||
|
val showFeedbackScreen = MutableStateFlow(false)
|
||||||
|
|
||||||
val showProtectAppSettingsScreen = MutableStateFlow(false)
|
val showProtectAppSettingsScreen = MutableStateFlow(false)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue