protected override async void OnIncomingPayload(NotificationPayload payload) { string challengeId; string winnerId; if (payload.Payload.TryGetValue("challengeId", out challengeId)) { if (challengeId == ViewModel?.Challenge?.Id) { await ViewModel.RefreshChallenge(); if (ViewModel.Challenge == null) { OnDecline?.Invoke(); await Navigation.PopAsync(); return; } if (payload.Payload.TryGetValue("winningAthleteId", out winnerId)) { OnPostResults?.Invoke(); } } } }
async protected virtual void OnIncomingPayload(NotificationPayload payload) { //string challengeId; //if(payload.Payload.TryGetValue("challengeId", out challengeId)) //{ // try // { // var vm = new BaseViewModel(); // var task = AzureService.Instance.GetChallengeById(challengeId); // await vm.RunSafe(task); // if(task.IsCompleted && !task.IsFaulted && task.Result != null) // { // var details = new ChallengeDetailsPage(task.Result); // details.AddDoneButton(); // await App.Instance.MainPage.Navigation.PushModalAsync(details.WithinNavigationPage()); // } // } // catch(Exception e) // { // //InsightsManager.Report(e); // Console.WriteLine(e); // } //} }
protected override async void OnIncomingPayload(NotificationPayload payload) { Debug.WriteLine("Incoming Payload Received!"); base.OnIncomingPayload(payload); string leagueId; string winnerId; string challengeId; if (payload.Payload.TryGetValue("leagueId", out leagueId)) { if (leagueId == ViewModel.League.Id) { await ViewModel.RefreshLeague(true); Device.BeginInvokeOnMainThread(() => { UpdateChallenageCarousel(); rankStrip.Membership = ViewModel.CurrentMembership; }); //var challenge = ViewModel.CurrentMembership?.OngoingChallenge; //payload.Payload.TryGetValue("challengeId", out challengeId); //if(challenge != null && challengeId == challenge.Id && payload.Payload.TryGetValue("winningAthleteId", out winnerId)) //{ // if(!_didPost) // { // PushChallengeDetailsPage(ViewModel.OngoingChallengeViewModel?.Challenge, true); // } //} } } }
protected override async void OnIncomingPayload(NotificationPayload payload) { base.OnIncomingPayload(payload); var reload = false; string membershipId = null; string winningAthleteId = null; string losingAthleteId = null; if (payload.Payload.TryGetValue("membershipId", out membershipId) && membershipId == ViewModel.Membership.Id) { reload = true; } if (payload.Payload.TryGetValue("winningAthleteId", out winningAthleteId) && payload.Payload.TryGetValue("losingAthleteId", out losingAthleteId)) { reload |= winningAthleteId == ViewModel.Membership.AthleteId || losingAthleteId == ViewModel.Membership.AthleteId; } // reload |= payload.Payload.TryGetValue("challengeId", out challengeId) && ViewModel.Membership.Athlete.AllChallenges.Any(c => c.Id == challengeId); if (reload) { await ViewModel.RefreshMembership(); } }
void HandleIncomingPayload(App sender, NotificationPayload payload) { if (payload != null) { OnIncomingPayload(payload); } }
protected override async void OnIncomingPayload(NotificationPayload payload) { base.OnIncomingPayload(payload); string leagueId; if (payload.Payload.TryGetValue("leagueId", out leagueId)) { if (leagueId == ViewModel.League.Id) { await ViewModel.GetLeaderboard(true); } } }
/// <summary> /// This method is here purely to handle shelved push notifications /// </summary> /// <param name="payload">Payload.</param> public void OnIncomingPayload(NotificationPayload payload) { if (payload == null) { return; } if (App.Instance.CurrentAthlete == null) { PendingNotificationPayload = payload; } else { MessagingCenter.Send(Instance, Messages.IncomingPayloadReceived, payload); } }
protected override void OnIncomingPayload(NotificationPayload payload) { base.OnIncomingPayload(payload); string leagueId = null; if(payload.Payload.TryGetValue("leagueId", out leagueId)) { //await ViewModel.RemoteRefresh(); return; } string challengeId; if(payload.Payload.TryGetValue("challengeId", out challengeId)) { //await ViewModel.RemoteRefresh(); return; } }
/// <summary> /// This method is here purely to handle shelved push notifications /// </summary> /// <param name="payload">Payload.</param> public void OnIncomingPayload(NotificationPayload payload) { if(payload == null) return; if(App.Instance.CurrentAthlete == null) { PendingNotificationPayload = payload; } else { MessagingCenter.Send(Instance, Messages.IncomingPayloadReceived, payload); } }