-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added better handling of DIInterceptor
- Loading branch information
Showing
10 changed files
with
98 additions
and
17 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
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
13 changes: 13 additions & 0 deletions
13
navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateContext.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,13 @@ | ||
package ksm.navigation.state.route | ||
|
||
import ksm.context.StateContext | ||
import ksm.navigation.state.route.interceptor.StateRouteInterceptor | ||
import ksm.navigation.state.route.plugin.StateRoutePlugin | ||
import ksm.plugin.plugin | ||
|
||
public fun StateContext.addStateReadyInterceptor(interceptor: StateRouteInterceptor) { | ||
plugin(StateRoutePlugin).addStateRouteInterceptor( | ||
context = this, | ||
interceptor = interceptor | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
navigation/src/commonMain/kotlin/ksm/navigation/state/route/StateControllerBuilder.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
13 changes: 13 additions & 0 deletions
13
...commonMain/kotlin/ksm/navigation/state/route/interceptor/CombinedStateRouteInterceptor.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,13 @@ | ||
package ksm.navigation.state.route.interceptor | ||
|
||
import ksm.context.StateContext | ||
|
||
internal class CombinedStateRouteInterceptor( | ||
private val first: StateRouteInterceptor?, | ||
private val second: StateRouteInterceptor | ||
) : StateRouteInterceptor { | ||
override fun onStateRoute(context: StateContext) { | ||
first?.onStateRoute(context) | ||
second.onStateRoute(context) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ion/src/commonMain/kotlin/ksm/navigation/state/route/interceptor/StateRouteInterceptor.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 ksm.navigation.state.route.interceptor | ||
|
||
import ksm.context.StateContext | ||
|
||
public fun interface StateRouteInterceptor { | ||
// Called after StateBuilderScope was built | ||
public fun onStateRoute(context: StateContext) | ||
} | ||
|
||
public operator fun StateRouteInterceptor?.plus(other: StateRouteInterceptor): StateRouteInterceptor { | ||
return CombinedStateRouteInterceptor( | ||
first = this, | ||
second = other | ||
) | ||
} |
12 changes: 12 additions & 0 deletions
12
navigation/src/commonMain/kotlin/ksm/navigation/state/route/plugin/StateRouteEntry.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,12 @@ | ||
package ksm.navigation.state.route.plugin | ||
|
||
import ksm.context.StateContext | ||
import ksm.navigation.state.route.interceptor.StateRouteInterceptor | ||
|
||
internal class StateRouteEntry : StateContext.Element { | ||
override val key = StateRouteEntry | ||
|
||
var interceptor: StateRouteInterceptor? = null | ||
|
||
companion object : StateContext.Key<StateRouteEntry> | ||
} |
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