Skip to content

Commit

Permalink
Fix for android
Browse files Browse the repository at this point in the history
  • Loading branch information
vj-abishek committed Dec 19, 2020
1 parent 937034a commit 854a3f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Components/Home/Room/Single.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ const Single = ({
messagecount = Count.get(snapShot.channelId).messageCount;
}

if(size > 0){
navigator?.setAppBadge(size).catch((error) => {
if(size > 0 && 'setAppBadge' in navigator){
navigator.setAppBadge(size).catch((error) => {
console.log('error:', error);
});
}
Expand Down
10 changes: 6 additions & 4 deletions src/Store/reducers/messageReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ export default produce((draft, { type, payload }) => {
if (hasInMap) {
draft.messageCount.delete(payload.channel);
}
// Clear the badge
navigator?.clearAppBadge().catch((error) => {
console.log(error);
});

if ('clearAppBadges' in navigator) {
// Clear the badge
navigator.clearAppBadge().catch((error) => {
console.log(error);
});
}
return draft;
}

Expand Down

1 comment on commit 854a3f8

@vercel
Copy link

@vercel vercel bot commented on 854a3f8 Dec 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.