Android drawer: rememberTagViews lives with the recent-tags code (#5931)
CI & Build / Python lint (push) Successful in 3s
CI & Build / Build now, or wait for Android? (push) Successful in 3s
Android / Build, or is the channel already serving this? (push) Successful in 3s
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 10s
CI & Build / Python tests (push) Successful in 15s
Android / Core and FFI clippy and tests (push) Successful in 26s
CI & Build / integration (push) Successful in 1m30s
CI & Build / Build & push image (push) Skipped
Android / Kotlin + Rust (APK) (push) Failing after 4m29s
Android / Build the server image (push) Skipped

detekt's function-count limit on BoardScreen.kt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 15:07:09 -04:00
co-authored by Claude Opus 5.5
parent 96e9fbfb3a
commit 7cb05b77c6
2 changed files with 23 additions and 17 deletions
@@ -69,13 +69,11 @@ import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.boundsInRoot
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import com.fabledsword.inkwell.R
import com.fabledsword.inkwell.TagViews
import com.fabledsword.inkwell.core.Label
import com.fabledsword.inkwell.core.Note
import kotlinx.coroutines.launch
@@ -402,21 +400,6 @@ 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
private fun NavigationDrawer(
current: Destination,
@@ -1,5 +1,13 @@
package com.fabledsword.inkwell.ui
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import com.fabledsword.inkwell.TagViews
import com.fabledsword.inkwell.core.Label
import com.fabledsword.inkwell.core.Note
import java.time.OffsetDateTime
@@ -50,3 +58,18 @@ fun tagRecency(
/** 0 for a missing or unreadable stamp: such a tag simply ranks last. */
fun epochMillis(stamp: String?): Long =
stamp?.let { runCatching { OffsetDateTime.parse(it).toInstant().toEpochMilli() }.getOrNull() } ?: 0L
/**
* 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
internal 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
}