Skip to content

Commit

Permalink
Update properties to still return the old model as well
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuberen committed Dec 10, 2024
1 parent c06950a commit 20153d1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ void main() {
expect(macosInfo.computerName, isNotNull);
expect(macosInfo.hostName, isNotNull);
expect(macosInfo.arch, isNotNull);
expect(macosInfo.model, isNotNull);
expect(macosInfo.modelName, isNotNull);
expect(macosInfo.modelIdentifier, isNotNull);
expect(macosInfo.kernelVersion, isNotNull);
expect(macosInfo.osRelease, isNotNull);
expect(macosInfo.activeCPUs, isNotNull);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class _MyAppState extends State<MyApp> {
'systemName': data.systemName,
'systemVersion': data.systemVersion,
'model': data.model,
'modelName': data.modelName,
'localizedModel': data.localizedModel,
'identifierForVendor': data.identifierForVendor,
'isPhysicalDevice': data.isPhysicalDevice,
Expand Down Expand Up @@ -165,8 +166,8 @@ class _MyAppState extends State<MyApp> {
'computerName': data.computerName,
'hostName': data.hostName,
'arch': data.arch,
'model': data.model,
'modelName': data.modelName,
'modelIdentifier': data.modelIdentifier,
'kernelVersion': data.kernelVersion,
'majorVersion': data.majorVersion,
'minorVersion': data.minorVersion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call
@"name" : [device name],
@"systemName" : [device systemName],
@"systemVersion" : [device systemVersion],
@"model" : deviceName,
@"model" : [device model],
@"localizedModel" : [device localizedModel],
@"modelName" : deviceName,
@"identifierForVendor" : [[device identifierForVendor] UUIDString]
?: [NSNull null],
@"isPhysicalDevice" : isPhysicalNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class IosDeviceInfo extends BaseDeviceInfo {
required this.systemName,
required this.systemVersion,
required this.model,
required this.modelName,
required this.localizedModel,
this.identifierForVendor,
required this.isPhysicalDevice,
Expand All @@ -38,10 +39,14 @@ class IosDeviceInfo extends BaseDeviceInfo {
/// https://developer.apple.com/documentation/uikit/uidevice/1620043-systemversion
final String systemVersion;

/// Device model.
/// Examples: `iPhone 16 Pro`, `iPad Pro 11-Inch 3`
/// Device model according to OS
/// https://developer.apple.com/documentation/uikit/uidevice/1620044-model
final String model;

/// Commercial or user-known model name
/// Examples: `iPhone 16 Pro`, `iPad Pro 11-Inch 3`
final String modelName;

/// Localized name of the device model.
/// https://developer.apple.com/documentation/uikit/uidevice/1620029-localizedmodel
final String localizedModel;
Expand All @@ -68,6 +73,7 @@ class IosDeviceInfo extends BaseDeviceInfo {
systemName: map['systemName'],
systemVersion: map['systemVersion'],
model: map['model'],
modelName: map['modelName'],
localizedModel: map['localizedModel'],
identifierForVendor: map['identifierForVendor'],
isPhysicalDevice: map['isPhysicalDevice'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class MacOsDeviceInfo extends BaseDeviceInfo {
required this.computerName,
required this.hostName,
required this.arch,
required this.model,
required this.modelName,
required this.modelIdentifier,
required this.kernelVersion,
required this.osRelease,
required this.majorVersion,
Expand All @@ -35,14 +35,14 @@ class MacOsDeviceInfo extends BaseDeviceInfo {
/// Note, that on Apple Silicon Macs can return `x86_64` if app runs via Rosetta
final String arch;

/// Device model identifier
/// Examples: `MacBookPro18,3`, `Mac16,2`.
final String model;

/// Device model name
/// Examples: `MacBook Pro (16-inch, 2021)`, `iMac (24-inch, 2024)`.
final String modelName;

/// Device model identifier
/// Examples: `MacBookPro18,3`, `Mac16,2`.
final String modelIdentifier;

/// Machine Kernel version.
/// Examples:
/// `Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64`
Expand Down Expand Up @@ -81,8 +81,8 @@ class MacOsDeviceInfo extends BaseDeviceInfo {
computerName: map['computerName'],
hostName: map['hostName'],
arch: map['arch'],
model: map['model'],
modelName: map['modelName'],
modelIdentifier: map['modelIdentifier'],
kernelVersion: map['kernelVersion'],
osRelease: map['osRelease'],
majorVersion: map['majorVersion'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class DeviceInfoPlusMacosPlugin: NSObject, FlutterPlugin {
let computerName = Host.current().localizedName ?? Sysctl.hostName
let hostName = Sysctl.osType
let arch = Sysctl.machine
let model = Sysctl.model
let modelName = getMacModelName(modelNumber: Sysctl.model)
let modelIdentifier = Sysctl.model
let kernelVersion = Sysctl.version
let osRelease = ProcessInfo.processInfo.operatingSystemVersionString
let osVersion = ProcessInfo.processInfo.operatingSystemVersion;
Expand All @@ -38,8 +38,8 @@ public class DeviceInfoPlusMacosPlugin: NSObject, FlutterPlugin {
"computerName": computerName,
"hostName": hostName,
"arch": arch,
"model": model,
"modelName": modelName,
"modelIdentifier": modelIdentifier,
"kernelVersion": kernelVersion,
"osRelease": osRelease,
"majorVersion": majorVersion,
Expand Down

0 comments on commit 20153d1

Please sign in to comment.