Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dynamic-links): add expo config plugin for dynamic-links #6650

Merged
merged 9 commits into from
Nov 2, 2022
3 changes: 3 additions & 0 deletions docs/dynamic-links/usage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ a Dynamic Link on iOS or Android, they can be taken directly to the linked conte

## iOS Setup

> Notes: Currently, iOS requires a workaround to make method swizzling work. The workaround is described in [this Github comment](https://github.com/invertase/react-native-firebase/issues/4548#issuecomment-1252028059). Without this, dynamic link matching behavior may be inconsistent.
> If you are using Expo Managed Workflow, be sure to load the [@react-native-firebase/dynamic-links config plugin](https://rnfirebase.io/#managed-workflow) to automatically apply the workaround.

To setup Dynamic Links on iOS, it is a **prerequisite** that you have an Apple developer account [setup](https://developer.apple.com/programs/enroll/).

1. Add an `App Store ID` & `Team ID` to your app in your Firebase console. If you do not have an `App Store ID` yet, you can put any number in here for now. Your `Team ID` can be found in your Apple developer console.
Expand Down
1 change: 1 addition & 0 deletions packages/dynamic-links/app.plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./plugin/build');
19 changes: 19 additions & 0 deletions packages/dynamic-links/plugin/__tests__/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Expo Config Plugin unit tests

To test the changes to native code applied by config plugins, [snapshot tests](https://jestjs.io/docs/snapshot-testing) are used. Plugin test flow, in short:

1. A test fixture is loaded. In this case, fixtures are template files (`build.gradle`, `AppDelegate.m` etc.) from [`expo-template-bare-minimum`](https://github.com/expo/expo/tree/master/templates/expo-template-bare-minimum).
2. Plugin changes are applied (e.g. gradle dependency is added).
3. Modified file is compared with previously saved snapshot. If they're equal, the test passes. If not, the test fails and the difference (actual vs expected) is shown.

You can preview the snapshot files manually, by opening `__snapshots__/*.snap` files.

### Updating the snapshots

Snapshot tests are designed to ensure the plugin result will not change. In case you intentionally modified the plugin behavior (e.g. updated gradle dependency versions), you have to update the snapshots, otherwise the tests will fail. There are two ways to do it:

- Update all snapshots by running `npm run tests:jest -u`.
- Update snapshots interactively, one by one:
1. Run `yarn tests:jest --watchAll`
2. Press `i` to let `jest` display changes and prompt you for updating each snapshot.
> This option is not available, when there are no failing snapshots
Loading