Skip to content

@W-21447588: Add iOS native bridge for setAdditionalContext#37

Open
robertson-waweru wants to merge 2 commits intosalesforce:devfrom
robertson-waweru:stack/additional-context/02-ios-native-bridge
Open

@W-21447588: Add iOS native bridge for setAdditionalContext#37
robertson-waweru wants to merge 2 commits intosalesforce:devfrom
robertson-waweru:stack/additional-context/02-ios-native-bridge

Conversation

@robertson-waweru
Copy link
Contributor

Part 2 of stacked PRs for additional context support (W-21447588, W-21447589).

Changes

  • Add setAdditionalContext React method to AgentforceModule.swift
  • Convert NSDictionary to [AgentforceVariable] array with proper JSEncodableValue enum handling
  • Validate conversation exists before applying context
  • Return clear error messages for invalid inputs
  • Add method declaration to AgentforceModule.m

Testing

  • Build iOS app and verify compilation
  • Launch conversation, then set context with sample variables
  • Verify native logs show context being set
  • Test error cases: no conversation, invalid data

Stack Context

Depends on: #36 (TypeScript types) - merge #36 first
Next: Android native bridge (PR #3)

iOS implementation of additional context support.

177 lines added

- Add CopilotContext.ts with CopilotContextVariable and CopilotAdditionalContext interfaces
- Add CopilotContextVariableType enum with Android SDK type names (Text, Number, Boolean, etc.)
- Export types from types/index.ts and src/index.ts
- Add comprehensive JSDoc with examples and type mappings

Establishes type contract for additional context feature.
- Add setAdditionalContext React method to AgentforceModule
- Convert NSDictionary to AgentforceVariable array with JSEncodableValue enum
- Handle value type conversion (string, number, boolean, array, object)
- Validate conversation exists before applying context
- Add method declaration to AgentforceModule.m

iOS implementation of additional context support.
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