Repository navigation
chore(test-app): start a second environment when a second key is set - #550
Open
abelonogov-ld wants to merge 1 commit into
Open
abelonogov-ld wants to merge 1 commit into
abelonogov-ld wants to merge 1 commit into
Conversation
LAUNCHDARKLY_SECONDARY_MOBILE_KEY in Secrets.xcconfig, or -LDSecondaryMobileKey at launch, adds a secondary mobile key to the client's LDConfig. An Environment picker then chooses which environment's client the buttons, the connection status, Post 20 MB and the Event storage section use. Restart, Flush, Flush+Wait, Offline and Identify still reach both, as the SDK applies them to every environment. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #545.
What
When
Config/Secrets.xcconfigsetsLAUNCHDARKLY_SECONDARY_MOBILE_KEY(or the app is launched with-LDSecondaryMobileKey mob-...), the client is started with that key as a secondary environment throughLDConfig.setSecondaryMobileKeys. An Environment picker at the top of Client chooses which environment's client the buttons use. Without the key nothing changes.The selected environment is used by:
These reach both environments whichever is selected, because the SDK applies
close,flush,flushAndWait,setOnlineandidentifyto every environment it started: Restart and the persistence picker, Flush, Flush+Wait, Offline, and Identify. A footer under Client says so.The choice is saved in
UserDefaults, so the launch that answers a kill scenario shows the same environment.InstanceLauncherforwards-LDSecondaryMobileKeyto the instances it starts.Testing
<bundle hash>.<key hash>), each holding its startup log.Note
The SDK keeps
ConnectionInformationunder oneUserDefaultskey for every environment (ConnectionInformationStore). Each environment's status therefore starts out showing whichever environment saved last, until its own connection updates it. This PR doesn't change that SDK behavior.Note
Overview
The TestApp can now run two LaunchDarkly environments when
LAUNCHDARKLY_SECONDARY_MOBILE_KEYis set (or-LDSecondaryMobileKeyat launch).LDConfig.setSecondaryMobileKeysstarts the secondary client alongside the primary; config, plist, and README document the new key.Environment picker appears on Client when a distinct secondary key is present. The choice is persisted in
UserDefaultsso kill/crash relaunch scenarios keep the same environment. Per-environment behavior covers flag eval/observers, track, stress and event-loss actions, connection status, event storage (per-directory via.id), and the oversized POST probe’s API key.Global SDK operations still hit both environments: restart, flush, offline, and identify—called out in a section footer.
InstanceLauncherforwards the secondary key to spawned instances.Reviewed by Cursor Bugbot for commit a796dca. Bugbot is set up for automated code reviews on this repo. Configure here.