-
-
Notifications
You must be signed in to change notification settings - Fork 893
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
Drop support for iOS < 11 #1461
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See notes below about potential pre-existing bugs found during the cleanup, which this PR currently does not attempt to fix.
} | ||
ServiceStatus serviceStatus = [centralManager state] == CBManagerStatePoweredOn ? ServiceStatusEnabled : ServiceStatusDisabled; | ||
_serviceStatusHandler(serviceStatus); | ||
|
||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left the code from here on to preserve behavior, but—with the caveat that I didn't look at the surrounding code—this looks very likely to be a pre-existing bug. It seems likely that this code was intended to be in an else
, or after a return
in the if
, such that it only ran for iOS < 10. What it has actually been doing (and what this preserves) is running both sets of code on iOS 10+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good found, It looks like CBCentralManagerStatePoweredOn
is deprecated so we should remove this. I've tested this briefly and it still works nevertheless we should clean it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've now removed the deprecated path.
} | ||
} | ||
|
||
if (permission == PermissionGroupLocationAlways) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff for this method looks odd because of how the diff is computed. What I actually did is:
- removed the
if (@available(iOS 8.0, *)) {
wrapping, and decreased the indent level of the code inside - trimmed the last
switch
to remove all the cases that were handled in the switch above.
The last two switches could be combined together, I just did the minimal change. I'm happy to restructure it if you would prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. It looks like kCLAuthorizationStatusAuthorized
is deprecated for iOS but not for macOS (10.6+). Isn't it a better idea to get rid of the deprecation warning by wrapping the code in a compile-time check so that we know when it gets deprecated for macOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would change the behavior of this method, and would require fully auditing all codepaths that lead to it to determine whether the deprecated constant is ever passed in as a parameter on iOS, since if it is adding a compile-time check would cause it to return the wrong value on iOS.
Do you want to make that part of this PR, rather than changing behavior in a follow-up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No let's keep this one simple. Let's do this in another PR.
completionHandler([CMMotionActivityManager isActivityAvailable] | ||
? ServiceStatusEnabled | ||
: ServiceStatusDisabled | ||
); | ||
|
||
completionHandler(ServiceStatusDisabled); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with the first comment above, I left the existing behavior as-is, but I would be extremely surprised if this one is not a bug given that it's unconditionally reporting disabled right after the previous call reports the detected status. But as with the other, there was not an else
or a return
, so this was always running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @stuartmorgan-g, I dove into this snippet and it indeed looks like a bug. HOWEVER, it is currently not possible to call this "code" because I noticed that the sensor
permission is not an instance of PermissionWithService
. So besides that we should remove the second completion handler, we should also update the sensor permission as a permissionWithService so that we can call this code. Maybe we should first merge these changes and later update the permission instance to a PermissionWithService
in the platform_interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now made the minimal change of just removing this incorrect line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thanks for your help!
iOS versions < 11 haven't been supported since Flutter 3.3, which is over two years old. Even that version is too old to be able to ship to the App store with (as it lacks a privacy manifest), so there is no clear value in continuing to support versions even older than that.
This updates the Flutter SDK constraint to 3.3, where iOS 11 became the minimum, and removes all
@available
checks related to iOS 11 or earlier, as well as any fallback code that only ran on versions older than that.Fixes #1455
Pre-launch Checklist
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.CHANGELOG.md
to add a description of the change.///
).main
.dart format .
and committed any changes.flutter analyze
and fixed any errors.