Skip to content

Commit

Permalink
Merge branch 'staging' of https://github.com/AgoraIO/Doc-Source-Private
Browse files Browse the repository at this point in the history
… into staging

# Conflicts:
#	shared/chat-sdk/client-api/messages/manage-messages/project-implementation/android.mdx
#	shared/chat-sdk/client-api/messages/manage-messages/understand/android.mdx
#	shared/chat-sdk/restful-api/_push-notification-management.mdx
#	shared/chat-sdk/restful-api/_reaction.mdx
#	shared/chat-sdk/restful-api/_user-attributes-management.mdx
#	shared/chat-sdk/restful-api/chat-group-management/_create-delete-retrieve-groups.mdx
  • Loading branch information
atovpeko committed Dec 1, 2023
2 parents 6f6a314 + 02eaab8 commit 6673dbe
Show file tree
Hide file tree
Showing 36 changed files with 610 additions and 533 deletions.
2 changes: 1 addition & 1 deletion agora-chat/restful-api/push-notification-management.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Push notification management'
title: 'Notification management'
sidebar_position: 9
type: docs
description: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ Map<String, Conversation> conversations = ChatClient.getInstance().chatManager()

### Retrieve messages in the specified conversation

Refer to the following code sample to retrieve the messages in the specified conversation:
Call `getAllMessages` to retrieve all the messages of this conversation in the message. Alternatively, you can call `loadMoreMsgFromDB` to load messages from the local database. The loaded message will be placed in the memory based on the timestamp of the messages.

