public override void SendMail(string _subject, string _body, bool _isHTMLBody, byte[] _attachmentByteArray, 
		                               string _mimeType, string _attachmentFileNameWithExtn, string[] _recipients, SharingCompletion _onCompletion)
        {
            base.SendMail(_subject, _body, _isHTMLBody, _attachmentByteArray, _mimeType,
                          _attachmentFileNameWithExtn, _recipients, _onCompletion);

            if (IsMailServiceAvailable())
            {
                if (_attachmentByteArray != null)
                    Console.LogWarning(Constants.kDebugTag, "[Sharing:Mail] Attachments are not supported in editor");

                string	_mailToAddress	= null;

                if (_recipients != null)
                    _mailToAddress		= string.Join(",", _recipients);

                string	_mailToSubject	= EscapingString(_subject);
                string	_mailToBody		= EscapingString(_body);
                string	_mailToString	= string.Format("mailto:{0}?subject={1}&body={2}", _mailToAddress, _mailToSubject, _mailToBody);

                // Opens mail client
                Application.OpenURL(_mailToString);

                // Send event
                MailShareFinished(null);
            }
        }
        /// <summary>
        /// Shares the image at path.
        /// </summary>
        /// <param name="_message">Message to share.</param>
        /// <param name="_imagePath">Path where image exists that needs to be shared.</param>
        /// <param name="_excludedOptions">List of sharing services to exclude while sharing.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public void ShareImageAtPath(string _message, string _imagePath, eShareOptions[] _excludedOptions, SharingCompletion _onCompletion)
        {
            if (!File.Exists(_imagePath))
            {
                Console.LogWarning(Constants.kDebugTag, "[Sharing] ShareImageAtPath, path is invalid");
                ShareImage(_message, null, _excludedOptions, _onCompletion);
                return;
            }

            // Download image from given path
            URL _imagePathURL				= URL.FileURLWithPath(_imagePath);
            DownloadTexture _newDownload	= new DownloadTexture(_imagePathURL, true, false);
            _newDownload.OnCompletion		= (Texture2D _texture, string _error)=>{

                // Download went wrong
                if (!string.IsNullOrEmpty(_error))
                {
                    Console.LogWarning(Constants.kDebugTag, "[Sharing] ShareImageAtPath, failed to download texture. Error=" + _error);
                }

                ShareImage(_message, _texture, _excludedOptions, _onCompletion);
            };

            // Start download
            _newDownload.StartRequest();
        }
Ejemplo n.º 3
0
        protected virtual void Share(string _message, string _URLString, byte[] _imageByteArray, string _excludedOptionsJsonString, SharingCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnSharingFinished = _onCompletion;
        }
        /// <summary>
        /// Share message , URL or image
        /// </summary>
        /// <param name="_message">Message to share.</param>
        /// <param name="_URLString">URL string to share.</param>
        /// <param name="_imageByteArray">image byte array to create the image from.</param>
        /// <param name="_excludedOptions">List of sharing services to exclude while sharing.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public void Share(string _message, string _URLString, byte[] _imageByteArray, eShareOptions[] _excludedOptions, SharingCompletion _onCompletion)
        {
            string _excludedOptionsJsonString	= null;

            if (_excludedOptions != null)
                _excludedOptionsJsonString	= _excludedOptions.ToJSON();

            Share(_message, _URLString, _imageByteArray, _excludedOptionsJsonString, _onCompletion);
        }
		protected override void Share (string _message, string _URLString, byte[] _imageByteArray, string _excludedOptionsJsonString, SharingCompletion _onCompletion)
		{
			base.Share(_message, _URLString, _imageByteArray, _excludedOptionsJsonString, _onCompletion);

			// Native method call
			int		_byteArrayLength	= _imageByteArray == null ? 0 : _imageByteArray.Length;
			
			Plugin.Call(Native.Methods.SHARE, _message, _URLString, _imageByteArray, _byteArrayLength, _excludedOptionsJsonString);
		}
		public override void SendTextMessage (string _body, string[] _recipients, SharingCompletion _onCompletion)
		{
			base.SendTextMessage (_body, _recipients, _onCompletion);
			
			if (IsMessagingServiceAvailable())
			{
				// Send message
				sendTextMessage(_body, _recipients.ToJSON());
			}
		}
		public override void ShareImageOnWhatsApp (byte[] _imageByteArray, SharingCompletion _onCompletion)
		{
			base.ShareImageOnWhatsApp(_imageByteArray, _onCompletion);
			
			// Failed to share image
			if (_imageByteArray == null || !IsWhatsAppServiceAvailable())
				return;
			
			Plugin.Call(Native.Methods.SHARE_ON_WHATS_APP, null, _imageByteArray, _imageByteArray.Length);
		}
		public override void ShareTextMessageOnWhatsApp (string _message, SharingCompletion _onCompletion)
		{
			base.ShareTextMessageOnWhatsApp(_message, _onCompletion);
			
			// Failed to share message
			if (string.IsNullOrEmpty(_message) || !IsWhatsAppServiceAvailable())
				return;
			
			Plugin.Call(Native.Methods.SHARE_ON_WHATS_APP, _message, null, 0);
		}
        protected override void Share(string _message, string _URLString, byte[] _imageByteArray, string _excludedOptionsJsonString, SharingCompletion _onCompletion)
        {
            base.Share (_message, _URLString, _imageByteArray, _excludedOptionsJsonString, _onCompletion);

            // Feature isnt supported
            Console.LogError(Constants.kDebugTag, Constants.kErrorMessage);

            // Post failed event
            SharingFinished(SharingFailedResponse());
        }
