private async void SendMess(string text) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } else { var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); var time2 = unixTimestamp.ToString(); //Here on This function will send Selected audio file to the user var(apiStatus, respond) = await RequestsAsync.Message.SendMessageAsync(UserId, time2, text); if (apiStatus == 200) { if (respond is SendMessageObject result) { Console.WriteLine(result.MessageData); if (!string.IsNullOrEmpty(CallId)) { var ckd = MsgTabbedMainActivity.GetInstance()?.LastCallsTab?.MAdapter?.MCallUser?.FirstOrDefault(a => a.Id == CallId); // id >> Call_Id if (ckd == null) { Classes.CallUser cv = new Classes.CallUser { Id = CallId, UserId = UserId, Avatar = Avatar, Name = Name, AccessToken = TwilioAccessToken, AccessToken2 = TwilioAccessTokenUser2, FromId = FromId, Active = Active, Time = "Missed call", Status = Status, RoomName = RoomName, Type = CallType, TypeIcon = "Cancel", TypeColor = "#FF0000" }; MsgTabbedMainActivity.GetInstance()?.LastCallsTab.MAdapter?.Insert(cv); SqLiteDatabase dbDatabase = new SqLiteDatabase(); dbDatabase.Insert_CallUser(cv); } } switch (CallType) { case "Twilio_video_call": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { async() => await RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Video) }); break; case "Twilio_audio_call": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { async() => await RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Audio) }); break; case "Agora_video_call_recieve": case "Agora_audio_call_recieve": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { async() => await ApiRequest.Send_Agora_Call_Action_Async("decline", CallId) }); break; } MsgTabbedMainActivity.RunCall = false; FinishVideoAudio(); } } else { Methods.DisplayReportResult(this, respond); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void LikeCommentReplyPostClick(CommentReplyClickEventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } switch (e.Holder.LikeTextView?.Tag?.ToString()) { case "Liked": { e.Holder.LikeTextView.Text = MainContext.GetText(Resource.String.Btn_Like); //e.Holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black); e.Holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.ParseColor("#888888")); e.Holder.LikeTextView.Tag = "Like"; switch (AppSettings.PostButton) { case PostButtonSystem.ReactionDefault: case PostButtonSystem.ReactionSubShine: { var x = e.CommentObject.Reaction.Count; switch (x) { case > 0: e.CommentObject.Reaction.Count--; break; default: e.CommentObject.Reaction.Count = 0; break; } e.CommentObject.Reaction.IsReacted = false; e.CommentObject.Reaction.Type = ""; if (e.Holder.CountLike != null && e.CommentObject.Reaction.Count > 0) { e.Holder.CountLikeSection.Visibility = ViewStates.Visible; e.Holder.CountLike.Text = Methods.FunString.FormatPriceValue(e.CommentObject.Reaction.Count); } else { e.Holder.CountLikeSection.Visibility = ViewStates.Gone; } PollyController.RunRetryPolicyFunction(TypeClass == "Reply" ? new List <Func <Task> > { () => RequestsAsync.Comment.ReactionCommentAsync(e.CommentObject.Id, "", "reaction_reply") } : new List <Func <Task> > { () => RequestsAsync.Comment.ReactionCommentAsync(e.CommentObject.Id, "") }); break; } default: e.CommentObject.IsCommentLiked = false; PollyController.RunRetryPolicyFunction(TypeClass == "Reply" ? new List <Func <Task> > { () => RequestsAsync.Comment.LikeUnLikeCommentAsync(e.CommentObject.Id, "reply_like") } : new List <Func <Task> > { () => RequestsAsync.Comment.LikeUnLikeCommentAsync(e.CommentObject.Id, "comment_like") }); break; } break; } default: { switch (AppSettings.PostButton) { case PostButtonSystem.ReactionDefault: case PostButtonSystem.ReactionSubShine: new ReactionComment(MainContext, TypeClass)?.ClickDialog(e); break; default: e.CommentObject.IsCommentLiked = true; e.Holder.LikeTextView.Text = MainContext.GetText(Resource.String.Btn_Liked); e.Holder.LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor)); e.Holder.LikeTextView.Tag = "Liked"; PollyController.RunRetryPolicyFunction(TypeClass == "Reply" ? new List <Func <Task> > { () => RequestsAsync.Comment.LikeUnLikeCommentAsync(e.CommentObject.Id, "reply_like") } : new List <Func <Task> > { () => RequestsAsync.Comment.LikeUnLikeCommentAsync(e.CommentObject.Id, "comment_like") }); break; } break; } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (p1 == DialogAction.Positive) { switch (TypeDialog) { case "DeleteComment": MainContext?.RunOnUiThread(() => { try { switch (TypeClass) { case "Comment": { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.CommentList.IndexOf(dataGlobal); switch (index) { case > -1: adapterGlobal.CommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); break; } } var dataPost = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter?.ListDiffer?.Where(a => a.PostData?.PostId == CommentObject?.PostId).ToList(); switch (dataPost?.Count) { case > 0: { foreach (var post in dataPost.Where(post => post.TypeView == PostModelType.CommentSection || post.TypeView == PostModelType.AddCommentSection)) { TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView?.RemoveByRowIndex(post); } break; } } var dataPost2 = WRecyclerView.GetInstance()?.NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.PostId == CommentObject?.PostId).ToList(); switch (dataPost2?.Count) { case > 0: { foreach (var post in dataPost2.Where(post => post.TypeView == PostModelType.CommentSection || post.TypeView == PostModelType.AddCommentSection)) { WRecyclerView.GetInstance()?.RemoveByRowIndex(post); } break; } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id) }); break; } case "Reply": { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); switch (index) { case > -1: adapterGlobal.ReplyCommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); break; } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id, "delete_reply") }); break; } } Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CommentSuccessfullyDeleted), ToastLength.Short)?.Show(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }); break; default: { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } break; } } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void CheckAndGetLocation() { try { Activity.RunOnUiThread(async() => { try { if (!LocationManager.IsProviderEnabled(LocationManager.GpsProvider)) { if (ShowAlertDialogGps) { ShowAlertDialogGps = false; Activity.RunOnUiThread(() => { try { // Call your Alert message AlertDialog.Builder alert = new AlertDialog.Builder(Context); alert.SetTitle(GetString(Resource.String.Lbl_Use_Location) + "?"); alert.SetMessage(GetString(Resource.String.Lbl_GPS_is_disabled) + "?"); alert.SetPositiveButton(GetString(Resource.String.Lbl_Ok), (senderAlert, args) => { //Open intent Gps new IntentController(Activity).OpenIntentGps(LocationManager); }); alert.SetNegativeButton(GetString(Resource.String.Lbl_Cancel), (senderAlert, args) => { }); Dialog gpsDialog = alert.Create(); gpsDialog.Show(); } catch (Exception e) { Console.WriteLine(e); } }); } } else { var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; var position = await locator.GetPositionAsync(TimeSpan.FromMilliseconds(10000)); Console.WriteLine("Position Status: {0}", position.Timestamp); Console.WriteLine("Position Latitude: {0}", position.Latitude); Console.WriteLine("Position Longitude: {0}", position.Longitude); UserDetails.Lat = position.Latitude.ToString(CultureInfo.InvariantCulture); UserDetails.Lng = position.Longitude.ToString(CultureInfo.InvariantCulture); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => LoadUsersAsync() }); } } catch (Exception e) { Console.WriteLine(e); } }); } catch (Exception e) { Console.WriteLine(e); } }
/// <summary> /// Method with 2 state set first React or back to default state /// </summary> public void ClickLikeAndDisLike(GlobalClickEventArgs postData, NativePostAdapter nativeFeedAdapter, string namePage = "") { try { PostData = postData; NamePage = namePage; NativeFeedAdapter = nativeFeedAdapter; //Code When User Click On Button //If State is true , dislike The Button And Return To Default State if (!Methods.CheckConnectivity()) { Toast.MakeText(Application.Context, Application.Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } if (UserDetails.SoundControl) { Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("reaction.mp3"); } if (MCurrentReactState) { PostData.NewsFeedClass.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); UpdateReactButtonByReaction(MDefaultReaction); if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { if (PostData.NewsFeedClass.Reaction != null) { if (PostData.NewsFeedClass.Reaction.Count > 0) { PostData.NewsFeedClass.Reaction.Count--; } else { PostData.NewsFeedClass.Reaction.Count = 0; } PostData.NewsFeedClass.Reaction.Type = ""; PostData.NewsFeedClass.Reaction.IsReacted = false; } } else { var x = Convert.ToInt32(PostData.NewsFeedClass.PostLikes); if (x > 0) { x--; } else { x = 0; } PostData.NewsFeedClass.IsLiked = false; PostData.NewsFeedClass.PostLikes = Convert.ToString(x, CultureInfo.InvariantCulture); } if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.LikeText1); if (likeCount != null && !likeCount.Text.Contains("K") && !likeCount.Text.Contains("M")) { var x = Convert.ToInt32(likeCount.Text); if (x > 0) { x--; } else { x = 0; } likeCount.Text = Convert.ToString(x, CultureInfo.InvariantCulture); } } else { var dataGlobal = nativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == PostData.NewsFeedClass.PostId).ToList(); if (dataGlobal?.Count > 0) { foreach (var dataClass in from dataClass in dataGlobal let index = nativeFeedAdapter.ListDiffer.IndexOf(dataClass) where index > -1 select dataClass) { dataClass.PostData = postData.NewsFeedClass; if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { dataClass.PostData.PostLikes = PostData.NewsFeedClass.Reaction.Count + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } else { dataClass.PostData.PostLikes = PostData.NewsFeedClass.PostLikes + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } nativeFeedAdapter.NotifyItemChanged(nativeFeedAdapter.ListDiffer.IndexOf(dataClass), "reaction"); } } var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.Likecount); if (likeCount != null) { if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { likeCount.Text = PostData.NewsFeedClass.Reaction.Count + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } else { likeCount.Text = PostData.NewsFeedClass.PostLikes + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } } } if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction") }); } else { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "like") }); } } else { UpdateReactButtonByReaction(MReactionPack[0]); if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { PostData.NewsFeedClass.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); if (PostData.NewsFeedClass.Reaction.IsReacted != null && !PostData.NewsFeedClass.Reaction.IsReacted.Value) { PostData.NewsFeedClass.Reaction.Count++; PostData.NewsFeedClass.Reaction.Type = "1"; PostData.NewsFeedClass.Reaction.IsReacted = true; } } else { var x = Convert.ToInt32(PostData.NewsFeedClass.PostLikes); x++; PostData.NewsFeedClass.IsLiked = true; PostData.NewsFeedClass.PostLikes = Convert.ToString(x, CultureInfo.InvariantCulture); } if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.LikeText1); if (likeCount != null && (!likeCount.Text.Contains("K") && !likeCount.Text.Contains("M"))) { var x = Convert.ToInt32(likeCount.Text); x++; likeCount.Text = Convert.ToString(x, CultureInfo.InvariantCulture); } } else { var dataGlobal = nativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == PostData.NewsFeedClass.PostId).ToList(); if (dataGlobal?.Count > 0) { foreach (var dataClass in from dataClass in dataGlobal let index = nativeFeedAdapter.ListDiffer.IndexOf(dataClass) where index > -1 select dataClass) { dataClass.PostData = postData.NewsFeedClass; if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { dataClass.PostData.PostLikes = PostData.NewsFeedClass.Reaction.Count + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } else { dataClass.PostData.PostLikes = PostData.NewsFeedClass.PostLikes + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } nativeFeedAdapter.NotifyItemChanged(nativeFeedAdapter.ListDiffer.IndexOf(dataClass), "reaction"); } } var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.Likecount); if (likeCount != null) { if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { likeCount.Text = PostData.NewsFeedClass.Reaction.Count + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } else { likeCount.Text = PostData.NewsFeedClass.PostLikes + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } } } if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { string like = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Like").Value?.Id ?? "1"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", like) }); } else { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "like") }); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
//Like private void MAdapterOnLikeItemClick(object sender, ActivitiesAdapterClickEventArgs e) { try { if (Methods.CheckConnectivity()) { if (UserDetails.IsLogin) { if (e.Position <= -1) { return; } var item = MAdapter.GetItem(e.Position); if (item == null) { return; } item.IsLiked = item.IsLiked switch { "0" => "1", "1" => "0", _ => "1" }; switch (item.IsLiked) { case "1": { if (!item.Likes.Contains("K") && !item.Likes.Contains("M")) { var x = Convert.ToDouble(item.Likes); x++; item.Likes = x.ToString(CultureInfo.CurrentCulture); } break; } case "0": { if (!item.Likes.Contains("K") && !item.Likes.Contains("M")) { var x = Convert.ToDouble(item.Likes); if (x > 0) { x--; } else { x = 0; } item.Likes = x.ToString(CultureInfo.CurrentCulture); } break; } } if (item.IsDisliked == "1") { item.IsDisliked = "0"; if (!item.Dislikes.Contains("K") && !item.Dislikes.Contains("M")) { var x = Convert.ToDouble(item.Dislikes); if (x > 0) { x--; } else { x = 0; } item.Dislikes = x.ToString(CultureInfo.CurrentCulture); } } MAdapter.NotifyItemChanged(e.Position); if (!Methods.CheckConnectivity()) { Toast.MakeText(Context, Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Activities.LikeActivity_Http(item.Id) }); } } else { PopupDialogController dialog = new PopupDialogController(Activity, null, "Login"); dialog.ShowNormalDialog(Context.GetText(Resource.String.Lbl_Warning), Context.GetText(Resource.String.Lbl_Please_sign_in_Dislike), Context.GetText(Resource.String.Lbl_Yes), Context.GetText(Resource.String.Lbl_No)); } } else { Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { string text = itemString.ToString(); if (text == GetString(Resource.String.Btn_Paypal)) { InitPayPalPayment.BtnPaypalOnClick(DataObject.Amount); } else if (text == GetString(Resource.String.Btn_GooglePlay)) { BillingPayment.SetConnInAppBilling(); BillingPayment.InitInAppBilling(DataObject.Amount, "Funding", ""); } else if (text == GetString(Resource.String.Lbl_CreditCard)) { OpenIntentCreditCard(); } else if (text == GetString(Resource.String.Lbl_BankTransfer)) { OpenIntentBankTransfer(); } else if (text == GetString(Resource.String.Lbl_Share)) { ShareEvent(); } else if (text == GetString(Resource.String.Lbl_Edit)) { EditEvent(); } else if (text == GetString(Resource.String.Lbl_Copy)) { CopyLinkEvent(); } else if (text == GetString(Resource.String.Lbl_Delete)) { DialogType = "Delete"; var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialog.Title(Resource.String.Lbl_Warning); dialog.Content(GetText(Resource.String.Lbl_DeleteFunding)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { try { // Send Api delete if (Methods.CheckConnectivity()) { var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.FundId == DataObject.Id); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.FundId == DataObject.Id); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } var dataFunding = FundingActivity.GetInstance()?.MAdapter?.FundingList?.FirstOrDefault(a => a.Id == DataObject.Id); if (dataFunding != null) { FundingActivity.GetInstance()?.MAdapter?.FundingList.Remove(dataFunding); FundingActivity.GetInstance().MAdapter.NotifyItemRemoved(FundingActivity.GetInstance().MAdapter.FundingList.IndexOf(dataFunding)); } Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short).Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Funding.DeleteFunding(DataObject.Id) }); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception e) { Console.WriteLine(e); } }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.ItemsCallback(this).Build().Show(); } } catch (Exception e) { Console.WriteLine(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (DialogType == "Delete") { if (p1 == DialogAction.Positive) { // Send Api delete if (Methods.CheckConnectivity()) { var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.PostId == DataInfoObject?.PostId).ToList(); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.PostId == DataInfoObject?.PostId).ToList(); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } var dataJob = JobsActivity.GetInstance()?.MAdapter?.JobList?.FirstOrDefault(a => a.Id == DataInfoObject.Id); if (dataJob != null) { JobsActivity.GetInstance()?.MAdapter?.JobList.Remove(dataJob); JobsActivity.GetInstance().MAdapter.NotifyItemRemoved(JobsActivity.GetInstance().MAdapter.JobList.IndexOf(dataJob)); } Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short)?.Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(DataInfoObject.PostId, "delete") }); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void OnUnLikeButtonClick(ReplyAdapterViewHolder holder, ReplyAdapterClickEventArgs e) { try { if (Methods.CheckConnectivity()) { if (UserDetails.IsLogin) { if (e.Class != null) { if (holder.UnLikeButton.Tag.ToString() == "1") { holder.UnLikeiconView.SetColorFilter(Color.ParseColor("#777777")); holder.UnLikeButton.Tag = "0"; e.Class.IsDislikedReply = 0; if (!holder.UnLikeNumber.Text.Contains("K") && !holder.UnLikeNumber.Text.Contains("M")) { double x = Convert.ToDouble(holder.UnLikeNumber.Text); if (x > 0) { x--; } else { x = 0; } holder.UnLikeNumber.Text = x.ToString(CultureInfo.InvariantCulture); e.Class.ReplyDislikes = Convert.ToInt32(x); } } else { holder.UnLikeiconView.SetColorFilter(Color.ParseColor(AppSettings.MainColor)); holder.UnLikeButton.Tag = "1"; e.Class.IsDislikedReply = 1; if (!holder.UnLikeNumber.Text.Contains("K") && !holder.UnLikeNumber.Text.Contains("M")) { double x = Convert.ToDouble(holder.UnLikeNumber.Text); x++; holder.UnLikeNumber.Text = x.ToString(CultureInfo.InvariantCulture); e.Class.ReplyDislikes = Convert.ToInt32(x); } } if (holder.LikeButton.Tag.ToString() == "1") { holder.LikeiconView.SetColorFilter(Color.ParseColor("#777777")); holder.LikeButton.Tag = "0"; e.Class.IsLikedReply = 0; if (!holder.LikeNumber.Text.Contains("K") && !holder.LikeNumber.Text.Contains("M")) { double x = Convert.ToDouble(holder.LikeNumber.Text); if (x > 0) { x--; } else { x = 0; } holder.LikeNumber.Text = x.ToString(CultureInfo.InvariantCulture); e.Class.ReplyLikes = Convert.ToInt32(x); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comments.Add_likeOrDislike_Comment_Http(e.Class.Id.ToString(), false) }); } } else { PopupDialogController dialog = new PopupDialogController(ActivityContext, null, "Login"); dialog.ShowNormalDialog(ActivityContext.GetText(Resource.String.Lbl_Warning), ActivityContext.GetText(Resource.String.Lbl_Please_sign_in_Dislike), ActivityContext.GetText(Resource.String.Lbl_Yes), ActivityContext.GetText(Resource.String.Lbl_No)); } } else { Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
//Contact seller private void BtnContactOnClick(object sender, EventArgs eventArgs) { try { switch (AppSettings.MessengerIntegration) { case true when AppSettings.ShowDialogAskOpenMessenger: { var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialog.Title(Resource.String.Lbl_Warning).TitleColorRes(Resource.Color.primary); dialog.Content(GetText(Resource.String.Lbl_ContentAskOPenAppMessenger)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { try { Intent intent = new Intent(this, typeof(ChatWindowActivity)); intent.PutExtra("UserID", ProductData.Seller.UserId); intent.PutExtra("TypeChat", "User"); intent.PutExtra("UserItem", JsonConvert.SerializeObject(ProductData.Seller)); StartActivity(intent); } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); break; } case true: Intent intent = new Intent(this, typeof(ChatWindowActivity)); intent.PutExtra("UserID", ProductData.Seller.UserId); intent.PutExtra("TypeChat", "User"); intent.PutExtra("UserItem", JsonConvert.SerializeObject(ProductData.Seller)); StartActivity(intent); break; default: { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); var time = unixTimestamp.ToString(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Message.SendMessageAsync(ProductData.Seller.UserId, time, "", "", "", "", "", "", ProductData.Id) }); Toast.MakeText(this, GetString(Resource.String.Lbl_MessageSentSuccessfully), ToastLength.Short)?.Show(); break; } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void SetWebView() { try { //Set WebView and Load url to be rendered on WebView if (!Methods.CheckConnectivity()) { SwipeRefreshLayout.Refreshing = false; Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long)?.Show(); } else { DataObject = JsonConvert.DeserializeObject <GamesDataObject>(Intent?.GetStringExtra("ItemObject")); if (DataObject != null) { string url; if (DataObject.GameLink.Contains("www.miniclip.com")) { url = DataObject.GameLink; } else if (DataObject.GameLink.Contains("http")) { url = DataObject.GameLink; } else { url = "https://www.miniclip.com/games/" + DataObject.GameLink + "/en/webgame.php"; } var frame = "<iframe src='" + url + "' id='iframe-game' name='iframe-game' class='loader-game-frame' width='100%' height='100%' border='0' frameborder='0' scrolling='no' allow='autoplay; fullscreen' allowfullscreen='true' style='border: none; height: -webkit-fill-available; min-height: 600px;'></iframe>"; string responsive = ".page-container{ display: -webkit-box; display: flex; -webkit-box-orient: vertical; flex-direction: column; padding: 20px; box-sizing: border-box;} .page-container.notification-opened { -webkit-box-orient: horizontal; flex-direction: row; } .page-container.notification-opened > .notification-arrow { margin-right: 20px; } "; string style = AppSettings.SetTabDarkTheme ? "<style type='text/css'>body{color: #fff; background-color: #444;}" + responsive + "</style>" : "<style type='text/css'>body{color: #444; background-color: #fff;}" + responsive + "</style>"; string data = "<!DOCTYPE html>"; data += "<head><title></title>" + style + "<script type='text/javascript' src ='https://static.miniclipcdn.com/js/game-embed.js'></script>" + "<script type='text/javascript' src ='https://static.miniclipcdn.com/js/mc.js'></script>" + "<script type='text/javascript' src ='https://static.miniclipcdn.com/js/currency.js'></script>" + "<script type='text/javascript' src ='https://static.miniclipcdn.com/js/currency/miniclip.js'></script>" + "</head>"; data += "<body>" + frame + "</body>"; data += "</html>"; WebSettings webSettings = HybridView.Settings; webSettings.JavaScriptEnabled = true; HybridView.HorizontalScrollBarEnabled = false; HybridView.VerticalScrollBarEnabled = false; HybridView.ScrollbarFadingEnabled = false; HybridView.SetScrollContainer(false); webSettings.SetSupportZoom(true); webSettings.BuiltInZoomControls = true; webSettings.DisplayZoomControls = false; HybridView.SetWebViewClient(new MyWebViewClient(this)); HybridView.SetWebChromeClient(new WebChromeClient()); HybridView.SetInitialScale(1); webSettings.AllowFileAccess = true; webSettings.SetPluginState(WebSettings.PluginState.On); webSettings.SetPluginState(WebSettings.PluginState.OnDemand); webSettings.LoadWithOverviewMode = true; webSettings.UseWideViewPort = true; webSettings.DomStorageEnabled = true; webSettings.LoadsImagesAutomatically = true; webSettings.JavaScriptCanOpenWindowsAutomatically = true; webSettings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.TextAutosizing); HybridView.ScrollBarStyle = ScrollbarStyles.InsideOverlay; //string desktopUserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36"; //string mobileUserAgent = "Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"; //Choose Mobile/Desktop client. webSettings.UserAgentString = HybridView.Settings.UserAgentString.Replace("Mobile", "eliboM").Replace("Android", "diordnA"); //Load url to be rendered on WebView HybridView.LoadDataWithBaseURL(null, data, "text/html", "UTF-8", null); if (DataObject.Active != "1") { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Games.AddToMyGames(DataObject.Id) }); } } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void BtnAddOnClick(object sender, EventArgs eventArgs) { try { if (Methods.CheckConnectivity()) { if (BtnAdd.Tag.ToString() == "Add") //(is_following == "0") >> Not Friend { BtnAdd.SetColor(Color.ParseColor(AppSettings.MainColor)); BtnAdd.SetImageResource(Resource.Drawable.ic_tick); BtnAdd.Tag = "friends"; Item.IsFollowing = "1"; } else if (BtnAdd.Tag.ToString() == "request") //(is_following == "2") >> Request { BtnAdd.SetColor(Color.ParseColor(AppSettings.MainColor)); BtnAdd.SetImageResource(Resource.Drawable.ic_tick); BtnAdd.Tag = "Add"; Item.IsFollowing = "2"; } else //(is_following == "1") >> Friend { BtnAdd.SetColor(Color.ParseColor("#8c8a8a")); BtnAdd.SetImageResource(Resource.Drawable.ic_add); BtnAdd.Tag = "Add"; var dbDatabase = new SqLiteDatabase(); dbDatabase.Delete_UsersContact(Userid); dbDatabase.Dispose(); Item.IsFollowing = "0"; } var local = ActivityContext.MAdapter?.UserList?.FirstOrDefault(a => a.UserId == Userid); if (local != null) { local.IsFollowing = Item.IsFollowing; ActivityContext.MAdapter?.NotifyItemChanged(ActivityContext.MAdapter.UserList.IndexOf(local)); } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Follow_User(Userid) }); if (Item.IsFollowing == "1") { if (AppSettings.ConnectivitySystem == 1) { Toast.MakeText(ActivityContext, GetText(Resource.String.Lbl_Sent_successfully_followed), ToastLength.Short).Show(); } else { Toast.MakeText(ActivityContext, GetText(Resource.String.Lbl_Sent_successfully_FriendRequest), ToastLength.Short).Show(); } } else { if (AppSettings.ConnectivitySystem == 1) { Toast.MakeText(ActivityContext, GetText(Resource.String.Lbl_Sent_successfully_Unfollowed), ToastLength.Short).Show(); } else { Toast.MakeText(ActivityContext, GetText(Resource.String.Lbl_Sent_successfully_FriendRequestCancelled), ToastLength.Short).Show(); } } } else { Toast.MakeText(ActivityContext, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception e) { Console.WriteLine(e); } }
//Event Click Login private async void SignInButtonOnClick(object sender, EventArgs e) { try { if (Methods.CheckConnectivity()) { if (!string.IsNullOrEmpty(EmailEditText.Text.Replace(" ", "")) || !string.IsNullOrEmpty(PasswordEditText.Text)) { ProgressBar.Visibility = ViewStates.Visible; LoginButton.Visibility = ViewStates.Gone; (int apiStatus, var respond) = await RequestsAsync.Auth.Login(EmailEditText.Text.Replace(" ", ""), PasswordEditText.Text, UserDetails.DeviceId); if (apiStatus == 200) { if (respond is LoginObject auth) { if (auth.data != null) { Current.AccessToken = auth.data.AccessToken; UserDetails.Username = EmailEditText.Text; UserDetails.FullName = EmailEditText.Text; UserDetails.Password = PasswordEditText.Text; UserDetails.AccessToken = auth.data.AccessToken; UserDetails.UserId = auth.data.UserId.ToString(); UserDetails.Status = "Active"; UserDetails.Cookie = auth.data.AccessToken; UserDetails.Email = EmailEditText.Text; //Insert user data to database var user = new DataTables.LoginTb { UserId = UserDetails.UserId, AccessToken = UserDetails.AccessToken, Cookie = UserDetails.Cookie, Username = EmailEditText.Text, Password = PasswordEditText.Text, Status = "Active", Lang = "", DeviceId = UserDetails.DeviceId, }; ListUtils.DataUserLoginList.Add(user); var dbDatabase = new SqLiteDatabase(); dbDatabase.InsertOrUpdateLogin_Credentials(user); dbDatabase.Dispose(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => ApiRequest.GetProfile_Api(this) }); StartActivity(new Intent(this, typeof(HomeActivity))); FinishAffinity(); } } } else if (apiStatus == 400) { if (respond is ErrorObject error) { var errorText = error.errors.ErrorText; var errorId = error.errors.ErrorId; if (errorId == "2") { Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorLogin_2), GetText(Resource.String.Lbl_Ok)); } else if (errorId == "4") { Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorLogin_4), GetText(Resource.String.Lbl_Ok)); } else if (errorId == "19") { Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_Error_19), GetText(Resource.String.Lbl_Ok)); } else { Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), errorText, GetText(Resource.String.Lbl_Ok)); } } ProgressBar.Visibility = ViewStates.Gone; LoginButton.Visibility = ViewStates.Visible; } else if (apiStatus == 404) { ProgressBar.Visibility = ViewStates.Gone; LoginButton.Visibility = ViewStates.Visible; Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), respond.toString(), GetText(Resource.String.Lbl_Ok)); } } else { ProgressBar.Visibility = ViewStates.Gone; LoginButton.Visibility = ViewStates.Visible; Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_Please_enter_your_data), GetText(Resource.String.Lbl_Ok)); } } else { ProgressBar.Visibility = ViewStates.Gone; LoginButton.Visibility = ViewStates.Visible; Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_CheckYourInternetConnection), GetText(Resource.String.Lbl_Ok)); } } catch (Exception exception) { Console.WriteLine(exception); ProgressBar.Visibility = ViewStates.Gone; LoginButton.Visibility = ViewStates.Visible; Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), exception.Message, GetText(Resource.String.Lbl_Ok)); } }
private void Initialize(SearchPageAdapterViewHolder holder, PageClass item) { try { GlideImageLoader.LoadImage(ActivityContext, item.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); if (!string.IsNullOrEmpty(item.PageTitle) || !string.IsNullOrWhiteSpace(item.PageTitle)) { holder.Name.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.PageTitle), 20); } else { holder.Name.Text = Methods.FunString.SubStringCutOf(Methods.FunString.DecodeString(item.PageName), 20); } CategoriesController cat = new CategoriesController(); holder.About.Text = cat.Get_Translate_Categories_Communities(item.PageCategory, item.Category); //var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor("#BF360C")); //holder.ImageView.SetImageDrawable(drawable); if (item.IsLiked != null) { //Set style Btn Like page if (item.IsLiked == "no" || item.IsLiked == "No" || item.IsLiked == "false") { holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor)); holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Like); holder.Button.Tag = "false"; } else if (item.IsLiked == "yes" || item.IsLiked == "Yes" || item.IsLiked == "true") { holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed); holder.Button.SetTextColor(Color.ParseColor("#ffffff")); holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Unlike); holder.Button.Tag = "true"; } } else { holder.Button.Visibility = ViewStates.Gone; } if (!holder.Button.HasOnClickListeners) { holder.Button.Click += (sender, args) => { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(ActivityContext, ActivityContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); return; } if (holder.Button.Tag.ToString() == "false") { holder.Button.SetBackgroundResource(Resource.Drawable .follow_button_profile_friends_pressed); holder.Button.SetTextColor(Color.ParseColor("#ffffff")); holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Unlike); holder.Button.Tag = "true"; } else { holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor)); holder.Button.Text = ActivityContext.GetText(Resource.String.Btn_Like); holder.Button.Tag = "false"; } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Page.Like_Page(item.PageId) }); } catch (Exception e) { Console.WriteLine(e); } } } ; } catch (Exception e) { Console.WriteLine(e); } }
public void FriendButtonClick(UsersClickEventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(ActivityContext, ActivityContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); return; } if (e.UserClass == null) { e.UserClass = GetItem(e.Position); } if (e.UserClass != null) { if (e.ButtonFollow.Tag.ToString() == "true") { e.ButtonFollow.Text = ActivityContext.GetString(Resource.String.Lbl_AddFriend); e.ButtonFollow.Tag = "false"; e.UserClass.IsFriend = false; e.UserClass.IsFriendRequest = false; var index = UserList.IndexOf(UserList.FirstOrDefault(a => a.Id == e.UserClass.Id)); if (index != -1) { UserList.Remove(e.UserClass); NotifyItemRemoved(index); NotifyItemRangeRemoved(0, ItemCount); } var countList = HomeActivity?.ProfileFragment?.FriendsFragment?.MAdapter?.ItemCount; if (countList == 0) { HomeActivity?.ProfileFragment?.FriendsFragment?.ShowEmptyPage(); } // Send Api Remove PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Friends.AddOrRemoveFriendsAsync(e.UserClass.Id.ToString()) }); } else if (e.ButtonFollow.Tag.ToString() == "false") { e.ButtonFollow.Text = ActivityContext.GetString(Resource.String.Lbl_UnFriend); e.ButtonFollow.Tag = "true"; e.UserClass.IsFriend = true; e.UserClass.IsFriendRequest = true; var index = UserList.IndexOf(UserList.FirstOrDefault(a => a.Id == e.UserClass.Id)); if (index != -1) { NotifyItemChanged(index); } // Send Api Add PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Friends.AddOrRemoveFriendsAsync(e.UserClass.Id.ToString()) }); } } } catch (Exception exception) { Console.WriteLine(exception); } }
public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { try { if (viewHolder is NearByAdapterViewHolder holder) { var users = NearByList[position]; if (users != null) { GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Color); //Online Or offline if (users.LastseenStatus == "on") { //Online GlideImageLoader.LoadImage(ActivityContext, "Green_Online", holder.ImageOnline, ImageStyle.CircleCrop, ImagePlaceholders.Color); holder.LastTimeOnline.Text = ActivityContext.GetString(Resource.String.Lbl_Online); } else { GlideImageLoader.LoadImage(ActivityContext, "Grey_Offline", holder.ImageOnline, ImageStyle.CircleCrop, ImagePlaceholders.Color); holder.LastTimeOnline.Text = Methods.Time.TimeAgo(int.Parse(users.LastseenUnixTime), true); } holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(users), 14); if (users.IsFollowing == "1" || users.IsFollowing == "yes" || users.IsFollowing == "Yes") // My Friend { holder.Button.SetBackgroundResource(Resource.Drawable .follow_button_profile_friends_pressed); holder.Button.SetTextColor(Color.ParseColor("#ffffff")); holder.Button.Text = ActivityContext.GetText(AppSettings.ConnectivitySystem == 1 ? Resource.String.Lbl_Following : Resource.String.Lbl_Friends); holder.Button.Tag = "friends"; } else //Not Friend { holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor)); holder.Button.Text = ActivityContext.GetText(AppSettings.ConnectivitySystem == 1 ? Resource.String.Lbl_Follow : Resource.String.Lbl_AddFriends); holder.Button.Tag = "false"; } if (!holder.Button.HasOnClickListeners) { holder.Button.Click += (sender, args) => { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(ActivityContext, ActivityContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { NotifyItemChanged(viewHolder.AdapterPosition, holder.Button.Tag.ToString() == "false" ? "true" : "false"); if (Methods.CheckConnectivity()) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Follow_User(users.UserId) }); } else { Toast.MakeText(ActivityContext, ActivityContext.GetString(Resource.String .Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } } catch (Exception e) { Console.WriteLine(e); } } } ; } } } catch (Exception exception) { Console.WriteLine(exception); } }
private void FirstRunExcite() { try { //AppCenter.Start("9f8cf987-8bfc-4895-a18b-bd4a86ef9ae3", typeof(Analytics), typeof(Crashes)); AdsGoogle.InitializeAdsGoogle.Initialize(this); if (AppSettings.ShowFbBannerAds || AppSettings.ShowFbInterstitialAds || AppSettings.ShowFbRewardVideoAds) { InitializeFacebook.Initialize(this); } InitRtcEngine(); InitConfig(); switch (AppSettings.TurnSecurityProtocolType3072On) { //Bypass Web Errors //====================================== case true: { ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; var client = new HttpClient(new AndroidClientHandler()); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls13; Console.WriteLine(client); break; } } switch (AppSettings.TurnTrustFailureOnWebException) { case true: { //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true; var b = new AesCryptoServiceProvider(); Console.WriteLine(b); break; } } //OneSignal Notification //====================================== OneSignalNotification.RegisterNotificationDevice(); //Init Settings MainSettings.Init(); ClassMapper.SetMappers(); //App restarted after crash AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironmentOnUnhandledExceptionRaiser; AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException; AppCompatDelegate.CompatVectorFromResourcesEnabled = true; FirebaseApp.InitializeApp(this); AXEmojiManager.Install(this, new AXIOSEmojiProvider(this)); Methods.AppLifecycleObserver appLifecycleObserver = new Methods.AppLifecycleObserver(); ProcessLifecycleOwner.Get().Lifecycle.AddObserver(appLifecycleObserver); if (Methods.CheckConnectivity()) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { ApiRequest.GetTimeZoneAsync }); } var sqLiteDatabase = new SqLiteDatabase(); if (!string.IsNullOrEmpty(UserDetails.AccessToken)) { ListUtils.MuteList = sqLiteDatabase.Get_MuteList(); ListUtils.PinList = sqLiteDatabase.Get_PinList(); ListUtils.ArchiveList = sqLiteDatabase.Get_ArchiveList(); ListUtils.StickersList = sqLiteDatabase.Get_From_StickersTb(); if (AppSettings.LastChatSystem == SystemApiGetLastChat.New) { ListUtils.UserList = sqLiteDatabase.Get_LastUsersChat_List(); } else { ListUtils.UserChatList = sqLiteDatabase.GetLastUsersChatList(); } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); Toast.MakeText(this, exception.Message, ToastLength.Short)?.Show(); } }
public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } if (itemString.ToString() == GetText(Resource.String.Lbl_MakeAdmin)) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Group.MakeGroupAdmin(GroupId, ItemUser.UserId) }); var local = MAdapter?.UserList?.FirstOrDefault(a => a.UserId == ItemUser.UserId); if (local != null) { ItemUser.IsAdmin = "1"; MAdapter?.NotifyItemChanged(MAdapter.UserList.IndexOf(local)); } } else if (itemString.ToString() == GetText(Resource.String.Lbl_RemoveAdmin)) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Group.MakeGroupAdmin(GroupId, ItemUser.UserId) }); var local = MAdapter?.UserList?.FirstOrDefault(a => a.UserId == ItemUser.UserId); if (local != null) { MAdapter.UserList.Remove(local); MAdapter?.NotifyItemRemoved(MAdapter.UserList.IndexOf(local)); } } else if (itemString.ToString() == GetText(Resource.String.Lbl_RemoveMember)) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Group.RemoveGroupMembers(GroupId, ItemUser.UserId) }); var local = MAdapter?.UserList?.FirstOrDefault(a => a.UserId == ItemUser.UserId); if (local != null) { MAdapter.UserList.Remove(local); MAdapter?.NotifyItemRemoved(MAdapter.UserList.IndexOf(local)); } } else if (itemString.ToString() == GetText(Resource.String.Lbl_BlockMember)) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Group.RemoveGroupMembers(GroupId, ItemUser.UserId), () => RequestsAsync.Global.Block_User(GroupId, true) }); var local = MAdapter?.UserList?.FirstOrDefault(a => a.UserId == ItemUser.UserId); if (local != null) { MAdapter.UserList.Remove(local); MAdapter?.NotifyItemRemoved(MAdapter.UserList.IndexOf(local)); } } else if (itemString.ToString() == GetText(Resource.String.Lbl_ViewProfile)) { WoWonderTools.OpenProfile(this, ItemUser.UserId, ItemUser); } if (MAdapter?.UserList?.Count == 0) { ShowEmptyPage(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private static void LoadCommentData(CommentsMoviesObject item, RecyclerView.ViewHolder viewHolder, int position = 0) { try { if (!(viewHolder is MoviesCommentAdapterViewHolder holder)) { return; } if (AppSettings.FlowDirectionRightToLeft) { holder.BubbleLayout.LayoutDirection = LayoutDirection.Rtl; } var changer = new TextSanitizer(holder.CommentText, ActivityContext); changer.Load(Methods.FunString.DecodeString(item.Text)); holder.TimeTextView.Text = Methods.Time.TimeAgo(int.Parse(item.Posted)); holder.UserName.Text = item.UserData.Name; GlideImageLoader.LoadImage(ActivityContext, item.UserData.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); var textHighLighter = item.UserData.Name; var textIsPro = string.Empty; if (item.UserData.Verified == "1") { textHighLighter += " " + IonIconsFonts.CheckmarkCircled; } if (item.UserData.IsPro == "0") { textIsPro = " " + IonIconsFonts.Flash; textHighLighter += textIsPro; } var decorator = TextDecorator.Decorate(holder.UserName, textHighLighter).SetTextStyle((int)TypefaceStyle.Bold, 0, item.UserData.Name.Length); if (item.UserData.Verified == "1") { decorator.SetTextColor(Resource.Color.Post_IsVerified, IonIconsFonts.CheckmarkCircled); } if (item.UserData.IsPro == "1") { decorator.SetTextColor(Resource.Color.text_color_in_between, textIsPro); } decorator.Build(); if (item.Replies?.Count > 0) { holder.ReplyTextView.Text = ActivityContext.GetText(Resource.String.Lbl_Reply) + " " + "(" + item.Replies.Count + ")"; } if (item.IsCommentLiked) { holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Liked); holder.LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor)); holder.LikeTextView.Tag = "Liked"; } else { holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like); holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#000000")); holder.LikeTextView.Tag = "Like"; } holder.TimeTextView.Tag = "true"; if (holder.Image.HasOnClickListeners) { return; } var postEventListener = new MoviesCommentClickListener(ActivityContext, Type); //Create an Event holder.MainView.LongClick += (sender, e) => postEventListener.MoreCommentReplyPostClick(new CommentReplyMoviesClickEventArgs { CommentObject = item, Position = position, View = holder.MainView }); holder.Image.Click += (sender, args) => postEventListener.ProfileClick(new CommentReplyMoviesClickEventArgs { Holder = holder, CommentObject = item, Position = position, View = holder.MainView }); switch (Type) { case "Comment": holder.ReplyTextView.Click += (sender, args) => VideoViewerActivity.GetInstance()?.CommentReplyClick(item); break; case "Reply": holder.ReplyTextView.Click += (sender, args) => VideoViewerActivity.GetInstance()?.ReplyOnReplyClick(item); break; } holder.LikeTextView.Click += delegate { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); return; } if (holder.LikeTextView.Tag.ToString() == "Liked") { item.IsCommentLiked = false; holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like); holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#000000")); holder.LikeTextView.Tag = "Like"; //sent api Dislike comment reply_like switch (Type) { case "Comment": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Movies.LikeUnLikeCommentAsync(item.MovieId, item.Id, false) }); break; case "Reply": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Movies.LikeUnLikeCommentAsync(item.MovieId, item.Id, false, "reply_like") }); break; } } else { item.IsCommentLiked = true; holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Liked); holder.LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor)); holder.LikeTextView.Tag = "Liked"; //sent api like comment switch (Type) { case "Comment": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Movies.LikeUnLikeCommentAsync(item.MovieId, item.Id, true) }); break; case "Reply": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Movies.LikeUnLikeCommentAsync(item.MovieId, item.Id, true, "reply_like") }); break; } } } catch (Exception e) { Console.WriteLine(e); } }; } catch (Exception e) { Console.WriteLine(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (TypeDialog == "DeletePost") { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.PostId == ProductData?.PostId).ToList(); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.PostId == ProductData?.PostId).ToList(); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } if (TabbedMarketActivity.GetInstance()?.MyProductsTab?.MAdapter?.MarketList != null) { TabbedMarketActivity.GetInstance().MyProductsTab.MAdapter.MarketList?.Remove(ProductData); TabbedMarketActivity.GetInstance().MyProductsTab.MAdapter.NotifyDataSetChanged(); } if (TabbedMarketActivity.GetInstance()?.MarketTab?.MAdapter?.MarketList != null) { TabbedMarketActivity.GetInstance().MarketTab.MAdapter.MarketList?.Remove(ProductData); TabbedMarketActivity.GetInstance().MarketTab.MAdapter.NotifyDataSetChanged(); } Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short)?.Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(ProductData.PostId, "delete") }); Finish(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
// send data and send api and show liner add code email private async void SaveButtonOnClick(object sender, EventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); return; } if (TypeDialog == "Confirmation") { switch (TypeTwoFactor) { case "on": { //Show a progress AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "..."); var(apiStatus, respond) = await RequestsAsync.Global.UpdateTwoFactorAsync(); if (apiStatus == 200) { if (!(respond is MessageObject result)) { return; } if (result.Message.Contains("confirmation code sent")) { Toast.MakeText(this, GetText(Resource.String.Lbl_ConfirmationCodeSent), ToastLength.Short).Show(); AndHUD.Shared.Dismiss(this); TypeDialog = "ConfirmationCode"; TxtTwoFactorCode.Visibility = ViewStates.Visible; SaveButton.Text = GetText(Resource.String.Btn_Send); } else { //Show a Error image with a message AndHUD.Shared.ShowError(this, result.Message, MaskType.Clear, TimeSpan.FromSeconds(2)); } } else { Methods.DisplayAndHUDErrorResult(this, respond); } break; } case "off": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { RequestsAsync.Global.UpdateTwoFactorAsync }); var local = ListUtils.MyProfileList.FirstOrDefault(); if (local != null) { local.TwoFactor = "0"; var sqLiteDatabase = new SqLiteDatabase(); sqLiteDatabase.Insert_Or_Update_To_MyProfileTable(local); sqLiteDatabase.Dispose(); } Finish(); break; } } else if (TypeDialog == "ConfirmationCode") { SendButtonOnClick(); } } catch (Exception exception) { AndHUD.Shared.Dismiss(this); Console.WriteLine(exception); } }
public void LoadCommentData(CommentObjectExtra item, RecyclerView.ViewHolder viewHolder, int position = 0, bool hasClickEvents = true) { try { if (!(viewHolder is CommentAdapterViewHolder holder)) { return; } if (AppSettings.FlowDirectionRightToLeft) { holder.BubbleLayout.LayoutDirection = LayoutDirection.Rtl; } if (!string.IsNullOrEmpty(item.Text) || !string.IsNullOrWhiteSpace(item.Text)) { var changer = new TextSanitizer(holder.CommentText, ActivityContext); changer.Load(Methods.FunString.DecodeString(item.Text)); } else { holder.CommentText.Visibility = ViewStates.Gone; } holder.TimeTextView.Text = Methods.Time.TimeAgo(int.Parse(item.Time)); holder.UserName.Text = item.Publisher.Name; GlideImageLoader.LoadImage(ActivityContext, item.Publisher.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); var textHighLighter = item.Publisher.Name; var textIsPro = string.Empty; if (item.Publisher.Verified == "1") { textHighLighter += " " + IonIconsFonts.CheckmarkCircled; } if (item.Publisher.IsPro == "1") { textIsPro = " " + IonIconsFonts.Flash; textHighLighter += textIsPro; } var decorator = TextDecorator.Decorate(holder.UserName, textHighLighter).SetTextStyle((int)TypefaceStyle.Bold, 0, item.Publisher.Name.Length); if (item.Publisher.Verified == "1") { decorator.SetTextColor(Resource.Color.Post_IsVerified, IonIconsFonts.CheckmarkCircled); } if (item.Publisher.IsPro == "1") { decorator.SetTextColor(Resource.Color.text_color_in_between, textIsPro); } decorator.Build(); //Image if (holder.ItemViewType == 1 || holder.CommentImage != null) { if (!string.IsNullOrEmpty(item.CFile) && (item.CFile.Contains("file://") || item.CFile.Contains("content://") || item.CFile.Contains("storage") || item.CFile.Contains("/data/user/0/"))) { File file2 = new File(item.CFile); var photoUri = FileProvider.GetUriForFile(ActivityContext, ActivityContext.PackageName + ".fileprovider", file2); Glide.With(ActivityContext).Load(photoUri).Apply(new RequestOptions()).Into(holder.CommentImage); //GlideImageLoader.LoadImage(ActivityContext,item.CFile, holder.CommentImage, ImageStyle.CenterCrop, ImagePlaceholders.Color); } else { if (!item.CFile.Contains(Client.WebsiteUrl)) { item.CFile = WoWonderTools.GetTheFinalLink(item.CFile); } GlideImageLoader.LoadImage(ActivityContext, item.CFile, holder.CommentImage, ImageStyle.CenterCrop, ImagePlaceholders.Color); } } //Voice if (holder.VoiceLayout != null && !string.IsNullOrEmpty(item.Record)) { LoadAudioItem(holder, position, item); } if (item.Replies != "0" && item.Replies != null) { holder.ReplyTextView.Text = ActivityContext.GetText(Resource.String.Lbl_Reply) + " " + "(" + item.Replies + ")"; } if (item.IsCommentLiked) { holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Liked); holder.LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor)); holder.LikeTextView.Tag = "Liked"; } else { holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like); if (AppSettings.SetTabDarkTheme || ThemeColor == "Dark") { holder.ReplyTextView.SetTextColor(Color.White); holder.LikeTextView.SetTextColor(Color.White); } else { holder.ReplyTextView.SetTextColor(Color.Black); holder.LikeTextView.SetTextColor(Color.Black); } holder.LikeTextView.Tag = "Like"; } holder.TimeTextView.Tag = "true"; if (holder.Image.HasOnClickListeners) { return; } var postEventListener = new CommentClickListener(ActivityContext, "Comment"); //Create an Event holder.MainView.LongClick += (sender, e) => postEventListener.MoreCommentReplyPostClick(new CommentReplyClickEventArgs { CommentObject = item, Position = position, View = holder.MainView }); holder.Image.Click += (sender, args) => postEventListener.ProfilePostClick(new ProfileClickEventArgs { Holder = holder, CommentClass = item, Position = position, View = holder.MainView }); if (hasClickEvents) { holder.ReplyTextView.Click += (sender, args) => postEventListener.CommentReplyPostClick(new CommentReplyClickEventArgs { CommentObject = item, Position = position, View = holder.MainView }); } holder.LikeTextView.Click += delegate { try { if (holder.LikeTextView.Tag.ToString() == "Liked") { item.IsCommentLiked = false; holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Like); if (AppSettings.SetTabDarkTheme || ThemeColor == "Dark") { holder.LikeTextView.SetTextColor(Color.White); } else { holder.LikeTextView.SetTextColor(Color.Black); } holder.LikeTextView.Tag = "Like"; //sent api Dislike comment PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.LikeUnLikeCommentAsync(item.Id, false) }); } else { item.IsCommentLiked = true; holder.LikeTextView.Text = ActivityContext.GetText(Resource.String.Btn_Liked); holder.LikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor)); holder.LikeTextView.Tag = "Liked"; //sent api like comment PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.LikeUnLikeCommentAsync(item.Id, true) }); } } catch (Exception e) { Console.WriteLine(e); } }; if (holder.CommentImage != null) { holder.CommentImage.Click += (sender, args) => postEventListener.OpenImageLightBox(item); } } catch (Exception e) { Console.WriteLine(e); } }
//Event Add Wonder private void BtnWonderOnClick(object sender, EventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(Application.Context, Application.Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } if (PostData.IsWondered != null && PostData.IsWondered.Value) { var x = Convert.ToInt32(PostData.PostWonders); if (x > 0) { x--; } else { x = 0; } ImgWonder.SetColorFilter(Color.White); ImgWoWonder.SetColorFilter(Color.White); PostData.IsWondered = false; PostData.PostWonders = Convert.ToString(x, CultureInfo.InvariantCulture); TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(x); switch (AppSettings.PostButton) { case PostButtonSystem.Wonder: TxtWonder.Text = GetText(Resource.String.Btn_Wonder); break; case PostButtonSystem.DisLike: TxtWonder.Text = GetText(Resource.String.Btn_Dislike); break; } BtnWonder.Tag = "false"; } else { var x = Convert.ToInt32(PostData.PostWonders); x++; PostData.PostWonders = Convert.ToString(x, CultureInfo.InvariantCulture); PostData.IsWondered = true; ImgWonder.SetColorFilter(Color.ParseColor("#f89823")); ImgWoWonder.SetColorFilter(Color.ParseColor("#f89823")); TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(x); switch (AppSettings.PostButton) { case PostButtonSystem.Wonder: TxtWonder.Text = GetText(Resource.String.Lbl_wondered); break; case PostButtonSystem.DisLike: TxtWonder.Text = GetText(Resource.String.Lbl_disliked); break; } BtnWonder.Tag = "true"; } TxtCountWoWonder.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(PostData.PostWonders)); switch (AppSettings.PostButton) { case PostButtonSystem.Wonder: PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.PostId, "wonder") }); break; case PostButtonSystem.DisLike: PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.PostId, "dislike") }); break; } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
//start Create account private async void BtnSignUpOnClick(object sender, EventArgs e) { try { if (!Methods.CheckConnectivity()) { Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_CheckYourInternetConnection), GetText(Resource.String.Lbl_Ok)); return; } if (!ChkTermsOfUse.Checked) { Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_You_can_not_access_your_disapproval), GetText(Resource.String.Lbl_Ok)); return; } if (string.IsNullOrEmpty(TxtUsername.Text.Replace(" ", ""))) { SetHighLight(true, UsernameLayout, TxtUsername, TxtUsernameRequired); return; } else { SetHighLight(false, UsernameLayout, TxtUsername, TxtUsernameRequired); } if (string.IsNullOrEmpty(TxtFirstName.Text.Replace(" ", ""))) { SetHighLight(true, FirstNameLayout, TxtFirstName, TxtFirstNameRequired); return; } else { SetHighLight(false, FirstNameLayout, TxtFirstName, TxtFirstNameRequired); } if (string.IsNullOrEmpty(TxtLastName.Text.Replace(" ", ""))) { SetHighLight(true, LastNameLayout, TxtLastName, TxtLastNameRequired); return; } else { SetHighLight(false, LastNameLayout, TxtLastName, TxtLastNameRequired); } if (string.IsNullOrEmpty(TxtEmail.Text.Replace(" ", ""))) { SetHighLight(true, EmailLayout, TxtEmail, TxtEmailRequired); return; } else { SetHighLight(false, EmailLayout, TxtEmail, TxtEmailRequired); } if (string.IsNullOrEmpty(GenderStatus)) { SetHighLight(true, GenderLayout, TxtGender, TxtGenderRequired); return; } else { SetHighLight(false, GenderLayout, TxtGender, TxtGenderRequired); } if (string.IsNullOrEmpty(TxtPassword.Text)) { SetHighLight(true, PasswordLayout, TxtPassword, TxtPasswordRequired); return; } else { SetHighLight(false, PasswordLayout, TxtPassword, TxtPasswordRequired); } if (string.IsNullOrEmpty(TxtConfirmPassword.Text)) { SetHighLight(true, ConfirmPasswordLayout, TxtConfirmPassword, TxtConfirmPasswordRequired); return; } else { SetHighLight(false, ConfirmPasswordLayout, TxtConfirmPassword, TxtConfirmPasswordRequired); } var smsOrEmail = ListUtils.SettingsSiteList?.SmsOrEmail; if (smsOrEmail == "sms" && string.IsNullOrEmpty(TxtPhoneNum.Text)) { SetHighLight(true, PhoneNumLayout, TxtPhoneNum, TxtPhoneNumRequired); return; } else { SetHighLight(false, PhoneNumLayout, TxtPhoneNum, TxtPhoneNumRequired); } var check = Methods.FunString.IsEmailValid(TxtEmail.Text.Replace(" ", "")); if (!check) { Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_IsEmailValid), GetText(Resource.String.Lbl_Ok)); return; } if (TxtPassword.Text != TxtConfirmPassword.Text) { Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_Your_password_dont_match), GetText(Resource.String.Lbl_Ok)); return; } HideKeyboard(); ToggleVisibility(true); var(apiStatus, respond) = await RequestsAsync.Auth.CreateAccountAsync(TxtUsername.Text.Replace(" ", ""), TxtPassword.Text, TxtConfirmPassword.Text, TxtEmail.Text.Replace(" ", ""), GenderStatus, TxtPhoneNum.Text, UserDetails.DeviceId, UserDetails.DeviceMsgId); if (apiStatus == 200 && respond is CreatAccountObject result) { SetDataLogin(result); var dataPrivacy = new Dictionary <string, string> { { "first_name", TxtFirstName.Text }, { "last_name", TxtLastName.Text }, }; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.UpdateUserDataAsync(dataPrivacy) }); if (AppSettings.ShowWalkTroutPage) { Intent newIntent = new Intent(this, typeof(AppIntroWalkTroutPage)); newIntent?.PutExtra("class", "register"); StartActivity(newIntent); } else { if (ListUtils.SettingsSiteList?.MembershipSystem == "1") { var intent = new Intent(this, typeof(GoProActivity)); intent.PutExtra("class", "register"); StartActivity(intent); } else { if (AppSettings.ShowSuggestedUsersOnRegister) { Intent newIntent = new Intent(this, typeof(SuggestionsUsersActivity)); newIntent?.PutExtra("class", "register"); StartActivity(newIntent); } else { StartActivity(new Intent(this, typeof(TabbedMainActivity))); } } } ToggleVisibility(false); FinishAffinity(); } else if (apiStatus == 220) { if (respond is AuthMessageObject message) { if (smsOrEmail == "sms") { UserDetails.Username = TxtUsername.Text; UserDetails.FullName = TxtFirstName.Text + " " + TxtLastName.Text; UserDetails.Password = TxtPassword.Text; UserDetails.UserId = message.UserId; UserDetails.Status = "Pending"; UserDetails.Email = TxtEmail.Text; //Insert user data to database var user = new DataTables.LoginTb { UserId = UserDetails.UserId, AccessToken = UserDetails.AccessToken, Cookie = UserDetails.Cookie, Username = UserDetails.Username, Password = UserDetails.Password, Status = "Pending", Lang = "", DeviceId = UserDetails.DeviceId, Email = UserDetails.Email, }; ListUtils.DataUserLoginList.Clear(); ListUtils.DataUserLoginList.Add(user); var dbDatabase = new SqLiteDatabase(); dbDatabase.InsertOrUpdateLogin_Credentials(user); Intent newIntent = new Intent(this, typeof(VerificationCodeActivity)); newIntent?.PutExtra("TypeCode", "AccountSms"); StartActivity(newIntent); } else if (smsOrEmail == "mail") { var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialog.Title(GetText(Resource.String.Lbl_ActivationSent)).TitleColorRes(Resource.Color.primary); dialog.Content(GetText(Resource.String.Lbl_ActivationDetails).Replace("@", TxtEmail.Text)); dialog.PositiveText(GetText(Resource.String.Lbl_Ok)).OnPositive(new WoWonderTools.MyMaterialDialog()); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } else { ProgressBar.Visibility = ViewStates.Invisible; Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), message.Message, GetText(Resource.String.Lbl_Ok)); } ToggleVisibility(false); } } else if (apiStatus == 400) { if (respond is ErrorObject error) { ToggleVisibility(false); var errorText = error.Error.ErrorText; var errorId = error.Error.ErrorId; switch (errorId) { case "3": Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorRegister_3), GetText(Resource.String.Lbl_Ok)); break; case "4": Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorRegister_4), GetText(Resource.String.Lbl_Ok)); break; case "5": Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_something_went_wrong), GetText(Resource.String.Lbl_Ok)); break; case "6": Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorRegister_6), GetText(Resource.String.Lbl_Ok)); break; case "7": Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorRegister_7), GetText(Resource.String.Lbl_Ok)); break; case "8": Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorRegister_8), GetText(Resource.String.Lbl_Ok)); break; case "9": Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorRegister_9), GetText(Resource.String.Lbl_Ok)); break; case "10": Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorRegister_10), GetText(Resource.String.Lbl_Ok)); break; case "11": Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), GetText(Resource.String.Lbl_ErrorRegister_11), GetText(Resource.String.Lbl_Ok)); break; default: Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), errorText, GetText(Resource.String.Lbl_Ok)); break; } } } else { ToggleVisibility(false); Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), respond.ToString(), GetText(Resource.String.Lbl_Ok)); } } catch (Exception exception) { ToggleVisibility(false); Methods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), exception.Message, GetText(Resource.String.Lbl_Ok)); Methods.DisplayReportResultTrack(exception); } }
private void ImgButtonOnClick(ReactionsClickEventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(Application.Context, Application.Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } if (UserDetails.SoundControl) { Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("reaction.mp3"); } Reaction data = MReactionPack[e.Position]; UpdateReactButtonByReaction(data); MReactAlertDialog.Dismiss(); PostData.NewsFeedClass.Reaction ??= new WoWonderClient.Classes.Posts.Reaction(); if (data.GetReactText() == ReactConstants.Like) { PostData.NewsFeedClass.Reaction.Type = "1"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Like").Value?.Id ?? "1"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.Love) { PostData.NewsFeedClass.Reaction.Type = "2"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Love").Value?.Id ?? "2"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.HaHa) { PostData.NewsFeedClass.Reaction.Type = "3"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "HaHa").Value?.Id ?? "3"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.Wow) { PostData.NewsFeedClass.Reaction.Type = "4"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Wow").Value?.Id ?? "4"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.Sad) { PostData.NewsFeedClass.Reaction.Type = "5"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Sad").Value?.Id ?? "5"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } else if (data.GetReactText() == ReactConstants.Angry) { PostData.NewsFeedClass.Reaction.Type = "6"; string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Angry").Value?.Id ?? "6"; PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(PostData.NewsFeedClass.PostId, "reaction", react) }); } if (PostData.NewsFeedClass.Reaction.IsReacted != null && !PostData.NewsFeedClass.Reaction.IsReacted.Value) { PostData.NewsFeedClass.Reaction.IsReacted = true; PostData.NewsFeedClass.Reaction.Count++; if (NamePage == "ImagePostViewerActivity" || NamePage == "MultiImagesPostViewerActivity") { var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.LikeText1); if (likeCount != null && (!likeCount.Text.Contains("K") && !likeCount.Text.Contains("M"))) { var x = Convert.ToInt32(likeCount.Text); x++; likeCount.Text = Convert.ToString(x, CultureInfo.InvariantCulture); } } else { var dataGlobal = NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == PostData.NewsFeedClass.PostId).ToList(); if (dataGlobal?.Count > 0) { foreach (var dataClass in from dataClass in dataGlobal let index = NativeFeedAdapter.ListDiffer.IndexOf(dataClass) where index > -1 select dataClass) { dataClass.PostData = PostData.NewsFeedClass; if (AppSettings.PostButton == PostButtonSystem.ReactionDefault || AppSettings.PostButton == PostButtonSystem.ReactionSubShine) { dataClass.PostData.PostLikes = PostData.NewsFeedClass.Reaction.Count + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } else { dataClass.PostData.PostLikes = PostData.NewsFeedClass.PostLikes + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } NativeFeedAdapter.NotifyItemChanged(NativeFeedAdapter.ListDiffer.IndexOf(dataClass), "reaction"); } } var likeCount = PostData.View?.FindViewById <TextView>(Resource.Id.Likecount); if (likeCount != null) { likeCount.Text = PostData.NewsFeedClass.Reaction.Count + " " + Application.Context.Resources?.GetString(Resource.String.Btn_Likes); } } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void GetDataArticles() { try { ArticleData = JsonConvert.DeserializeObject <ArticleDataObject>(Intent.GetStringExtra("ArticleObject")); if (ArticleData != null) { GlideImageLoader.LoadImage(this, ArticleData.Author.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); GlideImageLoader.LoadImage(this, ArticleData.Thumbnail, ImageBlog, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); TxtUsername.Text = ObeeNetworkTools.GetNameFinal(ArticleData.Author); TxtTitle.Text = Methods.FunString.DecodeString(ArticleData.Title); TxtViews.Text = ArticleData.View + " " + GetText(Resource.String.Lbl_Views); string style = AppSettings.SetTabDarkTheme ? "<style type='text/css'>body{color: #fff; background-color: #282828;}</style>" : "<style type='text/css'>body{color: #444; background-color: #FFFAFA;}</style>"; string imageFullWidthStyle = "<style>img{display: inline;height: auto;max-width: 100%;}</style>"; string content; if (Build.VERSION.SdkInt >= BuildVersionCodes.N) { content = Html.FromHtml(ArticleData.Content, FromHtmlOptions.ModeCompact).ToString(); } else { // This method is deprecated but need to use for old os devices #pragma warning disable CS0618 // Type or member is obsolete content = Html.FromHtml(ArticleData.Content).ToString(); #pragma warning restore CS0618 // Type or member is obsolete } //string content = Html.FromHtml(ArticleData.Content, FromHtmlOptions.ModeCompact).ToString(); DataWebHtml = "<!DOCTYPE html>"; DataWebHtml += "<head><title></title>" + style + imageFullWidthStyle + "</head>"; DataWebHtml += "<body>" + content + "</body>"; DataWebHtml += "</html>"; // <meta name='viewport' content='width=device-width, user-scalable=no' /> TxtHtml.SetWebViewClient(new MyWebViewClient(this)); TxtHtml.Settings.LoadsImagesAutomatically = true; TxtHtml.Settings.JavaScriptEnabled = true; TxtHtml.Settings.JavaScriptCanOpenWindowsAutomatically = true; TxtHtml.Settings.SetLayoutAlgorithm(WebSettings.LayoutAlgorithm.NarrowColumns); TxtHtml.Settings.DomStorageEnabled = true; TxtHtml.Settings.AllowFileAccess = true; TxtHtml.Settings.DefaultTextEncodingName = "utf-8"; TxtHtml.Settings.UseWideViewPort = (true); TxtHtml.Settings.LoadWithOverviewMode = (true); TxtHtml.Settings.SetSupportZoom(false); TxtHtml.Settings.BuiltInZoomControls = (false); TxtHtml.Settings.DisplayZoomControls = (false); int fontSize = (int)TypedValue.ApplyDimension(ComplexUnitType.Sp, 18, Resources.DisplayMetrics); TxtHtml.Settings.DefaultFontSize = fontSize; TxtHtml.LoadDataWithBaseURL(null, DataWebHtml, "text/html", "UTF-8", null); bool success = int.TryParse(ArticleData.Posted, out var number); string Timedate = ""; if (success) { TxtTime.Text = Timedate; //TxtTime.Text = Methods.Time.TimeAgo(Convert.ToInt32(number)); } else { TxtTime.Text = Timedate; //TxtTime.Text = ArticleData.Posted; } if (Methods.CheckConnectivity()) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Article.GetBlogById(ArticlesId) }); } } } catch (Exception e) { Console.WriteLine(e); } }
public void DislikeCommentReplyPostClick(CommentReplyClickEventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } e.CommentObject.IsCommentWondered = e.Holder.DislikeTextView?.Tag?.ToString() != "Disliked"; PollyController.RunRetryPolicyFunction(TypeClass == "Reply" ? new List <Func <Task> > { () => RequestsAsync.Comment.DislikeUnDislikeCommentAsync(e.CommentObject.Id, "reply_dislike") } : new List <Func <Task> > { () => RequestsAsync.Comment.DislikeUnDislikeCommentAsync(e.CommentObject.Id, "comment_dislike") }); switch (AppSettings.PostButton) { case PostButtonSystem.Wonder when e.CommentObject.IsCommentWondered: { e.Holder.DislikeTextView.Text = MainContext.GetString(Resource.String.Lbl_wondered); e.Holder.DislikeTextView.SetTextColor(Color.ParseColor(AppSettings.MainColor)); e.Holder.DislikeTextView.Tag = "Disliked"; break; } case PostButtonSystem.Wonder: { e.Holder.DislikeTextView.Text = MainContext.GetString(Resource.String.Btn_Wonder); e.Holder.DislikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black); e.Holder.DislikeTextView.Tag = "Dislike"; break; } case PostButtonSystem.DisLike when e.CommentObject.IsCommentWondered: { e.Holder.DislikeTextView.Text = MainContext.GetString(Resource.String.Lbl_disliked); e.Holder.DislikeTextView.SetTextColor(Color.ParseColor("#f89823")); e.Holder.DislikeTextView.Tag = "Disliked"; break; } case PostButtonSystem.DisLike: { e.Holder.DislikeTextView.Text = MainContext.GetString(Resource.String.Btn_Dislike); e.Holder.DislikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black); e.Holder.DislikeTextView.Tag = "Dislike"; break; } } switch (e.Holder.LikeTextView?.Tag?.ToString()) { case "Liked": e.CommentObject.IsCommentLiked = false; e.Holder.LikeTextView.Text = MainContext.GetText(Resource.String.Btn_Like); //e.Holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black); e.Holder.LikeTextView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.ParseColor("#888888")); e.Holder.LikeTextView.Tag = "Like"; break; } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
//Result protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { try { base.OnActivityResult(requestCode, resultCode, data); if (requestCode == 2500 && resultCode == Result.Ok) //add post { if (!string.IsNullOrEmpty(data.GetStringExtra("itemObject"))) { var postData = JsonConvert.DeserializeObject <PostDataObject>(data.GetStringExtra("itemObject")); if (postData != null) { var countList = PostFeedAdapter.ItemCount; var combine = new FeedCombiner(postData, PostFeedAdapter.ListDiffer, this); combine.CombineDefaultPostSections("Top"); int countIndex = 1; var model1 = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.Story); var model2 = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AddPostBox); var model3 = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AlertBox); var model4 = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.SearchForPosts); if (model4 != null) { countIndex += PostFeedAdapter.ListDiffer.IndexOf(model4) + 1; } else if (model3 != null) { countIndex += PostFeedAdapter.ListDiffer.IndexOf(model3) + 1; } else if (model2 != null) { countIndex += PostFeedAdapter.ListDiffer.IndexOf(model2) + 1; } else if (model1 != null) { countIndex += PostFeedAdapter.ListDiffer.IndexOf(model1) + 1; } else { countIndex = 0; } PostFeedAdapter.NotifyItemRangeInserted(countIndex, PostFeedAdapter.ListDiffer.Count - countList); } } else { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => MainRecyclerView.FetchNewsFeedApiPosts() }); } } else if (requestCode == 3950 && resultCode == Result.Ok) //Edit post { var postId = data.GetStringExtra("PostId") ?? ""; var postText = data.GetStringExtra("PostText") ?? ""; var diff = PostFeedAdapter.ListDiffer; List <AdapterModelsClass> dataGlobal = diff.Where(a => a.PostData?.Id == postId).ToList(); if (dataGlobal.Count > 0) { foreach (var postData in dataGlobal) { postData.PostData.Orginaltext = postText; var index = diff.IndexOf(postData); if (index > -1) { PostFeedAdapter.NotifyItemChanged(index); } } var checkTextSection = dataGlobal.FirstOrDefault(w => w.TypeView == PostModelType.TextSectionPostPart); if (checkTextSection == null) { var collection = dataGlobal.FirstOrDefault()?.PostData; var item = new AdapterModelsClass { TypeView = PostModelType.TextSectionPostPart, Id = int.Parse((int)PostModelType.TextSectionPostPart + collection?.Id), PostData = collection, IsDefaultFeedPost = true }; var headerPostIndex = diff.IndexOf(dataGlobal.FirstOrDefault(w => w.TypeView == PostModelType.HeaderPost)); if (headerPostIndex > -1) { diff.Insert(headerPostIndex + 1, item); PostFeedAdapter.NotifyItemInserted(headerPostIndex + 1); } } } } else if (requestCode == 3500 && resultCode == Result.Ok) //Edit post product { if (string.IsNullOrEmpty(data.GetStringExtra("itemData"))) { return; } var item = JsonConvert.DeserializeObject <ProductDataObject>(data.GetStringExtra("itemData")); if (item != null) { var diff = PostFeedAdapter.ListDiffer; var dataGlobal = diff.Where(a => a.PostData?.Id == item.PostId).ToList(); if (dataGlobal.Count > 0) { foreach (var postData in dataGlobal) { var index = diff.IndexOf(postData); if (index > -1) { var productUnion = postData.PostData.Product?.ProductClass; if (productUnion != null) { productUnion.Id = item.Id; } productUnion = item; Console.WriteLine(productUnion); PostFeedAdapter.NotifyItemChanged(PostFeedAdapter.ListDiffer.IndexOf(postData)); } } } } } } catch (Exception e) { Console.WriteLine(e); } }
public void OnInput(MaterialDialog p0, ICharSequence p1) { try { if (p1.Length() > 0) { var strName = p1.ToString(); if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, MainContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } else { switch (TypeClass) { case "Comment": { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.CommentList.IndexOf(dataGlobal); switch (index) { case > -1: adapterGlobal.NotifyItemChanged(index); break; } } var dataPost = WRecyclerView.GetInstance()?.NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject.PostId).ToList(); switch (dataPost?.Count) { case > 0: { foreach (var post in dataPost) { if (post.TypeView != PostModelType.CommentSection) { continue; } var dataComment = post.PostData.GetPostComments?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataComment != null) { dataComment.Text = strName; var index = post.PostData.GetPostComments.IndexOf(dataComment); switch (index) { case > -1: WRecyclerView.GetInstance()?.NativeFeedAdapter.NotifyItemChanged(index); break; } } } break; } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName) }); break; } case "Reply": { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); switch (index) { case > -1: adapterGlobal.NotifyItemChanged(index); break; } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName, "edit_reply") }); break; } } } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void RejectCallButton_Click(object sender, EventArgs e) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } switch (CallType) { case "Twilio_video_call": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { async() => await RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Video) }); break; case "Twilio_audio_call": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { async() => await RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Audio) }); break; case "Agora_video_call_recieve": case "Agora_audio_call_recieve": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { async() => await ApiRequest.Send_Agora_Call_Action_Async("decline", CallId) }); break; } if (!string.IsNullOrEmpty(CallId)) { var ckd = MsgTabbedMainActivity.GetInstance()?.LastCallsTab?.MAdapter?.MCallUser?.FirstOrDefault(a => a.Id == CallId); // id >> Call_Id if (ckd == null) { Classes.CallUser cv = new Classes.CallUser { Id = CallId, UserId = UserId, Avatar = Avatar, Name = Name, AccessToken = TwilioAccessToken, AccessToken2 = TwilioAccessTokenUser2, FromId = FromId, Active = Active, Time = "Missed call", Status = Status, RoomName = RoomName, Type = CallType, TypeIcon = "Cancel", TypeColor = "#FF0000" }; MsgTabbedMainActivity.GetInstance()?.LastCallsTab?.MAdapter?.Insert(cv); SqLiteDatabase dbDatabase = new SqLiteDatabase(); dbDatabase.Insert_CallUser(cv); } } MsgTabbedMainActivity.RunCall = false; FinishVideoAudio(); } catch (Exception exception) { MsgTabbedMainActivity.RunCall = false; FinishVideoAudio(); Methods.DisplayReportResultTrack(exception); } }