This repository was archived by the owner on Sep 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 418
feat: read/unread status #1376
Merged
Merged
feat: read/unread status #1376
Changes from 9 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
84ce9ad
feat: read/unread status
chris13524 f1b598f
feat: add read state changes
Elyniss 39183e0
chore: move features
Elyniss 629c142
chore: refactor
Elyniss 05b460e
Apply suggestions from code review
Elyniss 13130ae
Merge pull request #1381 from WalletConnect/fea/web3inbox-read-unred/…
Elyniss f465b0a
chore: rename
Elyniss 619a2e8
Merge pull request #1396 from WalletConnect/fea/web3inbox-read-unred/…
Elyniss f39a87f
chore: add api for read unread (#1383)
devceline be82275
fix: read unread in usage, and backwards-compatible parameters
chris13524 5286a03
Max sizes
chris13524 e96aa08
Merge pull request #1405 from WalletConnect/fix/web3inbox-read-unread…
chris13524 c1a4910
fix: add unreadCount
chris13524 442f9d3
feat: unread count
chris13524 a2a18a0
Merge branch 'main' of https://github.com/WalletConnect/walletconnect…
chris13524 f693a7d
fix: mark all notifications as read, remove mark as unread
chris13524 1187c9a
fix: remove "returned"
chris13524 910905f
feat: mark all as read endpoint
chris13524 1efc3d2
fix: syntax
chris13524 2d8c80f
fix: add rate limit for mark-all-as-read endpoint
chris13524 220a082
Update docs/web3inbox/frontend-integration/api.mdx
devceline 8f53bbc
Update docs/web3inbox/frontend-integration/api.mdx
devceline b097f62
Apply suggestions from code review
devceline 2a432d6
Update docs/web3inbox/frontend-integration/api.mdx
devceline ed951e7
chore: remove Web3Wallet changes
chris13524 23a99d7
fix: fmt
chris13524 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ Links to sections on this page. Some sections are platform specific and are only | |
Change allowed notification types sent by dapp | ||
- [Fetching available notification types](#fetching-available-notification-types): | ||
Get latest notification types | ||
- [Updating messages read state](#updating-messages-read-state): | ||
Marking messages as read or unread across all devices | ||
- [Unsubscribe from a dapp](#unsubscribe-from-a-dapp): | ||
Opt-out from receiving notifications from a dapp | ||
- [Account logout](#account-logout): | ||
|
@@ -45,6 +47,9 @@ section are: | |
|
||
To check the full list of platform specific instructions for your preferred platform, go to [Extra (Platform Specific)](#extra-platform-specific) and select your platform. | ||
|
||
|
||
|
||
|
||
chris13524 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
## Initialization | ||
|
||
<CloudBanner /> | ||
|
@@ -553,6 +558,50 @@ const notificationTypes = notifyClient.getActiveSubscriptions({ account }).filte | |
</PlatformTabItem> | ||
</PlatformTabs> | ||
|
||
|
||
## Updating messages read state | ||
|
||
Updating a messages read state allows the user to know that they already looked at and seen the message. The state of being read is also synced across all devices where the user can see the notification. | ||
|
||
This method could be used in several ways in your UI, for example the user may click a button to mark the notification as read. Or you may automatically mark the notification is read when the notification is within the viewport. How you choose implement this is up to you. | ||
|
||
<PlatformTabs activeOptions={["ios","android", "react-native"]}> | ||
<PlatformTabItem value="ios"> | ||
</PlatformTabItem> | ||
<PlatformTabItem value="android"> | ||
|
||
|
||
```kotlin | ||
val topic: String = // active subscription topic | ||
val notificationIds: List<String> = // List of notification ids to mark as read | ||
val read: Boolean = // Read state to set the notifications to | ||
|
||
val params = Notify.Params.UpdateNotificationsReadState(topic, notificationIds, read) | ||
|
||
NotifyClient.updateNotificationsReadState( | ||
params, | ||
onSuccess = { | ||
// callback for when the change notifications read state request was successful | ||
}, | ||
onError = { error -> | ||
// callback for when the change notifications read state request has failed | ||
} | ||
) | ||
} | ||
``` | ||
|
||
</PlatformTabItem> | ||
<PlatformTabItem value="react-native"> | ||
```typescript | ||
notifyClient.updateNotificationsReadState({ | ||
topic: string, | ||
notificationIds: ["notification-id1", "notification-id2"], | ||
chris13524 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
read: true | ||
}) | ||
``` | ||
</PlatformTabItem> | ||
</PlatformTabs> | ||
|
||
## Unsubscribe from a dapp | ||
|
||
To opt-out of receiving notifications from a dap, a user can decide to unsubscribe from dapp. | ||
|
@@ -765,6 +814,10 @@ val walletDelegate = object : NotifyClient.Delegate { | |
override fun onError(error: Notify.Model.Error) { | ||
// Triggered when there's an error inside the SDK | ||
} | ||
|
||
override fun onNotifyNotificationsChanged(notifyNotificationsChanged: Notify.Event.NotificationsChanged) { | ||
|
||
// Triggered when a state was changed in the notifications | ||
} | ||
} | ||
|
||
NotifyClient.setDelegate(walletDelegate) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.