From 4ca4c50f61a9758373fee3d2150733931c03516c Mon Sep 17 00:00:00 2001 From: Gary Tokman Date: Wed, 14 Feb 2024 18:20:00 -0500 Subject: [PATCH] chore: update readme --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index aacedcd..fbdf193 100644 --- a/README.md +++ b/README.md @@ -68,13 +68,18 @@ const isRegistered = await push.isRegisteredForRemoteNotifications(); // Listeners push.addListener('notificationReceived', (data) => { - const uuid = data.uuid; - const kind = data.kind; // foreground, background, or opened - const payload = data.payload; - if (uuid) { - // Required to tell iOS that the push was received, if not called, the library will call this in 30 seconds - await push.onFinish(uuid); + switch (data.kind) { + case 'opened': + console.log('opened'); + break; + case 'foreground': + case 'background': + console.log('foreground/background'); + const { uuid } = data; + await push.onFinish(uuid); + break; } + const { title, body } = data; }); push.addListener('deviceTokenReceived', (token) => {});