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

Reply via email to