Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

reverted browser notification experiment

Jonas Jabarif1b6620fea7e
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
index 8507250baf2..30bb76ba797 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
@@ -160,7 +160,6 @@ export class InAppNotificationCenterComponent implements OnInit, OnDestroy {
filter: this.urlParams.get('filter'),
name: this.urlParams.get('name'),
});
- this.checkNotificationPermissions();
this.setupEventListeners();
}
@@ -196,17 +195,4 @@ export class InAppNotificationCenterComponent implements OnInit, OnDestroy {
return this.text.no_notification_for_filter;
}
-
- checkNotificationPermissions():void {
- // Check if the browser supports notifications
- if (!('Notification' in window)) {
- return;
- }
- // if so, ask for permission if not already denied
- if (Notification.permission !== 'denied') {
- Notification.requestPermission().catch((error) => {
- console.error(error);
- });
- }
- }
}
diff --git a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
index 054ac6a32c3..00189e1cd8b 100644
--- a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
+++ b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
@@ -371,11 +371,6 @@ export class IanCenterService extends UntilDestroyedMixin {
if (state.centerHidden) {
// notification center is not visible (as far as it can be determined - e.g. another browser tab is selected)
- // try to notify user even when notification is associated with selected workpackage
- if (this.browserNotificationsEnabled()) {
- this.createBrowserNotification();
- }
-
this.showNotificationIndicatorInIcon();
this.showNewNotificationToast();
} else if (hasNewNotificationsForOtherThanSelectedWp) {
@@ -402,33 +397,6 @@ export class IanCenterService extends UntilDestroyedMixin {
}
}
- private browserNotificationsEnabled():boolean {
- let disabled = false;
- // Check if the browser supports notifications
- if (!('Notification' in window)) {
- disabled = true;
- }
-
- if (Notification.permission === 'denied') {
- disabled = true;
- }
-
- return !disabled;
- }
-
- private createBrowserNotification():void {
- const notification = new Notification('OpenProject', {
- body: this.I18n.t('js.notifications.center.new_notifications.message'),
- tag: 'opNewNotification', // important: without a tag the notifications would sum up which would be highly annoying
- });
-
- notification.onclick = () => {
- window.focus();
- notification.close();
- this.removeNotificationIndicatorInIcon();
- };
- }
-
private showNotificationIndicatorInIcon():void {
const iconLink = window.document.querySelector("link[rel*='icon']");
if (iconLink) {
@@ -443,51 +411,6 @@ export class IanCenterService extends UntilDestroyedMixin {
}
}
- private playNotificationSound():void {
- const audioContext = new window.AudioContext();
-
- const createOscillator = (freq:number, type:OscillatorType = 'sine') => {
- const osc = audioContext.createOscillator();
- osc.type = type;
- osc.frequency.setValueAtTime(freq, audioContext.currentTime);
- return osc;
- };
-
- const createEnvelope = () => {
- const gain = audioContext.createGain();
- gain.gain.setValueAtTime(0, audioContext.currentTime);
- gain.gain.linearRampToValueAtTime(0.2, audioContext.currentTime + 0.005);
- gain.gain.exponentialRampToValueAtTime(0.001, audioContext.currentTime + 0.5);
- return gain;
- };
-
- const oscillators = [
- createOscillator(880), // A5
- createOscillator(1108.73), // C#6
- createOscillator(1318.51), // E6
- createOscillator(1760, 'triangle'), // A6 (overtone)
- ];
-
- const masterGain = audioContext.createGain();
- masterGain.gain.setValueAtTime(0.7, audioContext.currentTime);
-
- oscillators.forEach((osc) => {
- const envelope = createEnvelope();
- osc.connect(envelope);
- envelope.connect(masterGain);
- osc.start();
- osc.stop(audioContext.currentTime + 0.5);
- });
-
- masterGain.connect(audioContext.destination);
-
- // Clean up
- setTimeout(() => {
- masterGain.disconnect();
- void audioContext.close();
- }, 1000);
- }
-
/**
* Reload after notifications were successfully marked as read
*/