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

HTML5FrontEnd: Fix iPad check and iOS isMobile #1901

Merged
merged 3 commits into from
Aug 9, 2016
Merged

HTML5FrontEnd: Fix iPad check and iOS isMobile #1901

merged 3 commits into from
Aug 9, 2016

Conversation

DleanJeans
Copy link
Contributor

  • On an iPad, user agent contains "Mac"
  • For some reason, [IOS(IPHONE), IOS(IPAD), IOS(IPOD)].contains(IOS(IPAD)) == false so that's my workaround

@@ -92,8 +92,7 @@ class HTML5FrontEnd

private function getIsMobile():Bool
{
return [ANDROID, BLACKBERRY, WINDOWS_PHONE,
IOS(IPHONE), IOS(IPAD), IOS(IPOD)].contains(platform);
return Type.enumConstructor(platform) == "IOS" || [ANDROID, BLACKBERRY, WINDOWS_PHONE].contains(platform);
Copy link
Member

Choose a reason for hiding this comment

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

This seems a bit hacky.. How about using a switch-case:

return switch (platform) {
    case ANDROID:
    case BLACKBERRY:
    ...
    case IOS(_):
        true; 
    default:
        false;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nah, switch-case doesn't work. It still returns false no matter what.

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'll take that back. It works now. My bad :P

@Gama11 Gama11 added the Bug label Aug 9, 2016
@Gama11
Copy link
Member

Gama11 commented Aug 9, 2016

Looks good, thanks!

@Gama11 Gama11 merged commit 179673f into HaxeFlixel:dev Aug 9, 2016
@DleanJeans DleanJeans deleted the html5-ios-fix branch August 13, 2016 14:09
Aurel300 pushed a commit to larsiusprime/haxeflixel that referenced this pull request Apr 18, 2018
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.

2 participants