Re: Media Query Parser

2014-02-02 Thread Lee Burrows

Capabilities.os returns "iPhone OS 7.0.4 iPad2,1" on my ipad

On 03/02/2014 01:49, Justin Mclean wrote:

Hi,

Just noticed this code in MediaQueryParser.

 private function getOSVersion(osPlatform:String):Number {
 //TODO (mamsellem)  retrieve  os version for Android, reading  
system/build.prop
 var os: String = Capabilities.os;
 var osMatch: Array;

 if (osPlatform == "ios")
{
 osMatch = os.match(/iPhone OS\s([\d\.]+)/);
 }
 else
{
 osMatch = os.match(/[A-Za-z\s]+([\d\.]+)/);
 }

return osMatch ? convertVersionStringToNumber(osMatch[1]) : 0.0;
 }

That match for IPhone is going to fail on a iPad (or iTouch I guess) right? Can 
anyone confirm (as I don't own one)?

There is a few other Capabilities.os or Capabilities.version checks throughout 
the SDK (mostly checking for iOS). There's a few other that are a little 
suspect eg assume that desktop is Windows or Mac and don't check for Linux.

Any objections if I move them all into a singe class (mx.utils.Platform) so 
they are a) all in one place and b) consistent and c) maintainable (eg if AIR 
decides to support windows mobile or another platform)?

Thanks,
Justin



--
Lee Burrows
ActionScripter



Re: Media Query Parser

2014-02-02 Thread Justin Mclean
Hi,

> Capabilities.os returns "iPhone OS 7.0.4 iPad2,1" on my ipad
So looks like that OK then.

Thanks,
Justin


RE: Media Query Parser

2014-02-03 Thread Maurice Amsellem
Capabilities.os returns iPhone OS for iOS devices. So it's OK.
However, it still does not return a consistent result for Android devices.
We have discussed earlier about a workaround to retrieve the AND version number.

That's why I kept the code private in MediaQueryParser, until the Android 
version is computed correctly.

No problem to move it to a centralized place.  There are a few calls in the SDK 
to test ios version that would benefit being centralized.

Maurice 

-Message d'origine-
De : Lee Burrows [mailto:subscripti...@leeburrows.com] 
Envoyé : lundi 3 février 2014 04:02
À : dev@flex.apache.org
Objet : Re: Media Query Parser

Capabilities.os returns "iPhone OS 7.0.4 iPad2,1" on my ipad

On 03/02/2014 01:49, Justin Mclean wrote:
> Hi,
>
> Just noticed this code in MediaQueryParser.
>
>  private function getOSVersion(osPlatform:String):Number {
>  //TODO (mamsellem)  retrieve  os version for Android, reading  
> system/build.prop
>  var os: String = Capabilities.os;
>  var osMatch: Array;
>   
>  if (osPlatform == "ios")
>   {
>  osMatch = os.match(/iPhone OS\s([\d\.]+)/);
>  }
>  else
>   {
>  osMatch = os.match(/[A-Za-z\s]+([\d\.]+)/);
>  }
>   
>   return osMatch ? convertVersionStringToNumber(osMatch[1]) : 0.0;
>  }
>
> That match for IPhone is going to fail on a iPad (or iTouch I guess) right? 
> Can anyone confirm (as I don't own one)?
>
> There is a few other Capabilities.os or Capabilities.version checks 
> throughout the SDK (mostly checking for iOS). There's a few other that are a 
> little suspect eg assume that desktop is Windows or Mac and don't check for 
> Linux.
>
> Any objections if I move them all into a singe class (mx.utils.Platform) so 
> they are a) all in one place and b) consistent and c) maintainable (eg if AIR 
> decides to support windows mobile or another platform)?
>
> Thanks,
> Justin


-- 
Lee Burrows
ActionScripter