Skip to content

Use putKotlinSerializable / getKotlinSerializable#1411

Open
kboyarshinov wants to merge 8 commits into
mainfrom
savedstate-update
Open

Use putKotlinSerializable / getKotlinSerializable#1411
kboyarshinov wants to merge 8 commits into
mainfrom
savedstate-update

Conversation

@kboyarshinov

Copy link
Copy Markdown
Contributor

Description

androidx.savedstate 1.5.0 added putKotlinSerializable / getKotlinSerializable helper functions.

This replaces encodeToSavedState/decodeFromSavedState + putSavedState/getSavedState with newly added functions in StackEntryState and StackEntry.Saver.

Also:

  • update StackEntryState to accept KSerializer in get/set methods instead of SerializationStrategy, DeserializationStrategy.
  • update StackEntryStateTest.restoreState test: replaced manual map with StackEntryState
  • add test for StackEntry.Saver covering all persisted keys

Note: one remaining decodeFromSavedState is in StackEntryState.get because at that point it no longer operates on SavedState but on the map of its data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant