API for creating pastes without showing notifications
Reviewed By: mweststrate Differential Revision: D33277470 fbshipit-source-id: 2ec9ad7d9fc48d7d2da64be3bfc1a66bb5b3a347
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6b8588c5ef
commit
dd4d7bbe7f
@@ -81,6 +81,8 @@ test('Correct top level API exposed', () => {
|
|||||||
"Atom",
|
"Atom",
|
||||||
"CrashLog",
|
"CrashLog",
|
||||||
"CrashLogListener",
|
"CrashLogListener",
|
||||||
|
"CreatePasteArgs",
|
||||||
|
"CreatePasteResult",
|
||||||
"DataDescriptionType",
|
"DataDescriptionType",
|
||||||
"DataInspectorExpanded",
|
"DataInspectorExpanded",
|
||||||
"DataTableColumn",
|
"DataTableColumn",
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export {
|
|||||||
DefaultKeyboardAction,
|
DefaultKeyboardAction,
|
||||||
} from './plugin/MenuEntry';
|
} from './plugin/MenuEntry';
|
||||||
export {Notification} from './plugin/Notification';
|
export {Notification} from './plugin/Notification';
|
||||||
|
export {CreatePasteArgs, CreatePasteResult} from './plugin/Paste';
|
||||||
|
|
||||||
export {theme} from './ui/theme';
|
export {theme} from './ui/theme';
|
||||||
export {Layout} from './ui/Layout';
|
export {Layout} from './ui/Layout';
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
EnvironmentInfo,
|
EnvironmentInfo,
|
||||||
FSStatsLike,
|
FSStatsLike,
|
||||||
} from 'flipper-common';
|
} from 'flipper-common';
|
||||||
|
import {CreatePasteArgs, CreatePasteResult} from './Paste';
|
||||||
|
|
||||||
export type FileEncoding = 'utf-8' | 'base64';
|
export type FileEncoding = 'utf-8' | 'base64';
|
||||||
|
|
||||||
@@ -94,7 +95,9 @@ export interface FlipperLib {
|
|||||||
isFB: boolean;
|
isFB: boolean;
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
enableMenuEntries(menuEntries: NormalizedMenuEntry[]): void;
|
enableMenuEntries(menuEntries: NormalizedMenuEntry[]): void;
|
||||||
createPaste(input: string): Promise<string | undefined>;
|
createPaste(
|
||||||
|
args: string | CreatePasteArgs,
|
||||||
|
): Promise<CreatePasteResult | undefined>;
|
||||||
GK(gatekeeper: string): boolean;
|
GK(gatekeeper: string): boolean;
|
||||||
selectPlugin(
|
selectPlugin(
|
||||||
device: Device,
|
device: Device,
|
||||||
|
|||||||
21
desktop/flipper-plugin/src/plugin/Paste.tsx
Normal file
21
desktop/flipper-plugin/src/plugin/Paste.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type CreatePasteArgs = {
|
||||||
|
content: string;
|
||||||
|
title?: string;
|
||||||
|
showSuccessNotification?: boolean;
|
||||||
|
showErrorNotification?: boolean;
|
||||||
|
writeToClipboard?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CreatePasteResult = {
|
||||||
|
number: number;
|
||||||
|
url: string;
|
||||||
|
};
|
||||||
@@ -17,6 +17,7 @@ import {batched} from '../state/batch';
|
|||||||
import {Idler} from '../utils/Idler';
|
import {Idler} from '../utils/Idler';
|
||||||
import {Notification} from './Notification';
|
import {Notification} from './Notification';
|
||||||
import {Logger} from '../utils/Logger';
|
import {Logger} from '../utils/Logger';
|
||||||
|
import {CreatePasteArgs, CreatePasteResult} from './Paste';
|
||||||
|
|
||||||
type StateExportHandler<T = any> = (
|
type StateExportHandler<T = any> = (
|
||||||
idler: Idler,
|
idler: Idler,
|
||||||
@@ -94,7 +95,9 @@ export interface BasePluginClient {
|
|||||||
* Creates a Paste (similar to a Github Gist).
|
* Creates a Paste (similar to a Github Gist).
|
||||||
* Facebook only function. Resolves to undefined if creating a paste failed.
|
* Facebook only function. Resolves to undefined if creating a paste failed.
|
||||||
*/
|
*/
|
||||||
createPaste(input: string): Promise<string | undefined>;
|
createPaste(
|
||||||
|
args: string | CreatePasteArgs,
|
||||||
|
): Promise<CreatePasteResult | undefined>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this is an internal Facebook build.
|
* Returns true if this is an internal Facebook build.
|
||||||
|
|||||||
@@ -7,20 +7,10 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default function createPaste(
|
import type {CreatePasteArgs, CreatePasteResult} from 'flipper-plugin';
|
||||||
_input: string,
|
|
||||||
): Promise<string | undefined> {
|
|
||||||
return Promise.reject(new Error('Not implemented!'));
|
|
||||||
}
|
|
||||||
|
|
||||||
export type CreatePasteResult = {
|
export default async function createPaste(
|
||||||
number: number;
|
_args: string | CreatePasteArgs,
|
||||||
url: string;
|
): Promise<CreatePasteResult | undefined> {
|
||||||
};
|
throw new Error('Not implemented');
|
||||||
|
|
||||||
export async function createPasteWithDetails(_details: {
|
|
||||||
title?: string;
|
|
||||||
content: string;
|
|
||||||
}): Promise<CreatePasteResult | undefined> {
|
|
||||||
return Promise.reject(new Error('Not implemented!'));
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user