Show possible remediation steps for known errors in a notification

Summary: This diff fires a notification with a remediation suggestion when the client takes a long time to connect back, for both WW and FS_ACCESS case

Reviewed By: mweststrate

Differential Revision: D23321067

fbshipit-source-id: 17ab93974e9571a0ba78af05c624eeb0522637c6
This commit is contained in:
Pritesh Nandgaonkar
2020-08-26 07:53:30 -07:00
committed by Facebook GitHub Bot
parent ce12c4e3df
commit dc4e224bfb
2 changed files with 38 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ import {Logger} from '../fb-interfaces/Logger';
import Client from '../Client';
import {UninitializedClient} from '../UninitializedClient';
import {addErrorNotification} from '../reducers/notifications';
import {CertificateExchangeMedium} from '../utils/CertificateProvider';
export default (store: Store, logger: Logger) => {
const server = new Server(logger, store);
server.init();
@@ -83,6 +83,28 @@ export default (store: Store, logger: Logger) => {
},
);
server.addListener(
'client-unresponsive-error',
({
client,
medium,
deviceID,
}: {
client: UninitializedClient;
medium: CertificateExchangeMedium;
deviceID: string;
}) => {
store.dispatch(
addErrorNotification(
`Client ${client.appName} with device ${deviceID} took long time to connect back on the trusted channel.`,
medium === 'WWW'
? 'Verify that you are on lighthouse on your client and have a working internet connection. To connect to lighthouse on your client, use VPN. Follow this link: https://www.internalfb.com/intern/wiki/Ops/Network/Enterprise_Network_Engineering/ene_wlra/VPN_Help/Vpn/mobile/'
: 'Verify if your client is connected to Flipper and verify if there is no error related to idb.',
),
);
},
);
if (typeof window !== 'undefined') {
window.addEventListener('beforeunload', () => {
server.close();