-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add default router context for ios targets
- Loading branch information
Showing
5 changed files
with
64 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/src/iosMain/kotlin/io/github/xxfast/decompose/router/app/utils/RouterContext.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.github.xxfast.decompose.router.app.utils | ||
|
||
import com.arkivanov.essenty.lifecycle.Lifecycle | ||
import com.arkivanov.essenty.lifecycle.LifecycleRegistry | ||
import com.arkivanov.essenty.lifecycle.destroy | ||
import com.arkivanov.essenty.lifecycle.resume | ||
import com.arkivanov.essenty.lifecycle.stop | ||
import io.github.xxfast.decompose.router.RouterContext | ||
import io.github.xxfast.decompose.router.defaultRouterContext | ||
|
||
fun defaultRouterContext(): RouterContext = defaultRouterContext() | ||
val Lifecycle.registry get() = this as LifecycleRegistry | ||
fun Lifecycle.destroy() = registry.destroy() | ||
fun Lifecycle.resume() = registry.resume() | ||
fun Lifecycle.stop() = registry.stop() |
11 changes: 11 additions & 0 deletions
11
decompose-router/src/iosMain/kotlin/io/github/xxfast/decompose/router/RouterContext.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package io.github.xxfast.decompose.router | ||
|
||
import com.arkivanov.essenty.backhandler.BackDispatcher | ||
import com.arkivanov.essenty.lifecycle.LifecycleRegistry | ||
|
||
fun defaultRouterContext(): RouterContext { | ||
val backDispatcher = BackDispatcher() | ||
val lifecycle = LifecycleRegistry() | ||
return RouterContext(lifecycle = lifecycle, backHandler = backDispatcher) | ||
} | ||
|