@@ -90,38 +90,7 @@ class NotificationService {
9090
9191 await LocalNotifications . addListener ( 'localNotificationReceived' , ( notification ) => {
9292 console . log ( '📱 Notification received while app active:' , notification ) ;
93-
94- const extra = notification ?. extra || notification ?. notification ?. extra ;
95- const itemTitle = extra ?. originalReminder ?. itemTitle || extra ?. itemTitle || notification . body ?. replace ( "Don't forget: " , "" ) || 'Untitled' ;
96- const wasScheduledWhenVisible = extra ?. scheduledWhenVisible ;
97-
98- // If this was scheduled when app was visible, it should be a silent notification
99- // and we should always show the in-app alert
100- if ( wasScheduledWhenVisible || document . visibilityState === 'visible' ) {
101- console . log ( '🔔 Showing in-app reminder alert for:' , itemTitle ) ;
102-
103- // Show native alert dialog
104- if ( window . Capacitor ?. Plugins ?. Dialog ) {
105- try {
106- window . Capacitor . Plugins . Dialog . alert ( {
107- title : '⏰ Reminder' ,
108- message : `Don't forget: ${ itemTitle } ` ,
109- buttonTitle : 'OK'
110- } ) . then ( ( ) => {
111- console . log ( '✅ Capacitor alert shown successfully' ) ;
112- } ) . catch ( ( error ) => {
113- console . error ( '❌ Capacitor alert failed, using browser alert:' , error ) ;
114- alert ( `⏰ Reminder: Don't forget: ${ itemTitle } ` ) ;
115- } ) ;
116- } catch ( error ) {
117- console . error ( '❌ Capacitor alert failed, using browser alert:' , error ) ;
118- alert ( `⏰ Reminder: Don't forget: ${ itemTitle } ` ) ;
119- }
120- } else {
121- // Fallback to browser alert
122- alert ( `⏰ Reminder: Don't forget: ${ itemTitle } ` ) ;
123- }
124- }
93+ // Let the system notification show normally - no interference
12594 } ) ;
12695 }
12796 } else {
@@ -184,29 +153,24 @@ class NotificationService {
184153 // mapping we wouldn't know which notification ID to cancel on receipt.
185154 this . notificationIdMap [ itemId ] = safeId ;
186155
187- // Check if app is currently visible to determine notification behavior
188- const isAppVisible = document . visibilityState === 'visible' ;
189-
190156 const notifications = [
191157 {
192158 title : '⏰ Reminder' ,
193159 body : `Don't forget: ${ itemTitle || 'Untitled' } ` ,
194160 id : safeId ,
195161 // Ensure alarms fire while idle on Android
196162 schedule : { at : notificationTime , allowWhileIdle : true } ,
197- // Use different channel based on app visibility
198- channelId : isAppVisible ? 'reminders_silent' : 'reminders' ,
199- // Lower importance if app is visible (will prevent heads-up notification)
200- importance : isAppVisible ? 2 : 5 ,
201- // Disable sound if app is visible
202- sound : isAppVisible ? null : null ,
163+ // Always use the main reminders channel for consistent behavior
164+ channelId : 'reminders' ,
165+ importance : 5 ,
166+ // Use default sound
167+ sound : null ,
203168 attachments : null ,
204169 actionTypeId : 'REMINDER_ACTION' ,
205170 extra : {
206171 itemId,
207172 reminderId : `${ itemId } -${ timestamp } ` ,
208- originalReminder : reminder ,
209- scheduledWhenVisible : isAppVisible
173+ originalReminder : reminder
210174 }
211175 }
212176 ] ;
0 commit comments