log headers, add user agent to backend app
This commit is contained in:
@@ -59,31 +59,23 @@ fun main() {
|
||||
|
||||
@OptIn(ExperimentalDecomposeApi::class, ExperimentalComposeUiApi::class)
|
||||
fun mainInternal() {
|
||||
val lifecycle = LifecycleRegistry()
|
||||
|
||||
startKoin<VBox>()
|
||||
|
||||
val lifecycle = LifecycleRegistry()
|
||||
val composeRoot = document.getElementById("compose-root") as HTMLElement
|
||||
|
||||
var rootRef: VBoxRootComponent? = null
|
||||
|
||||
val root: VBoxRootComponent = withWebHistory { stateKeeper: StateKeeper, deepLinkUrl: String? ->
|
||||
if (rootRef == null) {
|
||||
rootRef = createRoot(lifecycle, stateKeeper, deepLinkUrl)
|
||||
}
|
||||
rootRef
|
||||
}
|
||||
|
||||
hookPageVisibility(lifecycle)
|
||||
lifecycle.doOnResume { hideElementById("loader") }
|
||||
|
||||
ComposeViewport(viewportContainer = composeRoot, content = {
|
||||
val r = remember { root }
|
||||
|
||||
LaunchedEffect(null) {
|
||||
r.onFinish.collect { r.navReplace(Route.Loading()) }
|
||||
}
|
||||
|
||||
Box(Modifier.fillMaxSize().padding(WindowInsets.safeDrawing.asPaddingValues())) {
|
||||
Nav(r)
|
||||
}
|
||||
@@ -93,14 +85,12 @@ fun mainInternal() {
|
||||
private fun createRoot(
|
||||
lifecycle: LifecycleRegistry,
|
||||
stateKeeper: StateKeeper,
|
||||
deepLinkUrl: String?,
|
||||
deepLinkUrl: String?
|
||||
): VBoxRootComponent {
|
||||
val ctx = DefaultComponentContext(
|
||||
lifecycle = lifecycle, stateKeeper = stateKeeper
|
||||
)
|
||||
val deep = deepLinkUrl?.let { runCatching { UrlRoutes.parseUrl(it) }.getOrNull() }
|
||||
|
||||
val deep = deepLinkUrl?.let { UrlRoutes.parseUrl(it) }
|
||||
val initRoute: Route = deep ?: Route.default
|
||||
|
||||
return koin.get<RootFactory>().create(context = ctx, initStack = initRoute)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user