Skip to content

Add getDefaultViewModelInfo to experimental API#443

Open
mfazekas wants to merge 4 commits intorive-app:masterfrom
mfazekas:feat/get-default-viewmodel-info
Open

Add getDefaultViewModelInfo to experimental API#443
mfazekas wants to merge 4 commits intorive-app:masterfrom
mfazekas:feat/get-default-viewmodel-info

Conversation

@mfazekas
Copy link
Copy Markdown
Contributor

@mfazekas mfazekas commented Mar 23, 2026

Summary

Adds RiveFile.getDefaultViewModelInfo(artboard) to the experimental API, returning a DefaultViewModelInfo(viewModelName, instanceName). This mirrors the iOS experimental SDK's File.getDefaultViewModelInfo(for:) which already exists. Without this, ViewModelSource.DefaultForArtboard users cannot call getViewModelProperties(name) or getViewModelInstanceNames(name) since those are keyed by view model name

iOS reference

The C++ runtime already supports requestDefaultViewModelInfo (in command_queue.cpp). iOS wires it through:

This PR adds the equivalent Android wiring.

Add the ability to query the default view model name and instance name
for an artboard through the experimental CommandQueue API.

This mirrors the iOS experimental SDK's File.getDefaultViewModelInfo(for:)
which already exists. The name is needed for file-level queries like
getViewModelProperties() and getViewModelInstanceNames() which are keyed
by view model name — without it, ViewModelSource.DefaultForArtboard users
cannot access those APIs.

Changes:
- CommandQueueBridge: add cppGetDefaultViewModelInfo JNI declaration
- CommandQueue: add getDefaultViewModelInfo suspend function + callback
- RiveFile: add public getDefaultViewModelInfo(artboard) API
- DefaultViewModelInfo: new data class for the result
- bindings_command_queue.cpp: JNI binding + ArtboardListener callback
@mfazekas mfazekas force-pushed the feat/get-default-viewmodel-info branch from 3e94c26 to c73ef7c Compare March 23, 2026 20:34
@mfazekas mfazekas marked this pull request as ready for review March 23, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant