Skip to content

Commit

Permalink
In app notifications (#1502)
Browse files Browse the repository at this point in the history
* force the app to go to map page with click on in app notification

* remove test

* change notification duration
  • Loading branch information
yzlucas authored Dec 14, 2023
1 parent 64470b8 commit f52b09d
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { PushNotificationSchema, PushNotifications } from '@capacitor/push-notif
import { AppLauncher } from '@capacitor/app-launcher';

import { NotificationConfig, NotificationSnackbarComponent } from '../components/notification-snackbar/notification-snackbar.component';
import { ResourcesRoutes } from '@app/utils';

export interface CompassHeading {
magneticHeading?: number //The heading in degrees from 0-359.99 at a single moment in time. (Number)
Expand Down Expand Up @@ -278,7 +279,20 @@ export class CapacitorService {
let sb = this.showNotificationSnackbar( notification.title, notification.body )

sb.onAction().subscribe( () => {
this.emitLocationNotification( notification.data )
let c = JSON.parse(notification.data['coords']),
r = JSON.parse(notification.data['radius'])
this.router.navigate([ResourcesRoutes.ACTIVEWILDFIREMAP], {
queryParams: {
latitude: c[0],
longitude: c[1],
radius: r,
featureId: notification.data['messageID'],
featureType: notification.data['topicKey'],
identify:true,
notification:true,
time: Date.now()
}
});
} )

sb.afterDismissed().subscribe( () => {
Expand Down Expand Up @@ -315,7 +329,8 @@ export class CapacitorService {
showNotificationSnackbar( title: string, body: string ) {
let cfg: MatSnackBarConfig<NotificationConfig> = {
data: { title, body },
duration: 10 * 1000,
// need to change back to 10 sec. Using 60 sec for testing purpose in case QA missed it.
duration: 60 * 1000,
verticalPosition: 'top'
}

Expand Down

0 comments on commit f52b09d

Please sign in to comment.