Releases: arkivanov/Decompose
1.0.0-alpha-03-native-compose
This is the same release as 1.0.0-alpha-03, but with Compose for iOS support:
Versions and dependencies
Kotlin: 1.7.0
Essenty: 0.5.2
JetBrains Compose: 1.2.0-alpha01-dev753
1.0.0-alpha-02
- Fixed incorrect
initialValue
inextensions-compose-jetpack
DefaultStackAnimator
(#176)
Versions and dependencies
Kotlin: 1.7.0
Essenty: 0.5.2
extensions-compose-jetpack
Jetpack Compose: 1.2.0
Jetpack Compose Compiler: 1.2.0
extensions-compose-jetbrains
JetBrains Compose: 1.2.0-alpha01-dev753
1.0.0-alpha-01
- Version updated: Kotlin
1.7.0
,Gradle 7.4.2
, JB Compose1.2.0-alpha01-dev753
, Jetpack Compose1.2.0
(#158) - Replaced
BackPressedHandler
withBackHandler
(#164) - Added
otherChild
argument tostackAnimation
selector function (#162) - Removed
IDLE
entry from Compose animationDirection
enum (#161) - Nullable result in
StackAnimation
selector function (#163) - Nullable
Children
animation
argument (#165) - Better error messages when creating child components with same keys (#87)
- Removed previously deprecated
Router
(#159) - Removed previously deprecated
ValueObserver
type alias (#160)
Breaking changes
This release brings Decompose closer to v1.0.0
release. The main focus was to support latest Compose versions, further improve stack animation API, and support the new Predictive Back Gesture on Android 13. Please read about breaking changes in this release.
This release is binary and source incompatible with v0.8.0
.
Predictive Back Gesture on Android 13
Android 13 introduces the new Predictive Back Gesture. It is essential for Decompose to support it, so BackPressedHandler
was replaced with the new BackHandler
from Essenty library. The new BackHandler
has different API (closer to AndroidX OnBackPressedDispatcher
) compatible with Predictive Back Gesture. Please read corresponding section in Essenty readme.
If you are not using BackPressedHandler
or BackPressedDispatcher
, then most likely you won't notice any changes and the source code should compile just fine. However, if you do use either of them, then you will need to update your code.
Migration tips
// Before
class SomeComponent(componentContext: ComponentContext) : ComponentContext by componentContext {
init {
backPressedHandler.register {
// Process back pressed event
true | false // return true to consume the event, false to allow other handlers
}
}
}
// After
class SomeComponent(componentContext: ComponentContext) : ComponentContext by componentContext {
private val backCallback = BackCallback(isEnabled = false) { /* Process back pressed event */ }
init {
backHandler.register(backCallback)
}
private fun updateBackCallback() {
backCallback.isEnabled = true | false // return true to consume all back button events, false to allow other handlers
}
}
// Before
val backPressedDispatcher = BackPressedDispatcher()
val componentContext = DefaultComponentContext(..., backPressedHandler = backPressedDispatcher)
// ...
val backHandled = backPressedDispatcher.onBackPressed()
// After
val backDispatcher = BackDispatcher()
val componentContext = DefaultComponentContext(..., backHandler = backDispatcher)
// ...
val backHandled = backPressedDispatcher.back()
Changes in stack animation API
The stackAnimation {}
function's selector got an additional argument - otherChild
. Now it is possible to choose StackAnimator
for a child based on both - the child itself, and the second child (the other one) in the scene. For example - having different animations for a child X
when it is being opened from child A
or B
. It is also now possible to return null
from the selector
function, if no animation is required for a child
The Direction.IDLE
enum entry is removed, animators are not called when there is no ongoing animation, thanks to the new movableContentOf
Compose API.
Removed Router and ValueObserver
The Router
API was deprecated in v0.8.0
and is now completely removed. Please read v0.8.0 release notes for migration guides if you didn't migrate yet.
The previously deprecated ValueObserver
type alias is also removed. Please use normal function types instead - (T) -> Unit
.
Versions and dependencies
Kotlin: 1.7.0
Essenty: 0.5.2
extensions-compose-jetpack
Jetpack Compose: 1.2.0
Jetpack Compose Compiler: 1.2.0
extensions-compose-jetbrains
JetBrains Compose: 1.2.0-alpha01-dev753
1.0.0-alpha-01-native-compose
This is the same release as 1.0.0-alpha-01, but with Compose for iOS support:
Versions and dependencies
Kotlin: 1.7.0
Essenty: 0.5.2
JetBrains Compose: 1.2.0-alpha01-dev753
0.8.0
- Deprecated
Router
and introducedChild Stack
(#135, #136, #137, #140, #142, #143) - Deprecated
ValueObserver
typealias (#139)
The new Child Stack
The Router
and all its surroundings are now deprecated. There is new concept introduced - Child Stack
. It is located in a separate package and doesn't conflict with Router
. The main purpose of introducing Child Stack
is to bring more flexibility and compile time safety. And also to allow the room for another kinds of routing in the future.
Please refer to the updated docs and #134 for more information.
Migration tips
// Before
interface Root {
val routerState: Value<RouterState<*, Child>>
}
class RootComponent(componentContext: ComponentContext): ComponentContext by componentContext {
private val router = router<Config, Child>(..., childFactory = ::child)
override val routerState = router.state
private fun foo() {
router.push()
router.pop()
}
}
@Composable
fun RootContent(component: Root) {
val routerState by component.routerState.observeAsState()
Children(routerState = routerState, ...) {
// ...
}
}
// After
interface Root {
val childStack: Value<ChildStack<*, Child>>
}
class RootComponent(componentContext: ComponentContext): ComponentContext by componentContext {
private val navigation = StackNavigation<Config>()
private val stack = childStack(source = navigation, ..., childFactory = ::child)
override val childStack = stack
private fun foo() {
navigation.push()
navigation.pop()
}
}
@Composable
fun RootContent(component: Root) {
val stack by component.childStack.observeAsState()
Children(stack = stack, ...) {
// ...
}
}
Breaking changes
There are no breaking changes in this release, it should be both binary and source compatible.
Versions and dependencies
Kotlin: 1.6.10
Essenty: 0.2.2
extensions-compose-jetpack
Jetpack Compose: 1.1.1
Jetpack Compose Compiler: 1.1.1
extensions-compose-jetbrains
JetBrains Compose: 1.1.0
0.8.0-native-compose-02
This is the same release as 0.8.0, but with Compose for iOS support:
Versions and dependencies
Kotlin: 1.7.0
Essenty: 0.4.2
JetBrains Compose: 1.2.0-alpha01-dev745
0.7.0-native-compose-02
- Updated Kotlin to
1.7.0
, Compose to1.2.0-alpha01-dev741
, Essenty to0.4.2
, AGP to7.2.0
, Gradle to7.4.2
(#141)
Versions and dependencies
Kotlin: 1.7.0
Essenty: 0.4.2
JetBrains Compose: 1.2.0-alpha01-dev745
0.7.0-native-compose-01
This is the same release as 0.7.0, but with the following changes:
extensions-compose-jetbrains
supports additional targets:iosX64
,iosArm64
,macosX64
andmacosArm64
(iosSimulatorArm64
is not yet supported, because Compose doesn't support it)extensions-compose-jetpack
module is removed
Versions and dependencies
Kotlin: 1.6.21
Essenty: 0.2.2
JetBrains Compose: 1.2.0-alpha01-dev716
0.7.0
- Added
onComplete
callback toRouter.popWhile(...)
function (#104 by @Tommyten) - Added
onComplete
callback toRouter.push(...)
,Router. replaceCurrent(...)
andRouter. bringToFront(...)
functions (#128) - Added
ensureNeverFrozen
toMutableValue
(#116) - Interfaces
DefaultWebHistoryController.Window
andDefaultWebHistoryController.History
are markedinternal
(#127) - Fixed
DefaultWebHistoryController
not working on Chrome for iOS (#127)
Versions and dependencies
Kotlin: 1.6.10
Essenty: 0.2.2
extensions-compose-jetpack
Jetpack Compose: 1.1.1
Jetpack Compose Compiler: 1.1.1
extensions-compose-jetbrains
JetBrains Compose: 1.1.0