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:
Aaron Brady
2018-08-13 11:21:54 -07:00
committed by Facebook Github Bot
parent f400fcb99d
commit 1a7ef4fc85
2 changed files with 8 additions and 14 deletions

View File

@@ -53,6 +53,10 @@ export default class BaseDevice {
// possible src of icon to display next to the device title
icon: ?string;
supportsOS(os: string) {
return os.toLowerCase() === this.os.toLowerCase();
}
supportsPlugin = (DevicePlugin: Class<SonarDevicePlugin<>>): boolean => {
return this.supportedPlugins.includes(DevicePlugin.id);
};