Add debug logging
Summary: Open to feedback that this is making it harder to follow the code. I was trying to make sense of some odd opening behaviour and it helped in that case but we can also just keep this diff around to re-apply if needed. Reviewed By: mweststrate Differential Revision: D31857738 fbshipit-source-id: 4ebc8685e65e1cc854586518d4f790b3ad102633
This commit is contained in:
committed by
Facebook GitHub Bot
parent
75df79a248
commit
ece8b8e1a1
@@ -15,7 +15,11 @@ import {State, Store} from '../reducers/index';
|
||||
import {checkForUpdate} from '../fb-stubs/checkForUpdate';
|
||||
import {getAppVersion} from '../utils/info';
|
||||
import {UserNotSignedInError} from 'flipper-common';
|
||||
import {selectPlugin, setPluginEnabled} from '../reducers/connections';
|
||||
import {
|
||||
canBeDefaultDevice,
|
||||
selectPlugin,
|
||||
setPluginEnabled,
|
||||
} from '../reducers/connections';
|
||||
import {getUpdateAvailableMessage} from '../chrome/UpdateIndicator';
|
||||
import {Typography} from 'antd';
|
||||
import {getPluginStatus, PluginStatus} from '../utils/pluginUtils';
|
||||
@@ -56,6 +60,7 @@ export async function handleOpenPluginDeeplink(
|
||||
) {
|
||||
const params = parseOpenPluginParams(query);
|
||||
const title = `Opening plugin ${params.pluginId}…`;
|
||||
console.debug(`[deeplink] ${title} for with params`, params);
|
||||
|
||||
if (!(await verifyLighthouseAndUserLoggedIn(store, title))) {
|
||||
trackInteraction({
|
||||
@@ -64,7 +69,9 @@ export async function handleOpenPluginDeeplink(
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.debug('[deeplink] Cleared Lighthouse and log-in check.');
|
||||
await verifyFlipperIsUpToDate(title);
|
||||
console.debug('[deeplink] Cleared up-to-date check.');
|
||||
const [pluginStatusResult, pluginStatus] = await verifyPluginStatus(
|
||||
store,
|
||||
params.pluginId,
|
||||
@@ -78,6 +85,7 @@ export async function handleOpenPluginDeeplink(
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.debug('[deeplink] Cleared plugin status check:', pluginStatusResult);
|
||||
|
||||
const isDevicePlugin = store
|
||||
.getState()
|
||||
@@ -91,6 +99,7 @@ export async function handleOpenPluginDeeplink(
|
||||
title,
|
||||
isDevicePlugin,
|
||||
);
|
||||
console.debug('[deeplink] Selected device and client:', deviceOrClient);
|
||||
if (deviceOrClient === false) {
|
||||
trackInteraction({
|
||||
state: 'PLUGIN_DEVICE_BAIL',
|
||||
@@ -104,6 +113,8 @@ export async function handleOpenPluginDeeplink(
|
||||
const device: BaseDevice = isDevicePlugin
|
||||
? (deviceOrClient as BaseDevice)
|
||||
: (deviceOrClient as Client).device;
|
||||
console.debug('[deeplink] Client: ', client);
|
||||
console.debug('[deeplink] Device: ', device);
|
||||
|
||||
// verify plugin supported by selected device / client
|
||||
if (isDevicePlugin && !device.supportsPlugin(pluginDefinition)) {
|
||||
@@ -119,6 +130,7 @@ export async function handleOpenPluginDeeplink(
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.debug('[deeplink] Cleared device plugin support check.');
|
||||
if (!isDevicePlugin && !client!.plugins.has(params.pluginId)) {
|
||||
await Dialog.alert({
|
||||
title,
|
||||
@@ -132,6 +144,7 @@ export async function handleOpenPluginDeeplink(
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.debug('[deeplink] Cleared client plugin support check.');
|
||||
|
||||
// verify plugin enabled
|
||||
if (isDevicePlugin) {
|
||||
@@ -144,6 +157,7 @@ export async function handleOpenPluginDeeplink(
|
||||
} else {
|
||||
store.dispatch(setPluginEnabled(params.pluginId, client!.query.app));
|
||||
}
|
||||
console.debug('[deeplink] Cleared plugin enabling.');
|
||||
|
||||
// open the plugin
|
||||
if (isDevicePlugin) {
|
||||
@@ -455,6 +469,10 @@ async function selectDevicesAndClient(
|
||||
|
||||
// at this point we have 1 or more valid devices
|
||||
const availableDevices = findValidDevices();
|
||||
console.debug(
|
||||
'[deeplink] selectDevicesAndClient found at least one more valid device:',
|
||||
availableDevices,
|
||||
);
|
||||
// device plugin
|
||||
if (isDevicePlugin) {
|
||||
if (availableDevices.length === 1) {
|
||||
@@ -463,6 +481,7 @@ async function selectDevicesAndClient(
|
||||
return (await selectDeviceDialog(availableDevices, title)) ?? false;
|
||||
}
|
||||
|
||||
console.debug('[deeplink] Not a device plugin. Waiting for valid client.');
|
||||
// wait for valid client
|
||||
while (true) {
|
||||
const validClients = getAllClients(store.getState().connections)
|
||||
|
||||
Reference in New Issue
Block a user