Move GK documentation / explanation to the refguide

Summary: ^

Reviewed By: nikoant

Differential Revision: D25559029

fbshipit-source-id: cf47c3f3b9d567ba24b7a6a254a945c763350195
This commit is contained in:
Michel Weststrate
2020-12-15 12:32:42 -08:00
committed by Facebook GitHub Bot
parent f9c8826090
commit 63e46738c1
2 changed files with 13 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
id: flipper-plugin
title: Desktop Plugin API
---
import {FbInternalOnly} from 'internaldocs-fb-helpers';
## PluginClient
@@ -238,6 +239,18 @@ Usage: `client.GK(gatekeeper: string): boolean`
Returns `true` if the current user is part of the given GK. `false` in all other cases.
<FbInternalOnly>
To use a gatekeeper in the Facebook build of Flipper:
1. [Create the gatekeeper](https://www.internalfb.com/intern/gatekeeper/)
2. Add the Gatekeepers name to the `subscribedGatekeepers` array in `fbsource/xplat/sonar/desktop/src/fb/GK.tsx`
3. Use `client.GK('name_of_gk')` to read the gatekeeper, or alternatively: `import {GK} from 'flipper'; GK.get('name_of_gk')`
The gatekeepers are cached in `localStorage`. Therefore, you might get the cached result of the gatekeeper on the first access (which defaults to `false`). On the next start of the app you will get the new result.
</FbInternalOnly>
## DevicePluginClient
### Properties