Exemplo n.º 1
0
        public async void SendMedia(string filePath, string mediaType)
        {
            BTProgressHUD.Show("Please Wait", maskType: ProgressHUD.MaskType.Black);
            var mediaName = System.IO.Path.GetFileName(filePath); //AWSUploader.SetMediaName (mediaType);
            var url       = "";

            try
            {
                // BTProgressHUD.Show("Processing media..", maskType: ProgressHUD.MaskType.Black);
                if (mediaType == "Photo")
                {
                    await AWSUploader.AWSUploadImage(filePath, mediaName);
                }
                else
                {
                    await AWSUploader.AWSUploadAudioVideo(filePath, mediaName, mediaType);
                }
                url = AWSUploader.GetMediaUrl(mediaType) + mediaName;



                try
                {
                    if (string.IsNullOrEmpty(url))
                    {
                        // AlertBox.Create("Upload", "File upload failed, Please check your internet connection", null);

                        return;
                    }
                    else
                    {
                        lstAttachments = new List <AttachmentViewModel>();
                        var attachment = new AttachmentViewModel();
                        attachment.Type = mediaType;
                        attachment.Url  = url;
                        lstAttachments.Add(attachment);

                        SendThumbMedia(thumbFilePath, mediaType);
                        //BTProgressHUD.Dismiss();
                        //ButtonSendChatMessage();
                    }
                }
                catch (Exception e)
                {
                    // Crashes.TrackError(e);
                }
            }
            catch (Exception e)
            {
                // Crashes.TrackError(e);
            }
        }
Exemplo n.º 2
0
        private async void uploadMedia(string filePath, string mediaType)
        {
            var mediaName = System.IO.Path.GetFileName(filePath); //AWSUploader.SetMediaName (mediaType);
            var url       = "";

            try
            {
                // BTProgressHUD.Show("Processing media..", maskType: ProgressHUD.MaskType.Black);
                if (mediaType == "Photo")
                {
                    await AWSUploader.AWSUploadImage(filePath, mediaName);
                }
                else
                {
                    await AWSUploader.AWSUploadAudioVideo(filePath, mediaName, mediaType);
                }
                url = AWSUploader.GetMediaUrl(mediaType) + mediaName;


                try
                {
                    if (string.IsNullOrEmpty(url))
                    {
                        Toast.MakeText(this, "Check Your Internet Connection", ToastLength.Long).Show();
                    }
                    else
                    {
                        var model = new GroupRequestViewModel
                        {
                            Name        = txtGroupName.Text,
                            Description = txtGroupDesc.Text,
                            GroupType   = (GroupType)grouptype,
                            InterestId  = Convert.ToInt32(drpInterestList[drpInterest.SelectedItemPosition].Value),
                            IsPrivate   = privategroup.Checked,
                            PictureUrl  = url
                        };
                        Intent intent = new Intent(this, typeof(SelectGroupContactActivity));
                        intent.PutExtra("GroupObject", JsonConvert.SerializeObject(model));
                        StartActivity(intent);
                    }
                }
                catch (Java.Lang.Exception e)
                {
                    Toast.MakeText(this, e.Message, ToastLength.Long).Show();
                }
            }
            catch (Java.Lang.Exception e)
            {
                Toast.MakeText(this, e.Message, ToastLength.Long).Show();
            }
        }
