Create Support Requests from Flipper
Summary: This diff adds an initial support to prefill the app information and the revision information. This diff also copies the workplace url in the clipboard. Reviewed By: passy Differential Revision: D16990925 fbshipit-source-id: 4f354e52de5fea07c2ea36336761d6963c27ef66
This commit is contained in:
committed by
Facebook Github Bot
parent
b041da6d61
commit
84c5067210
38
src/utils/clientUtils.tsx
Normal file
38
src/utils/clientUtils.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright 2018-present Facebook.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
import Client from '../Client';
|
||||
import 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 = appNameFromClienID(id) || '';
|
||||
const device = deviceFromClienID(id) || '';
|
||||
return {appName, device};
|
||||
})
|
||||
.filter(
|
||||
({device}: {device: string}) =>
|
||||
device && selectedDevice && device == selectedDevice.os,
|
||||
)
|
||||
.map(client => client.appName);
|
||||
return currentActiveApps;
|
||||
}
|
||||
|
||||
export function appNameFromClienID(id: string): string | undefined {
|
||||
const arr = id.split('#');
|
||||
const appName = arr[0];
|
||||
return appName;
|
||||
}
|
||||
|
||||
export function deviceFromClienID(id: string): string | undefined {
|
||||
const arr = id.split('#');
|
||||
const device = arr[1];
|
||||
return device;
|
||||
}
|
||||
Reference in New Issue
Block a user