diff --git a/state-keeper/api/android/state-keeper.api b/state-keeper/api/android/state-keeper.api index 12687ca..07fca0b 100644 --- a/state-keeper/api/android/state-keeper.api +++ b/state-keeper/api/android/state-keeper.api @@ -1,8 +1,8 @@ public final class com/arkivanov/essenty/statekeeper/AndroidExtKt { public static final fun StateKeeper (Landroidx/savedstate/SavedStateRegistry;ZLkotlin/jvm/functions/Function0;)Lcom/arkivanov/essenty/statekeeper/StateKeeper; public static synthetic fun StateKeeper$default (Landroidx/savedstate/SavedStateRegistry;ZLkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lcom/arkivanov/essenty/statekeeper/StateKeeper; - public static final fun stateKeeper (Landroidx/savedstate/SavedStateRegistryOwner;Lkotlin/jvm/functions/Function0;)Lcom/arkivanov/essenty/statekeeper/StateKeeper; - public static synthetic fun stateKeeper$default (Landroidx/savedstate/SavedStateRegistryOwner;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lcom/arkivanov/essenty/statekeeper/StateKeeper; + public static final fun stateKeeper (Landroidx/savedstate/SavedStateRegistryOwner;ZLkotlin/jvm/functions/Function0;)Lcom/arkivanov/essenty/statekeeper/StateKeeper; + public static synthetic fun stateKeeper$default (Landroidx/savedstate/SavedStateRegistryOwner;ZLkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lcom/arkivanov/essenty/statekeeper/StateKeeper; } public final class com/arkivanov/essenty/statekeeper/DefaultStateKeeperDispatcher$SavedState$Creator : android/os/Parcelable$Creator { diff --git a/state-keeper/src/androidMain/kotlin/com/arkivanov/essenty/statekeeper/AndroidExt.kt b/state-keeper/src/androidMain/kotlin/com/arkivanov/essenty/statekeeper/AndroidExt.kt index 5f995fc..c3366dd 100644 --- a/state-keeper/src/androidMain/kotlin/com/arkivanov/essenty/statekeeper/AndroidExt.kt +++ b/state-keeper/src/androidMain/kotlin/com/arkivanov/essenty/statekeeper/AndroidExt.kt @@ -43,11 +43,17 @@ fun StateKeeper( /** * Creates a new instance of [StateKeeper] and attaches it to the AndroidX [SavedStateRegistry]. * + * @param discardSavedState a flag indicating whether any previously saved state should be discarded or not, + * default value is `false`. * @param isSavingAllowed called before saving the state. * When `true` then the state will be saved, otherwise it won't. Default value is `true`. */ -fun SavedStateRegistryOwner.stateKeeper(isSavingAllowed: () -> Boolean = { true }): StateKeeper = +fun SavedStateRegistryOwner.stateKeeper( + discardSavedState: Boolean = false, + isSavingAllowed: () -> Boolean = { true }, +): StateKeeper = StateKeeper( savedStateRegistry = savedStateRegistry, + discardSavedState = discardSavedState, isSavingAllowed = isSavingAllowed )