From 2f4621c0e5ef5ef70a888055cc92ce42c1faa086 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 1 Aug 2018 08:37:48 +0200 Subject: [PATCH] Ready to implement groups support in notification system. --- .../android/comunic/client/data/enums/NotifElemType.java | 5 +++++ .../comunic/client/data/helpers/NotificationsHelper.java | 3 +++ .../android/comunic/client/data/utils/NotifsUtils.java | 6 ++++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 15 insertions(+) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/enums/NotifElemType.java b/app/src/main/java/org/communiquons/android/comunic/client/data/enums/NotifElemType.java index b986389..70531d4 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/enums/NotifElemType.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/enums/NotifElemType.java @@ -29,6 +29,11 @@ public enum NotifElemType { */ USER_PAGE, + /** + * On a group page + */ + GROUP_PAGE, + /** * On a comment */ 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 051d7e3..b90091a 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 @@ -195,6 +195,9 @@ public class NotificationsHelper { case "user_page": return NotifElemType.USER_PAGE; + case "group_page": + return NotifElemType.GROUP_PAGE; + case "conversation": return NotifElemType.CONVERSATION; diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/utils/NotifsUtils.java b/app/src/main/java/org/communiquons/android/comunic/client/data/utils/NotifsUtils.java index a7b0616..4fbe671 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/utils/NotifsUtils.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/utils/NotifsUtils.java @@ -61,6 +61,7 @@ public class NotifsUtils { //Notification target + //User page if(notif.getFrom_container_type() == NotifElemType.USER_PAGE){ if(notif.getFrom_user_id() == notif.getFrom_container_id()) @@ -71,6 +72,11 @@ public class NotifsUtils { } + //Group page + else if(notif.getFrom_container_type() == NotifElemType.GROUP_PAGE){ + message += UiUtils.getString(context, R.string.notif_on_group_page); + } + //Return the message return message; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 18fa77f..12e361c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -200,4 +200,5 @@ Open navigation drawer Close navigation drawer My Page + on the page of the group %1$s