expo / config-plugins

Out-of-tree Expo config plugins for packages that haven't adopted the config plugin system yet.
427 stars 91 forks source link

feat(branch): add support for test environments #229

Open rodperottoni opened 2 months ago

rodperottoni commented 2 months ago

Why

Branch has a handy test mode that lets developers test their implementation in a sandbox, preventing data pollution in the live environment. At the moment this config plugin does not support the test environment feature.

iOS docs Android docs

How

I introduced this feature into the config plugin by expanding the config plugin parameters to accept some new values:

Enabling the test environment varies between platforms:

Considerations / Help Needed

Part of this PR depends on some updated types in the official expo/config-types. Specifically, the ExpoConfig type supports a branch.apiKey field underneath the config.ios and config.android, and this config-plugin currently makes use of those values.

In an ideal world, I think the global ExpoConfig should have nothing that deals with Branch. It just... doesn't make sense? If this sentiment is shared between other maintainers, I'd be happy to completely kill those values from ExpoConfig and make the necessary changes in this PR to only take in options from the config-plugin itself.

Regardless, I have opened a PR in the expo repo to update the ExpoConfig type to accept the testApiKey and enableTestEnvironment parameters: https://github.com/expo/expo/pull/28084

What I'm confused about is how would these PRs be orchestrated to work together? Would we have to first merge the main repo PR and only then update the config plugin here? I'll wait for someone to chime in on this, as I'm a beginner in multi-repo contributions 😂

Test Plan