Skip to content

Commit

Permalink
fix(dynamic-links, ios): expo config plugin automates dynamic-links w…
Browse files Browse the repository at this point in the history
…orkaround (#6650)

Related #2660

Co-authored-by: Mike Hardy <github@mikehardy.net>
  • Loading branch information
austin43 and mikehardy committed Nov 2, 2022
1 parent d654d00 commit e558ad7
Show file tree
Hide file tree
Showing 14 changed files with 1,175 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/dynamic-links/usage/index.md
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
@@ -0,0 +1 @@
module.exports = require('./plugin/build');
19 changes: 19 additions & 0 deletions packages/dynamic-links/plugin/__tests__/README.md
@@ -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

1 comment on commit e558ad7

@vercel
Copy link

@vercel vercel bot commented on e558ad7 Nov 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.