Update desktop-plugin-structure.mdx to add supportedApps

Summary:
This diff has been automatically generated by the inpage editor

Addresses the comment https://www.internalfb.com/diff/D30193668?dst_version_fbid=579384449899538&transaction_fbid=938191196910073

Reviewed By: passy, mweststrate

Differential Revision: D30248046

fbshipit-source-id: 1ef1e5ad75cdabf716ab7b81314e77e2dd9de5ce
This commit is contained in:
Ananya Arun
2021-08-12 03:50:09 -07:00
committed by Facebook GitHub Bot
parent 6544e5a7a3
commit 5e350add4f

View File

@@ -136,8 +136,42 @@ export function Component() {
} }
``` ```
<FbInternalOnly>
Client plugins must have the property `pluginType` set to `client` in their package.json. They should also specify supported apps using property `supportedApps`
in package.json. The property should contain an array of supported apps each defined as conjunction of app properties in the following format:
`{"appID": <"Facebook" | "Instagram" | "Messenger">, "os": <"Android" | "iOS" | "Metro">, "type": <"physical" | "emulator"> }`. For example: `{ "appID": "Facebook", "os": "Android", "type": "emulator" }` means
that app facebook must work on Android AND must be an emulator in order to debug it using the plugin.
Note that if the os field is missing that means both Android and iOS are supported by the app and similarly we assume that a specific plugin working for a physical device will also work for the emulator. Hence the type field is assumed to be true for both physical and emulator devices unless specifically only one of them is written in the .json file.
To specify that a plugin supports Facebook on Android/iOS physical/emulator devices, Messenger on only Android physical/emulator and does not support Instagram, the plugin package.json should look like that:
```json
{
"$schema": "https://fbflipper.com/schemas/plugin-package/v2.json",
"name": "flipper-plugin-myclientplugin",
"id": "myclientplugin",
"pluginType": "client",
"supportedApps": [
{"AppID": "Facebook"},
{"AppID": "Messenger", "os": "Android"}
]
...
}
```
</FbInternalOnly>
A further guide on how to write custom Flipper plugins can be found here: [tutorial](../tutorial/js-custom.mdx). A further guide on how to write custom Flipper plugins can be found here: [tutorial](../tutorial/js-custom.mdx).
<FbInternalOnly>
Note after adding new plugins the metadata of the supportedApps field needs to be updated. This has to be done in the package.json file in the directory by the name of the plugin under plugins/fb/\{directory name\} or plugins/public/\{directory name\}/fb.
If an App is not listed in the supportedApps definition, it does not always mean flipper doesn't support it. It could just be because the plugin was recently added and the .json files were not updated.
Plugins will work for apps that register them, even when they are not registered here in the metadata. The most important reason to add supported apps to the suppertedApps is to allow Flipper to signal to the user which plugins are supposed to work on which apps during troubleshooting.
</FbInternalOnly>
### Creating a Device Plugin ### Creating a Device Plugin
Flipper also supports so-called device plugins - plugins that are available for an entire device - but don't receive a connection to a running app, Flipper also supports so-called device plugins - plugins that are available for an entire device - but don't receive a connection to a running app,