Skip to content

@W-21447589: Add Android native bridge for setAdditionalContext#38

Open
robertson-waweru wants to merge 3 commits intosalesforce:devfrom
robertson-waweru:stack/additional-context/03-android-native-bridge
Open

@W-21447589: Add Android native bridge for setAdditionalContext#38
robertson-waweru wants to merge 3 commits intosalesforce:devfrom
robertson-waweru:stack/additional-context/03-android-native-bridge

Conversation

@robertson-waweru
Copy link
Contributor

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

Changes

  • Add setAdditionalContext React method to AgentforceModule.kt
  • Convert ReadableMap to CopilotAdditionalContext object
  • Import SDK classes: CopilotAdditionalContext, CopilotContextVariable
  • Handle multiple value types (String, Number, Boolean, Map, Array)
  • Validate conversation exists before applying context
  • Use coroutine scope for async context setting

Testing

  • Build Android app and verify compilation
  • Launch conversation, then set context with sample variables
  • Check logcat for logs confirming context was set
  • Test error cases: no conversation, invalid data

Stack Context

Depends on: #36 (TypeScript types), #37 (iOS bridge) - merge in order
Next: JavaScript bridge layer (PR #4)

Android implementation of additional context support.

130 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.
- Add setAdditionalContext React method to AgentforceModule.kt
- Convert ReadableMap to CopilotAdditionalContext object
- Import SDK classes: CopilotAdditionalContext, CopilotContextVariable
- Handle multiple value types (String, Number, Boolean, Map, Array)
- Validate conversation exists before applying context
- Use coroutine scope for async context setting

Android implementation of additional context support.
Copy link
Contributor

@CCX-Wu CCX-Wu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

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