-
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.
- Loading branch information
Showing
6 changed files
with
9 additions
and
19 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
7 changes: 3 additions & 4 deletions
7
...-compose/src/main/kotlin/ksm/navigation/compose/interceptor/CombinedComposeInterceptor.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 |
---|---|---|
@@ -1,16 +1,15 @@ | ||
package ksm.navigation.compose.interceptor | ||
|
||
import ksm.context.StateContext | ||
import ksm.navigation.compose.plugin.ComposeContent | ||
|
||
internal class CombinedComposeInterceptor( | ||
private val first: ComposeInterceptor?, | ||
private val second: ComposeInterceptor | ||
) : ComposeInterceptor { | ||
override fun intercept(context: StateContext, base: ComposeContent): ComposeContent { | ||
override fun intercept(base: ComposeContent): ComposeContent { | ||
var applied = base | ||
applied = first?.intercept(context, applied) ?: applied | ||
applied = second.intercept(context, applied) | ||
applied = first?.intercept(applied) ?: applied | ||
applied = second.intercept(applied) | ||
return applied | ||
} | ||
} |
6 changes: 1 addition & 5 deletions
6
...vigation-compose/src/main/kotlin/ksm/navigation/compose/interceptor/ComposeInterceptor.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
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
9 changes: 2 additions & 7 deletions
9
...ation/navigation-compose/src/main/kotlin/ksm/navigation/compose/wrapper/ComposeWrapper.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 |
---|---|---|
@@ -1,17 +1,12 @@ | ||
package ksm.navigation.compose.wrapper | ||
|
||
import ksm.StateController | ||
import ksm.asStateController | ||
import ksm.navigation.compose.interceptor.ComposeInterceptor | ||
import ksm.navigation.compose.plugin.ComposeContent | ||
|
||
public fun interface ComposeWrapper { | ||
public fun StateController.wrap(content: ComposeContent): ComposeContent | ||
public fun wrap(content: ComposeContent): ComposeContent | ||
} | ||
|
||
public fun ComposeWrapper.toInterceptor(): ComposeInterceptor { | ||
return ComposeInterceptor { context, base -> | ||
val controller = context.asStateController() | ||
controller.wrap(base) | ||
} | ||
return ComposeInterceptor(::wrap) | ||
} |