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 {checkForUpdate} from '../fb-stubs/checkForUpdate';
|
||||||
import {getAppVersion} from '../utils/info';
|
import {getAppVersion} from '../utils/info';
|
||||||
import {UserNotSignedInError} from 'flipper-common';
|
import {UserNotSignedInError} from 'flipper-common';
|
||||||
import {selectPlugin, setPluginEnabled} from '../reducers/connections';
|
import {
|
||||||
|
canBeDefaultDevice,
|
||||||
|
selectPlugin,
|
||||||
|
setPluginEnabled,
|
||||||
|
} from '../reducers/connections';
|
||||||
import {getUpdateAvailableMessage} from '../chrome/UpdateIndicator';
|
import {getUpdateAvailableMessage} from '../chrome/UpdateIndicator';
|
||||||
import {Typography} from 'antd';
|
import {Typography} from 'antd';
|
||||||
import {getPluginStatus, PluginStatus} from '../utils/pluginUtils';
|
import {getPluginStatus, PluginStatus} from '../utils/pluginUtils';
|
||||||
@@ -56,6 +60,7 @@ export async function handleOpenPluginDeeplink(
|
|||||||
) {
|
) {
|
||||||
const params = parseOpenPluginParams(query);
|
const params = parseOpenPluginParams(query);
|
||||||
const title = `Opening plugin ${params.pluginId}…`;
|
const title = `Opening plugin ${params.pluginId}…`;
|
||||||
|
console.debug(`[deeplink] ${title} for with params`, params);
|
||||||
|
|
||||||
if (!(await verifyLighthouseAndUserLoggedIn(store, title))) {
|
if (!(await verifyLighthouseAndUserLoggedIn(store, title))) {
|
||||||
trackInteraction({
|
trackInteraction({
|
||||||
@@ -64,7 +69,9 @@ export async function handleOpenPluginDeeplink(
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.debug('[deeplink] Cleared Lighthouse and log-in check.');
|
||||||
await verifyFlipperIsUpToDate(title);
|
await verifyFlipperIsUpToDate(title);
|
||||||
|
console.debug('[deeplink] Cleared up-to-date check.');
|
||||||
const [pluginStatusResult, pluginStatus] = await verifyPluginStatus(
|
const [pluginStatusResult, pluginStatus] = await verifyPluginStatus(
|
||||||
store,
|
store,
|
||||||
params.pluginId,
|
params.pluginId,
|
||||||
@@ -78,6 +85,7 @@ export async function handleOpenPluginDeeplink(
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.debug('[deeplink] Cleared plugin status check:', pluginStatusResult);
|
||||||
|
|
||||||
const isDevicePlugin = store
|
const isDevicePlugin = store
|
||||||
.getState()
|
.getState()
|
||||||
@@ -91,6 +99,7 @@ export async function handleOpenPluginDeeplink(
|
|||||||
title,
|
title,
|
||||||
isDevicePlugin,
|
isDevicePlugin,
|
||||||
);
|
);
|
||||||
|
console.debug('[deeplink] Selected device and client:', deviceOrClient);
|
||||||
if (deviceOrClient === false) {
|
if (deviceOrClient === false) {
|
||||||
trackInteraction({
|
trackInteraction({
|
||||||
state: 'PLUGIN_DEVICE_BAIL',
|
state: 'PLUGIN_DEVICE_BAIL',
|
||||||
@@ -104,6 +113,8 @@ export async function handleOpenPluginDeeplink(
|
|||||||
const device: BaseDevice = isDevicePlugin
|
const device: BaseDevice = isDevicePlugin
|
||||||
? (deviceOrClient as BaseDevice)
|
? (deviceOrClient as BaseDevice)
|
||||||
: (deviceOrClient as Client).device;
|
: (deviceOrClient as Client).device;
|
||||||
|
console.debug('[deeplink] Client: ', client);
|
||||||
|
console.debug('[deeplink] Device: ', device);
|
||||||
|
|
||||||
// verify plugin supported by selected device / client
|
// verify plugin supported by selected device / client
|
||||||
if (isDevicePlugin && !device.supportsPlugin(pluginDefinition)) {
|
if (isDevicePlugin && !device.supportsPlugin(pluginDefinition)) {
|
||||||
@@ -119,6 +130,7 @@ export async function handleOpenPluginDeeplink(
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.debug('[deeplink] Cleared device plugin support check.');
|
||||||
if (!isDevicePlugin && !client!.plugins.has(params.pluginId)) {
|
if (!isDevicePlugin && !client!.plugins.has(params.pluginId)) {
|
||||||
await Dialog.alert({
|
await Dialog.alert({
|
||||||
title,
|
title,
|
||||||
@@ -132,6 +144,7 @@ export async function handleOpenPluginDeeplink(
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.debug('[deeplink] Cleared client plugin support check.');
|
||||||
|
|
||||||
// verify plugin enabled
|
// verify plugin enabled
|
||||||
if (isDevicePlugin) {
|
if (isDevicePlugin) {
|
||||||
@@ -144,6 +157,7 @@ export async function handleOpenPluginDeeplink(
|
|||||||
} else {
|
} else {
|
||||||
store.dispatch(setPluginEnabled(params.pluginId, client!.query.app));
|
store.dispatch(setPluginEnabled(params.pluginId, client!.query.app));
|
||||||
}
|
}
|
||||||
|
console.debug('[deeplink] Cleared plugin enabling.');
|
||||||
|
|
||||||
// open the plugin
|
// open the plugin
|
||||||
if (isDevicePlugin) {
|
if (isDevicePlugin) {
|
||||||
@@ -455,6 +469,10 @@ async function selectDevicesAndClient(
|
|||||||
|
|
||||||
// at this point we have 1 or more valid devices
|
// at this point we have 1 or more valid devices
|
||||||
const availableDevices = findValidDevices();
|
const availableDevices = findValidDevices();
|
||||||
|
console.debug(
|
||||||
|
'[deeplink] selectDevicesAndClient found at least one more valid device:',
|
||||||
|
availableDevices,
|
||||||
|
);
|
||||||
// device plugin
|
// device plugin
|
||||||
if (isDevicePlugin) {
|
if (isDevicePlugin) {
|
||||||
if (availableDevices.length === 1) {
|
if (availableDevices.length === 1) {
|
||||||
@@ -463,6 +481,7 @@ async function selectDevicesAndClient(
|
|||||||
return (await selectDeviceDialog(availableDevices, title)) ?? false;
|
return (await selectDeviceDialog(availableDevices, title)) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.debug('[deeplink] Not a device plugin. Waiting for valid client.');
|
||||||
// wait for valid client
|
// wait for valid client
|
||||||
while (true) {
|
while (true) {
|
||||||
const validClients = getAllClients(store.getState().connections)
|
const validClients = getAllClients(store.getState().connections)
|
||||||
|
|||||||
Reference in New Issue
Block a user