Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class _MyAppState extends State<MyApp> {
'localizedModel': data.localizedModel,
'identifierForVendor': data.identifierForVendor,
'isPhysicalDevice': data.isPhysicalDevice,
'isiOSAppOnMac': data.isiOSAppOnMac,
'utsname.sysname:': data.utsname.sysname,
'utsname.nodename:': data.utsname.nodename,
'utsname.release:': data.utsname.release,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ - (void)handleMethodCall:(FlutterMethodCall *)call

NSNumber *isPhysicalNumber =
[NSNumber numberWithBool:[self isDevicePhysical]];
NSProcessInfo *info = [NSProcessInfo processInfo];
NSNumber *isiOSAppOnMac = [NSNumber numberWithBool:NO];
if (@available(iOS 14.0, *)) {
isiOSAppOnMac = [NSNumber numberWithBool:[info isiOSAppOnMac]];
}
NSString *machine;
if ([self isDevicePhysical]) {
machine = @(un.machine);
} else {
machine = [[NSProcessInfo processInfo]
environment][@"SIMULATOR_MODEL_IDENTIFIER"];
machine = [info environment][@"SIMULATOR_MODEL_IDENTIFIER"];
}

result(@{
@"name" : [device name],
@"systemName" : [device systemName],
Expand All @@ -40,6 +43,7 @@ - (void)handleMethodCall:(FlutterMethodCall *)call
@"identifierForVendor" : [[device identifierForVendor] UUIDString]
?: [NSNull null],
@"isPhysicalDevice" : isPhysicalNumber,
@"isiOSAppOnMac" : isiOSAppOnMac,
@"utsname" : @{
@"sysname" : @(un.sysname),
@"nodename" : @(un.nodename),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class IosDeviceInfo extends BaseDeviceInfo {
required this.localizedModel,
this.identifierForVendor,
required this.isPhysicalDevice,
required this.isiOSAppOnMac,
required this.utsname,
}) : super(data);

Expand Down Expand Up @@ -52,6 +53,10 @@ class IosDeviceInfo extends BaseDeviceInfo {
/// `false` if the application is running in a simulator, `true` otherwise.
final bool isPhysicalDevice;

/// that indicates whether the process is an iPhone or iPad app running on a Mac.
/// https://developer.apple.com/documentation/foundation/nsprocessinfo/3608556-iosapponmac
final bool isiOSAppOnMac;

/// Operating system information derived from `sys/utsname.h`.
final IosUtsname utsname;

Expand All @@ -66,6 +71,7 @@ class IosDeviceInfo extends BaseDeviceInfo {
localizedModel: map['localizedModel'],
identifierForVendor: map['identifierForVendor'],
isPhysicalDevice: map['isPhysicalDevice'],
isiOSAppOnMac: map['isiOSAppOnMac'],
utsname:
IosUtsname._fromMap(map['utsname']?.cast<String, dynamic>() ?? {}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ void main() {
'utsname': iosUtsnameMap,
'systemName': 'systemName',
'isPhysicalDevice': true,
'isiOSAppOnMac': true,
'systemVersion': 'systemVersion',
'localizedModel': 'localizedModel',
'identifierForVendor': 'identifierForVendor',
Expand All @@ -32,6 +33,7 @@ void main() {
expect(iosDeviceInfo.name, 'name');
expect(iosDeviceInfo.model, 'model');
expect(iosDeviceInfo.isPhysicalDevice, isTrue);
expect(iosDeviceInfo.isiOSAppOnMac, isTrue);
expect(iosDeviceInfo.systemName, 'systemName');
expect(iosDeviceInfo.systemVersion, 'systemVersion');
expect(iosDeviceInfo.localizedModel, 'localizedModel');
Expand Down
Loading