-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add lifecycle aware Presenters #1282
Conversation
419bee7
to
ad075f8
Compare
ad075f8
to
b18689a
Compare
b18689a
to
ff394c3
Compare
...uit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/NavigableCircuitContent.kt
Show resolved
Hide resolved
circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/PauseablePresenter.kt
Outdated
Show resolved
Hide resolved
circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/PauseablePresenter.kt
Outdated
Show resolved
Hide resolved
circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/CircuitContent.kt
Outdated
Show resolved
Hide resolved
...oidUnitTest/kotlin/com/slack/circuit/foundation/NavigableCircuitViewModelStateAndroidTest.kt
Show resolved
Hide resolved
circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/Lifecycle.kt
Outdated
Show resolved
Hide resolved
...uit-runtime-presenter/src/commonMain/kotlin/com/slack/circuit/runtime/presenter/Presenter.kt
Outdated
Show resolved
Hide resolved
circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/Lifecycle.kt
Outdated
Show resolved
Hide resolved
circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/Lifecycle.kt
Outdated
Show resolved
Hide resolved
circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/CircuitContent.kt
Outdated
Show resolved
Hide resolved
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.
Can you unpack the change from key: String?
-> key: Any?
for me? I didn't quite follow from the PR diff alone why that was necessary. Otherwise a couple nits around naming. Any thoughts on the CI failure? If not I can look into it
circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/Lifecycle.kt
Outdated
Show resolved
Hide resolved
circuit-foundation/src/commonMain/kotlin/com/slack/circuit/foundation/Lifecycle.kt
Outdated
Show resolved
Hide resolved
So I thought it would be good to add a
It's one last failing test which I need to fix. Going to look at it asap. |
circuit-foundation/src/jvmTest/kotlin/com/slack/circuit/foundation/KeyedCircuitContentTests.kt
Show resolved
Hide resolved
are you possibly mixing up inputs and keys? |
Why there's a difference, I don't really know. Happy to revert back to a String, I don't feel strongly here. |
yeah let's keep them consistent for the |
Side note: I think adding a |
Yes definitely. I started tinkering in #1168 but never picked it back up |
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.
Last bit before I hit merge - do you mind adding a blurb to the Unreleased section of the CHANGELOG.md? I can add one post-merge too if you're busy
…ents (#1354) This PR migrates `NavigableCircuitContent` to use `SaveableStateHolder`, rather than our hand-rolled `SaveableStateRegistryBackStackRecordLocalProvider`. I don't know the history behind `SaveableStateRegistryBackStackRecordLocalProvider`, but `SaveableStateHolder` is the first party solution for this. It is used by AndroidX Navigation, so we can assume it is well tested. This PR relies on a bunch of `movableContent` fixes added in #1282 (I had to add a similar one in this PR for `CupertinoGestureNavigationDecoration`). Fixes #1342
This PR adds a new
Lifecycle
interface, which presenters and UI can observe to know when they are 'paused'. The API is rudimentary at the moment and will change before this is ready to land.A bundled
PauseablePresenter
class can be extended, enabling clients to automatically add pausing ability to their presenters. This impl will simply return the last emittedUiState
when the presenter is paused. Again, name TBD.Other things:
GestureNavigationRetainedStateTest
andGestureNavigationSaveableStateTest
have been combined into a parameterizedGestureNavigationStateTest
. This new test also now testsCupertinoGestureNavigationDecoration
so we get extra coverage.rememberRetained
'skey
param toAny
to be consistent with all of the otherremember
functions.TODO: