Add device level icons
Summary: Gave every device an icon, and use it as fallback in case we don't have a client icon. Added an icon for the Flipper client. This gets (largely) rid of the 'blank' icons Reviewed By: fabiomassimo Differential Revision: D26691054 fbshipit-source-id: d83012e755ae5edb230747e88f9b2eac45450b19
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a5cd18c289
commit
f2689d3a5d
@@ -31,7 +31,7 @@ export default class AndroidDevice extends BaseDevice {
|
|||||||
) {
|
) {
|
||||||
super(serial, deviceType, title, 'Android', specs);
|
super(serial, deviceType, title, 'Android', specs);
|
||||||
this.adb = adb;
|
this.adb = adb;
|
||||||
this.icon = 'icons/android.svg';
|
this.icon = 'mobile';
|
||||||
this.abiList = abiList;
|
this.abiList = abiList;
|
||||||
this.sdkVersion = sdkVersion;
|
this.sdkVersion = sdkVersion;
|
||||||
this.adb.openLogcat(this.serial).then((reader) => {
|
this.adb.openLogcat(this.serial).then((reader) => {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export default class ArchivedDevice extends BaseDevice {
|
|||||||
supportRequestDetails?: SupportFormRequestDetailsState;
|
supportRequestDetails?: SupportFormRequestDetailsState;
|
||||||
}) {
|
}) {
|
||||||
super(options.serial, options.deviceType, options.title, options.os);
|
super(options.serial, options.deviceType, options.title, options.os);
|
||||||
|
this.icon = 'box';
|
||||||
this.connected.set(false);
|
this.connected.set(false);
|
||||||
this.source = options.source || '';
|
this.source = options.source || '';
|
||||||
this.supportRequestDetails = options.supportRequestDetails;
|
this.supportRequestDetails = options.supportRequestDetails;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default class IOSDevice extends BaseDevice {
|
|||||||
|
|
||||||
constructor(serial: string, deviceType: DeviceType, title: string) {
|
constructor(serial: string, deviceType: DeviceType, title: string) {
|
||||||
super(serial, deviceType, title, 'iOS');
|
super(serial, deviceType, title, 'iOS');
|
||||||
this.icon = 'icons/ios.svg';
|
this.icon = 'mobile';
|
||||||
this.buffer = '';
|
this.buffer = '';
|
||||||
this.startLogListener();
|
this.startLogListener();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import BaseDevice from './BaseDevice';
|
|||||||
export default class MacDevice extends BaseDevice {
|
export default class MacDevice extends BaseDevice {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('', 'physical', 'Mac', 'MacOS');
|
super('', 'physical', 'Mac', 'MacOS');
|
||||||
|
this.icon = 'app-apple';
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {}
|
teardown() {}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import BaseDevice from './BaseDevice';
|
|||||||
export default class WindowsDevice extends BaseDevice {
|
export default class WindowsDevice extends BaseDevice {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('', 'physical', 'Windows', 'Windows');
|
super('', 'physical', 'Windows', 'Windows');
|
||||||
|
this.icon = 'app-microsoft-windows';
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {}
|
teardown() {}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export function AppSelector() {
|
|||||||
}>
|
}>
|
||||||
<AppInspectButton title="Select the device / app to inspect">
|
<AppInspectButton title="Select the device / app to inspect">
|
||||||
<Layout.Horizontal gap center>
|
<Layout.Horizontal gap center>
|
||||||
<AppIcon appname={client?.query.app} />
|
<AppIcon appname={client?.query.app} device={selectedDevice} />
|
||||||
<Layout.Container grow shrink>
|
<Layout.Container grow shrink>
|
||||||
<Text strong>{client?.query.app ?? ''}</Text>
|
<Text strong>{client?.query.app ?? ''}</Text>
|
||||||
<Text>{selectedDevice?.title || 'Available devices'}</Text>
|
<Text>{selectedDevice?.title || 'Available devices'}</Text>
|
||||||
@@ -137,13 +137,19 @@ const AppInspectButton = styled(Button)({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function AppIcon({appname}: {appname?: string}) {
|
function AppIcon({
|
||||||
|
appname,
|
||||||
|
device,
|
||||||
|
}: {
|
||||||
|
appname?: string;
|
||||||
|
device?: BaseDevice | null;
|
||||||
|
}) {
|
||||||
const invert = appname?.endsWith('Lite') ?? false;
|
const invert = appname?.endsWith('Lite') ?? false;
|
||||||
const brandName = appname?.replace(/ Lite$/, '');
|
const brandName = appname?.replace(/ Lite$/, '');
|
||||||
const color = brandName
|
const color = brandName
|
||||||
? getColorByApp(brandName)
|
? getColorByApp(brandName)
|
||||||
: theme.backgroundTransparentHover;
|
: theme.backgroundTransparentHover;
|
||||||
const icon = brandName && (brandIcons as any)[brandName];
|
const icon = (brandName && (brandIcons as any)[brandName]) ?? device?.icon;
|
||||||
return (
|
return (
|
||||||
<AppIconContainer style={{background: invert ? 'white' : color}}>
|
<AppIconContainer style={{background: invert ? 'white' : color}}>
|
||||||
{icon && (
|
{icon && (
|
||||||
|
|||||||
@@ -296,4 +296,5 @@ export const brandIcons = {
|
|||||||
WhatsApp: 'app-whatsapp',
|
WhatsApp: 'app-whatsapp',
|
||||||
Workplace: 'app-workplace',
|
Workplace: 'app-workplace',
|
||||||
'Work Chat': 'app-work-chat',
|
'Work Chat': 'app-work-chat',
|
||||||
|
Flipper: 'list-gear', // used for the self inspection client
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,7 +35,8 @@
|
|||||||
16
|
16
|
||||||
],
|
],
|
||||||
"box": [
|
"box": [
|
||||||
12
|
12,
|
||||||
|
24
|
||||||
],
|
],
|
||||||
"brush-paint": [
|
"brush-paint": [
|
||||||
12,
|
12,
|
||||||
@@ -536,7 +537,8 @@
|
|||||||
16
|
16
|
||||||
],
|
],
|
||||||
"mobile-outline": [
|
"mobile-outline": [
|
||||||
16
|
16,
|
||||||
|
24
|
||||||
],
|
],
|
||||||
"bookmark-outline": [
|
"bookmark-outline": [
|
||||||
16
|
16
|
||||||
@@ -571,5 +573,14 @@
|
|||||||
],
|
],
|
||||||
"upload": [
|
"upload": [
|
||||||
16
|
16
|
||||||
|
],
|
||||||
|
"list-gear-outline": [
|
||||||
|
24
|
||||||
|
],
|
||||||
|
"app-apple-outline": [
|
||||||
|
24
|
||||||
|
],
|
||||||
|
"app-microsoft-windows": [
|
||||||
|
24
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user