⚡️ A Compose-driven architecture for Kotlin and Android applications.
RememberObserver
to work with rememberRetained
.Navigator.popRoot()
. extension (#1274)CircuitContent
to keep Ui
and Presenter
consistent. We already did this for presenters, this just makes it consistent for both.ToastEffect
.rememberImpressionNavigator()
not delegating PopResult
.PopResult
to onRootPop()
.canRetainCheck
when saving RetainedStateRegistry
.com.google.guava:listenablefuture
to 1.0
to avoid conflicts with Guava.1.5.10.1
.1.8.0
.1.6.1
.1.6.3
.1.4.1
.2.51
.1.1.0
.0.8.3
.1.9.23
.1.9.23-1.0.19
.Special thanks to @chrisbanes, @aschulz90, and @alexvanyo for contributing to this release!
key
to CircuitContent to keep UI and Presenter consistent by @stagg in https://github.com/slackhq/circuit/pull/1254
PopResult
to onRootPop
by @stagg in https://github.com/slackhq/circuit/pull/1256
Full Changelog: https://github.com/slackhq/circuit/compare/0.19.1...0.20.0
This is a small bug fix release focused SaveableBackStack
consistency and FakeNavigator
API improvements.
FakeNavigator.awaitNextScreen()
not suspending.FakeNavigator.resetRoot()
not returning the actual popped screens.Navigator.peekBackStack()
and Navigator.resetRoot()
return ImmutableList
.BackStack.popUntil()
return the ImmutableList
of the popped records.FakeNavigator.peekBackStack()
return the ImmutableList
of the popped records.FakeNavigator
. This should offer much more information about the events.BackStack
instance in FakeNavigator
+ allow for specifying a user-provided instance.FakeNavigator
unless using a custom BackStack
.
goTo
event.rememberSaveableBackStack()
.Navigator()
factory function.Full Changelog: https://github.com/slackhq/circuit/compare/0.19.0...0.19.1
This release introduces support for inter-screen navigation results. This is useful for scenarios where you want to pass data back to the previous screen after a navigation event, such as when a user selects an item from a list and you want to pass the selected item back to the previous screen.
var photoUrl by remember { mutableStateOf<String?>(null) }
val takePhotoNavigator = rememberAnsweringNavigator<TakePhotoScreen.Result>(navigator) { result ->
photoUrl = result.url
}
// Elsewhere
takePhotoNavigator.goTo(TakePhotoScreen)
// In TakePhotoScreen.kt
data object TakePhotoScreen : Screen {
@Parcelize
data class Result(val url: String) : PopResult
}
class TakePhotoPresenter {
@Composable fun present(): State {
// ...
navigator.pop(result = TakePhotoScreen.Result(newFilters))
}
}
See the new section in the navigation docs for more details, as well as updates to the Overlays docs that help explain when to use an Overlay
vs navigating to a Screen
with a result.
This release introduces support for saving/restoring navigation state on root resets (aka multi back stack). This is useful for scenarios where you want to reset the back stack to a new root but still want to retain the previous back stack's state, such as an app UI that has a persistent bottom navigation bar with different back stacks for each tab.
This works by adding two new optional saveState
and restoreState
parameters to Navigator.resetRoot()
.
navigator.resetRoot(HomeNavTab1, saveState = true, restoreState = true)
// User navigates to a details screen
navigator.push(EntityDetails(id = foo))
// Later, user clicks on a bottom navigation item
navigator.resetRoot(HomeNavTab2, saveState = true, restoreState = true)
// Later, user switches back to the first navigation item
navigator.resetRoot(HomeNavTab1, saveState = true, restoreState = true)
// The existing back stack is restored, and EntityDetails(id = foo) will be top of
// the back stack
There are times when saving and restoring the back stack may not be appropriate, so use this feature only when it makes sense. A common example where it probably does not make sense is launching screens which define a UX flow which has a defined completion, such as onboarding.
On top of Circuit's existing docs, we've added a new tutorial to help you get started with Circuit. It's a step-by-step guide that walks you through building a simple inbox app using Circuit, intended to serve as a sort of small code lab that one could do in 1-2 hours. Check it out here.
AlertDialogOverlay
, BasicAlertDialogOverlay
, and BasicDialogOverlay
to circuitx-overlay
.OverlayEffect
to circuit-overlay
. This offers a simple composable effect to show an overlay and await a result.
OverlayEffect(state) { host ->
val result = host.show(AlertDialogOverlay(...))
// Do something with the result
}
OverlayState
and LocalOverlayState
to circuit-overlay
. This allows you to check the current overlay state (UNAVAILABLE
, HIDDEN
, or SHOWING
).OverlayHost
as @ReadOnlyOverlayApi
to indicate that it's not intended for direct implementation by consumers.Overlay
as @Stable
.NavEvent.screen
public.Navigator.popUntil
to be exclusive.Navigator.peek()
to peek the top screen of the back stack.Navigator.peekBackStack()
to peek the top screen of the back stack.backStack
.BackStack.Record
as @Stable
.onRootPop
of the Android rememberCircuitNavigator
.2.7.0
.1.5.12
.1.6.1
.2024.02.00
.1.5.9
.0.23.2
.2.4.9
.1.16.0
.1.9.22-1.0.17
.Special thanks to @milis92, @ChrisBanes, and @vulpeszerda for contributing to this release!
Full Changelog: https://github.com/slackhq/circuit/compare/0.18.2...0.19.0
Record
s' ViewModelStores
. This fully fixes #1065.1.3.2
.1.5.7.1
.Special thanks to @dandc87 for contributing to this release!
Full Changelog: https://github.com/slackhq/circuit/compare/0.18.1...0.18.2
Happy new year!
ProvidedValues
lifetime. See #1065 for more details.GestureNavDecoration
dropping saveable/retained state on back gestures. See #1089 for more details.Special thanks to @ChrisBanes and @dandc87 for contributing to this release!
Full Changelog: https://github.com/slackhq/circuit/compare/0.18.0...0.18.1
AnimatedOverlay
.ModalBottomSheet
appearance in BottomSheetOverlay
.1.9.22
.1.9.22-1.0.16
.2.50
.0.3.7
.1.8.2
.Special thanks to @ChrisBanes, @chriswiesner, and @BryanStern for contributing to this release!
Full Changelog: https://github.com/slackhq/circuit/compare/0.17.1...0.18.0
SaveableStateRegistryBackStackRecordLocalProvider
to be supported across all currently supported platforms.LocalBackStackRecordLocalProviders
always returning a new composition local.androidx.compose.compiler:compiler
to 1.5.5
1.15.3
2.49
Special thanks to @alexvanyo for contributing to this release.
Full Changelog: https://github.com/slackhq/circuit/compare/0.17.0...0.17.1
The circuitx-effects artifact provides some effects for use with logging/analytics. These effects
are typically used in Circuit presenters for tracking impressions
and will run only once until
forgotten based on the current circuit-retained strategy.
dependencies {
implementation("com.slack.circuit:circuitx-effects:<version>")
}
Docs: https://slackhq.github.io/circuit/circuitx/#effects
Circuit's code gen artifact now supports generating for Hilt projects. See the docs for usage instructions: https://slackhq.github.io/circuit/code-gen/
CircuitContent
internals like rememberPresenter()
, rememberUi
, etc for reuse.CircuitContent()
overload that accepts a pre-constructed presenter/ui parameters public to allow for more control over content.0.8.2
.1.15.1
.1.5.11
.1.9.21
.1.9.21-1.0.15
.1.5.4
.1.3.1
.Special thanks to @jamiesanson, @frett, and @bryanstern for contributing to this release!
Full Changelog: https://github.com/slackhq/circuit/compare/0.16.1...0.17.0
1.9.20-1.0.14
.Full Changelog: https://github.com/slackhq/circuit/compare/0.16.0...0.16.1
circut-retained
is now enabled by defaultFollowing the discussion in #891 circut-retained
is automatically added in CircuitCompositionLocals
by default, we still allow overriding it with a no-op implementation. (#931)
1.9.20
.1.5.2
.agp
to 8.1.2
.androidx.activity
to 1.8.0
.benchmark
to 1.2.0
.coil
to 2.5.0
.compose.material3
to 1.1.2
.compose.material
to 1.5.4
.compose.runtime
to 1.5.4
.compose.ui
to 1.5.4
.roborazzi
to 1.6.0
.Full Changelog: https://github.com/slackhq/circuit/compare/0.15.0...0.16.0