invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.88k stars 228 forks source link

Direct Reply Notifications #936

Closed turkergercik closed 9 months ago

turkergercik commented 11 months ago

Hi, When ı reply to a notification, it closes and opens all the time. ı use same id. here is the screen record

https://github.com/invertase/notifee/assets/88100534/ff38a004-9fa0-470a-907e-1e89830fddea

 let messages =[ ]

messaging().setBackgroundMessageHandler(async remoteMessage => {
let x =JSON.parse(remoteMessage.data.message)
   messages =[...messages,{
      text: x.text,
      timestamp: Date.now(),
      person: {
        name: x.senderName,
          } }]
    const channelId = await notifee.createChannel({
        id: 'privatemessage',
        name: 'privatemessage',
        importance:AndroidImportance.HIGH
      });

      await notifee.displayNotification({
        id:"1",
        title:"hello",
        body:"hell no",
        android: {
          color:AndroidColor.RED,
            onlyAlertOnce:false,
            actions :[ {
                title: 'reply',
                icon: 'https://my-cdn.com/icons/snooze.png',
                pressAction: {
                  id: 'reply',
                },input: {
              allowFreeFormInput: true, // set to false
              editableChoices:true,
              choices: ['Yes','No' ,'Maybe'],
              placeholder: 'Reply to Sarah...',
            },}

            ],
           channelId:"privatemessage",
           style: {
            group:false,
            type: AndroidStyle.MESSAGING,
            person: {
              name:x.senderName ,
              icon: 'https://my-cdn.com/avatars/123.png',
            }, messages: [
                ...messages
              ],

        }
        },
      })

})
notifee.onBackgroundEvent(async ({ type, detail }) => {

    if (type === EventType.ACTION_PRESS && detail.pressAction.id === 'reply') {
        messages=[...messages,{text:detail.input,
        timestamp:Date.now(),
        person: {
          name: "me",
            }
        }, 
        ]

       await notifee.displayNotification({
        id:"1",
         title:detail.input,
         body:detail.input,
        android: {
          color:AndroidColor.RED,
            onlyAlertOnce:true,
            actions :[ {
                title: 'reply',
                pressAction: {
                  id: 'reply',
                },input: {
                  editableChoices:true,
              allowFreeFormInput: true, // set to false
              choices: ['Yes','No' ,'Maybe'],
              placeholder: 'Reply to Sarah...',
            },}

            ],
           channelId:"privatemessage",
           style: {
            group:true,
            type: AndroidStyle.MESSAGING,
            person: {
              name: 'me',
            }, messages: [
                ...messages
              ]

        }
        },
      }) 

  });
github-actions[bot] commented 10 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

github-actions[bot] commented 9 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.