DeviceLogs plugin to Sandy

Summary:
Converted the DeviceLogs plugin to sandy.

Kept logic and UI the same (so same batching, localstorage mechanisms etc). But used sandy api's for log subscribing, state, and separating the logical part of the component from the UI.

Note that some mechanisms work slightly different, like deeplinking and scrollToBottom handling, to reflect the fact that plugins are now long lived

Reviewed By: jknoxville

Differential Revision: D22845466

fbshipit-source-id: 7c98b2ddd9121dc730768ee1bece7e71bb5bec16
This commit is contained in:
Michel Weststrate
2020-08-20 13:31:17 -07:00
committed by Facebook GitHub Bot
parent dd15cffa64
commit 685cc09b3b
9 changed files with 267 additions and 259 deletions

View File

@@ -12,7 +12,7 @@ import {Logger} from '../fb-interfaces/Logger';
import {PluginNotification} from '../reducers/notifications';
import {PluginDefinition, isSandyPlugin} from '../plugin';
import isHeadless from '../utils/isHeadless';
import {setStaticView, setDeeplinkPayload} from '../reducers/connections';
import {setStaticView} from '../reducers/connections';
import {ipcRenderer, IpcRendererEvent} from 'electron';
import {
setActiveNotifications,
@@ -48,9 +48,11 @@ export default (store: Store, logger: Logger) => {
) => {
if (eventName === 'click' || (eventName === 'action' && arg === 0)) {
store.dispatch(
setDeeplinkPayload(pluginNotification.notification.action ?? null),
setStaticView(
NotificationScreen,
pluginNotification.notification.action ?? null,
),
);
store.dispatch(setStaticView(NotificationScreen));
} else if (eventName === 'action') {
if (arg === 1 && pluginNotification.notification.category) {
// Hide similar (category)