-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cli] Warn user when trying to an iOS app in a incompatible device (#194
) * [cli] Warn user when trying to an iOS app in a incompatible device * Prevent detectIOSAppType from erroring out * Apply suggestions from code review Co-authored-by: Brent Vatne <brentvatne@gmail.com> * Add changelog entry --------- Co-authored-by: Brent Vatne <brentvatne@gmail.com>
- Loading branch information
1 parent
c6b6ffa
commit e7ad094
Showing
5 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import path from 'path'; | ||
import fs from 'fs-extra'; | ||
|
||
import { parseBinaryPlistAsync } from '../../utils/parseBinaryPlistAsync'; | ||
|
||
export async function detectIOSAppType(appPath: string): Promise<'device' | 'simulator'> { | ||
const builtInfoPlistPath = path.join(appPath, 'Info.plist'); | ||
if (!fs.existsSync(builtInfoPlistPath)) { | ||
return 'device'; | ||
} | ||
|
||
const { DTPlatformName }: { DTPlatformName: string } = | ||
await parseBinaryPlistAsync(builtInfoPlistPath); | ||
|
||
return DTPlatformName.includes('simulator') ? 'simulator' : 'device'; | ||
} |