Android drawer: tag-view tracking in its own composable (#5931)
CI & Build / Python lint (push) Successful in 2s
CI & Build / Build now, or wait for Android? (push) Successful in 2s
Android / Build, or is the channel already serving this? (push) Successful in 2s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 2s
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Skipped
Desktop (Tauri) / Tauri desktop (Linux) (push) Skipped
Desktop (Tauri) / Windows installer (cross-compiled) (push) Skipped
Desktop (Tauri) / Update manifest (push) Skipped
CI & Build / Web typecheck and unit tests (push) Successful in 8s
CI & Build / Python tests (push) Successful in 13s
Android / Core and FFI clippy and tests (push) Successful in 24s
CI & Build / integration (push) Successful in 1m28s
CI & Build / Build & push image (push) Skipped
Android / Kotlin + Rust (APK) (push) Failing after 3m32s
Android / Build the server image (push) Skipped
CI & Build / Python lint (push) Successful in 2s
CI & Build / Build now, or wait for Android? (push) Successful in 2s
Android / Build, or is the channel already serving this? (push) Successful in 2s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 2s
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Skipped
Desktop (Tauri) / Tauri desktop (Linux) (push) Skipped
Desktop (Tauri) / Windows installer (cross-compiled) (push) Skipped
Desktop (Tauri) / Update manifest (push) Skipped
CI & Build / Web typecheck and unit tests (push) Successful in 8s
CI & Build / Python tests (push) Successful in 13s
Android / Core and FFI clippy and tests (push) Successful in 24s
CI & Build / integration (push) Successful in 1m28s
CI & Build / Build & push image (push) Skipped
Android / Kotlin + Rust (APK) (push) Failing after 3m32s
Android / Build the server image (push) Skipped
detekt's cyclomatic-complexity limit on BoardScreen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -99,15 +99,7 @@ fun BoardScreen(
|
|||||||
) {
|
) {
|
||||||
val drawerState = rememberDrawerState(DrawerValue.Closed)
|
val drawerState = rememberDrawerState(DrawerValue.Closed)
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
val views = rememberTagViews(state.destination)
|
||||||
// Opening a tag's lens counts as using it, however it was opened: from the
|
|
||||||
// drawer, or a tag on a card (#5931).
|
|
||||||
val context = LocalContext.current
|
|
||||||
val tagViews = remember(context) { TagViews(context) }
|
|
||||||
var views by remember { mutableStateOf(tagViews.all()) }
|
|
||||||
LaunchedEffect(state.destination) {
|
|
||||||
(state.destination as? Destination.WithLabel)?.let { views = tagViews.record(it.id) }
|
|
||||||
}
|
|
||||||
val snackbars = remember { SnackbarHostState() }
|
val snackbars = remember { SnackbarHostState() }
|
||||||
|
|
||||||
// Held HERE rather than on the card. A card lives in a lazy grid and is disposed
|
// Held HERE rather than on the card. A card lives in a lazy grid and is disposed
|
||||||
@@ -410,6 +402,21 @@ private fun SearchBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When each tag's lens was last opened here. Opening one counts as using it,
|
||||||
|
* however it was opened: from the drawer, or a tag on a card (#5931).
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
private fun rememberTagViews(destination: Destination): Map<String, Long> {
|
||||||
|
val context = LocalContext.current
|
||||||
|
val tagViews = remember(context) { TagViews(context) }
|
||||||
|
var views by remember { mutableStateOf(tagViews.all()) }
|
||||||
|
LaunchedEffect(destination) {
|
||||||
|
if (destination is Destination.WithLabel) views = tagViews.record(destination.id)
|
||||||
|
}
|
||||||
|
return views
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun NavigationDrawer(
|
private fun NavigationDrawer(
|
||||||
current: Destination,
|
current: Destination,
|
||||||
|
|||||||
Reference in New Issue
Block a user