Exemplo n.º 3
0
        private async void uploadMedia(string filePath, string mediaType, GroupRequestViewModel model)
        {
            var mediaName = System.IO.Path.GetFileName(filePath); //AWSUploader.SetMediaName (mediaType);
            var url       = "";

            try
            {
                // BTProgressHUD.Show("Processing media..", maskType: ProgressHUD.MaskType.Black);
                if (mediaType == "Photo")
                {
                    await AWSUploader.AWSUploadImage(filePath, mediaName);
                }
                else
                {
                    await AWSUploader.AWSUploadAudioVideo(filePath, mediaName, mediaType);
                }
                url = AWSUploader.GetMediaUrl(mediaType) + mediaName;


                try
                {
                    if (string.IsNullOrEmpty(url))
                    {
                        //Toast.MakeText(this, "Check Your Internet Connection", ToastLength.Long).Show();
                    }
                    else
                    {
                        GroupRequestViewModel groupRequestViewModel = new GroupRequestViewModel();
                        groupRequestViewModel = new GroupRequestViewModel
                        {
                            Name        = txtGroupName.Text,
                            Description = txtDescription.Text,
                            GroupType   = (GroupType)grouptype,
                            InterestId  = interestID,
                            IsPrivate   = privategroup,
                            PictureUrl  = url
                        };
                        BTProgressHUD.Dismiss();

                        InvokeOnMainThread(delegate
                        {
                            var viewController        = (SelectGroupContactViewController)Storyboard.InstantiateViewController("SelectGroupContactViewController");
                            viewController.groupmodel = groupRequestViewModel;
                            NavigationController.PushViewController(viewController, true);
                        });
                    }
                }
                catch (Exception e)
                {
                    Crashes.TrackError(e);
                    BTProgressHUD.Dismiss();
                    new UIAlertView("Error", e.ToString(), null, "OK", null).Show();
                    //Toast.MakeText(this, e.Message, ToastLength.Long).Show();
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                BTProgressHUD.Dismiss();
                new UIAlertView("Error", e.ToString(), null, "OK", null).Show();
                //Toast.MakeText(this, e.Message, ToastLength.Long).Show();
            }
        }
        private async void uploadMedia(string filePath, string mediaType, UserRegisterResponseViewModel model)
        {
            var mediaName = System.IO.Path.GetFileName(filePath); //AWSUploader.SetMediaName (mediaType);
            var url       = "";

            try
            {
                // BTProgressHUD.Show("Processing media..", maskType: ProgressHUD.MaskType.Black);
                if (mediaType == "Photo")
                {
                    await AWSUploader.AWSUploadImage(filePath, mediaName);
                }
                else
                {
                    await AWSUploader.AWSUploadAudioVideo(filePath, mediaName, mediaType);
                }
                url = AWSUploader.GetMediaUrl(mediaType) + mediaName;


                try
                {
                    if (string.IsNullOrEmpty(url))
                    {
                        //Toast.MakeText(this, "Check Your Internet Connection", ToastLength.Long).Show();
                    }
                    else
                    {
                        var Result = await new AccountService().Registration(new UserRegisterRequestViewModel
                        {
                            Email    = model.Email,
                            Password = model.Password,

                            ZipCode         = model.ZipCode,
                            City            = model.City,
                            State           = model.State,
                            Country         = model.Country,
                            AboutMe         = model.AboutMe,
                            ProfileImageUrl = url,
                        }, GlobalConstant.AccountUrls.RegisterServiceUrl);

                        if (Result.Status == 1)
                        {
                            var modelReporeg = JsonConvert.DeserializeObject <UserRegisterResponseViewModel>(Result.Response.ToString());

                            var UserprofileRepo = UserProfileRepository.GetUserProfile(CommonHelper.GetUserId());
                            UserprofileRepo.ZipCode = modelReporeg.ZipCode;
                            UserprofileRepo.City    = modelReporeg.City;
                            UserprofileRepo.State   = modelReporeg.State;
                            UserprofileRepo.Country = modelReporeg.Country;

                            UserprofileRepo.AboutMe         = modelReporeg.AboutMe;
                            UserprofileRepo.ProfileImageUrl = modelReporeg.ProfileImageUrl;



                            UserProfileRepository.UpdateUserProfile(UserprofileRepo);
                            new UIAlertView("Update Your Profile", "Profile Updated Successfully", null, "OK", null).Show();

                            BTProgressHUD.Dismiss();
                            this.DismissViewController(true, null);
                        }
                    }
                }
                catch (Exception e)
                {
                    Crashes.TrackError(e);
                    BTProgressHUD.Dismiss();
                    new UIAlertView("Error", e.ToString(), null, "OK", null).Show();
                    //Toast.MakeText(this, e.Message, ToastLength.Long).Show();
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                BTProgressHUD.Dismiss();
                new UIAlertView("Error", e.ToString(), null, "OK", null).Show();
                //Toast.MakeText(this, e.Message, ToastLength.Long).Show();
            }
        }
Exemplo n.º 5
0
        private async void uploadMedia(string filePath, string mediaType, UserRegisterResponseViewModel model)
        {
            var mediaName = System.IO.Path.GetFileName(filePath); //AWSUploader.SetMediaName (mediaType);
            var url       = "";

            try
            {
                // BTProgressHUD.Show("Processing media..", maskType: ProgressHUD.MaskType.Black);
                if (mediaType == "Photo")
                {
                    await AWSUploader.AWSUploadImage(filePath, mediaName);
                }
                else
                {
                    await AWSUploader.AWSUploadAudioVideo(filePath, mediaName, mediaType);
                }
                url = AWSUploader.GetMediaUrl(mediaType) + mediaName;


                try
                {
                    if (string.IsNullOrEmpty(url))
                    {
                        Toast.MakeText(this, "Check Your Internet Connection", ToastLength.Long).Show();
                    }
                    else
                    {
                        var Result = await new AccountService().Registration(new UserRegisterRequestViewModel
                        {
                            Email    = model.Email,
                            Password = model.Password,

                            ZipCode         = model.ZipCode,
                            City            = model.City,
                            State           = model.State,
                            Country         = model.Country,
                            AboutMe         = model.AboutMe,
                            ProfileImageUrl = url,
                        }, GlobalConstant.AccountUrls.RegisterServiceUrl);

                        if (Result.Status == 1)
                        {
                            var modelReporeg = JsonConvert.DeserializeObject <UserRegisterResponseViewModel>(Result.Response.ToString());

                            var UserprofileRepo = UserProfileRepository.GetUserProfile(CommonHelper.GetUserId());
                            UserprofileRepo.ZipCode = modelReporeg.ZipCode;
                            UserprofileRepo.City    = modelReporeg.City;
                            UserprofileRepo.State   = modelReporeg.State;
                            UserprofileRepo.Country = modelReporeg.Country;

                            UserprofileRepo.AboutMe         = modelReporeg.AboutMe;
                            UserprofileRepo.ProfileImageUrl = modelReporeg.ProfileImageUrl;



                            UserProfileRepository.UpdateUserProfile(UserprofileRepo);
                            Toast.MakeText(this, "Profile Complete Successfully", ToastLength.Short).Show();
                            CommonHelper.DismissProgressBar(this);
                            this.Finish();
                            var intent = new Intent(this, typeof(MainActivity));
                            intent.AddFlags(ActivityFlags.SingleTop);

                            StartActivity(intent);
                        }
                    }
                }
                catch (Java.Lang.Exception e)
                {
                    Toast.MakeText(this, e.Message, ToastLength.Long).Show();
                }
            }
            catch (Java.Lang.Exception e)
            {
                Toast.MakeText(this, e.Message, ToastLength.Long).Show();
            }
        }