From 6a0854557e7aafebdc3122ae8254723bfd1a7ff5 Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Wed, 3 Feb 2021 02:22:48 -0800 Subject: [PATCH] Add gk checks in plugin Summary: This diff adds gk checks, VPN check and User login check to our plugin. I added gk checks for Insta and FB apps. There are three kind of GK's. One with FB universe, one with Distillery universe and one with Insta WWW universe. We have API's to check gk with FB and Distillery universe. API to check with Insta WWW universe doesn't exists. There are some technical challenges to build this API. So right now for gks with Insta WWW universe, we just show an notification with info icon. For gks in other universe we aggressively check it when user closes the notif to verify if user assigned himself/herself to it. In long term we are moving away from gks altogether, we need this UX improvement as it will help users to onboard easily. See the following flow. Reviewed By: mweststrate Differential Revision: D26176996 fbshipit-source-id: 92a931610f9b244c14c6888bb12df936b62edd75 --- desktop/app/src/fb-stubs/GK.tsx | 16 ++++++++++++++++ desktop/app/src/index.tsx | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/desktop/app/src/fb-stubs/GK.tsx b/desktop/app/src/fb-stubs/GK.tsx index 69c835360..0807ae4fd 100644 --- a/desktop/app/src/fb-stubs/GK.tsx +++ b/desktop/app/src/fb-stubs/GK.tsx @@ -11,8 +11,24 @@ export type GKID = string; export const TEST_PASSING_GK = 'TEST_PASSING_GK'; export const TEST_FAILING_GK = 'TEST_FAILING_GK'; +export type GKMap = {[key: string]: boolean}; + const whitelistedGKs: Array = []; +export function loadGKs(_username: string, _gks: Array): Promise { + return Promise.reject( + new Error('Implement your custom logic for loading GK'), + ); +} + +export function loadDistilleryGK( + _gk: GKID, +): Promise<{[key: string]: {result: boolean}}> { + return Promise.reject( + new Error('Implement your custom logic for loading GK'), + ); +} + export default class GK { static init() {} diff --git a/desktop/app/src/index.tsx b/desktop/app/src/index.tsx index 15ddb1ae4..7f414d9b2 100644 --- a/desktop/app/src/index.tsx +++ b/desktop/app/src/index.tsx @@ -15,7 +15,7 @@ export * from './ui/index'; export {getStringFromErrorLike, textContent, sleep} from './utils/index'; export {serialize, deserialize} from './utils/serialization'; export * from './utils/jsonTypes'; -export {default as GK} from './fb-stubs/GK'; +export {default as GK, loadGKs, loadDistilleryGK} from './fb-stubs/GK'; export {default as createPaste} from './fb-stubs/createPaste'; export { internGraphGETAPIRequest, @@ -47,6 +47,7 @@ export {Store, MiddlewareAPI, State as ReduxState} from './reducers/index'; export {default as BaseDevice} from './devices/BaseDevice'; export {DeviceLogEntry, LogLevel, DeviceLogListener} from 'flipper-plugin'; export {shouldParseAndroidLog} from './utils/crashReporterUtility'; +export {deconstructClientId} from './utils/clientUtils'; export {default as isProduction} from './utils/isProduction'; export {createTablePlugin} from './createTablePlugin'; export {default as DetailSidebar} from './chrome/DetailSidebar';