-
Notifications
You must be signed in to change notification settings - Fork 10
Nav3 #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Nav3 #191
Conversation
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this file
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
class ExampleUnitTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this file
@@ -0,0 +1,4 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this file
@@ -0,0 +1,16 @@ | |||
package io.github.openflocon.navigation | |||
|
|||
class FloconNavigationState internal constructor() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please :
- split into interface/impl
interface FloconNavigationState {
val stack: State<List<FloconRoute>>
fun navigate(route: FloconRoute)
fun back(count: Int = 1)
}
- use a mutable state & collect
// not sure mutableStateListOf exists, maybe mutableStateOf<List>(
class FloconNavigationState internal constructor() {
private val _stack = mutableStateListOf<FloconRoute>(LoadingRoute)
val stack: State<List<FloconRoute>> = _stack
fun navigate(route: FloconRoute) {
_stack.add(route)
}
fun back(count: Int = 1) {
repeat(count) { _stack.removeLast() }
}
}
val stack by navigationState.stack
dcebe83
to
96b7cec
Compare
No description provided.