Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(device_info_plus)!: Return model name for iOS and MacOS devices #3358

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

vbuberen
Copy link
Collaborator

Description

Long awaited feature to show device names that are known to users. Marking as breaking, because I changed the API.

On iOS model field now returns names like iPhone 15 Pro, etc. instead of just iPhone, iPad.

Screenshot from iPhone with model name

photo_2024-11-14 20 54 19

On MacOS the plugin returns modelName and modelIdentifier fields instead of just model which was returning identifier earlier.

Screenshot from MacBook with model name and identifier Screenshot 2024-11-14 at 20 39 46

Related Issues

Closes #2656

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

case "Mac14,5", "Mac14,9": return "MacBook Pro (14-inch, 2023)"
case "Mac14,6", "Mac14,10": return "MacBook Pro (14-inch, 2023)"
case "Mac14,7": return "MacBook Pro (13-inch, 2022)"
case "Mac15,3": return "MacBook Pro (14-inch, 2023)"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these lists I wasn't sure if we need to specify CPU model, like it is done on Apple's website but decided that it is redundant info.

@vbuberen
Copy link
Collaborator Author

Don't know why iOS integration test fails.

Copy link
Member

@miquelbeltran miquelbeltran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@miquelbeltran
Copy link
Member

miquelbeltran commented Nov 15, 2024

Don't know why iOS integration test fails.

Could be that increasing the minimum deployment target makes these properties mandatory:

Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
ERROR: Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.

You can try to add a version here: https://github.com/fluttercommunity/plus_plugins/blob/main/packages/device_info_plus/device_info_plus/example/pubspec.yaml

@vbuberen
Copy link
Collaborator Author

Could be that increasing the minimum deployment target makes these properties mandatory:

I saw these warnings earlier, but still tried to add version - still failing. Will investigate later.

@StanleyCocos
Copy link
Contributor

This feature is needed by many people, but the downside is that maintenance can be troublesome. After Apple releases new devices, we need to update the code promptly.

Therefore, I suggest changing the "Unknown Model" returned in modelName to modelIdentifier. This would avoid situations where modelName == Unknown Model, and we might need to use modelIdentifier in conjunction with it to determine the device information accurately.

@vbuberen
Copy link
Collaborator Author

vbuberen commented Dec 3, 2024

This feature is needed by many people, but the downside is that maintenance can be troublesome. After Apple releases new devices, we need to update the code promptly.

This is not an issue with current pace of product releases from Apple. It is not a big deal to report the missing model. Returning modelIdentifier won't solve anything and it is better to show that the model is unknown explicitly than to create a confusion with returning modelIdentifier 2 times. So don't agree with this suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request]: Show iOS user known device model names
3 participants