Expose isConnected and currentUser

Summary: Requested by antonk52 and MSYS team

Reviewed By: passy

Differential Revision: D44662243

fbshipit-source-id: 2bace476c4e79b6a05bfb89ddc3e6acb437c6c3b
This commit is contained in:
Andrey Goncharov
2023-04-04 05:26:31 -07:00
committed by Facebook GitHub Bot
parent f8a1f38c0a
commit 7f111a11de
6 changed files with 55 additions and 7 deletions

View File

@@ -27,8 +27,10 @@ import {
FSStatsLike,
FlipperServerCommands,
ENVIRONMENT_VARIABLES,
User,
} from 'flipper-common';
import {CreatePasteArgs, CreatePasteResult} from './Paste';
import {Atom} from '../state/atom';
export type FileEncoding = 'utf-8' | 'base64';
@@ -213,6 +215,8 @@ interface InternAPI {
* @deprecated
*/
isLoggedIn: FlipperServerCommands['is-logged-in'];
currentUser: () => Atom<User | null>;
isConnected: () => Atom<boolean>;
}
export let flipperLibInstance: FlipperLib | undefined;

View File

@@ -18,6 +18,7 @@ import {
FlipperPluginModule,
SandyPluginDefinition,
} from '../plugin/SandyPluginDefinition';
import {createState} from '../state/atom';
import {stubLogger} from '../utils/Logger';
declare const process: any;
@@ -80,6 +81,8 @@ export function createMockFlipperLib(options?: StartPluginOptions): FlipperLib {
graphGet: createStubFunction(),
graphPost: createStubFunction(),
isLoggedIn: createStubFunction(),
currentUser: () => createState(null),
isConnected: () => createState(true),
},
remoteServerContext: {
childProcess: {