Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Read Only Data Controller Exposed in Player Endstate on JVM/Android #220

Open
KetanReddy opened this issue Nov 7, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@KetanReddy
Copy link
Member

KetanReddy commented Nov 7, 2023

#216 Adds functionality to expose a read only instance of Player's Data Controller on the end state to allow Bindings to be evaluated after a flow has ended. This functionality should be exposed on JVM/Android

@KetanReddy KetanReddy added the enhancement New feature or request label Nov 7, 2023
@sugarmanz
Copy link
Member

Context for wrapping this on the JVM - the dataModel is already exposed as part of the CompletedState:

// TODO: Completed state dataModel change needs rectification here
public val dataModel: DataModelWithParser by lazy {
DataModelWithParser(controllers.data.node)
}

But not through the controllers API, and it doesn't include the safeguards against invoking the set APIs. We should:

  • Maintain API level parity with core (i.e. player.completedState?.controllers?.data)
    • Should create an extension for supporting player.completedState?.dataModel and mark as deprecated
  • Restrict the typing of this to only provide access to the getter APIs

Maintain API level parity with core

We'll likely need a local CompletedState.ControllerState that only exposes data (or anything else that's potentially added to CompletedState). Then we can use the existing NodeSerializableField pattern for exposing that publicly .

Should create an extension for supporting player.completedState?.dataModel and mark as deprecated

Something like:

@Deprecated(
    "Access through controllers API",
    ReplaceWith("controllers.data"),
    DeprecationLevel.WARNING,
)
val CompletedState.dataModel: DataModelWithParser get() = controllers.data

Restrict the typing of this to only provide access to the getter APIs

We'll likely need a new interface that only exposes the gets -- which could be used as a super type to the existing DataModelWithParser and DataController. Open to ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants