Revert "feat: enhance navigation behavior in MainApp and add log export functionality in LogsScreen"
This reverts commit 29540cad8f.
This commit is contained in:
@@ -73,33 +73,23 @@ fun MainApp() {
|
|||||||
NavigationBarItem(
|
NavigationBarItem(
|
||||||
selected = currentRoute == Routes.Tables || currentRoute?.startsWith("list/") == true,
|
selected = currentRoute == Routes.Tables || currentRoute?.startsWith("list/") == true,
|
||||||
onClick = {
|
onClick = {
|
||||||
if (currentRoute?.startsWith("list/") == true) {
|
|
||||||
// Behave like back from details to tables overview
|
|
||||||
navController.popBackStack()
|
|
||||||
} else {
|
|
||||||
navController.navigate(Routes.Tables) {
|
navController.navigate(Routes.Tables) {
|
||||||
popUpTo(navController.graph.findStartDestination().id) { saveState = true }
|
popUpTo(navController.graph.findStartDestination().id) { saveState = true }
|
||||||
launchSingleTop = true
|
launchSingleTop = true
|
||||||
restoreState = true
|
restoreState = true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
icon = { androidx.compose.material3.Icon(Icons.Default.Home, contentDescription = null) },
|
icon = { androidx.compose.material3.Icon(Icons.Default.Home, contentDescription = null) },
|
||||||
label = { Text("Tables") },
|
label = { Text("Tables") },
|
||||||
)
|
)
|
||||||
NavigationBarItem(
|
NavigationBarItem(
|
||||||
selected = currentRoute == Routes.Settings || currentRoute == Routes.Logs,
|
selected = currentRoute == Routes.Settings,
|
||||||
onClick = {
|
onClick = {
|
||||||
if (currentRoute == Routes.Logs) {
|
|
||||||
// Behave like back from logs to settings screen
|
|
||||||
navController.popBackStack()
|
|
||||||
} else {
|
|
||||||
navController.navigate(Routes.Settings) {
|
navController.navigate(Routes.Settings) {
|
||||||
popUpTo(navController.graph.findStartDestination().id) { saveState = true }
|
popUpTo(navController.graph.findStartDestination().id) { saveState = true }
|
||||||
launchSingleTop = true
|
launchSingleTop = true
|
||||||
restoreState = true
|
restoreState = true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
icon = { androidx.compose.material3.Icon(Icons.Default.Settings, contentDescription = null) },
|
icon = { androidx.compose.material3.Icon(Icons.Default.Settings, contentDescription = null) },
|
||||||
label = { Text("Settings") },
|
label = { Text("Settings") },
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.material.icons.filled.Delete
|
import androidx.compose.material.icons.filled.Delete
|
||||||
import androidx.compose.material.icons.filled.Share
|
|
||||||
import androidx.compose.material.icons.filled.FilterList
|
import androidx.compose.material.icons.filled.FilterList
|
||||||
import androidx.compose.material3.Badge
|
import androidx.compose.material3.Badge
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
@@ -55,8 +54,6 @@ import androidx.compose.ui.unit.sp
|
|||||||
import com.collabtable.app.utils.LogEntry
|
import com.collabtable.app.utils.LogEntry
|
||||||
import com.collabtable.app.utils.LogLevel
|
import com.collabtable.app.utils.LogLevel
|
||||||
import com.collabtable.app.utils.Logger
|
import com.collabtable.app.utils.Logger
|
||||||
import android.content.Intent
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
|
||||||
|
|
||||||
enum class TimeRange(val label: String, val milliseconds: Long) {
|
enum class TimeRange(val label: String, val milliseconds: Long) {
|
||||||
LAST_10_SECONDS("Last 10 seconds", 10_000),
|
LAST_10_SECONDS("Last 10 seconds", 10_000),
|
||||||
@@ -129,20 +126,6 @@ fun LogsScreen(onNavigateBack: () -> Unit) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions = {
|
actions = {
|
||||||
// Export logs via share intent
|
|
||||||
val ctx = LocalContext.current
|
|
||||||
IconButton(onClick = {
|
|
||||||
val all = logs.joinToString(separator = "\n") { it.toFormattedString() }
|
|
||||||
val sendIntent = Intent(Intent.ACTION_SEND).apply {
|
|
||||||
type = "text/plain"
|
|
||||||
putExtra(Intent.EXTRA_TEXT, all)
|
|
||||||
putExtra(Intent.EXTRA_SUBJECT, "CollabTable Logs")
|
|
||||||
}
|
|
||||||
val chooser = Intent.createChooser(sendIntent, "Export logs")
|
|
||||||
ctx.startActivity(chooser)
|
|
||||||
}) {
|
|
||||||
Icon(Icons.Default.Share, contentDescription = "Export logs")
|
|
||||||
}
|
|
||||||
IconButton(onClick = { showFilterSheet = true }) {
|
IconButton(onClick = { showFilterSheet = true }) {
|
||||||
Badge(
|
Badge(
|
||||||
containerColor =
|
containerColor =
|
||||||
@@ -261,7 +244,7 @@ fun LogsScreen(onNavigateBack: () -> Unit) {
|
|||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(MaterialTheme.colorScheme.background),
|
.background(Color(0xFF1E1E1E)),
|
||||||
contentPadding = PaddingValues(8.dp),
|
contentPadding = PaddingValues(8.dp),
|
||||||
) {
|
) {
|
||||||
items(filteredLogs) { log ->
|
items(filteredLogs) { log ->
|
||||||
|
|||||||
Reference in New Issue
Block a user