4.0-preview-1
Conductor 4.0's first public preview
Conductor 4.0 is coming soon. It is already being used in production with many, many millions of users. It is, however, not guaranteed to be API stable. As such, it is being released as a preview rather than a standard release. Preview in this context is not a commentary on stability. It is considered to be up to the same quality standards as the current 3.x stable release.
Other than some Kotlin migrations and dependency updates, there are two primary changes in this release:
Support for predictive back gestures
This is an opt-in change. If no changes are made in your codebase, you shouldn't experience any functionality changes.
Changes needed to fully support predictive back gestures in your app:
- Call both
setPopRootControllerMode(PopRootControllerMode.NEVER)
andsetOnBackPressedDispatcherEnabled(true)
on your Activity's Router. - Remove the override of
onBackPressed()
from the Activity. No replacement is needed. - Opt in to predictive back gestures in your manifest file as shown here
- Replace any override of
handleBack()
, which is now deprecated, with an OnBackPressedCallback. Example callback:
// "this" must be a LifecycleOwner
onBackPressedDispatcher?.addCallback(this, object : OnBackPressedCallback(enabled = true) {
override fun handleOnBackPressed() {
println("back handled")
}
})
AndroidX backing
This is an opt-out change, and is enabled by default. Conductor has historically relied on platform Fragments to receive lifecycle events. This has resulted in a few shortcomings as functionality has been added to AndroidX Fragments, but is only available in newer API versions for the platform versions. Conductor will now automatically use AndroidX backing under two conditions: your Activity extends FragmentActivity and allowExperimentalAndroidXBacking = false
is not passed into the Conductor.attachRouter
method.