Ejemplo n.º 10
0
        public override void SendTextMessage(string _body, string[] _recipients, SharingCompletion _onCompletion)
        {
            base.SendTextMessage(_body, _recipients, _onCompletion);

            if (IsMessagingServiceAvailable())
            {
                // Send message
                sendTextMessage(_body, _recipients.ToJSON());
            }
        }
        public override void ShareTextMessageOnWhatsApp(string _message, SharingCompletion _onCompletion)
        {
            base.ShareTextMessageOnWhatsApp(_message, _onCompletion);

            // Failed to share message
            if (string.IsNullOrEmpty(_message) || !IsWhatsAppServiceAvailable())
                return;

            // Native call
            shareTextMessageOnWhatsApp(_message);
        }
        public override void ShareImageOnWhatsApp(byte[] _imageByteArray, SharingCompletion _onCompletion)
        {
            base.ShareImageOnWhatsApp(_imageByteArray, _onCompletion);

            // Failed to share image
            if (_imageByteArray == null || !IsWhatsAppServiceAvailable())
                return;

            // Native call
            shareImageOnWhatsApp(_imageByteArray, _imageByteArray.Length);
        }
Ejemplo n.º 13
0
        public void ShareScreenshotOnWhatsApp(SharingCompletion _onCompletion)
        {
            // First capture frame
            StartCoroutine(TextureExtensions.TakeScreenshot((_texture) => {
                // Convert texture into byte array
                byte[] _imageByteArray = _texture.EncodeToPNG();

                // Share
                ShareImageOnWhatsApp(_imageByteArray, _onCompletion);
            }));
        }
		public void ShareScreenshotOnWhatsApp (SharingCompletion _onCompletion)
		{
			// First capture frame
			StartCoroutine(TextureExtensions.TakeScreenshot((_texture)=>{
				// Convert texture into byte array
				byte[] _imageByteArray	= _texture.EncodeToPNG();
				
				// Share
				ShareImageOnWhatsApp(_imageByteArray, _onCompletion);
			}));
		}
Ejemplo n.º 15
0
        public void SendMailWithScreenshot(string _subject, string _body, bool _isHTMLBody,
                                           string[] _recipients, SharingCompletion _onCompletion)
        {
            // First capture frame
            StartCoroutine(TextureExtensions.TakeScreenshot((_texture) => {
                // Convert texture into byte array
                byte[] _imageByteArray = _texture.EncodeToPNG();

                SendMail(_subject, _body, _isHTMLBody, _imageByteArray,
                         MIMEType.kPNG, "Screenshot.png", _recipients, _onCompletion);
            }));
        }
Ejemplo n.º 16
0
		protected override void Share (string _message, string _URLString, byte[] _imageByteArray, string _excludedOptionsJsonString, SharingCompletion _onCompletion)
		{
			base.Share(_message, _URLString, _imageByteArray, _excludedOptionsJsonString, _onCompletion);
			
			// Get image byte array length
			int _byteArrayLength	= 0;
			
			if (_imageByteArray != null)
				_byteArrayLength	= _imageByteArray.Length;
			
			share(_message, _URLString, _imageByteArray, _byteArrayLength, _excludedOptionsJsonString);
		}
		public void SendMailWithScreenshot (string _subject, string _body, bool _isHTMLBody, 
		                                    string[] _recipients, SharingCompletion _onCompletion) 
		{
			// First capture frame
			StartCoroutine(TextureExtensions.TakeScreenshot((_texture)=>{
				// Convert texture into byte array
				byte[] _imageByteArray	= _texture.EncodeToPNG();
				
				SendMail(_subject, _body, _isHTMLBody, _imageByteArray, 
				         MIMEType.kPNG , "Screenshot.png", _recipients, _onCompletion);
			}));
		}
Ejemplo n.º 18
0
        public override void ShareImageOnWhatsApp(byte[] _imageByteArray, SharingCompletion _onCompletion)
        {
            base.ShareImageOnWhatsApp(_imageByteArray, _onCompletion);

            // Failed to share image
            if (_imageByteArray == null || !IsWhatsAppServiceAvailable())
            {
                return;
            }

            Plugin.Call(Native.Methods.SHARE_ON_WHATS_APP, null, _imageByteArray, _imageByteArray.Length);
        }
Ejemplo n.º 19
0
        public override void SendTextMessage(string _body, string[] _recipients, SharingCompletion _onCompletion)
        {
            base.SendTextMessage(_body, _recipients, _onCompletion);

            if (IsMessagingServiceAvailable())
            {
                string _recipientJSONList = _recipients == null ? null : _recipients.ToJSON();

                // Native method is called
                Plugin.Call(Native.Methods.SEND_SMS, _body, _recipientJSONList);
            }
        }
Ejemplo n.º 20
0
        public override void ShareTextMessageOnWhatsApp(string _message, SharingCompletion _onCompletion)
        {
            base.ShareTextMessageOnWhatsApp(_message, _onCompletion);

            // Failed to share message
            if (string.IsNullOrEmpty(_message) || !IsWhatsAppServiceAvailable())
            {
                return;
            }

            Plugin.Call(Native.Methods.SHARE_ON_WHATS_APP, _message, null, 0);
        }
		public override void SendTextMessage (string _body, string[] _recipients, SharingCompletion _onCompletion)
		{
			base.SendTextMessage (_body, _recipients, _onCompletion);

			if (IsMessagingServiceAvailable())
			{
				string _recipientJSONList	= _recipients == null ? null : _recipients.ToJSON();

				// Native method is called
				Plugin.Call(Native.Methods.SEND_SMS, _body, _recipientJSONList);
			}
		}
Ejemplo n.º 22
0
        public override void ShareImageOnWhatsApp(byte[] _imageByteArray, SharingCompletion _onCompletion)
        {
            base.ShareImageOnWhatsApp(_imageByteArray, _onCompletion);

            // Failed to share image
            if (_imageByteArray == null || !IsWhatsAppServiceAvailable())
            {
                return;
            }

            // Native call
            shareImageOnWhatsApp(_imageByteArray, _imageByteArray.Length);
        }
Ejemplo n.º 23
0
        public override void ShareTextMessageOnWhatsApp(string _message, SharingCompletion _onCompletion)
        {
            base.ShareTextMessageOnWhatsApp(_message, _onCompletion);

            // Failed to share message
            if (string.IsNullOrEmpty(_message) || !IsWhatsAppServiceAvailable())
            {
                return;
            }

            // Native call
            shareTextMessageOnWhatsApp(_message);
        }
Ejemplo n.º 24
0
        public void ShareImageOnWhatsApp(Texture2D _texture, SharingCompletion _onCompletion)
        {
            if (_texture == null)
            {
                Console.LogError(Constants.kDebugTag, "[Sharing:WhatsApp] Texture is null");
                ShareImageOnWhatsApp((byte[])null, _onCompletion);
                return;
            }

            // Convert texture into byte array
            byte[] _imageByteArray = _texture.EncodeToPNG();

            // Share
            ShareImageOnWhatsApp(_imageByteArray, _onCompletion);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Sends the text message.
        /// </summary>
        /// <param name="_body">Body of message.</param>
        /// <param name="_recipients">List of receipients.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public virtual void SendTextMessage(string _body, string[] _recipients, SharingCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnSharingFinished = _onCompletion;

            // Messaging service isnt available
            if (!IsMessagingServiceAvailable())
            {
                MessagingShareFinished(MessagingShareFailedResponse());
                return;
            }
        }
        /// <summary>
        /// Shares the image on whats app.
        /// </summary>
        /// <param name="_texture">Texture to take the image from.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public void ShareImageOnWhatsApp(Texture2D _texture, SharingCompletion _onCompletion)
        {
            if (_texture == null)
            {
                Console.LogError(Constants.kDebugTag, "[Sharing:WhatsApp] Texture is null");
                ShareImageOnWhatsApp((byte[])null, _onCompletion);
                return;
            }

            // Convert texture into byte array
            byte[] _imageByteArray	= _texture.EncodeToPNG();

            // Share
            ShareImageOnWhatsApp(_imageByteArray, _onCompletion);
        }
        /// <summary>
        /// Sends the text message.
        /// </summary>
        /// <param name="_body">Body of message.</param>
        /// <param name="_recipients">List of receipients.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public virtual void SendTextMessage(string _body, string[] _recipients, SharingCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnSharingFinished	= _onCompletion;

            // Messaging service isnt available
            if (!IsMessagingServiceAvailable())
            {
                MessagingShareFinished(MessagingShareFailedResponse());
                return;
            }
        }
        /// <summary>
        /// Shares the image on whatsApp.
        /// </summary>
        /// <param name="_imagePath">Path of the image to be shared.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public void ShareImageOnWhatsApp(string _imagePath, SharingCompletion _onCompletion)
        {
            if (!File.Exists(_imagePath))
            {
                Console.LogError(Constants.kDebugTag, "[Sharing:WhatsApp] File doesnt exist. Path="  + _imagePath);
                ShareImageOnWhatsApp((byte[])null, _onCompletion);
                return;
            }

            // Get file data
            byte[] _imageByteArray	= FileOperations.ReadAllBytes(_imagePath);

            // Share
            ShareImageOnWhatsApp(_imageByteArray, _onCompletion);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Shares the image.
        /// </summary>
        /// <param name="_message">Message to share.</param>
        /// <param name="_texture">Texture to share as image.</param>
        /// <param name="_excludedOptions">List of sharing services to exclude while sharing.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public void ShareImage(string _message, Texture2D _texture, eShareOptions[] _excludedOptions, SharingCompletion _onCompletion)
        {
            byte[] _imageByteArray	= null;

            if (_texture != null)
            {
                _imageByteArray	= _texture.EncodeToPNG();
            }
            else
            {
                Console.LogWarning(Constants.kDebugTag, "[Sharing] ShareImage, texure is null");
            }

            Share(_message, null, _imageByteArray, _excludedOptions, _onCompletion);
        }
Ejemplo n.º 30
0
        public void ShareImageOnWhatsApp(string _imagePath, SharingCompletion _onCompletion)
        {
            if (!File.Exists(_imagePath))
            {
                Console.LogError(Constants.kDebugTag, "[Sharing:WhatsApp] File doesnt exist. Path=" + _imagePath);
                ShareImageOnWhatsApp((byte[])null, _onCompletion);
                return;
            }

            // Get file data
            byte[] _imageByteArray = FileOperations.ReadAllBytes(_imagePath);

            // Share
            ShareImageOnWhatsApp(_imageByteArray, _onCompletion);
        }
Ejemplo n.º 31
0
        public virtual void SendMail(string _subject, string _body, bool _isHTMLBody, byte[] _attachmentByteArray,
                                     string _mimeType, string _attachmentFileNameWithExtn, string[] _recipients, SharingCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnSharingFinished = _onCompletion;

            // Cant send mail
            if (!IsMailServiceAvailable())
            {
                MailShareFinished(MailShareFailedResponse());
                return;
            }
        }
		public virtual void ShareTextMessageOnWhatsApp (string _message, SharingCompletion _onCompletion)
		{
			// Pause unity player
			this.PauseUnity();
			
			// Cache callback
			OnSharingFinished	= _onCompletion;
			
			// Sharing on whatsapp isnt supported
			if (string.IsNullOrEmpty(_message) || !IsWhatsAppServiceAvailable())
			{
				Console.Log(Constants.kDebugTag, "[Sharing:WhatsApp] Failed to share text");
				WhatsAppShareFinished(WhatsAppShareFailedResponse());
				return;
			}
		}
Ejemplo n.º 33
0
        public virtual void ShareImageOnWhatsApp(byte[] _imageByteArray, SharingCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnSharingFinished = _onCompletion;

            // Sharing on whatsapp isnt supported
            if (_imageByteArray == null || !IsWhatsAppServiceAvailable())
            {
                Console.LogError(Constants.kDebugTag, "[Sharing:WhatsApp] Failed to share image");
                WhatsAppShareFinished(WhatsAppShareFailedResponse());
                return;
            }
        }
        /// <summary>
        /// Sends the mail with attachment from byte array.
        /// </summary>
        /// <param name="_subject">Subject of mail.</param>
        /// <param name="_body">Body of the mail.</param>
        /// <param name="_isHTMLBody">Indicates if the sent body string is HTML string.</param>
        /// <param name="_attachmentByteArray">Attachment byte array.</param>
        /// <param name="_mimeType">MIME type of attachment. ex: image/png, application/pdf .</param>
        /// <param name="_attachmentFileNameWithExtn">Attachment file name with extension.</param>
        /// <param name="_recipients">List of receipients.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public virtual void SendMail(string _subject, string _body, bool _isHTMLBody, byte[] _attachmentByteArray, 
		                              string _mimeType, string _attachmentFileNameWithExtn, string[] _recipients, SharingCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnSharingFinished	= _onCompletion;

            // Cant send mail
            if (!IsMailServiceAvailable())
            {
                MailShareFinished(MailShareFailedResponse());
                return;
            }
        }
Ejemplo n.º 35
0
        public virtual void ShareTextMessageOnWhatsApp(string _message, SharingCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnSharingFinished = _onCompletion;

            // Sharing on whatsapp isnt supported
            if (string.IsNullOrEmpty(_message) || !IsWhatsAppServiceAvailable())
            {
                Console.Log(Constants.kDebugTag, "[Sharing:WhatsApp] Failed to share text");
                WhatsAppShareFinished(WhatsAppShareFailedResponse());
                return;
            }
        }
        /// <summary>
        /// Shares the image on whats app.
        /// </summary>
        /// <param name="_imageByteArray">Image byte array to create the image from.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public virtual void ShareImageOnWhatsApp(byte[] _imageByteArray, SharingCompletion _onCompletion)
        {
            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnSharingFinished	= _onCompletion;

            // Sharing on whatsapp isnt supported
            if (_imageByteArray == null || !IsWhatsAppServiceAvailable())
            {
                Console.LogError(Constants.kDebugTag, "[Sharing:WhatsApp] Failed to share image");
                WhatsAppShareFinished(WhatsAppShareFailedResponse());
                return;
            }
        }
		public override void SendMail (string _subject, string _body, bool _isHTMLBody, byte[] _attachmentByteArray, 
		                               string _mimeType, string _attachmentFileNameWithExtn, string[] _recipients, SharingCompletion _onCompletion)
		{
			base.SendMail(_subject, _body, _isHTMLBody, _attachmentByteArray, _mimeType, 
			              _attachmentFileNameWithExtn, _recipients, _onCompletion);
			
			if (IsMailServiceAvailable())
			{
				// Find attachment data array length
				int		_attachmentByteArrayLength	= _attachmentByteArray == null ? 0 : _attachmentByteArray.Length;
				string	_toRecipientsJSONList		= (_recipients == null) ? null : _recipients.ToJSON();

				Plugin.Call(Native.Methods.SEND_MAIL, _subject, _body,
				            _isHTMLBody, _attachmentByteArray, _attachmentByteArrayLength,
				            _mimeType, _attachmentFileNameWithExtn, _toRecipientsJSONList, null, null);
			}
		}
Ejemplo n.º 38
0
        public void ShareImageOnWhatsApp(string _imagePath, SharingCompletion _onCompletion)
        {
            DownloadAsset _request = new DownloadAsset(new URL(_imagePath), true);

            _request.OnCompletion = (WWW _www, string _error) => {
                if (string.IsNullOrEmpty(_error))
                {
                    ShareImageOnWhatsApp(_www.bytes, _onCompletion);
                }
                else
                {
                    DebugUtility.Logger.LogError(Constants.kDebugTag, "[Sharing] The operation could not be completed. Error=" + _error);
                    ShareImageOnWhatsApp((byte[])null, _onCompletion);
                    return;
                }
            };
            _request.StartRequest();
        }
        public override void SendMail(string _subject, string _body, bool _isHTMLBody, byte[] _attachmentByteArray, 
		                               string _mimeType, string _attachmentFileNameWithExtn, string[] _recipients, SharingCompletion _onCompletion)
        {
            base.SendMail(_subject, _body, _isHTMLBody, _attachmentByteArray, _mimeType,
                          _attachmentFileNameWithExtn, _recipients, _onCompletion);

            if (IsMailServiceAvailable())
            {
                // Attachment data array length
                int _attachmentByteArrayLength	= 0;

                if (_attachmentByteArray != null)
                    _attachmentByteArrayLength	= _attachmentByteArray.Length;

                sendMail(_subject, _body, _isHTMLBody, _attachmentByteArray, _attachmentByteArrayLength,
                         _mimeType, _attachmentFileNameWithExtn, _recipients.ToJSON());
            }
        }
        /// <summary>
        /// Sends the mail with an attachment.
        /// </summary>
        /// <param name="_subject">Subject of mail.</param>
        /// <param name="_body">Body of the mail.</param>
        /// <param name="_isHTMLBody">Indicates if the sent body string is HTML string.</param>
        /// <param name="_attachmentPath">Path to attachment file.</param>
        /// <param name="_mimeType">MIME type of attachment. ex: image/png, application/pdf .</param>
        /// <param name="_recipients">List of receipients.</param>
        /// <param name="_onCompletion">Callback to be triggered when sharing action completes.</param>
        public void SendMailWithAttachment(string _subject, string _body, bool _isHTMLBody, 
		                                    string _attachmentPath, string _mimeType, string[] _recipients, SharingCompletion _onCompletion)
        {
            byte[] _attachmentByteArray	= null;
            string _filename			= null;

            // File exists
            if (File.Exists(_attachmentPath))
            {
                _attachmentByteArray	= FileOperations.ReadAllBytes(_attachmentPath);
                _filename				= Path.GetFileName(_attachmentPath);
            }
            else
            {
                Console.LogWarning(Constants.kDebugTag, "[Sharing:Mail] Sending file with no attachments, file doesnt exist at path="  + _attachmentPath);
            }

            SendMail(_subject, _body, _isHTMLBody, _attachmentByteArray,
                     _mimeType, _filename, _recipients, _onCompletion);
        }
		public void SendMailWithTexture (string _subject, string _body, bool _isHTMLBody, 
		                                 Texture2D _texture, string[] _recipients, SharingCompletion _onCompletion) 
		{
			byte[] _imageByteArray	= null;
			string _mimeType		= null;
			string _attachmentName	= null;
			
			// Convert texture into byte array
			if (_texture != null)
			{
				_imageByteArray	= _texture.EncodeToPNG();
				_attachmentName	= "texture.png";
				_mimeType		= MIMEType.kPNG;
			}
			else
			{
				Console.LogWarning(Constants.kDebugTag, "[Sharing:Mail] Sending mail with no attachments, attachment is null");
			}
			
			SendMail(_subject, _body, _isHTMLBody, _imageByteArray, 
			         _mimeType, _attachmentName, _recipients, _onCompletion);
		}
Ejemplo n.º 42
0
        public override void SendTextMessage(string _body, string[] _recipients,
                                             SharingCompletion _onCompletion)
        {
            base.SendTextMessage(_body, _recipients, _onCompletion);
            if (IsMessagingServiceAvailable())
            {
                string appendedRecipients = "";
                if (_recipients != null && _recipients.Length > 0)
                {
                    int i = 0;
                    for (; i < (_recipients.Length - 1); i++)
                    {
                        appendedRecipients += _recipients[i];
                        appendedRecipients += ";";
                    }
                    appendedRecipients += _recipients[i];
                }

                // Native method is called
                Plugin.Call(NativeInfo.Methods.SEND_SMS, _body, appendedRecipients);
            }
        }
        public override void SendTextMessage(string _body, 		string[] _recipients,
		                                      SharingCompletion _onCompletion)
        {
            base.SendTextMessage (_body, _recipients, _onCompletion);
            if (IsMessagingServiceAvailable())
            {
                string 	appendedRecipients = "";
                if(_recipients != null && _recipients.Length > 0)
                {
                    int i = 0;
                    for(; i < (_recipients.Length-1); i++)
                    {
                        appendedRecipients += _recipients[i];
                        appendedRecipients += ";";
                    }
                    appendedRecipients += _recipients[i];
                }

                // Native method is called
                Plugin.Call(NativeInfo.Methods.SEND_SMS, _body, appendedRecipients);
            }
        }
