[strict[ ScreenCaptureButton
Summary: _typescript_ Reviewed By: jknoxville Differential Revision: D17282357 fbshipit-source-id: 6ddd912978faa30195f59971f19d29d3ea79342b
This commit is contained in:
committed by
Facebook Github Bot
parent
7e833b1d70
commit
ac120aa59c
@@ -51,6 +51,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@jest-runner/electron": "^2.0.1",
|
"@jest-runner/electron": "^2.0.1",
|
||||||
"@types/deep-equal": "^1.0.1",
|
"@types/deep-equal": "^1.0.1",
|
||||||
|
"@types/expand-tilde": "^2.0.0",
|
||||||
"@types/fs-extra": "^8.0.0",
|
"@types/fs-extra": "^8.0.0",
|
||||||
"@types/invariant": "^2.2.30",
|
"@types/invariant": "^2.2.30",
|
||||||
"@types/jest": "^24.0.16",
|
"@types/jest": "^24.0.16",
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ class ScreenCaptureButtons extends Component<Props, State> {
|
|||||||
reportPlatformFailures(
|
reportPlatformFailures(
|
||||||
selectedDevice
|
selectedDevice
|
||||||
.screenshot()
|
.screenshot()
|
||||||
.then((buffer: Buffer) => writeBufferToFile(pngPath, buffer))
|
.then(buffer => writeBufferToFile(pngPath, buffer))
|
||||||
.then((path: string) => openFile(path)),
|
.then(path => openFile(path)),
|
||||||
'captureScreenshot',
|
'captureScreenshot',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,9 @@ class ScreenCaptureButtons extends Component<Props, State> {
|
|||||||
dst: string,
|
dst: string,
|
||||||
): Promise<string> => {
|
): Promise<string> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
return device.adb.pull(device.serial, src).then(stream => {
|
return device.adb
|
||||||
|
.pull(device.serial, src)
|
||||||
|
.then((stream: NodeJS.ReadStream) => {
|
||||||
stream.on('end', () => {
|
stream.on('end', () => {
|
||||||
resolve(dst);
|
resolve(dst);
|
||||||
});
|
});
|
||||||
@@ -236,7 +238,7 @@ class ScreenCaptureButtons extends Component<Props, State> {
|
|||||||
return device.adb
|
return device.adb
|
||||||
.shell(device.serial, command)
|
.shell(device.serial, command)
|
||||||
.then(adb.util.readAll)
|
.then(adb.util.readAll)
|
||||||
.then(output => output.toString().trim());
|
.then((output: Buffer) => output.toString().trim());
|
||||||
};
|
};
|
||||||
|
|
||||||
onRecordingClicked = () => {
|
onRecordingClicked = () => {
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ import fs from 'fs';
|
|||||||
* Writes a buffer to a specified file path.
|
* Writes a buffer to a specified file path.
|
||||||
* Returns a Promise which resolves to the file path.
|
* Returns a Promise which resolves to the file path.
|
||||||
*/
|
*/
|
||||||
export const writeBufferToFile = (filePath: string, buffer: Buffer) => {
|
export const writeBufferToFile = (
|
||||||
|
filePath: string,
|
||||||
|
buffer: Buffer,
|
||||||
|
): Promise<string> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fs.writeFile(filePath, buffer, err => {
|
fs.writeFile(filePath, buffer, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ interface Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'adbkit-fb' {
|
declare module 'adbkit-fb' {
|
||||||
const util: any;
|
const util: Util;
|
||||||
const adbkit: any;
|
const adbkit: any;
|
||||||
export interface Client {
|
export interface Client {
|
||||||
listDevices: () => Promise<Device[]>;
|
listDevices: () => Promise<Device[]>;
|
||||||
|
|||||||
@@ -1077,6 +1077,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
|
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
|
||||||
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==
|
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==
|
||||||
|
|
||||||
|
"@types/expand-tilde@^2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/expand-tilde/-/expand-tilde-2.0.0.tgz#c01a706675b9d60931bf6a7dc7dfa45d63540c97"
|
||||||
|
integrity sha512-17h/6MRHoetV2QVUVnUfrmaFCXNIFJ3uDJmXlklX2xDtlEb1W0OXLgP+qwND2Ibg/PtQfQi0vx19KGuPayjLiw==
|
||||||
|
|
||||||
"@types/fs-extra@^8.0.0":
|
"@types/fs-extra@^8.0.0":
|
||||||
version "8.0.0"
|
version "8.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.0.0.tgz#d3e2c313ca29f95059f198dd60d1f774642d4b25"
|
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.0.0.tgz#d3e2c313ca29f95059f198dd60d1f774642d4b25"
|
||||||
|
|||||||
Reference in New Issue
Block a user