feat: configurable widgets (iOS 17+)#147
Open
V3RON wants to merge 1 commit into
Open
Conversation
Add support for the "Edit Widget" button on iOS, allowing users to personalise widget content from the home screen without opening the app.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Widgets today show the same content for every user. The only way to personalise what a widget displays is to open the app and push new content via
updateWidget(). This creates a frustrating gap: users who want a stock widget showing a specific ticker, or a news widget showing their preferred category, have no native way to express that preference.Configurable widgets solve this. iOS 17 introduced
AppIntentConfiguration, which surfaces a native "Edit Widget" sheet for any parameters you declare. This PR adds full support for that feature in Voltra — from plugin config through native Swift codegen to the React Native read API.parametersin plugin config — declareenum,bool,int, ordoubleparameters; Voltra generates the requiredAppEnum,WidgetConfigurationIntent, andAppIntentConfigurationSwift types at prebuild timeoutdatedStatePath— pre-rendered holding state shown while the user has changed parameters but the app hasn't re-rendered yet (non-server widgets)getWidgetParameters(widgetId)— new synchronous JS API (iOS-only,@use-voltra/ios-client) that reads the current parameter values from the shared App GroupVoltraConfigurableHomeWidgetProvider— reusable genericAppIntentTimelineProviderin the Swift package; generated code is a thin shell over itVoltraHomeWidgetProviderandVoltraConfigurableHomeWidgetProvidernow serve stale cached content fromplaceholder(in:)instead of showing a spinnerTest plan
getWidgetParameters('greeting')returns the values selected in the edit sheet@available(iOS 17.0, *))