Asyncify complex promise function
Summary: Linter flagged this as it's using promises inside promises. This is a bit easier to read. Reviewed By: timur-valiev Differential Revision: D30402783 fbshipit-source-id: aee7dedc4468538bceec4fc64379f8b2d89a660c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
45ce538c8d
commit
393e47641b
@@ -309,26 +309,24 @@ export default class CertificateProvider {
|
|||||||
}
|
}
|
||||||
if (os === 'iOS' || os === 'windows' || os == 'MacOS') {
|
if (os === 'iOS' || os === 'windows' || os == 'MacOS') {
|
||||||
return promisify(fs.writeFile)(destination + filename, contents).catch(
|
return promisify(fs.writeFile)(destination + filename, contents).catch(
|
||||||
(err) => {
|
async (err) => {
|
||||||
if (os === 'iOS') {
|
if (os === 'iOS') {
|
||||||
// Writing directly to FS failed. It's probably a physical device.
|
// Writing directly to FS failed. It's probably a physical device.
|
||||||
const relativePathInsideApp =
|
const relativePathInsideApp =
|
||||||
this.getRelativePathInAppContainer(destination);
|
this.getRelativePathInAppContainer(destination);
|
||||||
return appNamePromise
|
const appName = await appNamePromise;
|
||||||
.then((appName) => {
|
const udid = await this.getTargetiOSDeviceId(
|
||||||
return this.getTargetiOSDeviceId(appName, destination, csr);
|
appName,
|
||||||
})
|
destination,
|
||||||
.then((udid) => {
|
csr,
|
||||||
return appNamePromise.then((appName) =>
|
);
|
||||||
this.pushFileToiOSDevice(
|
return await this.pushFileToiOSDevice(
|
||||||
udid,
|
udid,
|
||||||
appName,
|
appName,
|
||||||
relativePathInsideApp,
|
relativePathInsideApp,
|
||||||
filename,
|
filename,
|
||||||
contents,
|
contents,
|
||||||
),
|
);
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Invalid appDirectory recieved from ${os} device: ${destination}: ` +
|
`Invalid appDirectory recieved from ${os} device: ${destination}: ` +
|
||||||
|
|||||||
Reference in New Issue
Block a user