Notification refactor for consistency
Summary: ^ Reviewed By: aigoncharov Differential Revision: D47873882 fbshipit-source-id: 9bfb17b1ecadc3489645b456d6760fc217af7759
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ea50f19655
commit
aaa0a01c6b
@@ -37,13 +37,7 @@ export function connectFlipperServerToStore(
|
|||||||
) {
|
) {
|
||||||
server.on('notification', ({type, title, description}) => {
|
server.on('notification', ({type, title, description}) => {
|
||||||
const key = `[${type}] ${title}: ${description}`;
|
const key = `[${type}] ${title}: ${description}`;
|
||||||
notification.open({
|
showNotification(key, type, title, description);
|
||||||
message: title,
|
|
||||||
description: <NotificationBody text={description} />,
|
|
||||||
type: type,
|
|
||||||
duration: 0,
|
|
||||||
key,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on(
|
server.on(
|
||||||
@@ -288,6 +282,21 @@ export function handleDeviceDisconnected(
|
|||||||
existing?.connected.set(false);
|
existing?.connected.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showNotification(
|
||||||
|
key: string,
|
||||||
|
type: 'success' | 'info' | 'error' | 'warning',
|
||||||
|
message: string,
|
||||||
|
description: string,
|
||||||
|
) {
|
||||||
|
notification.open({
|
||||||
|
message,
|
||||||
|
description: <NotificationBody text={description} />,
|
||||||
|
type,
|
||||||
|
duration: 0,
|
||||||
|
key,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function showConnectivityTroubleshootNotification(
|
function showConnectivityTroubleshootNotification(
|
||||||
store: Store,
|
store: Store,
|
||||||
key: string,
|
key: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user