Skip to content

feat: loadFlags and setContext support on all platforms#210

Merged
msiebert merged 18 commits intomainfrom
msiebert-ff-608-load-flags
Apr 9, 2026
Merged

feat: loadFlags and setContext support on all platforms#210
msiebert merged 18 commits intomainfrom
msiebert-ff-608-load-flags

Conversation

@msiebert
Copy link
Copy Markdown
Contributor

@msiebert msiebert commented Mar 14, 2026

Summary

  • Update Mixpanel Android SDK to 8.5.0 and Swift SDK to 6.2.0
  • updateContext() now calls setContext on iOS and Android instead of being a no-op — context is replaced and flags are automatically re-fetched
  • loadFlags() now supported on web via mixpanel.flags.load_flags()
  • Web updateContext and loadFlags properly await JS Promises before completing the Future

🤖 Generated with Claude Code

@msiebert msiebert self-assigned this Mar 14, 2026
@msiebert msiebert changed the title Add loadFlags() for manual feature flag refresh feat: loadFlags with completion callback support Mar 17, 2026
@msiebert msiebert marked this pull request as draft March 17, 2026 22:12
@msiebert msiebert changed the title feat: loadFlags with completion callback support feat: loadFlags and setContext support on all platforms Apr 8, 2026
@msiebert msiebert requested a review from efahk April 8, 2026 17:18
@msiebert msiebert marked this pull request as ready for review April 8, 2026 17:18
Comment thread test/mixpanel_flutter_test.dart
Comment thread test/mixpanel_flutter_test.dart Outdated
Comment thread android/src/main/java/com/mixpanel/mixpanel_flutter/MixpanelFlutterPlugin.java Outdated
@msiebert msiebert requested a review from tylerjroach April 8, 2026 17:35
msiebert and others added 5 commits April 8, 2026 11:58
Exposes the native SDK loadFlags() method through the Flutter plugin,
enabling developers to manually trigger a fresh fetch of feature flag
variant assignments from Mixpanel servers on iOS and Android.
Web implementation logs a warning since the JS SDK lacks this method.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use the new completion-callback overloads of loadFlags on both iOS
(Swift SDK) and Android (Android SDK) so the Dart Future resolves
only after the fetch finishes.  On failure, the native plugins now
return a FlutterError / PlatformException instead of silently
succeeding, enabling kill-switch and retry patterns in app code.

- iOS: flags.loadFlags { success in … }
- Android: flags.loadFlags(success -> …)
- Dart doc comment updated with error behaviour
- Tests added for both success and failure paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Android SDK 8.2.5 → 8.5.0, Swift SDK 5.1.3 → 6.2.0
- updateContext() now calls setContext on iOS and Android (was a no-op)
- loadFlags() now supported on web via mixpanel.flags.load_flags()
- Web updateContext/loadFlags properly await JS Promises

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Return error instead of success when loadFlags is called before
Mixpanel is initialized on Android and iOS. Add updateContext
success/error tests and async/await to loadFlags error test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@msiebert msiebert force-pushed the msiebert-ff-608-load-flags branch from dce8e66 to 828e4cd Compare April 8, 2026 19:01
@msiebert msiebert changed the base branch from main to feat/add-osx-support April 8, 2026 19:01
The macOS podspec was still pinned to 6.1.0 which doesn't have the
setContext method on MixpanelFlags, causing the macOS CI build to fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@tylerjroach tylerjroach 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 to me. Will plan on getting osx support branch merged, then change the base here and mege.

@tylerjroach tylerjroach changed the base branch from feat/add-osx-support to main April 9, 2026 15:01
@msiebert msiebert merged commit 05cc4c9 into main Apr 9, 2026
7 checks passed
@tylerjroach tylerjroach added the enhancement New feature or request label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants