Skip to content

Commit 9b0eb9a

Browse files
update SnifferPlugin.kt
1 parent 11b706c commit 9b0eb9a

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

Example/composeApp/src/commonMain/kotlin/org/example/project/App.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import ui.SnifferIndicator
88
@Composable
99
@Preview
1010
fun App() {
11-
ContextScope {
12-
MainPanel()
13-
}
14-
11+
MainPanel()
1512
SnifferIndicator()
1613
}

Example/composeApp/src/commonMain/kotlin/org/example/project/Context.kt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,13 @@
11
package org.example.project
22

3-
import androidx.compose.runtime.Composable
4-
import androidx.compose.runtime.CompositionLocalProvider
5-
import androidx.compose.runtime.remember
63
import androidx.compose.runtime.staticCompositionLocalOf
74
import io.ktor.client.*
85
import io.ktor.client.plugins.contentnegotiation.*
96
import io.ktor.serialization.kotlinx.json.*
107
import kotlinx.serialization.json.Json
118
import util.ktor.SnifferPlugin
129

13-
val LocalHttpClient = staticCompositionLocalOf<HttpClient> { error("Not provider") }
14-
15-
@Composable
16-
fun ContextScope(
17-
content: @Composable () -> Unit
18-
) {
19-
val httpClient = remember { defaultHttpClient() }
20-
21-
CompositionLocalProvider(LocalHttpClient provides httpClient) {
22-
content.invoke()
23-
}
24-
}
10+
val LocalHttpClient = staticCompositionLocalOf { defaultHttpClient() }
2511

2612
fun defaultHttpClient(): HttpClient {
2713
return HttpClient {

0 commit comments

Comments
 (0)