Exemple #1
0
        public Feed(Activity activity, ulong forSource, string sourceType, bool isIOS)
        {
            _activity    = activity;
            _rawActivity = _activity.RawActivity;
            _ViewerId    = forSource;
            _isIOS       = isIOS;
            if (activity.IsLikeCommentOrReact)
            {
                attachment = GetAttachments(_activity, forSource, sourceType);
                FeedAttachmentActivity innerFeed = attachment[0] as FeedAttachmentActivity;
                CopyValsFrom(innerFeed.shared_post_data[0].feed);
                SetCommonFields();
                privacy_icon = null;
            }
            else //primary or share
            {
                action_id = _rawActivity.action_id;
                //object_type = _rawActivity.object_type;
                //object_id = _rawActivity.object_id;
                attachment = GetAttachments(_activity, forSource, sourceType);
                SetCommonFields();

                privacy = _activity.Privacy.ToString().ToLower();
                var authorization = _activity.GetAuthorization(forSource, sourceType);
                commentable = (uint)(((authorization & (ushort)AuthorizationFlags.Comment) > 0) & _activity.RawActivity.commentable ? 1 : 0); //(uint)(CanReact("comment",forSource,sourceType)?1:0);
                likeable    = (uint)((authorization & (ushort)AuthorizationFlags.Like) > 0 ? 1 : 0);                                          //(uint)(CanReact("like", forSource, sourceType) ? 1 : 0);
                shareable   = (uint)(((authorization & (ushort)AuthorizationFlags.Share) > 0) && _activity.RawActivity.shareable ? 1 : 0);    //(uint)(CanShare() ? 1 : 0);


                comment_count = _rawActivity.comment_count;
                like_count    = GetLikeCount();
            }
        }
Exemple #2
0
        public FeedWrapper(Activity activity, ulong forSource, string sourceType, bool isIOS)
        {
            var source = SourcesMap.Instance.GetSource(forSource, sourceType);

            this.isIOS = isIOS;

            feed = new Feed(activity, forSource, sourceType, isIOS);

            var tagList = feed.TagList;

            if (activity.IsLikeCommentOrReact)
            {
                //copy from inner feed
                FeedAttachmentActivity innerFeed = feed.attachment[0] as FeedAttachmentActivity;
                var innerWrapper = innerFeed.shared_post_data[0];
                canComment             = can_comment = innerWrapper.canComment;
                can_share              = innerWrapper.can_share;
                is_like                = innerWrapper.is_like;
                isNotificationTurnedOn = innerWrapper.isNotificationTurnedOn;
                isSaveFeedOption       = innerWrapper.isSaveFeedOption;
                feed_menus             = innerWrapper.feed_menus;
                feed_footer_menus      = innerWrapper.feed_footer_menus;
                // feed_link = innerWrapper.feed_link;
                //feed_link = $"https://beta.koobeca2.com/profile/{activity.EffectiveSubjectId}/action_id/{activity.ActivityId}/show_comments/1";
                feed_link        = $"https://beta.koobeca.com/view.php?action_id={activity.ActivityId}";
                feed_reactions   = innerWrapper.feed_reactions;
                my_feed_reaction = innerWrapper.my_feed_reaction;
            }
            else //primary or share
            {
                canComment             = can_comment = feed.commentable;
                can_share              = feed.shareable;
                is_like                = (uint)(activity.Reaction(forSource) != null ? 1 : 0);
                isNotificationTurnedOn = activity.NotifiedUsers.IsNotified(forSource);
                isSaveFeedOption       = (uint)(source.SavedItems.IsSaved(activity.ActivityId)?0:1);
                feed_menus             = new Menus(activity, source, sourceType).Items;
                feed_footer_menus      = new FooterMenus(activity, feed);
                //feed_link = $"https://beta.koobeca.com/profile/{activity.EffectiveSubjectId}/action_id/{activity.ActivityId}/show_comments/1";
                feed_link = $"https://beta.koobeca.com/view.php?action_id={activity.ActivityId}";
                hashtags  = tagList.Count > 0 ? tagList : null;

                feed_reactions   = GetFeedReactions(activity);
                my_feed_reaction = GetMyReaction(activity, forSource);
            }

            if (isIOS)
            {
                ReviseFeed();
            }
            // feed.SetActionId();
        }