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

Drop support for iOS < 11 #1461

Merged
merged 7 commits into from
Apr 10, 2025
Merged

Conversation

stuartmorgan-g
Copy link
Contributor

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

  • I made sure the project builds.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors.

Copy link
Contributor Author

@stuartmorgan-g stuartmorgan-g left a 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"
Copy link
Contributor Author

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+.

Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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);
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@TimHoogstrate TimHoogstrate left a 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!

@TimHoogstrate TimHoogstrate merged commit de516a4 into Baseflow:main Apr 10, 2025
1 check 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.

[Enhancement proposal]: Update iOS minimum version to 10.0 or higher, delete dead fallback code
2 participants