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

fix(device_info_plus)!: return type of isPhysicalDevice as boolean for ios #2508

Merged
merged 2 commits into from Feb 16, 2024

Conversation

muhib349
Copy link
Contributor

@muhib349 muhib349 commented Jan 7, 2024

Description

For iOS devices isPhysicalDevice was returned as String from native platform, now it is returning boolean from native platform.

Related Issues

Replace this paragraph with a list of issues related to this PR from the issue database. Indicate, which of these issues are resolved or fixed by this PR.

e.g.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (flutter analyze) does not report any problems on my PR.

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.

@muhib349 muhib349 changed the title fixed return type of isPhysicalDevice as boolean for ios fix: return type of isPhysicalDevice as boolean for ios Jan 7, 2024
@miquelbeltran miquelbeltran self-requested a review February 7, 2024 09:06
Comment on lines +24 to +25
NSNumber *isPhysicalNumber =
[NSNumber numberWithBool:[self isDevicePhysical]];
Copy link
Member

Choose a reason for hiding this comment

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

Objective-C is weird :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was my first time writing code in Objective-C, from a Java and Android background. Undoubtedly, it was horrible for me.

@miquelbeltran
Copy link
Member

Thanks! Change LGTM, but I want to run it before approval, that will take a day or two.

@miquelbeltran
Copy link
Member

I could test it now and it works as expected!

Just curious, why did you need to use [NSNumber numberWithBool ..]? Could not be possible to just pass the boolean value in the result map?

@miquelbeltran miquelbeltran changed the title fix: return type of isPhysicalDevice as boolean for ios fix(device_info_plus)!: return type of isPhysicalDevice as boolean for ios Feb 7, 2024
@miquelbeltran
Copy link
Member

@vbuberen I changed the title to fix(device_info_plus)!: ... to mark it as breaking change.

@muhib349
Copy link
Contributor Author

muhib349 commented Feb 8, 2024

I could test it now and it works as expected!

Just curious, why did you need to use [NSNumber numberWithBool ..]? Could not be possible to just pass the boolean value in the result map?

I tried to do so, however, Bool is a primitive data type and we couldn't pass any primitive data types to the map object. That's why I used NSNumber to represent boolean.

@vbuberen
Copy link
Collaborator

I could test it now and it works as expected!

This change looks good to me as well. @miquelbeltran are you Ok with merging this change?

@miquelbeltran
Copy link
Member

All good from my side as well @vbuberen

@vbuberen vbuberen merged commit e3a983b into fluttercommunity:main Feb 16, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Why 'isPhysicalDevice' type as String on iOS? It's bool on Android.
3 participants