mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: modern APIs — Koin 4.2, CMP 1.11, Ktor resilience, Room @Upsert, injected dispatchers (#5119)
This commit is contained in:
parent
99378c9291
commit
9acdf5309f
32 changed files with 453 additions and 278 deletions
|
|
@ -27,17 +27,18 @@ import androidx.compose.runtime.mutableLongStateOf
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import org.meshtastic.core.common.util.nowMillis
|
||||
|
||||
@Composable
|
||||
actual fun rememberTimeTickWithLifecycle(): Long {
|
||||
val context = LocalContext.current
|
||||
var value by remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
var value by remember { mutableLongStateOf(nowMillis) }
|
||||
|
||||
DisposableEffect(context) {
|
||||
val receiver =
|
||||
object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
value = System.currentTimeMillis()
|
||||
value = nowMillis
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.meshtastic.core.ui.component
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import org.meshtastic.core.common.util.nowMillis
|
||||
|
||||
/** JVM implementation — returns System.currentTimeMillis() (no lifecycle-based updates on Desktop). */
|
||||
@Composable actual fun rememberTimeTickWithLifecycle(): Long = System.currentTimeMillis()
|
||||
/** JVM implementation — returns the current epoch millis (no lifecycle-based updates on Desktop). */
|
||||
@Composable actual fun rememberTimeTickWithLifecycle(): Long = nowMillis
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue