Esempio n. 1
0
        /// <summary>
        /// Disables the default integration that registers the page and popup navigation.
        /// </summary>
        /// <param name="options">The Sentry Xamarion Options.</param>
        public static void RemoveNavigationPageIntegration(this SentryXamarinOptions options)
        {
            var oldTracker = options.PageTracker;

            oldTracker?.Unregister();
            options.PageTracker = DisabledNavigationPage.Instance;
        }
 internal static void ConfigureSentryXamarinOptions(this SentryXamarinOptions options)
 {
     if (options.InternalCacheEnabled)
     {
         options.CacheDirectoryPath ??= options.DefaultCacheDirectoryPath();
     }
 }
        internal static void RegisterScreenshotEventProcessor(this SentryXamarinOptions options)
        {
#if NATIVE_PROCESSOR && !UAP10_0_16299
            if (options.AttachScreenshots)
            {
                SentrySdk.ConfigureScope(s =>
                                         s.AddAttachment(new ScreenshotAttachment(new ScreenshotAttachmentContent())));
            }
#endif
        }
        internal static void RegisterXamarinEventProcessors(this SentryXamarinOptions options)
        {
            options.AddEventProcessor(new XamarinEventProcessor(options));

#if NATIVE_PROCESSOR
            options.AddEventProcessor(new NativeEventProcessor(options));
#else
            options.DiagnosticLogger?.Log(SentryLevel.Debug, "No NativeEventProcessor found for the given target.");
#endif
        }
        internal static bool RegisterNativeActivityStatus(this SentryXamarinOptions options)
        {
#if NATIVE_PROCESSOR
            if (options.AutoSessionTracking)
            {
                options.SessionLogger = new DeviceActiveLogger();
                return(true);
            }
#endif
            return(false);
        }
        internal static bool RegisterNativeIntegrations(this SentryXamarinOptions options)
        {
            if (options.NativeIntegrationEnabled)
            {
#if NATIVE_PROCESSOR
                var nativeintegration = new NativeIntegration(options);
                options.AddIntegration(nativeintegration);
                return(true);
#else
                options.DiagnosticLogger?.Log(SentryLevel.Debug, "No NativeIntegration found for the given target.");
#endif
            }
            return(false);
        }
 internal static void RegisterXamarinInAppExclude(this SentryXamarinOptions options)
 {
     options.AddInAppExclude("Java.");
     options.AddInAppExclude("ZXing");
     options.AddInAppExclude("TouchView");
     options.AddInAppExclude("Rg.Plugins");
     options.AddInAppExclude("Prism");
     options.AddInAppExclude("CarouselView.FormsPlugin");
     options.AddInAppExclude("CardsView");
     options.AddInAppExclude("MvvmCross.Forms");
     options.AddInAppExclude("Com.Airbnb.Xamarin.Forms.Lottie");
     options.AddInAppExclude("Com.OneSignal");
     options.AddInAppExclude("SQLite-net");
 }
Esempio n. 8
0
        /// <summary>
        /// Initializes the SDK with an optional configuration options callback.
        /// </summary>
        /// <param name="configureOptions">The configure options.</param>
        public static void Init(Action <SentryXamarinOptions> configureOptions)
        {
            var options = new SentryXamarinOptions();

            // Set the release now but give the user a chance to reset it (i.e: to null to rely on the built-in format)
            options.Release = $"{AppInfo.PackageName}@{AppInfo.VersionString}+{AppInfo.BuildString}";

            configureOptions?.Invoke(options);

            options.ConfigureSentryXamarinOptions();
            options.RegisterNativeActivityStatus();
            options.RegisterNativeIntegrations();
            options.RegisterXamarinEventProcessors();
            options.RegisterXamarinInAppExclude();
            options.ProtocolPackageName ??= ProtocolPackageName;

            Init(options);
        }
Esempio n. 9
0
        /// <summary>
        /// Add the Sentry Xamarin Forms integration to Sentry.Xamarin SDK.
        /// </summary>
        /// <param name="options">The Sentry Xamarion Options.</param>
        public static void AddXamarinFormsIntegration(this SentryXamarinOptions options)
        {
            var applicationListener = new FormsApplicationListener(options);

            var formsIntegration = new SentryXamarinFormsIntegration(options);

            options.AddIntegration(formsIntegration);
            applicationListener.AddListener(formsIntegration.RegisterRequestThemeChange);

            if (options.PageTracker is null)
            {
                var navigationIntegration = new FormsNavigationIntegration();
                options.AddPageNavigationTrackerIntegration(navigationIntegration);
                applicationListener.AddListener(navigationIntegration.ApplySentryNavigationEvents);
            }

            options.ProtocolPackageName = ProtocolPackageName;

            applicationListener.Invoke();
        }
 internal static string DefaultCacheDirectoryPath(this SentryXamarinOptions _)
 => _internalCacheDefaultPath.Value;
 /// <summary>
 /// Disables the cache, must be called before Sentry gets initialized
 /// </summary>
 /// <param name="options">The Sentry options.</param>
 public static void DisableOfflineCaching(this SentryXamarinOptions options)
 {
     options.InternalCacheEnabled = false;
 }
 /// <summary>
 /// Disables the Sentry Xamarin Native integration.
 /// </summary>
 /// <param name="options">The Sentry options.</param>
 public static void DisableNativeIntegration(this SentryXamarinOptions options)
 {
     options.NativeIntegrationEnabled = false;
 }
 /// <summary>
 /// Disables the automatic Xamarin warning crumbs.
 /// </summary>
 /// <param name="options">The Sentry options.</param>
 public static void DisableXamarinWarningsBreadcrumbs(this SentryXamarinOptions options)
 {
     options.XamarinLoggerEnabled = false;
 }
 /// <summary>
 /// Unregister the previous navigation tracker and adds the registers the new Navigation Tracker to SentryXamarinOptions.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="tracker">The IPageNavigationTracker.</param>
 internal static void AddPageNavigationTrackerIntegration(this SentryXamarinOptions options, IPageNavigationTracker tracker)
 {
     options.AddIntegration(tracker);
     options.PageTracker?.Unregister();
     options.PageTracker = tracker;
 }
Esempio n. 15
0
        /// <summary>
        /// Initializes the SDK with the specified options instance.
        /// </summary>
        /// <param name="options">The options instance</param>
        public static void Init(SentryXamarinOptions options)
        {
            SentrySdk.Init(options);

            options.RegisterScreenshotEventProcessor();
        }