adding UI

Summary:
- Adds the Flipper notifications UI from the hackweek
- The notifications plugin is hidden behind a GK `flipper_notifications`
- Plugins currently can not dispatch any notifications

Reviewed By: jknoxville, passy

Differential Revision: D10300838

fbshipit-source-id: 2a3a823f09fee3370ce725b506b162e57751c382
This commit is contained in:
Daniel Büchele
2018-10-10 10:34:27 -07:00
committed by Facebook Github Bot
parent f7cb4667c4
commit 78252b2ef2
7 changed files with 600 additions and 62 deletions

View File

@@ -24,23 +24,12 @@ export type PluginClient = {|
type PluginTarget = BaseDevice | Client;
export type Notification = {|
title: string,
message: string,
severity: 'warning' | 'error',
timestamp?: number,
category?: string,
action?: string,
|};
export type NotificationSet = {[id: string]: Notification};
export type Props<T> = {
logger: Logger,
persistedState: T,
setPersistedState: (state: $Shape<T>) => void,
setActiveNotifications: NotificationSet => void,
target: PluginTarget,
deepLinkPayload: ?string,
};
export class FlipperBasePlugin<
@@ -75,9 +64,6 @@ export class FlipperBasePlugin<
// methods to be overriden by plugins
init(): void {}
teardown(): void {}
computeNotifications(props: Props<*>, state: State): NotificationSet {
return {};
}
// methods to be overridden by subclasses
_init(): void {}
_teardown(): void {}
@@ -97,10 +83,6 @@ export class FlipperBasePlugin<
throw new TypeError(`Reducer ${actionData.type} isn't a function`);
}
}
componentDidUpdate(props: Props<*>, state: State): void {
props.setActiveNotifications(this.computeNotifications(props, state));
}
}
export class FlipperDevicePlugin<S = *, A = *, P = *> extends FlipperBasePlugin<