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

Mobile.as does not include isWindows #226

Open
Snky opened this issue Aug 23, 2014 · 6 comments
Open

Mobile.as does not include isWindows #226

Snky opened this issue Aug 23, 2014 · 6 comments

Comments

@Snky
Copy link

Snky commented Aug 23, 2014

static public function isWindows():Boolean {
return ( Capabilities.version.substr(0, 3) == "WIN" );
}

I assume this is a better place to post these sorts of things? I know technically it doesn't make sense that there would be a MOBILE.windows, but ah, I'm over it, this is where I'm placing the function for laziness. But then I guess Mobile.as could be renamed to Device or something and it would all make sense again hoorah!

@alamboley
Copy link
Member

Yes, this class definitely need some refactoring ;)
Maybe Platform would be even a better name... ?

@Snky
Copy link
Author

Snky commented Mar 27, 2015

Hey Aymeric, wonder if you get email notifications for these comments..
I found some issues I believe with the way Mobile.as was comparing width to height, to check if iPad and so on.. maybe you'll notice, hard to go into detail off the top of my head. Also that Mobile.as was not checking for isLandscape for the iPhones... and constant string comparison, with the substr stuff seems more CPU intensive than necessary, this class will only ever 'query' once, rather than the old class which constantly compared, everything.

I wanted to try and help you guys out,
so I spent a whole day remaking the entire class. I hope you find something useful, if not all. :D
( p.s. if it turns out to be good, may cause confusion with objects.platform )

LINK includes: ( Platform.as + swf + exe + apk + ipa + air )
https://dl.dropbox.com/s/z9618q6s4e3g5me/SNKY%20-%20Platform.as%20%2B%20builds%20to%20test.zip
( Modified 11pm GMT +0 )

@Snky
Copy link
Author

Snky commented Mar 27, 2015

I can confirm:
isBrowser()
isWindows()
isDesktop()
isAndroid()
isIOS()
isIphone()
isIphone4()
isRetina()

Seems to be querying accurately, but I guess technically every combination will need testing.
Also made sure they all worked in an update function, on my TF101 ( android ), iPhone 4S and Windows/Browser.

alamboley added a commit that referenced this issue Mar 30, 2015
@alamboley
Copy link
Member

Hey @SnkyGames I pushed your class ;)
Thanks for the hard work!

@Snky
Copy link
Author

Snky commented Nov 8, 2015

Updated Platform.as ( 08 nov ):
1-Unlocked isLandscape to public instead of private
2-Small fix for accurate apple phone detection*

  • Must compare both width against width and height against height, to fix a device conflicting issue between iphone4 and iphone5 due to both devices having the same widths. Fix also now works no matter the orientation either.

@Snky
Copy link
Author

Snky commented Nov 9, 2015

Patched again: ( 09 nov 00:37am ):
3-added support for iPad Pro (nov 25th release)
4-changed iPadRetina to iPadRetinaLegacy*

*example usage:
isIpadLegacy(); //ip1/ip2/ipm1
isIpadRetinaLegacy(); //ip3/ip4/ipm2/ipm3/ipa1/ipa2
isIpadRetinaPro(); //ippro

Please patch utils\Platform.as with this updated one:
https://www.dropbox.com/s/97s4uzpj5r0knml/Platform.as?dl=0
^^ Thanks

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

No branches or pull requests

2 participants