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

Small fix for iOS version detection #84

Merged

Conversation

HeLau1337
Copy link
Contributor

This PR refers to this comment on issue #26.

The answer to
// TODO: check what systemVersion returns on an actual iOS device. (comment in lib/bloc.dart)
is that ios.systemVersion actually returns the string representation of a double instead of an int. So the fix for this was quite simple.

Debugging output before I made the changes:
Screenshot 2020-11-08 at 23 17 48

There are also many auto-generated changes made by XCode during the iOS build. Most of them look like dependency-updates. But for some reason, it also automatically changed the "PRODUCT_BUNDLE_IDENTIFIER" from
"com.jeroen1602.lighthousePm"
to
"com.jeroen1602.VrLighthousePm".

I have no idea why. @jeroen1602 is this new bundle identifier correct or do you have an idea why this happened?

@HeLau1337
Copy link
Contributor Author

HeLau1337 commented Nov 9, 2020

Oh, I forgot to update the changelog... again ':D
I'm not 100% sure how your versioning works or how you structure and update your changelog, @jeroen1602 .
Do I have to create a "new version section" like "Version 1.1.2 RC" and list my changes/fixes under this new section? Sorry for having to ask this.

@jeroen1602 jeroen1602 self-assigned this Nov 9, 2020
Copy link
Owner

@jeroen1602 jeroen1602 left a comment

Choose a reason for hiding this comment

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

I've looked into the bundle id change, and I can't find why it has done it. The good thing is that there hasn't been any iOS release yet, so it isn't a very big problem.

Maybe you have set a setting in xcode somewhere?

lib/bloc.dart Outdated
@@ -175,8 +175,7 @@ class SettingsBloc {
}
} else if (Platform.isIOS) {
final ios = await deviceInfo.iosInfo;
// TODO: check what systemVersion returns on an actual iOS device.
if (int.tryParse(ios.systemVersion, radix: 10) >= 13 /* iOS 13*/) {
if (double.tryParse(ios.systemVersion) >= 13.0 /* iOS 13.0 */) {
Copy link
Owner

Choose a reason for hiding this comment

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

This will probably never happen but double.tryParse will return null if it could not parse the number. And null >= 13.0 will throw an exception.

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 actually threw these exceptions on iOS when it was int.tryParse instead of double.tryParse. Which also created a never ending Circular Progress Indicator on the settings page where the dropdown menu for the "preferred theme" is.

Should I surround the if-condition with a try-catch where it does simply nothing if it catches an exception (= return false)?

Copy link
Owner

Choose a reason for hiding this comment

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

I was thinking about saving the result of double.tryParse() to a variable and extending the if to if (version != null && version >= 13.0)

Maybe crash the app if the version is null and we are running in debug mode.

@jeroen1602
Copy link
Owner

Oh, I forgot to update the changelog... again ':D
I'm not 100% sure how your versioning works or how you structure and update your changelog, @jeroen1602 .
Do I have to create a "new version section" like "Version 1.1.2 RC" and list my changes/fixes under this new section? Sorry for having to ask this.

Yeah just use Version 1.1.2+7 RC

The RC means release candidate, as in it hasn't been released yet (we're still working on it)
And the 1.1.2 is just normal major.minor.patch, the +7 should always increment (this is what the system uses to compare if there is a new version).

@HeLau1337
Copy link
Contributor Author

Thanks for the feedback. I'm going to update the PR later today.

… value != null, revert changes made to iOS bundle identifier
@jeroen1602 jeroen1602 merged commit 1366beb into jeroen1602:master Nov 9, 2020
@HeLau1337 HeLau1337 deleted the 26-fix-ios-version-detection branch November 9, 2020 19:16
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.

None yet

2 participants