public static void OpenDialer(string phoneNumber)
        {
            Check.Argument.IsStrNotNullOrEmpty(phoneNumber, "phoneNumber");

            if (IGUtils.IsIosCheck())
            {
                return;
            }

            IGUtils._openUrl(string.Format("tel:{0}", phoneNumber));
        }
        public static void StartFaceTimeAudioCall(string userId)
        {
            Check.Argument.IsStrNotNullOrEmpty(userId, "userId");

            if (IGUtils.IsIosCheck())
            {
                return;
            }

            IGUtils._openUrl(string.Format("facetime-audio:{0}", userId));
        }
示例#3
0
        public static void OpenYoutubeVideo(string videoId)
        {
            Check.Argument.IsStrNotNullOrEmpty(videoId, "videoId");

            if (IGUtils.IsIosCheck())
            {
                return;
            }

            IGUtils._openUrl(Device.systemVersion.StartsWith("11") ? string.Format("youtube://{0}", videoId) : string.Format("http://www.youtube.com/watch?v={0}", videoId));
        }
        /// <summary>
        ///     Performs the search in apple maps application.
        /// </summary>
        /// <param name="query">
        ///     The query. This parameter is treated as if its value had been typed into the Maps search field by
        ///     the user.
        /// </param>
        /// <param name="viewType">Map view type.</param>
        public static void PerformSearch(string query, MapViewType viewType = MapViewType.Standard)
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            Check.Argument.IsStrNotNullOrEmpty(query, "query");

            var url = FormatMapsUrl("q={0}&t={1}", UnityWebRequest.EscapeURL(query), _mapViews[viewType]);

            IGUtils._openUrl(url);
        }
        public static void OpenAppOnAppStore(string appId)
        {
            Check.Argument.IsStrNotNullOrEmpty(appId, "appId");

            if (IGUtils.IsIosCheck())
            {
                return;
            }

            var iTunesUrl = string.Format("itms://itunes.apple.com/us/app/apple-store/id{0}?mt=8", appId);

            IGUtils._openUrl(iTunesUrl);
        }
示例#6
0
        /// <summary>
        ///	 Opens the sms app with provided phone number.
        ///	 You can specify message body with this method but its not documented and NOT guaranteed to work.
        /// </summary>
        /// <param name="phoneNumber">Phone number.</param>
        /// <param name="body">Message body. NOT GUARANTEED TO WORK!</param>
        public static void SendSmsViaDefaultApp(string phoneNumber, string body = null)
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            var url = string.Format("sms:{0}", phoneNumber);

            if (!string.IsNullOrEmpty(body))
            {
                url += string.Format("&body={0}", body.Escape());
            }
            IGUtils._openUrl(url);
        }
        /// <summary>
        ///     Opens the apple maps location.
        /// </summary>
        /// <param name="location">Location to open.</param>
        /// <param name="label">Label of location.</param>
        /// <param name="viewType">Map view type.</param>
        public static void OpenMapLocation(Location location, string label = null, MapViewType viewType = MapViewType.Standard)
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            var url = FormatMapsUrl("ll={0}&t={1}", location.ToLinkStr(), _mapViews[viewType]);

            if (label != null)
            {
                // The q parameter can also be used as a label
                // if the location is explicitly defined in the ll or address parameters.
                url = url + "&q=" + label;
            }
            IGUtils._openUrl(url);
        }
        /// <summary>
        ///     Performs the search with provided query near specified location.
        /// </summary>
        /// <param name="query">Query.</param>
        /// <param name="searchLocation">Search location.</param>
        /// <param name="zoom">Zoom level. Must be between 2 and 23</param>
        /// <param name="viewType">Map view type.</param>
        public static void PerformSearch(string query, Location searchLocation, int zoom = DefaultMapZoomLevel,
                                         MapViewType viewType = MapViewType.Standard)
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            Check.Argument.IsStrNotNullOrEmpty(query, "query");

            if (zoom < MinMapZoomLevel || zoom > MaxMapZoomLevel)
            {
                throw new ArgumentOutOfRangeException("zoom", "Zoom level must be between 2 and 23");
            }

            var url = FormatMapsUrl("q={0}&sll={1}&z={2}&t={3}",
                                    UnityWebRequest.EscapeURL(query), searchLocation.ToLinkStr(), zoom, _mapViews[viewType]);

            IGUtils._openUrl(url);
        }
        /// <summary>
        ///     Opens the map address.
        /// </summary>
        /// <param name="address">Address to open.</param>
        /// <param name="label">Label of location.</param>
        /// <param name="viewType">Map view type.</param>
        public static void OpenMapAddress(string address, string label = null, MapViewType viewType = MapViewType.Standard)
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            address = address.EscapeMapQuery();
            Check.Argument.IsStrNotNullOrEmpty(address, "address");

            var url = FormatMapsUrl("address={0}&t={1}", address, _mapViews[viewType]);

            if (label != null)
            {
                // The q parameter can also be used as a label
                // if the location is explicitly defined in the ll or address parameters.
                url = url + "&q=" + label;
            }
            IGUtils._openUrl(url);
        }
示例#10
0
        /// <summary>
        ///	 Sends the email using default mail app.
        /// </summary>
        /// <param name="recipients">Recipient email addresses.</param>
        /// <param name="subject">Subject of email.</param>
        /// <param name="body">Body of email.</param>
        /// <param name="cc">
        ///	 Cc recipients. Cc stands for "carbon copy."
        ///	 Anyone you add to the cc: field of a message receives a copy of that message when you send it.
        ///	 All other recipients of that message can see that person you designated as a cc
        /// </param>
        /// <param name="bcc">
        ///	 Bcc recipients. Bcc stands for "blind carbon copy."
        ///	 Anyone you add to the bcc: field of a message receives a copy of that message when you send it.
        ///	 But, bcc: recipients are invisible to all the other recipients of the message including other bcc: recipients.
        /// </param>
        public static void SendEmail(string[] recipients, string subject, string body, string[] cc = null, string[] bcc = null)
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            var url = string.Format("mailto:{0}?subject={1}&body={2}",
                                    recipients.JoinByComma(),
                                    subject.Escape(), body.Escape()
                                    );

            if (cc != null && cc.Length > 0)
            {
                url += string.Format("&cc={0}", cc.JoinByComma());
            }
            if (bcc != null && cc.Length > 0)
            {
                url += string.Format("&bcc={0}", bcc.JoinByComma());
            }

            IGUtils._openUrl(url);
        }
        /// <summary>
        ///     Opens apple maps maps application with direction to destination
        /// </summary>
        /// <param name="destinationAddress">Destination address.</param>
        /// <param name="sourceAddress">Source address.</param>
        /// <param name="transportType">Transport type.</param>
        /// <param name="viewType">Map view type.</param>
        public static void GetDirections(string destinationAddress, string sourceAddress = null,
                                         TransportType transportType = TransportType.ByCar,
                                         MapViewType viewType        = MapViewType.Standard)
        {
            if (IGUtils.IsIosCheck())
            {
                return;
            }

            if (string.IsNullOrEmpty(destinationAddress))
            {
                throw new ArgumentException("Destination address must not be null or empty", "destinationAddress");
            }

            var url = FormatMapsUrl("daddr={0}&dirflg={1}&t={2}",
                                    UnityWebRequest.EscapeURL(destinationAddress), _transportTypes[transportType], viewType);

            if (!string.IsNullOrEmpty(sourceAddress))
            {
                url = url + "&saddr=" + UnityWebRequest.EscapeURL(sourceAddress);
            }
            Debug.Log("XXX: " + url);
            IGUtils._openUrl(url);
        }