Files
flipper/desktop/app/src/utils/clientUtils.tsx
Michel Weststrate d88b28330a Move app/server to flipper-server-core
Summary: moved `app/src/server` to `flipper-server-core/src` and fixed any fallout from that (aka integration points I missed on the preparing diffs).

Reviewed By: passy

Differential Revision: D31541378

fbshipit-source-id: 8a7e0169ebefa515781f6e5e0f7b926415d4b7e9
2021-10-12 16:00:52 -07:00

30 lines
859 B
TypeScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {deconstructClientId} from 'flipper-common';
import type Client from '../Client';
import type BaseDevice from '../devices/BaseDevice';
export function currentActiveApps(
clients: Array<Client>,
selectedDevice: null | BaseDevice,
): Array<string> {
const currentActiveApps: Array<string> = clients
.map(({id}: {id: string}) => {
const appName = deconstructClientId(id).app || '';
const os = deconstructClientId(id).os || '';
return {appName, os};
})
.filter(
({os}: {os: string}) => os && selectedDevice && os == selectedDevice.os,
)
.map((client) => client.appName);
return currentActiveApps;
}