mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-27 07:49:28 +00:00
Support group membership notifications.
This commit is contained in:
parent
0e74358dcf
commit
fb4b46074a
@ -86,6 +86,10 @@ public class NotifsList extends ArrayList<Notif> {
|
|||||||
&& !IDs.contains(notif.getFrom_container_id()))
|
&& !IDs.contains(notif.getFrom_container_id()))
|
||||||
IDs.add(notif.getFrom_container_id());
|
IDs.add(notif.getFrom_container_id());
|
||||||
|
|
||||||
|
if(notif.getOn_elem_type() == NotifElemType.GROUPS_MEMBERSHIP
|
||||||
|
&& !IDs.contains(notif.getOn_elem_id()))
|
||||||
|
IDs.add(notif.getOn_elem_id());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return IDs;
|
return IDs;
|
||||||
|
@ -44,6 +44,11 @@ public enum NotifElemType {
|
|||||||
*/
|
*/
|
||||||
FRIEND_REQUEST,
|
FRIEND_REQUEST,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifications related to group memberships
|
||||||
|
*/
|
||||||
|
GROUPS_MEMBERSHIP,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unknown type
|
* Unknown type
|
||||||
*/
|
*/
|
||||||
|
@ -39,6 +39,20 @@ public enum NotificationTypes {
|
|||||||
*/
|
*/
|
||||||
ELEM_UPDATED,
|
ELEM_UPDATED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Group membership invitations
|
||||||
|
*/
|
||||||
|
SENT_GROUP_MEMBERSHIP_INVITATION,
|
||||||
|
ACCEPTED_GROUP_MEMBERSHIP_INVITATION,
|
||||||
|
REJECTED_GROUP_MEMBERSHIP_INVITATION,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Group membership requests
|
||||||
|
*/
|
||||||
|
SENT_GROUP_MEMBERSHIP_REQUEST,
|
||||||
|
ACCEPTED_GROUP_MEMBERSHIP_REQUEST,
|
||||||
|
REJECTED_GROUP_MEMBERSHIP_REQUEST,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unknown notification type
|
* Unknown notification type
|
||||||
*/
|
*/
|
||||||
|
@ -213,6 +213,9 @@ public class NotificationsHelper {
|
|||||||
case "friend_request":
|
case "friend_request":
|
||||||
return NotifElemType.FRIEND_REQUEST;
|
return NotifElemType.FRIEND_REQUEST;
|
||||||
|
|
||||||
|
case "group_membership":
|
||||||
|
return NotifElemType.GROUPS_MEMBERSHIP;
|
||||||
|
|
||||||
//Default : unknown type of elem
|
//Default : unknown type of elem
|
||||||
default:
|
default:
|
||||||
return NotifElemType.UNKNOWN;
|
return NotifElemType.UNKNOWN;
|
||||||
@ -248,6 +251,24 @@ public class NotificationsHelper {
|
|||||||
case "elem_updated":
|
case "elem_updated":
|
||||||
return NotificationTypes.ELEM_UPDATED;
|
return NotificationTypes.ELEM_UPDATED;
|
||||||
|
|
||||||
|
case "sent_group_membership_invitation":
|
||||||
|
return NotificationTypes.SENT_GROUP_MEMBERSHIP_INVITATION;
|
||||||
|
|
||||||
|
case "accepted_group_membership_invitation":
|
||||||
|
return NotificationTypes.ACCEPTED_GROUP_MEMBERSHIP_INVITATION;
|
||||||
|
|
||||||
|
case "rejected_group_membership_invitation":
|
||||||
|
return NotificationTypes.REJECTED_GROUP_MEMBERSHIP_INVITATION;
|
||||||
|
|
||||||
|
case "sent_group_membership_request":
|
||||||
|
return NotificationTypes.SENT_GROUP_MEMBERSHIP_REQUEST;
|
||||||
|
|
||||||
|
case "accepted_group_membership_request":
|
||||||
|
return NotificationTypes.ACCEPTED_GROUP_MEMBERSHIP_REQUEST;
|
||||||
|
|
||||||
|
case "rejected_group_membership_request":
|
||||||
|
return NotificationTypes.REJECTED_GROUP_MEMBERSHIP_REQUEST;
|
||||||
|
|
||||||
//Default : Unknown notification type
|
//Default : Unknown notification type
|
||||||
default:
|
default:
|
||||||
return NotificationTypes.UNKNOWN;
|
return NotificationTypes.UNKNOWN;
|
||||||
|
@ -47,6 +47,20 @@ public class NotifsUtils {
|
|||||||
if(notif.getType() == NotificationTypes.REJECTED_FRIEND_REQUEST)
|
if(notif.getType() == NotificationTypes.REJECTED_FRIEND_REQUEST)
|
||||||
message += UiUtils.getString(context, R.string.notif_rejected_friend_request);
|
message += UiUtils.getString(context, R.string.notif_rejected_friend_request);
|
||||||
|
|
||||||
|
//For group membership
|
||||||
|
if(notif.getType() == NotificationTypes.SENT_GROUP_MEMBERSHIP_INVITATION)
|
||||||
|
message += UiUtils.getString(context, R.string.notif_sent_group_membership_invitation);
|
||||||
|
if(notif.getType() == NotificationTypes.ACCEPTED_GROUP_MEMBERSHIP_INVITATION)
|
||||||
|
message += UiUtils.getString(context, R.string.notif_accepted_group_membership_invitation);
|
||||||
|
if(notif.getType() == NotificationTypes.REJECTED_GROUP_MEMBERSHIP_INVITATION)
|
||||||
|
message += UiUtils.getString(context, R.string.notif_rejected_group_membership_invitation);
|
||||||
|
if(notif.getType() == NotificationTypes.SENT_GROUP_MEMBERSHIP_REQUEST)
|
||||||
|
message += UiUtils.getString(context, R.string.notif_sent_group_membership_request);
|
||||||
|
if(notif.getType() == NotificationTypes.ACCEPTED_GROUP_MEMBERSHIP_REQUEST)
|
||||||
|
message += UiUtils.getString(context, R.string.notif_accepted_group_membership_request);
|
||||||
|
if(notif.getType() == NotificationTypes.REJECTED_GROUP_MEMBERSHIP_REQUEST)
|
||||||
|
message += UiUtils.getString(context, R.string.notif_rejected_group_membership_request);
|
||||||
|
|
||||||
//In case of creation of an element
|
//In case of creation of an element
|
||||||
if(notif.getType() == NotificationTypes.ELEM_CREATED){
|
if(notif.getType() == NotificationTypes.ELEM_CREATED){
|
||||||
|
|
||||||
@ -83,6 +97,11 @@ public class NotifsUtils {
|
|||||||
groupsInfo.get(notif.getFrom_container_id()).getName());
|
groupsInfo.get(notif.getFrom_container_id()).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Group membership
|
||||||
|
else if(notif.getOn_elem_type() == NotifElemType.GROUPS_MEMBERSHIP){
|
||||||
|
message += groupsInfo.get(notif.getOn_elem_id()).getName();
|
||||||
|
}
|
||||||
|
|
||||||
//Return the message
|
//Return the message
|
||||||
return message;
|
return message;
|
||||||
|
|
||||||
|
@ -203,4 +203,10 @@
|
|||||||
<string name="notif_on_group_page">on the page of the group %1$s</string>
|
<string name="notif_on_group_page">on the page of the group %1$s</string>
|
||||||
<string name="err_get_groups_info">Could not get information about groups!</string>
|
<string name="err_get_groups_info">Could not get information about groups!</string>
|
||||||
<string name="post_visibility_members">members</string>
|
<string name="post_visibility_members">members</string>
|
||||||
|
<string name="notif_sent_group_membership_invitation">invited you to join the group</string>
|
||||||
|
<string name="notif_accepted_group_membership_invitation">accepted his invitation to join the group</string>
|
||||||
|
<string name="notif_rejected_group_membership_invitation">rejected his invitation to join the group</string>
|
||||||
|
<string name="notif_sent_group_membership_request">sent a request to join the group</string>
|
||||||
|
<string name="notif_accepted_group_membership_request">accepted your request to join the group</string>
|
||||||
|
<string name="notif_rejected_group_membership_request">rejected your request to join the group</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user