From b1170d90752539797d45f7956e40dd5593e7a1b0 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 16 Feb 2019 17:08:05 +0100 Subject: [PATCH] Notifications service get pending calls --- .../client/data/helpers/NotificationsHelper.java | 2 ++ .../client/data/models/NotificationsCount.java | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/NotificationsHelper.java b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/NotificationsHelper.java index fece44d..f4a7dd0 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/NotificationsHelper.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/NotificationsHelper.java @@ -53,6 +53,7 @@ public class NotificationsHelper { APIRequest params = new APIRequest(mContext, "notifications/count_all_news"); params.addBoolean("friends_request", true); + params.addBoolean("include_calls", true); //Try to perform the request and parse results try { @@ -65,6 +66,7 @@ public class NotificationsHelper { res.setNotificationsCount(object.getInt("notifications")); res.setConversationsCount(object.getInt("conversations")); res.setFriendsRequestsCount(object.getInt("friends_request")); + res.setPendingCalls(object.getInt("calls")); return res; diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/models/NotificationsCount.java b/app/src/main/java/org/communiquons/android/comunic/client/data/models/NotificationsCount.java index 609ed71..f57dac7 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/models/NotificationsCount.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/models/NotificationsCount.java @@ -13,6 +13,7 @@ public class NotificationsCount { private int notificationsCount; private int conversationsCount; private int friendsRequestsCount; + private int pendingCalls; //Set and get notifications count @@ -42,4 +43,16 @@ public class NotificationsCount { public void setFriendsRequestsCount(int friendsRequestsCount) { this.friendsRequestsCount = friendsRequestsCount; } + + public int getPendingCalls() { + return pendingCalls; + } + + public boolean hasPendingCalls() { + return pendingCalls > 0; + } + + public void setPendingCalls(int pendingCalls) { + this.pendingCalls = pendingCalls; + } }