Citrus-Engine icon indicating copy to clipboard operation
Citrus-Engine copied to clipboard

Mobile.as does not include isWindows

Open Snky opened this issue 10 years ago • 6 comments

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!

Snky avatar Aug 23 '14 13:08 Snky

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

alamboley avatar Aug 25 '14 06:08 alamboley

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 avatar Mar 27 '15 20:03 Snky

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.

Snky avatar Mar 27 '15 20:03 Snky

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

alamboley avatar Mar 30 '15 07:03 alamboley

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 avatar Nov 08 '15 22:11 Snky

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

Snky avatar Nov 09 '15 00:11 Snky