private Action OpenActivityDetailsFunc(bool showFeed)
    {
        return(() =>
        {
            GetSocial.GetActivities(ActivitiesQuery.PostsForGlobalFeed().WithLimit(1), (posts) =>
            {
                if (posts.Count == 0)
                {
                    _console.LogW("No activities, post something to global feed!");
                    return;
                }
#pragma warning disable 0618
                GetSocialUi.CreateActivityDetailsView(posts.First().Id)
                .SetWindowTitle("Unity Global")
                .SetViewStateCallbacks(() => _console.LogD("Activity details opened"),
                                       () => _console.LogD("Activity details closed"))
                .SetButtonActionListener(OnActivityActionClicked)
                .SetActionListener(OnAction)
                .SetShowActivityFeedView(showFeed)
                .SetUiActionListener((action, pendingAction) =>
                {
                    Debug.Log("Action invoked: " + action);
                    pendingAction();
                })
                .Show();
#pragma warning restore 0618
            }, (error) => _console.LogE("Failed to get activities, error: " + error.Message));
        });
    }
    void GetFeedComments()
    {
        var query = ActivitiesQuery.CommentsToPost(_activityId).WithLimit(5);

        GetSocial.GetActivities(query, comments =>
        {
            _console.LogD(string.Format("[{0}] Feed comments count: {1}", _feed, comments.Count));
            _console.LogD(comments.ToPrettyString());
        }, OnError);
    }
    void GetFeedActivitiesNoFilter()
    {
        var query = ActivitiesQuery.PostsForFeed(_feed).WithLimit(5);

        GetSocial.GetActivities(query, posts =>
        {
            _console.LogD(string.Format("[{0}] Feed posts count: {1}", _feed, posts.Count));
            _console.LogD(posts.ToPrettyString());
        }, OnError);
    }
    void GetFriendsGlobalActivities()
    {
        var query = ActivitiesQuery.PostsForGlobalFeed().WithLimit(5).FriendsFeed(true);

        GetSocial.GetActivities(query, posts =>
        {
            _console.LogD("Global feed posts count: " + posts.Count);
            _console.LogD(posts.ToPrettyString());
        }, OnError);
    }
    void GetMyGlobalActivities()
    {
        var query = ActivitiesQuery.PostsForGlobalFeed().WithLimit(5).FilterByUser(GetSocial.User.Id);

        GetSocial.GetActivities(query, posts =>
        {
            _console.LogD("Global feed posts count: " + posts.Count);
            _console.LogD(posts.ToPrettyString());
        }, OnError);
    }
 void FetchLastActivity()
 {
     GetSocial.GetActivities(ActivitiesQuery.PostsForGlobalFeed().WithLimit(1), list =>
     {
         if (list.Count > 0)
         {
             _console.LogD(string.Format("Fetched activity: {0}", list[0]));
             _activityId = list[0].Id;
         }
     }, OnError);
 }
    void GetFeedActivitiesFilterBefore()
    {
        var query = ActivitiesQuery.PostsForFeed(_feed)
                    .WithLimit(5)
                    .WithFilter(ActivitiesQuery.Filter.Older, _activityId);

        GetSocial.GetActivities(query, posts =>
        {
            _console.LogD(string.Format("[{0}] Feed posts older count: {1}", _feed, posts.Count));
            _console.LogD(posts.ToPrettyString());
        }, OnError);
    }
Exemplo n.º 8
0
    public void LoadMessages()
    {
        var chatId = GenerateChatId(new[] { GetSocial.User.Id, Receiver.Id });
        var query  = ActivitiesQuery.PostsForFeed(chatId);

        GetSocial.GetActivities(query, list =>
        {
            _messages = list;
            _messages.Reverse();
        }, error =>
        {
            _console.LogE("Failed to get messages, error: " + error);
        });
    }