private async Task OnKudosAsync(ActivityMeta activity) { if (activity != null && SelectedActivity != null) { _athlete = _athlete ?? await _stravaService.GetAthleteAsync(); var canGiveKudos = _athlete.Id != SelectedActivity.Athlete.Id && !SelectedActivity.HasKudoed; if (canGiveKudos) { await _stravaService.GiveKudosAsync(activity.Id.ToString()); await LoadActivityDetails(activity.Id.ToString()); } } ServiceLocator.Current.GetInstance <IMessenger>().Send <PivotMessage <ActivityPivots> >(new PivotMessage <ActivityPivots>(ActivityPivots.Kudos, true, true), Tokens.ActivityPivotMessage); }
public List <ForeignActivity> GetForeignActivities(string userId) { ActivityMeta meta = activityMetaCollection .Find(a => a.UserId == userId) .FirstOrDefault(); if (meta == null) { meta = new ActivityMeta(); meta.HiddenActivityIds = new List <string>(); } var restult = from a in collection.AsQueryable() .Where(a => a.UserId != userId && !(a.ApplicantUserIds.Contains(userId) || a.MemberUserIds.Contains(userId) || meta.HiddenActivityIds.Contains(a.Id)) ) join u in userProfileCollection.AsQueryable() on a.UserId equals u.UserId into user select new ForeignActivity { Id = a.Id, ApplicantUserIds = a.ApplicantUserIds, Description = a.Description, Title = a.Title, ApplicationDeadline = a.ApplicationDeadline, Image = a.Image, Location = a.Location, MaxMember = a.MaxMember, MemberUserIds = a.MemberUserIds, StartDate = a.StartDate, EndDate = a.EndDate, StartTime = a.StartTime, EndTime = a.EndTime, Tags = a.Tags, Visibility = a.Visibility, UserId = a.UserId, Firstname = user.First().Firstname, Lastname = user.First().Lastname, Username = user.First().Username, Avatar = user.First().Avatar }; return(restult.ToList()); }
private async Task OnCommentAsync(ActivityMeta activity) { if (null == activity) { return; } CommentContentDialog dialog = new CommentContentDialog(); dialog.AdjustSize(); ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary && !string.IsNullOrEmpty(dialog.Description)) { await _stravaService.PostComment(activity.Id.ToString(), dialog.Description); await LoadActivityDetails(activity.Id.ToString()); ServiceLocator.Current.GetInstance <IMessenger>().Send <PivotMessage <ActivityPivots> >(new PivotMessage <ActivityPivots>(ActivityPivots.Comments, true, true), Tokens.ActivityPivotMessage); } }
public void HideActivity(string activityId, string userId) { ActivityMeta meta = activityMetaCollection .Find(a => a.UserId == userId) .FirstOrDefault(); if (meta == null) { meta = new ActivityMeta { UserId = userId, HiddenActivityIds = new List <string>() }; meta.HiddenActivityIds.Add(activityId); activityMetaCollection.InsertOne(meta); } else { meta.HiddenActivityIds.Add(activityId); activityMetaCollection.ReplaceOne(a => a.Id == meta.Id, meta); } }
public Task <List <Stream> > GetActivityStreams(ActivityMeta activity, params StreamType[] types) { return(GetActivityStreams(activity.Id, types)); }
public Task<List<Stream>> GetActivityStreams(ActivityMeta activity, params StreamType[] types) { return GetActivityStreams(activity.Id, types); }