예제 #1
0
        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();
                    }
                }
            }
        }
예제 #2
0
        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);
            //	}
            //}
        }
예제 #3
0
        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);
                    //	}
                    //}
                }
            }
        }
예제 #4
0
        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();
            }
        }
예제 #5
0
 void HandleIncomingPayload(App sender, NotificationPayload payload)
 {
     if (payload != null)
     {
         OnIncomingPayload(payload);
     }
 }
예제 #6
0
        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);
                }
            }
        }
예제 #7
0
        /// <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);
            }
        }
예제 #8
0
		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;
			}
		}
예제 #9
0
파일: App.xaml.cs 프로젝트: xamarin/Sport
		/// <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);
			}
		}