Ejemplo n.º 44
0
        public void SendMailWithTexture(string _subject, string _body, bool _isHTMLBody,
                                        Texture2D _texture, string[] _recipients, SharingCompletion _onCompletion)
        {
            byte[] _imageByteArray = null;
            string _mimeType       = null;
            string _attachmentName = null;

            // Convert texture into byte array
            if (_texture != null)
            {
                _imageByteArray = _texture.EncodeToPNG();
                _attachmentName = "texture.png";
                _mimeType       = MIMEType.kPNG;
            }
            else
            {
                DebugUtility.Logger.LogWarning(Constants.kDebugTag, "[Sharing] Sending mail with no attachments, attachment is null");
            }

            SendMail(_subject, _body, _isHTMLBody, _imageByteArray,
                     _mimeType, _attachmentName, _recipients, _onCompletion);
        }
Ejemplo n.º 45
0
        private IEnumerator ShowViewCoroutine(IShareView _shareView, SharingCompletion _onCompletion)
        {
            while (!_shareView.IsReadyToShowView)
            {
                yield return(null);
            }

            // Pause unity player
            this.PauseUnity();

            // Cache callback
            OnSharingFinished = _onCompletion;

            if (_shareView is MailShareComposer)
            {
                ShowMailShareComposer((MailShareComposer)_shareView);
            }
            else if (_shareView is MessageShareComposer)
            {
                ShowMessageShareComposer((MessageShareComposer)_shareView);
            }
            else if (_shareView is WhatsAppShareComposer)
            {
                ShowWhatsAppShareComposer((WhatsAppShareComposer)_shareView);
            }
            else if (_shareView is FBShareComposer)
            {
                ShowFBShareComposer((FBShareComposer)_shareView);
            }
            else if (_shareView is TwitterShareComposer)
            {
                ShowTwitterShareComposer((TwitterShareComposer)_shareView);
            }
            else
            {
                ShowShareSheet((ShareSheet)_shareView);
            }
        }
Ejemplo n.º 46
0
		private IEnumerator ShowViewCoroutine (IShareView _shareView, SharingCompletion _onCompletion)
		{
			while (!_shareView.IsReadyToShowView)
				yield return null;

			// Pause unity player
			this.PauseUnity();
			
			// Cache callback
			OnSharingFinished	= _onCompletion;

			if (_shareView is MailShareComposer)
			{
				ShowMailShareComposer((MailShareComposer)_shareView);
			}
			else if (_shareView is MessageShareComposer)
			{
				ShowMessageShareComposer((MessageShareComposer)_shareView);
			}
			else if (_shareView is WhatsAppShareComposer)
			{
				ShowWhatsAppShareComposer((WhatsAppShareComposer)_shareView);
			}
			else if (_shareView is FBShareComposer)
			{
				ShowFBShareComposer((FBShareComposer)_shareView);
			}
			else if (_shareView is TwitterShareComposer)
			{
				ShowTwitterShareComposer((TwitterShareComposer)_shareView);
			}
			else 
			{
				ShowShareSheet((ShareSheet)_shareView);
			}
		}
Ejemplo n.º 47
0
 public void ShareImageOnSocialNetwork(string _message, Texture2D _texture, SharingCompletion _onCompletion)
 {
     ShareImage(_message, _texture, m_socialNetworkExcludedList, _onCompletion);
 }
Ejemplo n.º 48
0
        public void Share(string _message, string _URLString, byte[] _imageByteArray, eShareOptions[] _excludedOptions, SharingCompletion _onCompletion)
        {
            string _excludedOptionsJsonString = null;

            if (_excludedOptions != null)
            {
                _excludedOptionsJsonString = _excludedOptions.ToJSON();
            }

            Share(_message, _URLString, _imageByteArray, _excludedOptionsJsonString, _onCompletion);
        }
