Add support for checking if the iOS app is running on macOS #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MacOS makes it possible to run iPad apps on Mac with M chip. This means that React Native still returns Platform iOS and isPad true. For analytics, however, it would be helpful to know the number of MacOS users.
To cover this scenario, I have added the
isiOSAppOnMac
check to the Swift module so that the right operating system is logged.Regarding the OS version, there are two options:
ProcessInfo.processInfo.operatingSystemVersion
: 17.6.0 --> Version of the emulated iPadProcessInfo.processInfo.operatingSystemVersionString
: Version 14.6 (Build 23G80) --> Should be same, but apparently it's the MacOS Version with extra formattingOption 1 could lead to confusion, as MacOS is specified as the operating system.
Option 2 cannot be confirmed in the Apple documentation and might be a bug. Also Apple does not recommend to continue parse this value.
It would probably be the best to rename the operating system value to "MacOS (designed for iPad)", but the dashboard does currently not show the proper icon. The other option would be to add a note before the version, such as "iPadOS 14.6.0".
I would appreciate feedback and further opinions.