Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions compose/api/compose.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,10 @@ final object app.tinyui.components.generated/BuiltinSchemas { // app.tinyui.comp
final fun <get-Box>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.Box.<get-Box>|<get-Box>(){}[0]
final val Button // app.tinyui.components.generated/BuiltinSchemas.Button|{}Button[0]
final fun <get-Button>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.Button.<get-Button>|<get-Button>(){}[0]
final val Checkbox // app.tinyui.components.generated/BuiltinSchemas.Checkbox|{}Checkbox[0]
final fun <get-Checkbox>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.Checkbox.<get-Checkbox>|<get-Checkbox>(){}[0]
final val CodeField // app.tinyui.components.generated/BuiltinSchemas.CodeField|{}CodeField[0]
final fun <get-CodeField>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.CodeField.<get-CodeField>|<get-CodeField>(){}[0]
final val Column // app.tinyui.components.generated/BuiltinSchemas.Column|{}Column[0]
final fun <get-Column>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.Column.<get-Column>|<get-Column>(){}[0]
final val Divider // app.tinyui.components.generated/BuiltinSchemas.Divider|{}Divider[0]
Expand All @@ -697,10 +701,14 @@ final object app.tinyui.components.generated/BuiltinSchemas { // app.tinyui.comp
final fun <get-LazyColumn>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.LazyColumn.<get-LazyColumn>|<get-LazyColumn>(){}[0]
final val Loading // app.tinyui.components.generated/BuiltinSchemas.Loading|{}Loading[0]
final fun <get-Loading>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.Loading.<get-Loading>|<get-Loading>(){}[0]
final val Option // app.tinyui.components.generated/BuiltinSchemas.Option|{}Option[0]
final fun <get-Option>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.Option.<get-Option>|<get-Option>(){}[0]
final val RadioButton // app.tinyui.components.generated/BuiltinSchemas.RadioButton|{}RadioButton[0]
final fun <get-RadioButton>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.RadioButton.<get-RadioButton>|<get-RadioButton>(){}[0]
final val Row // app.tinyui.components.generated/BuiltinSchemas.Row|{}Row[0]
final fun <get-Row>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.Row.<get-Row>|<get-Row>(){}[0]
final val Select // app.tinyui.components.generated/BuiltinSchemas.Select|{}Select[0]
final fun <get-Select>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.Select.<get-Select>|<get-Select>(){}[0]
final val Spacer // app.tinyui.components.generated/BuiltinSchemas.Spacer|{}Spacer[0]
final fun <get-Spacer>(): app.tinyui.schema/ComponentSchema // app.tinyui.components.generated/BuiltinSchemas.Spacer.<get-Spacer>|<get-Spacer>(){}[0]
final val Text // app.tinyui.components.generated/BuiltinSchemas.Text|{}Text[0]
Expand Down
4 changes: 4 additions & 0 deletions compose/src/androidMain/kotlin/app/tinyui/Platform.android.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import io.ktor.client.HttpClient
import io.ktor.client.engine.okhttp.OkHttp
import java.util.Locale
import java.util.TimeZone
import androidx.compose.ui.text.input.PlatformImeOptions
import okio.FileSystem

internal actual fun platformInfo(): Map<String, String> = mapOf(
Expand All @@ -25,6 +26,9 @@ internal actual fun zoneOffsetMinutes(zone: String, epochMs: Long): Int? =

internal actual fun plainTextClipEntry(text: String): ClipEntry = ClipEntry(ClipData.newPlainText(null, text))

// Android autofill takes the content type from semantics (the component sets it), so nothing goes through the IME options
internal actual fun oneTimeCodeImeOptions(oneTimeCode: Boolean): PlatformImeOptions? = null

internal actual val platformFileSystem: FileSystem = FileSystem.SYSTEM

internal actual fun defaultHttpClient(): HttpClient = HttpClient(OkHttp)
7 changes: 7 additions & 0 deletions compose/src/commonMain/kotlin/app/tinyui/HostInterfaces.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app.tinyui

import androidx.compose.ui.platform.ClipEntry
import androidx.compose.ui.text.input.PlatformImeOptions
import kotlin.concurrent.atomics.AtomicReference
import kotlin.concurrent.atomics.ExperimentalAtomicApi
import kotlin.concurrent.atomics.update
Expand Down Expand Up @@ -145,3 +146,9 @@ internal expect fun systemTimeZone(): String
internal expect fun zoneOffsetMinutes(zone: String, epochMs: Long): Int?

internal expect fun plainTextClipEntry(text: String): ClipEntry

/**
* iOS reads the text content type only from here, never from semantics, and otherwise derives it from the keyboard:
* NumberPassword would make a code field a password field. Null where the platform has nothing to say (Android).
*/
internal expect fun oneTimeCodeImeOptions(oneTimeCode: Boolean): PlatformImeOptions?
5 changes: 4 additions & 1 deletion compose/src/commonMain/kotlin/app/tinyui/PageHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ class PageHost internal constructor(
private set

private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
// the engine lock is fair, but entries launched on a multi-threaded pool can reach it out of order: one lane keeps
// them in call order up to the lock (onChange before onComplete, onFocusChange before onCommit)
private val entryLane = Dispatchers.Default.limitedParallelism(1)
private val timers = HashMap<Int, Job>()
private val subscriptions = HashMap<String, AutoCloseable>()
private val storeVersions = HashMap<String, Long>()
Expand Down Expand Up @@ -205,7 +208,7 @@ class PageHost internal constructor(

private fun entry(name: String, vararg args: JsValue, before: () -> Unit = {}, skipWhen: () -> Boolean = { false }) {
if (failure != null) return
scope.launch {
scope.launch(entryLane) {
try {
withTimeout(entryTimeoutMs) {
runtime.withEngine {
Expand Down
Loading
Loading