From 79f2c4d6d6d455df43000f37b57360e9b2c3b525 Mon Sep 17 00:00:00 2001 From: Vadym Rostok Date: Thu, 9 Jul 2020 13:29:54 +0300 Subject: [PATCH] Fix setBadgeCount argument structure. Formatting. --- README.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 66e4845..62f74d7 100644 --- a/README.md +++ b/README.md @@ -11,20 +11,19 @@ ```typescript -import 'fancy-notifications'; import { Plugins } from '@capacitor/core'; -const {FancyNotifications} = Plugins; +const { FancyNotifications } = Plugins; async function updateBadgeCount() { const check = await FancyNotifications.hasPermission(); - if(check.value){ - FancyNotifications.setBadgeCount(2); - }else{ - const request = await FancyNotifications.requestPermission(); - if(request.value){ - FancyNotifications.setBadgeCount(2); - }else{ + if (check.value) { + FancyNotifications.setBadgeCount({ count: 2 }); + } else { + const request = await FancyNotifications.requestPermission(); + if(request.value) { + FancyNotifications.setBadgeCount({ count: 2 }); + } else { // User failed to grant permission show some dialog - } + } } } @@ -42,4 +41,4 @@ async function updateBadgeCount() { ## TODO -- [ ] Add Notifications Support \ No newline at end of file +- [ ] Add Notifications Support