Skip to content

v0.9.0

Latest
Compare
Choose a tag to compare
@ikarenkov ikarenkov released this 07 Jul 19:43
· 1 commit to dev since this release
844d0e1

💫 Big update with stability and flexibility improvements

🔲 Dialogs

Custom dialogs

We introduced the ability to create custom dialogs without using the Dialog composable. This feature adds the dialog's content over the non-dialog content of your StackScreen. You can do so by providing the configuration in your dialog:

class SampleDialog(
    private val systemDialog: Boolean = true,
    override val screenKey: ScreenKey = generateScreenKey()
) : DialogScreen {

    override fun provideDialogConfig(): DialogScreen.DialogConfig = if (systemDialog) {
        DialogScreen.DialogConfig.System(
            useSystemDim = true,
            dialogProperties = DialogProperties(
                usePlatformDefaultWidth = true,
                decorFitsSystemWindows = true
            )
        )
    } else {
        DialogScreen.DialogConfig.Custom
    }
}

Permanent dialogs

You can mark a dialog as permanent to prevent it from hiding when a new dialog appears on top of it:

class SamplePermanentDialog(
    override val screenKey: ScreenKey = generateScreenKey()
) : DialogScreen {

    override val permanentDialog: Boolean get() = true
    
    ...
}

DialogPlaceHolder

We introduced the provideDialogPlaceholderScreen function for StackScreen to provide animations for appearing dialogs. By default, it is just an empty full-screen composable.

PRs

🔄 State modification

Enhanced and simplified state modification!

  1. NavigationAction<NavigationState> - now action is defined by NavigationState, distinguishing actions for different ContainerScreens.
  2. ContainerScreen<NavigationState, NavigationAction> - now ContainerScreen is also defined by NavigationAction.
  3. Custom actions - now you can create custom navigation actions in-place and define what they do without creating a custom reducer. To do so, use ReducerAction<NavigationState>:
    internal sealed interface RemovableItemContainerAction : ReducerAction<RemovableItemContainerState> {
        data object Remove : RemovableItemContainerAction {
            override fun reduce(oldState: RemovableItemContainerState): RemovableItemContainerState =
                oldState.copy(screen3 = null)
        }
    
        data object CreateScreen : RemovableItemContainerAction {
            override fun reduce(oldState: RemovableItemContainerState): RemovableItemContainerState =
                oldState.copy(screen3 = NestedScreen(canBeRemoved = true))
        }
    }

PRs

📚 Samples and Docs

We are happy to introduce our website with documentation!

We welcome any feedback and contributions! You can easily edit pages by clicking "edit" at the top of the page.

PRs

  • Enhanced samples, added screen effects samples by @ikarenkov in #38
  • Enhanced README and added a list of features and fixed sample package by @ikarenkov in #43
  • Docs site setup by @ikarenkov in #49
  • Improved existing topics and added new ones, added GitHub link, and changed structure by @ikarenkov in #50
  • Updated version and documentation by @ikarenkov in #51
  • Docs improvements by @ikarenkov in #52

🛣️ Integrations

Activity and Fragment

We introduced rememberRootScreen for Activity and Fragment, providing a convenient single-line integration of Modo. Documentation.

LazyList utils

We introduced screenItems and screenItem for convenient integration of your screens into LazyList (and pagers).

Stability for Screen, ContainerScreen, and NavigationContainer

  • Marked Screen, ContainerScreen, and NavigationContainer as stable by @ikarenkov in #46

ListNavigation

If you are seeking for list-based custom navigations, here are some convenient actions for state modification and some inheritance improvements.

Bug fixes

Now Modo.init and Modo.getOrCreateRootScreen return the same instance of the RootScreen within a single process. Previously, a new instance was created, leading to problems if you injected RootScreen or any of its children into a DI container.

  • New Modo integration fix by @ikarenkov in #44
  • Fixed crush for replace command. Covered with tests. Introduced including param for BackTo action. by @ikarenkov in #54

🦦 Other

⚠️ Migrations and deprecations

  • Modo.init - renamed and deprecated to prevent confusion. It has been renamed to Modo.getOrCreateRootScreen to explicitly declare its behavior.
  • Screen.OnScreenRemoved - moved to another package, and the function from the old package is deprecated. com.github.terrakok.modo.model.OnScreenRemoved -> com.github.terrakok.modo.lifecycle.OnScreenRemoved

👯‍♀️ New Contributors

Full Changelog: v0.8.0...v0.9.0