cinny icon indicating copy to clipboard operation
cinny copied to clipboard

Rework User Settings

Open ajbura opened this issue 1 year ago • 1 comments

Description

Fixes #

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

Checklist:

  • [ ] My code follows the style guidelines of this project
  • [ ] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] My changes generate no new warnings

ajbura avatar Oct 01 '24 06:10 ajbura

Preview: https://1988--pr-cinny.netlify.app ⚠️ Exercise caution. Use test accounts. ⚠️

github-actions[bot] avatar Oct 01 '24 06:10 github-actions[bot]

Could this be an opportunity to add a setting for full body web notifications?

Adding the functionality would look something like this:

diff --git a/src/app/pages/client/ClientNonUIFeatures.tsx b/src/app/pages/client/ClientNonUIFeatures.tsx
index b257d7a..8678e61 100644
--- a/src/app/pages/client/ClientNonUIFeatures.tsx
+++ b/src/app/pages/client/ClientNonUIFeatures.tsx
@@ -146,19 +146,17 @@ function MessageNotifications() {
       roomName,
       roomAvatar,
       username,
-      message,
     }: {
       roomName: string;
       roomAvatar?: string;
       username: string;
       roomId: string;
       eventId: string;
-      message: string;
     }) => {
-      const noti = new window.Notification(`${username} in ${roomName}`, {
+      const noti = new window.Notification(roomName, {
         icon: roomAvatar,
         badge: roomAvatar,
-        body: message,
+        body: `New inbox notification from ${username}`,
         silent: true,
       });

@@ -180,7 +178,7 @@ function MessageNotifications() {
   }, []);

   useEffect(() => {
-    const handleTimelineEvent: RoomEventHandlerMap[RoomEvent.Timeline] = async (
+    const handleTimelineEvent: RoomEventHandlerMap[RoomEvent.Timeline] = (
       mEvent,
       room,
       toStartOfTimeline,
@@ -217,8 +215,6 @@ function MessageNotifications() {
       if (showNotifications && Notification.permission === 'granted') {
         const avatarMxc =
           room.getAvatarFallbackMember()?.getMxcAvatarUrl() ?? room.getMxcAvatarUrl();
-        if (mEvent.isEncrypted()) await mEvent.getDecryptionPromise();
-        let content = mEvent.getContent();
         notify({
           roomName: room.name ?? 'Unknown',
           roomAvatar: avatarMxc
@@ -227,7 +223,6 @@ function MessageNotifications() {
           username: getMemberDisplayName(room, sender) ?? getMxIdLocalPart(sender) ?? sender,
           roomId: room.roomId,
           eventId,
-          message: content.body,
         });
       }

This would fix https://github.com/cinnyapp/cinny/issues/1883, various people have shown interest in re-enabling the message body in notifications.

LevitatingBusinessMan avatar Jan 29 '25 19:01 LevitatingBusinessMan