Ejemplo n.º 49
0
        public void ShareImageAtPath(string _message, string _imagePath, eShareOptions[] _excludedOptions, SharingCompletion _onCompletion)
        {
            URL           _imagePathURL = URL.FileURLWithPath(_imagePath);
            DownloadAsset _newDownload  = new DownloadAsset(_imagePathURL, true);

            _newDownload.OnCompletion = (WWW _www, string _error) => {
                byte[] _imageData = null;

                if (string.IsNullOrEmpty(_error))
                {
                    _imageData = _www.bytes;
                }
                else
                {
                    DebugUtility.Logger.LogWarning(Constants.kDebugTag, "[Sharing] The operation could not be completed. Error=" + _error);
                }

                Share(_message, null, _imageData, _excludedOptions, _onCompletion);
            };
            _newDownload.StartRequest();
        }
Ejemplo n.º 50
0
        public void ShareImage(string _message, Texture2D _texture, eShareOptions[] _excludedOptions, SharingCompletion _onCompletion)
        {
            byte[] _imageByteArray = null;

            if (_texture != null)
            {
                _imageByteArray = _texture.EncodeToPNG();
            }
            else
            {
                DebugUtility.Logger.LogWarning(Constants.kDebugTag, "[Sharing] ShareImage, texure is null");
            }

            Share(_message, null, _imageByteArray, _excludedOptions, _onCompletion);
        }
Ejemplo n.º 51
0
 public void ShareScreenShot(string _message, eShareOptions[] _excludedOptions, SharingCompletion _onCompletion)
 {
     // First capture screenshot
     StartCoroutine(TextureExtensions.TakeScreenshot((_texture) => {
         // Share image
         ShareImage(_message, _texture, _excludedOptions, _onCompletion);
     }));
 }
Ejemplo n.º 52
0
        public void ShareURL(string _message, string _URLString, eShareOptions[] _excludedOptions, SharingCompletion _onCompletion)
        {
            if (string.IsNullOrEmpty(_URLString))
            {
                DebugUtility.Logger.LogWarning(Constants.kDebugTag, "[Sharing] ShareURL, URL is null/empty");
            }

            Share(_message, _URLString, null, _excludedOptions, _onCompletion);
        }
Ejemplo n.º 53
0
 public void ShareMessage(string _message, eShareOptions[] _excludedOptions, SharingCompletion _onCompletion)
 {
     Share(_message, null, null, _excludedOptions, _onCompletion);
 }
Ejemplo n.º 54
0
 public void ShareImageOnSocialNetwork(string _message, byte[] _imageByteArray, SharingCompletion _onCompletion)
 {
     Share(_message, null, _imageByteArray, m_socialNetworkExcludedList, _onCompletion);
 }
Ejemplo n.º 55
0
 public void ShareScreenShotOnSocialNetwork(string _message, SharingCompletion _onCompletion)
 {
     ShareScreenShot(_message, m_socialNetworkExcludedList, _onCompletion);
 }
Ejemplo n.º 56
0
		public void ShareImageOnSocialNetwork (string _message, Texture2D _texture, SharingCompletion _onCompletion)
		{
			ShareImage(_message, _texture, m_socialNetworkExcludedList, _onCompletion);
		}
Ejemplo n.º 57
0
		public void ShareScreenShotOnSocialNetwork (string _message, SharingCompletion _onCompletion)
		{
			ShareScreenShot(_message, m_socialNetworkExcludedList, _onCompletion);
		}
Ejemplo n.º 58
0
		public void ShareURLOnSocialNetwork (string _message, string _URLString, SharingCompletion _onCompletion) 
		{
			ShareURL(_message, _URLString, m_socialNetworkExcludedList, _onCompletion);
		}
Ejemplo n.º 59
0
 public void ShareURLOnSocialNetwork(string _message, string _URLString, SharingCompletion _onCompletion)
 {
     ShareURL(_message, _URLString, m_socialNetworkExcludedList, _onCompletion);
 }
Ejemplo n.º 60
0
 public void ShareImageOnSocialNetwork(string _message, string _imagePath, SharingCompletion _onCompletion)
 {
     ShareImageAtPath(_message, _imagePath, m_socialNetworkExcludedList, _onCompletion);
 }