Exemplo n.º 1
0
        private FeedItem CreatePhotoPhotoTagItem(NewsItem newsFeedItem, List <Group> groups, List <User> profiles)
        {
            FeedItem feedItem     = new FeedItem();
            WallPost fromNewsItem = WallPost.CreateFromNewsItem(newsFeedItem);

            feedItem.DefaultTarget       = "/default";
            feedItem.Author.DisplayName  = fromNewsItem.GetAuthorDisplayName(groups, profiles);
            feedItem.Author.RemoteId     = RemoteIdHelper.GenerateUniqueRemoteId(fromNewsItem.from_id.ToString(), RemoteIdHelper.RemoteIdItemType.UserOrGroup);
            feedItem.Author.Username     = feedItem.Author.DisplayName;
            feedItem.ReactionDisplayKind = (ReactionDisplayKind)0;
            feedItem.Timestamp           = new DateTimeOffset(ExtensionsBase.UnixTimeStampToDateTime((double)fromNewsItem.date, true));
            feedItem.Style    = (FeedItemStyle)1;
            feedItem.RemoteId = RemoteIdHelper.GenerateUniqueRemoteId(fromNewsItem.GloballyUniqueId, RemoteIdHelper.RemoteIdItemType.WallPost);
            string photoTagFeedText = this.GetPhotoPhotoTagFeedText(newsFeedItem, groups, profiles);

            if (string.IsNullOrEmpty(photoTagFeedText))
            {
                return(null);
            }
            feedItem.PrimaryContent.Title = photoTagFeedText;
            string photosMode = "Photos";

            if (newsFeedItem.Photo_tags != null && newsFeedItem.Photo_tags.Count > 0)
            {
                photosMode = "PhotoTags";
            }
            this.ProcessAttachmentsIntoFeedItem(fromNewsItem, feedItem, null, null, photosMode);
            if (((ICollection <FeedMediaThumbnail>)feedItem.Thumbnails).Count > 0)
            {
                feedItem.DefaultTarget = feedItem.Thumbnails[0].Target;
            }
            return(feedItem);
        }
Exemplo n.º 2
0
        private FeedItem CreateFeedItem(NewsItem newsFeedItem, List <Group> groups, List <User> profiles)
        {
            FeedItem feedItem = null;

            switch (newsFeedItem.NewsItemType)
            {
            case NewsItemType.post:
                feedItem = this.CreateFeedItem(WallPost.CreateFromNewsItem(newsFeedItem), groups, profiles, true);
                break;

            case NewsItemType.photo:
            case NewsItemType.photo_tag:
                feedItem = this.CreatePhotoPhotoTagItem(newsFeedItem, groups, profiles);
                break;
            }
            return(feedItem);
        }
Exemplo n.º 3
0
 private static WallPost GetWallPostFromNewsItem(NewsItem newsItem)
 {
     return(WallPost.CreateFromNewsItem(newsItem));
 }