feat(flags): add remote config support for mobile SDKs#53265
feat(flags): add remote config support for mobile SDKs#53265gustavohstrassburger wants to merge 5 commits intomasterfrom
Conversation
- Add iOS, Android, React Native, and Flutter to remote configuration libraries - Update mobile SDK snippets to support remote configuration with proper code examples: - iOS: Swift getFeatureFlagPayload() implementation - Android: Kotlin getFeatureFlagPayload() implementation - React Native: useFeatureFlagWithPayload() hook usage - Flutter: Dart getFeatureFlagPayload() implementation - Add actionable tutorial links below code snippets for complete implementation details - Maintain client/server library separation in UI - Clean tutorial URLs without UTM parameters 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update iOS snippets to use getFeatureFlagResult() instead of getFeatureFlagPayload() - This provides access to both flag value and payload through result.payload - Maintains consistency with iOS SDK patterns
|
Size Change: 0 B Total Size: 127 MB ℹ️ View Unchanged
|
Prompt To Fix All With AIThis is a comment left during a code review.
Path: frontend/src/scenes/feature-flags/FeatureFlagSnippets.tsx
Line: 523
Comment:
**Missing `REMOTE_CONFIG_REMINDER` in all mobile SDK snippets**
All server-side SDK snippets (Node.js, Python, Go, Ruby, etc.) consistently include `REMOTE_CONFIG_REMINDER` ("Must initialize SDK with a feature flags secure API key to enable remote configuration.") when `remoteConfiguration` is true. The 4 new mobile SDK snippets skip this reminder and only conditionally show `ENCRYPTED_PAYLOAD_REMINDER` when `encryptedPayload` is true.
This means mobile SDK users won't see the critical note about needing a secure API key, which could lead to silent failures when trying to use remote config.
The same issue exists in `FlutterSnippet` (line 574), `iOSSnippet` (line 626), and `ReactNativeSnippet` (line 680).
For consistency with the server snippets, the pattern should be:
```suggestion
const warning = `// ${REMOTE_CONFIG_REMINDER}` + (encryptedPayload ? `\n// ${ENCRYPTED_PAYLOAD_REMINDER}` : '')
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: frontend/src/scenes/feature-flags/FeatureFlagSnippets.tsx
Line: 647-655
Comment:
**Unrelated change to iOS regular payload snippet**
This PR's stated purpose is adding remote config support, but the non-remote-config iOS `payload` branch has also changed from the original single-line `getFeatureFlagPayload` call to a multi-line `getFeatureFlagResult`-based snippet. The original code was:
```swift
PostHogSDK.shared.getFeatureFlagPayload("${flagKey}")
```
The new code uses `getFeatureFlagResult` and optional binding, which is the same API used in the new remote config snippet. If `getFeatureFlagPayload` is still the correct API for fetching a payload without the remote config context, this change may be pointing users at the wrong method. Could you confirm whether this change is intentional and whether `getFeatureFlagResult` is now the recommended way to fetch a payload in the iOS SDK?
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(flags): use getFeatureFlagResult for..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Adds remote configuration support for mobile SDKs in the feature flag instructions UI, including updated code examples and tutorial links.
Changes:
- Added iOS/Android/React Native/Flutter to remote configuration library options and UI grouping.
- Extended mobile code snippets to show remote config payload usage.
- Added external tutorial links below remote config snippets.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| frontend/src/scenes/feature-flags/FeatureFlagSnippets.tsx | Adds remote config branches for mobile snippets and renders tutorial links under snippets. |
| frontend/src/scenes/feature-flags/FeatureFlagInstructions.tsx | Splits remote config library selection into “Client libraries” vs “Server libraries”. |
| frontend/src/scenes/feature-flags/FeatureFlagCodeOptions.tsx | Extends the remote configuration library allowlist to include mobile SDK keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Revert iOS regular payload snippet to original getFeatureFlagPayload API - Add missing REMOTE_CONFIG_REMINDER to all mobile SDK remote config snippets - Ensures consistency with server-side SDK patterns and proper API usage
- Add rel="noopener noreferrer" to external tutorial links for security - Use strict equality (===) instead of loose equality (==) in type comparisons - Improves security posture and code consistency
The PostHog Link component automatically handles the rel attribute internally, so manually specifying rel="noopener noreferrer" was causing TypeScript errors since it's not included in the component's prop interface. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
dmarticus
left a comment
There was a problem hiding this comment.
stamping to unblock but the method names are wrong
| return ( | ||
| <> | ||
| <CodeSnippet language={Language.Kotlin} wrap> | ||
| {`${warning ? warning + '\n' : ''}val remoteConfig = ${clientSuffix}getFeatureFlagPayload("${flagKey}") |
There was a problem hiding this comment.
this should be getFeatureFlagResult, right? like the payload method is deprecated
There was a problem hiding this comment.
(this comment pertains to all of the SDKs, just mentioning it in one place)
Problem
Remote configuration for feature flags currently only supports server-side SDKs. Mobile SDKs (iOS, Android, React Native, Flutter) are missing from the remote config UI.
Changes
How did you test this code?
Publish to changelog?
no