flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Mclean <jus...@classsoftware.com>
Subject Media Query Parser
Date Mon, 03 Feb 2014 01:49:40 GMT

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\.]+)/);
            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)?

View raw message