Coder Social home page Coder Social logo

Comments (6)

lucas-zimerman avatar lucas-zimerman commented on September 21, 2024

Hi, Thanks for opening this issue.
In your case, would you prefer to have an option that allows the SDK to disable the navigation breadcrumbs and you implement it on your side, or that we give you a callback where you decide what to ignore on the Appearing event?

from sentry-xamarin.

Hackmodford avatar Hackmodford commented on September 21, 2024

Disabling would be good too. I thought about having the ignore list, but I have some other custom navigation stuff that would be neat to add.

from sentry-xamarin.

bruno-garcia avatar bruno-garcia commented on September 21, 2024

You could also use BeforeBreadcrumb to remove those programatically

from sentry-xamarin.

bruno-garcia avatar bruno-garcia commented on September 21, 2024

So we agreed to resolve this we can add an extension method RemoveNavigationPageIntegration.

from sentry-xamarin.

Hackmodford avatar Hackmodford commented on September 21, 2024

I'm going to experiment with BeforeBreadcrumb

from sentry-xamarin.

Hackmodford avatar Hackmodford commented on September 21, 2024

Here's my workaround using BeforeBreadcrumb

options.BeforeBreadcrumb = breadcrumb =>
{
    var output = AlwaysIgnorePage(breadcrumb, "LoadingOverlayPage");
    output = IgnoreNavigationPage(output, "CustomNavigationPage");
    return output;
};

private static Breadcrumb? AlwaysIgnorePage(Breadcrumb? breadcrumb, string pageName)
{
    // not the breadcrumb we're interested in
    if (breadcrumb is null) return breadcrumb;
    if (breadcrumb.Type is null) return breadcrumb;
    if (breadcrumb.Type != "navigation") return breadcrumb;
    if (breadcrumb.Data is null) return breadcrumb;

    return breadcrumb.Data["to"].Contains(pageName) ? null : breadcrumb;
}

private static string? _lastPageName;

private static Breadcrumb? IgnoreNavigationPage(Breadcrumb? breadcrumb, string pageName)
{
    // not the breadcrumb we're interested in
    if (breadcrumb is null) return breadcrumb;
    if (breadcrumb.Type is null) return breadcrumb;
    if (breadcrumb.Type != "navigation") return breadcrumb;
    if (breadcrumb.Data is null) return breadcrumb;

    if (breadcrumb.Data["to"].Contains(pageName))
    {
        _lastPageName = breadcrumb.Data["from"];
        return null;
    }

    if (_lastPageName is null) return null;

    var data = new Dictionary<string, string>()
    {
        { "from", _lastPageName },
        { "to", breadcrumb.Data["to"] }
    };

    var replacementBreadcrumb = new Breadcrumb(
        breadcrumb.Message!,
        breadcrumb.Type, data,
        breadcrumb.Category,
        breadcrumb.Level);

    _lastPageName = breadcrumb.Data["to"];

    return replacementBreadcrumb;
}

from sentry-xamarin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.