|
1 | 1 | import * as Sentry from '@nativescript-community/sentry';
|
2 | 2 | import * as Tracing from '@nativescript-community/sentry/tracing';
|
3 |
| -import { Application, Trace, Utils } from '@nativescript/core'; |
| 3 | +import { Application, NavigatedData, Page, Trace, Utils, View } from '@nativescript/core'; |
4 | 4 | import { on as applicationOn, launchEvent } from '@nativescript/core/application';
|
5 | 5 | import Vue from 'nativescript-vue';
|
6 | 6 | import Home from './views/Home';
|
@@ -36,6 +36,42 @@ async function startSentry() {
|
36 | 36 | enableUserInteractionTracing: false,
|
37 | 37 | enableAutoBreadcrumbTracking: false,
|
38 | 38 | });
|
| 39 | + Page.on('navigatingTo', (event: NavigatedData) => { |
| 40 | + Sentry.addBreadcrumb({ |
| 41 | + category: 'navigation', |
| 42 | + type: 'navigation', |
| 43 | + // We assume that context.name is the name of the route. |
| 44 | + message: `Navigation to ${event.object}`, |
| 45 | + data: { |
| 46 | + isBackNavigation: event.isBackNavigation, |
| 47 | + from: `${(event.object as Page).frame?.currentPage}`, |
| 48 | + to: `${event.object}` |
| 49 | + } |
| 50 | + }); |
| 51 | + }); |
| 52 | + View.on('showingModally', (event: NavigatedData) => { |
| 53 | + Sentry.addBreadcrumb({ |
| 54 | + category: 'navigation', |
| 55 | + type: 'navigation', |
| 56 | + // We assume that context.name is the name of the route. |
| 57 | + message: `Navigation to Modal ${event.object}`, |
| 58 | + data: { |
| 59 | + from: `${(event.object as View)._modalParent}`, |
| 60 | + to: `${event.object}` |
| 61 | + } |
| 62 | + }); |
| 63 | + }); |
| 64 | + View.on('closingModally', (event: NavigatedData) => { |
| 65 | + Sentry.addBreadcrumb({ |
| 66 | + category: 'navigation', |
| 67 | + type: 'navigation', |
| 68 | + // We assume that context.name is the name of the route. |
| 69 | + message: `Closing modal ${event.object}`, |
| 70 | + data: { |
| 71 | + from: `${event.object as View}` |
| 72 | + } |
| 73 | + }); |
| 74 | + }); |
39 | 75 | setTimeout(()=>{
|
40 | 76 | Sentry.withScope(scope => {
|
41 | 77 | try {
|
|
0 commit comments