You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Harbs <ha...@gmail.com> on 2019/02/11 08:10:14 UTC

Re: [royale-asjs] branch develop updated: New IOSUtils class to get the IOS device for now

Carlos,

We already have a BrowserInfo class which has info about the environment including the formFactor. You can discover this info there.

> On Feb 10, 2019, at 7:31 PM, carlosrovira@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> carlosrovira pushed a commit to branch develop
> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
> 
> 
> The following commit(s) were added to refs/heads/develop by this push:
>     new ec28c0b  New IOSUtils class to get the IOS device for now
> ec28c0b is described below
> 
> commit ec28c0bf4cbeb5e3486a3439712b498af1684f9c
> Author: Carlos Rovira <ca...@apache.org>
> AuthorDate: Sun Feb 10 18:30:52 2019 +0100
> 
>    New IOSUtils class to get the IOS device for now
> ---
> .../projects/Core/src/main/royale/CoreClasses.as   |  1 +
> .../royale/org/apache/royale/utils/IOSUtils.as     | 81 ++++++++++++++++++++++
> .../main/royale/org/apache/royale/utils/OSUtils.as |  2 +-
> 3 files changed, 83 insertions(+), 1 deletion(-)
> 
> diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
> index a06c1fc..e3c5774 100644
> --- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
> +++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
> @@ -214,6 +214,7 @@ import org.apache.royale.events.ItemRemovedEvent; ItemRemovedEvent;
> 	import org.apache.royale.utils.JXON; JXON;
> 	import org.apache.royale.utils.MD5; MD5;
> 	import org.apache.royale.utils.OSUtils; OSUtils;
> +	import org.apache.royale.utils.IOSUtils; IOSUtils;
>     import org.apache.royale.utils.LocaleUtils; LocaleUtils;
> 	import org.apache.royale.utils.PointUtils; PointUtils;
>     import org.apache.royale.utils.StringPadder; StringPadder;
> diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IOSUtils.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IOSUtils.as
> new file mode 100644
> index 0000000..6d7117e
> --- /dev/null
> +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IOSUtils.as
> @@ -0,0 +1,81 @@
> +////////////////////////////////////////////////////////////////////////////////
> +//
> +//  Licensed to the Apache Software Foundation (ASF) under one or more
> +//  contributor license agreements.  See the NOTICE file distributed with
> +//  this work for additional information regarding copyright ownership.
> +//  The ASF licenses this file to You under the Apache License, Version 2.0
> +//  (the "License"); you may not use this file except in compliance with
> +//  the License.  You may obtain a copy of the License at
> +//
> +//      http://www.apache.org/licenses/LICENSE-2.0
> +//
> +//  Unless required by applicable law or agreed to in writing, software
> +//  distributed under the License is distributed on an "AS IS" BASIS,
> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +//  See the License for the specific language governing permissions and
> +//  limitations under the License.
> +//
> +////////////////////////////////////////////////////////////////////////////////
> +package org.apache.royale.utils
> +{
> +	/**
> +	 *  The IOSUtils class is an all-static class with methods for
> +	 *  getting information about the IOS operating system.
> +	 *  You do not create instances of IOSUtils;
> +	 *  instead you call methods such as 
> +	 *  the <code>IOSUtils.getDevice()</code> method.  
> +	 *  
> +	 *  @langversion 3.0
> +	 *  @playerversion Flash 9
> +	 *  @playerversion AIR 1.1
> +	 *  @productversion Royale 1.0.0
> +	 *  @productversion Royale 0.9.6
> +	 */
> +    public class IOSUtils
> +    {
> +        COMPILE::SWF
> +        {
> +            import flash.system.Capabilities;
> +        }
> +        public function OSUtils ()
> +        {
> +        }
> +        public static const IOS_OS:String = "iOS";
> +        
> +        public static const UNKNOWN_DEVICE:String = "Unknown Device";
> +        public static const IOS_IPAD:String = "iPad";
> +        public static const IOS_IPHONE:String = "iPhone";
> +        public static const IOS_IPOD:String = "iPod";
> +
> +        /**
> +         * Gets the name of the operating system.
> +         */
> +        public static function getIOSDevice():String
> +        {
> +            COMPILE::SWF
> +            {
> +                if(!_iosDevice)
> +                {
> +                    //TODO for SWF
> +                    _iosDevice = UNKNOWN_DEVICE;
> +                }
> +                return _iosDevice;
> +            }
> +
> +            COMPILE::JS
> +            {
> +                if(!_iosDevice)
> +                {
> +                    _iosDevice = UNKNOWN_DEVICE;
> +                    var appVersion:String = navigator.appVersion;
> +                    if (appVersion.indexOf("iPad") != -1) _iosDevice = IOS_IPAD;
> +                    if (appVersion.indexOf("iPhone") != -1) _iosDevice = IOS_IPHONE;
> +                    if (appVersion.indexOf("iPod") != -1) _iosDevice = IOS_IPOD;
> +                }
> +                return _iosDevice;
> +            }
> +        }
> +        
> +        private static var _iosDevice:String;
> +    }
> +}
> diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/OSUtils.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/OSUtils.as
> index 5be1b5c..ce07753 100644
> --- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/OSUtils.as
> +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/OSUtils.as
> @@ -20,7 +20,7 @@ package org.apache.royale.utils
> {
> 	/**
> 	 *  The OSUtils class is an all-static class with methods for
> -	 *  getting informatiojn about the host operating system.
> +	 *  getting information about the host operating system.
> 	 *  You do not create instances of OSUtils;
> 	 *  instead you call methods such as 
> 	 *  the <code>OSUtils.getOS()</code> method.  
> 


Re: [royale-asjs] branch develop updated: New IOSUtils class to get the IOS device for now

Posted by Carlos Rovira <ca...@apache.org>.
Ok Harbs,
thanks! didn't know about it.
Will revert this
thanks!

El lun., 11 feb. 2019 a las 9:10, Harbs (<ha...@gmail.com>) escribió:

> Carlos,
>
> We already have a BrowserInfo class which has info about the environment
> including the formFactor. You can discover this info there.
>
> > On Feb 10, 2019, at 7:31 PM, carlosrovira@apache.org wrote:
> >
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > carlosrovira pushed a commit to branch develop
> > in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
> >
> >
> > The following commit(s) were added to refs/heads/develop by this push:
> >     new ec28c0b  New IOSUtils class to get the IOS device for now
> > ec28c0b is described below
> >
> > commit ec28c0bf4cbeb5e3486a3439712b498af1684f9c
> > Author: Carlos Rovira <ca...@apache.org>
> > AuthorDate: Sun Feb 10 18:30:52 2019 +0100
> >
> >    New IOSUtils class to get the IOS device for now
> > ---
> > .../projects/Core/src/main/royale/CoreClasses.as   |  1 +
> > .../royale/org/apache/royale/utils/IOSUtils.as     | 81
> ++++++++++++++++++++++
> > .../main/royale/org/apache/royale/utils/OSUtils.as |  2 +-
> > 3 files changed, 83 insertions(+), 1 deletion(-)
> >
> > diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as
> b/frameworks/projects/Core/src/main/royale/CoreClasses.as
> > index a06c1fc..e3c5774 100644
> > --- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
> > +++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
> > @@ -214,6 +214,7 @@ import org.apache.royale.events.ItemRemovedEvent;
> ItemRemovedEvent;
> >       import org.apache.royale.utils.JXON; JXON;
> >       import org.apache.royale.utils.MD5; MD5;
> >       import org.apache.royale.utils.OSUtils; OSUtils;
> > +     import org.apache.royale.utils.IOSUtils; IOSUtils;
> >     import org.apache.royale.utils.LocaleUtils; LocaleUtils;
> >       import org.apache.royale.utils.PointUtils; PointUtils;
> >     import org.apache.royale.utils.StringPadder; StringPadder;
> > diff --git
> a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IOSUtils.as
> b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IOSUtils.as
> > new file mode 100644
> > index 0000000..6d7117e
> > --- /dev/null
> > +++
> b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/IOSUtils.as
> > @@ -0,0 +1,81 @@
> >
> +////////////////////////////////////////////////////////////////////////////////
> > +//
> > +//  Licensed to the Apache Software Foundation (ASF) under one or more
> > +//  contributor license agreements.  See the NOTICE file distributed
> with
> > +//  this work for additional information regarding copyright ownership.
> > +//  The ASF licenses this file to You under the Apache License, Version
> 2.0
> > +//  (the "License"); you may not use this file except in compliance with
> > +//  the License.  You may obtain a copy of the License at
> > +//
> > +//      http://www.apache.org/licenses/LICENSE-2.0
> > +//
> > +//  Unless required by applicable law or agreed to in writing, software
> > +//  distributed under the License is distributed on an "AS IS" BASIS,
> > +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> > +//  See the License for the specific language governing permissions and
> > +//  limitations under the License.
> > +//
> >
> +////////////////////////////////////////////////////////////////////////////////
> > +package org.apache.royale.utils
> > +{
> > +     /**
> > +      *  The IOSUtils class is an all-static class with methods for
> > +      *  getting information about the IOS operating system.
> > +      *  You do not create instances of IOSUtils;
> > +      *  instead you call methods such as
> > +      *  the <code>IOSUtils.getDevice()</code> method.
> > +      *
> > +      *  @langversion 3.0
> > +      *  @playerversion Flash 9
> > +      *  @playerversion AIR 1.1
> > +      *  @productversion Royale 1.0.0
> > +      *  @productversion Royale 0.9.6
> > +      */
> > +    public class IOSUtils
> > +    {
> > +        COMPILE::SWF
> > +        {
> > +            import flash.system.Capabilities;
> > +        }
> > +        public function OSUtils ()
> > +        {
> > +        }
> > +        public static const IOS_OS:String = "iOS";
> > +
> > +        public static const UNKNOWN_DEVICE:String = "Unknown Device";
> > +        public static const IOS_IPAD:String = "iPad";
> > +        public static const IOS_IPHONE:String = "iPhone";
> > +        public static const IOS_IPOD:String = "iPod";
> > +
> > +        /**
> > +         * Gets the name of the operating system.
> > +         */
> > +        public static function getIOSDevice():String
> > +        {
> > +            COMPILE::SWF
> > +            {
> > +                if(!_iosDevice)
> > +                {
> > +                    //TODO for SWF
> > +                    _iosDevice = UNKNOWN_DEVICE;
> > +                }
> > +                return _iosDevice;
> > +            }
> > +
> > +            COMPILE::JS
> > +            {
> > +                if(!_iosDevice)
> > +                {
> > +                    _iosDevice = UNKNOWN_DEVICE;
> > +                    var appVersion:String = navigator.appVersion;
> > +                    if (appVersion.indexOf("iPad") != -1) _iosDevice =
> IOS_IPAD;
> > +                    if (appVersion.indexOf("iPhone") != -1) _iosDevice
> = IOS_IPHONE;
> > +                    if (appVersion.indexOf("iPod") != -1) _iosDevice =
> IOS_IPOD;
> > +                }
> > +                return _iosDevice;
> > +            }
> > +        }
> > +
> > +        private static var _iosDevice:String;
> > +    }
> > +}
> > diff --git
> a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/OSUtils.as
> b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/OSUtils.as
> > index 5be1b5c..ce07753 100644
> > ---
> a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/OSUtils.as
> > +++
> b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/OSUtils.as
> > @@ -20,7 +20,7 @@ package org.apache.royale.utils
> > {
> >       /**
> >        *  The OSUtils class is an all-static class with methods for
> > -      *  getting informatiojn about the host operating system.
> > +      *  getting information about the host operating system.
> >        *  You do not create instances of OSUtils;
> >        *  instead you call methods such as
> >        *  the <code>OSUtils.getOS()</code> method.
> >
>
>

-- 
Carlos Rovira
http://about.me/carlosrovira