From 9c39112bf73f19065ace821413700971ed1b8bad Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 6 Aug 2018 11:29:29 +0200 Subject: [PATCH] Parse group metadata associated with posts. --- .../android/comunic/client/data/enums/PageType.java | 7 ++++++- .../android/comunic/client/data/helpers/PostsHelper.java | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/enums/PageType.java b/app/src/main/java/org/communiquons/android/comunic/client/data/enums/PageType.java index dde69a0..41b618a 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/enums/PageType.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/enums/PageType.java @@ -12,6 +12,11 @@ public enum PageType { /** * User page */ - USER_PAGE + USER_PAGE, + + /** + * Group page + */ + GROUP_PAGE } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/PostsHelper.java b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/PostsHelper.java index 5cd7149..31bd23b 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/PostsHelper.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/PostsHelper.java @@ -315,6 +315,12 @@ public class PostsHelper { post.setPage_id(json.getInt("user_page_id")); } + else if(json.getInt("group_id") != 0){ + //Set information about the user + post.setPage_type(PageType.GROUP_PAGE); + post.setPage_id(json.getInt("group_id")); + } + post.setContent(json.getString("content")); post.setComments_list(CommentsHelper.parse_json_array(json.getJSONArray("comments")));