Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove right icon from Electron notifications. #13330

Merged
merged 2 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function canUseBrowserNotifications() {
* @param {Object} params
* @param {String} params.title
* @param {String} params.body
* @param {String} [params.icon] Default to Expensify logo
* @param {String} [params.icon] Path to icon
* @param {Number} [params.delay]
* @param {Function} [params.onClick]
* @param {String} [params.tag]
Expand All @@ -54,7 +54,7 @@ function push({
delay = DEFAULT_DELAY,
onClick = () => {},
tag = '',
icon = EXPENSIFY_ICON_URL,
icon,
}) {
return new Promise((resolve) => {
if (!title || !body) {
Expand All @@ -69,8 +69,8 @@ function push({

const notification = new Notification(title, {
body,
icon,
tag,
icon,
});

// If we pass in a delay param greater than 0 the notification
Expand Down Expand Up @@ -103,8 +103,9 @@ export default {
* @param {Object} params
* @param {Object} params.reportAction
* @param {Function} params.onClick
* @param {Boolean} usesIcon true if notification uses right circular icon
*/
pushReportCommentNotification({reportAction, onClick}) {
pushReportCommentNotification({reportAction, onClick}, usesIcon = false) {
const {person, message} = reportAction;
const plainTextPerson = Str.htmlDecode(_.map(person, f => f.text).join());

Expand All @@ -116,6 +117,7 @@ export default {
body: plainTextMessage,
delay: 0,
onClick,
icon: usesIcon ? EXPENSIFY_ICON_URL : '',
});
},

Expand Down
14 changes: 14 additions & 0 deletions src/libs/Notification/LocalNotification/index.website.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import BrowserNotifications from './BrowserNotifications';

function showCommentNotification({reportAction, onClick}) {
BrowserNotifications.pushReportCommentNotification({reportAction, onClick}, true);
}

function showUpdateAvailableNotification() {
BrowserNotifications.pushUpdateAvailableNotification();
}

export default {
showCommentNotification,
showUpdateAvailableNotification,
};