Skip to content

Add Custom View Provider toggle to Settings feature flags#34

Open
asikora-sf wants to merge 10 commits intosalesforce:devfrom
asikora-sf:stack/viewprovider/05-settings-toggle
Open

Add Custom View Provider toggle to Settings feature flags#34
asikora-sf wants to merge 10 commits intosalesforce:devfrom
asikora-sf:stack/viewprovider/05-settings-toggle

Conversation

@asikora-sf
Copy link
Contributor

Summary

  • Adds enableCustomViewProvider toggle to the Feature Flags tab in Settings
  • Persists the flag via UserDefaults (iOS) and SharedPreferences (Android)
  • Reads/writes in getFeatureFlags, setFeatureFlags, and configure paths on both platforms

Stack

PR 5/6 in the viewprovider stack. Depends on PRs #30-#33.

Test plan

  • New "Custom View Provider" toggle appears in Settings > Flags tab
  • Toggle persists across app restarts
  • Flag value flows through to native configure() calls
  • Default is off (false)

Replace componentTypes[] + reactComponentName with a componentMap
Record<string, string> so each SDK component type maps to its own
React Native component name.
Bridges the native SDK view customization to React Native via RCTRootView.
- BridgeViewProvider: canHandle() checks pre-registered types, view() renders RCTRootView in SwiftUI
- registerViewProvider/clearViewProvider native methods exposed to JS
- ViewProvider passed to AgentforceClient init when registered
Replace Set<String> + single reactComponentName with a [String: String]
dictionary mapping each component definition to its own React component.
canHandle() checks map keys, view() looks up the component name per type.
@asikora-sf asikora-sf force-pushed the stack/viewprovider/05-settings-toggle branch from bda532f to 845ac30 Compare March 5, 2026 22:31
RCTRootView embedded in UIViewRepresentable was getting zero size
because SwiftUI had no sizing information. Set sizeFlexibility and
implement sizeThatFits so the React content measures correctly.
Bridges the native SDK view customization to React Native via ReactRootView.
- BridgeViewProvider: canHandle() checks pre-registered types, GetView() renders ReactRootView in Compose
- registerViewProvider/clearViewProvider React methods exposed to JS
- ViewProvider passed to AgentforceConfiguration builder when registered
Change BridgeViewProvider from N:1 (multiple types → one component) to
1:1 mapping (each type → its own React component name). The register()
method now accepts a Map<String, String> and GetView() looks up the
per-type component name from the map.

Also update registerViewProvider in AgentforceModule to read componentMap
from the ReadableMap instead of componentTypes array + reactComponentName.
…ceService

Exposes view provider registration to JS consumers:
- setViewProviderDelegate() registers component types + React component name with native
- clearViewProviderDelegate() removes registration
- Cleanup in destroy()
Pass componentMap (Record<string, string>) to native registerViewProvider
instead of componentTypes array + reactComponentName, matching the 1:1
design change in the native layers.
…istence

- Adds Custom View Provider toggle to Feature Flags tab in Settings
- Persists flag via UserDefaults (iOS) and SharedPreferences (Android)
- Reads/writes in getFeatureFlags, setFeatureFlags, and configure paths
@asikora-sf asikora-sf force-pushed the stack/viewprovider/05-settings-toggle branch from 845ac30 to c1d3382 Compare March 5, 2026 23:25
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.

2 participants