Generalize client OS filtering by device and move logic to Device class itself
Summary: Adding support for a WindowsDevice (in following diff) that relies on this behavior, also seems reasonable that the logic for what client os' a device supports should be in the device class. Reviewed By: jknoxville Differential Revision: D8861698 fbshipit-source-id: 2907f616baa04eb71a9e4ef3b6704980acbafaf5
This commit is contained in:
committed by
Facebook Github Bot
parent
f400fcb99d
commit
1a7ef4fc85
@@ -28,8 +28,6 @@ import {devicePlugins} from '../device-plugins/index.js';
|
||||
import plugins from '../plugins/index.js';
|
||||
import {selectPlugin} from '../reducers/connections.js';
|
||||
import {connect} from 'react-redux';
|
||||
import AndroidDevice from '../devices/AndroidDevice.js';
|
||||
import IOSDevice from '../devices/IOSDevice.js';
|
||||
|
||||
const CustomClickableListItem = ClickableListItem.extends({
|
||||
paddingLeft: 10,
|
||||
@@ -166,18 +164,10 @@ class MainSidebar extends Component<MainSidebarProps> {
|
||||
});
|
||||
|
||||
clients = clients
|
||||
.filter((client: Client) => {
|
||||
if (
|
||||
(selectedDevice instanceof AndroidDevice &&
|
||||
client.query.os.toLowerCase() !== 'android') ||
|
||||
(selectedDevice instanceof IOSDevice &&
|
||||
client.query.os.toLowerCase() !== 'ios')
|
||||
) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
.filter(
|
||||
(client: Client) =>
|
||||
selectedDevice && selectedDevice.supportsOS(client.query.os),
|
||||
)
|
||||
.sort((a, b) => (a.query.app || '').localeCompare(b.query.app));
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user