appyx icon indicating copy to clipboard operation
appyx copied to clipboard

[#310] Ensure NavTarget and State are parcelable

Open LachlanMcKee opened this issue 2 years ago • 4 comments

Description

Fixes #310

Check list

  • [x] I have updated CHANGELOG.md if required.
  • [x] I have updated documentation if required.

LachlanMcKee avatar Jan 02 '23 19:01 LachlanMcKee

This is definitely a breaking change. We can likely fix the problems (samples that do not use Parcelable) in a different PR, but I think it's worthwhile adding this to avoid issues in the future

LachlanMcKee avatar Jan 02 '23 21:01 LachlanMcKee

If we don't want to go down this path (I don't see why we shouldn't, other than the fact that we have to make the enums parcelable), we MAY be able to solve this with a detekt rule (though that would mean that the library may not work as advertised if developers don't use detekt)

LachlanMcKee avatar Jan 03 '23 09:01 LachlanMcKee

The original intention was to allow different types like primitives and serialisables.

We can potentially introduce runtime checks class.java.isPrimitive || class.java.implementsParcelableOrSerializable as an alternative which we can perform in the constructor of NavElement.

Not against your approach.

CherryPerry avatar Jan 03 '23 11:01 CherryPerry

@CherryPerry that could be a good alternative as well. Let's discuss tomorrow!

LachlanMcKee avatar Jan 03 '23 13:01 LachlanMcKee