AGPL-3.0-only, a source link in the app, and everything on dev since #5 #6
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user