```java
Conversation conversation = ChatClient.getInstance().chatManager().getConversation(conversationId);
// Gets all the messages in the current conversation.

List<ChatMessage> messages = conversation.getAllMessages();
// Only one message is loaded during SDK initialization. Call loadMoreMsgFromDB to retrieve more messages.
// startMsgId: Starting message ID for query. The SDK loads messages, starting from the specified one, in the descending order of the timestamp included in the messages.
// pageSize: Number of message to load on each page. The value range is [1,400].
List<ChatMessage> messages = conversation.loadMoreMsgFromDB(startMsgId, pagesize);
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
SQLCipher is used to encrypt the database that stores local messages. The Chat SDK uses `ChatManager` to manage local messages. Followings are the core methods:

- `getAllConversations`: Loads the conversation list on the local device.
- `getAllMessages`/`loadMoreMsgFromDB`: Loads messages of a conversation.
- `deleteConversation`: Deletes the specified conversation locally.
- `deleteConversationFromServer`: Delete a conversation from the server.
- `Conversation.getUnreadMsgCount`: Retrieves the count of unread messages in the specified conversation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
SQLCipher is used to encrypt the database that stores local messages. The Chat SDK uses `ChatManager` to manage local messages. Followings are the core methods:

- `getAllConversations`: Loads the conversation list on the local device.
- `loadMessagesStartFromId`: Loads messages of a conversation.
- `deleteConversation`: Deletes a local conversation.
- `deleteConversations`: Deletes multiple local conversations.
- `AgoraChatConversation.unreadMessagesCount`: Retrieves the count of unread messages in the specified conversation.
Expand Down
90 changes: 16 additions & 74 deletions shared/chat-sdk/develop/offline-push/project-implementation/web.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,91 +2,33 @@

## Implementation

To optimize user experience when dealing with an influx of push notifications, Chat provides fine-grained options for the push notification and do-not-disturb (DND) modes at both the app and conversation levels, as shown in the following table:
To optimize user experience when dealing with an influx of push notifications, Agora Chat provides fine-grained options for the push notification and do-not-disturb (DND) modes at both the app and conversation levels.

<table class="cellspacing=0 border=1">
<tbody>
<tr>
<th>
<nobr>Mode</nobr>
</th>
<th>
<nobr>Option</nobr>
</th>
<th>
<nobr>App</nobr>
</th>
<th>
<nobr>Conversation</nobr>
</th>
</tr>
<tr>
<td rowspan="3">
<nobr>Push notification mode</nobr>
</td>
<td>
<nobr><code>ALL</code>: Receives push notifications for all offline messages.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
</tr>
**Push notification mode**

<table width="781" height="300" border="1">
<tbody>
<tr>
<td>
<nobr><code>AT</code>: Only receives push notifications for mentioned messages.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td width="192"><strong>Push Notification Mode</strong></td>
<td width="379"><strong>Description </strong></td>
<td width="188"><strong>Application Scope</strong></td>
</tr>
<tr>
<td>
<nobr><code>NONE</code>: Do not receive push notifications for offline messages.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>ALL</td>
<td>Receives push notifications for all offline messages.</td>
<td rowspan="3">Application and one-to-one and group chat conversations</td>
</tr>
<tr>
<td rowspan="2">
<nobr>Do-not-disturb mode</nobr>
</td>
<td>
<nobr><code>duration</code>: Do not receive push notifications for the specified duration.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>AT</td>
<td>Only receives push notifications for mentioned messages.</td>
</tr>
<tr>
<td>
<nobr><code>startTime</code> & <code>endTime</code>: Do not receive push notifications in the specified time frame.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✗</nobr>
</td>
<td>NONE</td>
<td>Do not receive push notifications for offline messages.</td>
</tr>
</tbody>
</tbody>
</table>


**Push notification mode**

The setting of the push notification mode at the conversation level takes precedence over that at the app level, and those conversations that do not have specific settings for the push notification mode inherit the app setting by default.

For example, assume that the push notification mode of the app is set to `AT`, while that of the specified conversation is set to `ALL`. You receive all the push notifications from this conversation, while you only receive the push notifications for mentioned messages from all the other conversations.
Expand Down
138 changes: 55 additions & 83 deletions shared/chat-sdk/develop/offline-push/project-setup/android.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,98 +2,70 @@

## Set up push notifications

To optimize user experience when dealing with an influx of push notifications, Chat provides fine-grained options for the push notification and do-not-disturb (DND) modes at both the app and conversation levels, as shown in the following table:
To optimize user experience when dealing with an influx of push notifications, Agora Chat provides fine-grained options for the push notification and do-not-disturb (DND) modes at both the app and conversation levels.

<table class="cellspacing=0 border=1">
<tbody>
<tr>
<th>
<nobr>Mode</nobr>
</th>
<th>
<nobr>Option</nobr>
</th>
<th>
<nobr>App</nobr>
</th>
<th>
<nobr>Conversation</nobr>
</th>
</tr>
<tr>
<td rowspan="3">
<nobr>Push notification mode</nobr>
</td>
<td>
<nobr><code>ALL</code>: Receives push notifications for all offline messages.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
</tr>
<tr>
<td>
<nobr><code>MENTION_ONLY</code>: Only receives push notifications for mentioned messages.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
**Push notification mode**

<table width="781" height="300" border="1">
<tbody>
<tr>
<td width="192"><strong>Push Notification Mode</strong></td>
<td width="379"><strong>Description </strong></td>
<td width="188"><strong>Application Scope</strong></td>
</tr>
<tr>
<td>
<nobr><code>NONE</code>: Do not receive push notifications for offline messages.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>All</td>
<td>Receives push notifications for all offline messages.</td>
<td rowspan="3">Application and one-to-one and group chat conversations</td>
</tr>
<tr>
<td rowspan="2">
<nobr>Do-not-disturb mode</nobr>
</td>
<td>
<nobr><code>SILENT_MODE_DURATION</code>: Do not receive push notifications for the specified duration.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>MENTION_ONLY</td>
<td>Only receives push notifications for mentioned messages.</td>
</tr>
<tr>
<td>
<nobr><code>SILENT_MODE_INTERVAL</code>: Do not receive push notifications in the specified time frame.</nobr>
</td>
<td>
<nobr>✓</nobr>
</td>
<td>
<nobr>✗</nobr>
</td>
<td>NONE</td>
<td>Do not receive push notifications for offline messages.</td>
</tr>
</tbody>
</tbody>
</table>


**Push notification mode**

The setting of the push notification mode at the conversation level takes precedence over that at the app level, and those conversations that do not have specific settings for the push notification mode inherit the app setting by default.

For example, assume that the push notification mode of the app is set to `MENTION_ONLY`, while that of the specified conversation is set to `ALL`. You receive all the push notifications from this conversation, while you only receive the push notifications for mentioned messages from all the other conversations.

**Do-not-disturb mode**

<div class="alert note"><ol><li>You can specify both the DND duration and DND time frame at the app level. During the specified DND time periods, you do not receive any push notifications.</li><li>Conversations only support the DND duration setting; the setting of the DND time frame does not take effect.</li></ol></div>
You can specify both the DND duration and DND interval at the app level. During the specified DND time periods, you do not receive any push notifications.

<table width="726" border="1">
<tbody>
<tr>
<td width="196" height="32"><strong>Do-not-disturb Parameter</strong></td>
<td width="83"><strong>Type</strong></td>
<td width="272"><strong> Description</strong></td>
<td width="147"><strong> Application Scope</strong></td>
</tr>
<tr>
<td height="65">SILENT_MODE_INTERVAL</td>
<td>Number</td>
<td><p>The interval during which the DND mode is scheduled everyday. The time is represented in the 24-hour notation in the form of H:M, for example, 8:30-10:00, where H ranges from `0` to `23` in hour and M from `0` to `59` in minute. </p><li>The DND mode is enabled everyday in the specified interval. For example, if you set the start time to 8:0 and end time to 10:0, the app stays in DND mode during 8:00-10:00; if you set the same period at 9:00, the DND mode works during 9:00-10:00 on the current day and 8:00-10:00 in subsequent days.</li>
<li>If the start time is set to the same time spot as the end time, the app enters the permanent DND mode. However, the value 0:0-0:0 means to disable the DND mode.</li>
<li>If the start time is later than the end time, the app remains in DND mode from the start time on the current day until the end time next day. For example, if you set the interval as 10:0-8:0, the DND mode lasts from 10:0 until 08:00 the next day. </li>
<li> Currently, only one DND interval is allowed, with the new setting overwriting the old.</li>
<li>If this parameter is not specified, pass in an empty string.</li>
<li>If both `SILENT_MODE_INTERVAL` and `SILENT_MODE_DURATION` are set, the DND mode works in both periods. For example, at 8:00, you set `SILENT_MODE_INTERVAL` to 8:0-10:0 and `SILENT_MODE_DURATION` to 240 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.</li></td>
<td>App</td>
</tr>
<tr>
<td height="108">SILENT_MODE_DURATION</td>
<td>Number</td>
<td>The DND duration in minutes. The value range is [0,10080], where `0` indicates that this parameter is invalid and `10080` indicates that the DND mode lasts for 7 days.
<li>Unlike `SILENT_MODE_INTERVAL` set as a daily period, this parameter specifies that the DND mode works only for the given duration starting from the current time. For example, if this parameter is set to 240 (4 hours) for the app at 8:00, the DND mode lasts only during 8:00-12:00 on the current day.</li>
<li> If both `SILENT_MODE_INTERVAL` and `SILENT_MODE_DURATION` are set, the DND mode works in both periods. For example, at 8:00, you set `SILENT_MODE_INTERVAL` to 8:0-10:0 and `SILENT_MODE_DURATION` to 240 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.</li> </td>
<td>App and one-to-one and group chat conversations in it </td>
</tr>
</tbody>
</table>

For both the app and all the conversations in the app, the setting of the DND mode takes precedence over the setting of the push notification mode.

Expand All @@ -113,7 +85,7 @@ SilentModeParam param = new SilentModeParam(SilentModeParam.SilentModeParamType.
// Sets the DND duration to 15 minutes.
SilentModeParam param = new SilentModeParam(SilentModeParam.SilentModeParamType.SILENT_MODE_DURATION)
.setSilentModeDuration(15);
// Sets the DND time frame from 8:30 to 15:00.
// Sets the DND interval from 8:30 to 15:00.
SilentModeParam param = new SilentModeParam(SilentModeParam.SilentModeParamType.SILENT_MODE_INTERVAL)
.setSilentModeInterval(new SilentModeTime(8, 30), new SilentModeTime(15, 0));
// Sets the push notifications at the app level.
Expand All @@ -133,14 +105,14 @@ ChatClient.getInstance().pushManager().getSilentModeForAll(new ValueCallBack<Sil
PushManager.PushRemindType remindType = result.getRemindType();
// Retrieves the Unix timestamp when the DND duration of an app expires.
long timestamp = result.getExpireTimestamp();
// Retrieves the start time specified in the DND time frame at the app level.
// Retrieves the start time specified in the DND interval at the app level.
SilentModeTime startTime = result.getSilentModeStartTime();
startTime.getHour(); // The start hour of the DND time frame.
startTime.getMinute(); // The start minute of the DND time frame.
// Retrieves the end time specified in the DND time frame at the app level.
startTime.getHour(); // The start hour of the DND interval.
startTime.getMinute(); // The start minute of the DND interval.
// Retrieves the end time specified in the DND interval at the app level.
SilentModeTime endTime = result.getSilentModeEndTime();
endTime.getHour(); // The end hour of the DND time frame.
endTime.getMinute(); // The end minute of the DND time frame.
endTime.getHour(); // The end hour of the DND interval.
endTime.getMinute(); // The end minute of the DND interval.
}
@Override
public void onError(int error, String errorMsg) {}
Expand Down
Loading

0 comments on commit 6673dbe

Please sign in to comment.