Ejemplo n.º 1
0
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     AppCenterEnabledSwitch.On = AppCenter.IsEnabledAsync().Result;
     LogLevelLabel.Text        = LogLevelNames[AppCenter.LogLevel];
     LogWriteLevelLabel.Text   = LogLevelNames[mLogWriteLevel];
 }
Ejemplo n.º 2
0
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     AnalyticsEnabledSwitch.On      = Analytics.IsEnabledAsync().Result;
     AnalyticsEnabledSwitch.Enabled = AppCenter.IsEnabledAsync().Result;
     NumPropertiesLabel.Text        = mEventProperties.Count.ToString();
 }
Ejemplo n.º 3
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            EnabledSwitchCell.On = await Analytics.IsEnabledAsync();

            EnabledSwitchCell.IsEnabled = await AppCenter.IsEnabledAsync();
        }
Ejemplo n.º 4
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            CrashesEnabledSwitchCell.On = await Crashes.IsEnabledAsync();

            CrashesEnabledSwitchCell.IsEnabled = await AppCenter.IsEnabledAsync();

            // Attachments
            if (Application.Current.Properties.TryGetValue(TextAttachmentKey, out var textAttachment) &&
                textAttachment is string text)
            {
                TextAttachmentCell.Detail = text;
            }
            if (Application.Current.Properties.TryGetValue(FileAttachmentKey, out var fileAttachment) &&
                fileAttachment is string file)
            {
                var filePicker = DependencyService.Get <IFilePicker>();
                try
                {
                    FileAttachmentCell.Detail = filePicker?.GetFileDescription(file);
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Couldn't read file attachment: {0}", e.Message);
                    Application.Current.Properties.Remove(FileAttachmentKey);
                }
            }
            if (XamarinDevice.RuntimePlatform == XamarinDevice.UWP)
            {
                TextAttachmentCell.IsEnabled = false;
                FileAttachmentCell.IsEnabled = false;
            }
        }
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            CrashesEnabledSwitchCell.On = await Crashes.IsEnabledAsync();

            CrashesEnabledSwitchCell.IsEnabled = await AppCenter.IsEnabledAsync();

            var hasLowMemoryWarning = await Crashes.HasReceivedMemoryWarningInLastSessionAsync();

            MemoryWarningLabel.Text = hasLowMemoryWarning ? "Yes" : "No";

            // Attachments
            if (Application.Current.Properties.TryGetValue(TextAttachmentKey, out var textAttachment) &&
                textAttachment is string text)
            {
                TextAttachmentContent.Text = text;
            }
            if (Application.Current.Properties.TryGetValue(FileAttachmentKey, out var fileAttachment) &&
                fileAttachment is string file)
            {
                try
                {
                    BinaryAttachmentFilePathLabel.Text = file;
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Couldn't read file attachment: {0}", e.Message);
                    Application.Current.Properties.Remove(FileAttachmentKey);
                }
            }
        }
Ejemplo n.º 6
0
 void UpdateAppCenterLabel()
 {
     if (AppCenterEnabledLabel != null)
     {
         AppCenterEnabledLabel.Text = AppCenter.IsEnabledAsync().Result ? TestStrings.AppCenterEnabledText : TestStrings.AppCenterDisabledText;
     }
 }
 public void start(string appId)
 {
     RunOnDispatcher(async() =>
     {
         try
         {
             bool isEnabled    = await AppCenter.IsEnabledAsync();
             bool isConfigured = AppCenter.Configured;
             if (isConfigured == false)
             {
                 AppCenter.Configure(appId);
                 AppCenter.Start(typeof(Analytics));
             }
             else
             {
                 if (isEnabled == false)
                 {
                     await AppCenter.SetEnabledAsync(true);
                 }
             }
         }
         catch (Exception e)
         {
             Debug.WriteLine(e.Message);
         }
     });
 }
Ejemplo n.º 8
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var acEnabled = await AppCenter.IsEnabledAsync();

            DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync();

            DistributeEnabledSwitchCell.IsEnabled = acEnabled;
            PushEnabledSwitchCell.On = await Push.IsEnabledAsync();

            PushEnabledSwitchCell.IsEnabled = acEnabled;
            AuthEnabledSwitchCell.On        = await Auth.IsEnabledAsync();

            AuthEnabledSwitchCell.IsEnabled = acEnabled;
            if (!Application.Current.Properties.ContainsKey(AccountId))
            {
                SignInInformationButton.Text = "Authentication status unknown";
            }
            else if (Application.Current.Properties[AccountId] is string)
            {
                SignInInformationButton.Text = "User is authenticated";
            }
            else
            {
                SignInInformationButton.Text = "User is not authenticated";
            }
        }
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var acEnabled = await AppCenter.IsEnabledAsync();

            DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync();

            DistributeEnabledSwitchCell.IsEnabled = acEnabled;
            PushEnabledSwitchCell.On = await Push.IsEnabledAsync();

            PushEnabledSwitchCell.IsEnabled = acEnabled;
            RumEnabledSwitchCell.On         = _rumStarted && await RealUserMeasurements.IsEnabledAsync();

            RumEnabledSwitchCell.IsEnabled  = acEnabled;
            EventFilterEnabledSwitchCell.On = _eventFilterStarted && await EventFilterHolder.Implementation?.IsEnabledAsync();

            EventFilterEnabledSwitchCell.IsEnabled = acEnabled && EventFilterHolder.Implementation != null;
            if (userInfo?.AccountId != null)
            {
                SignInInformationButton.Text = "User authenticated";
            }
            else
            {
                SignInInformationButton.Text = "User not authenticated";
            }
        }
Ejemplo n.º 10
0
        protected override void OnStart()
        {
            if (!AppCenter.Configured)
            {
                AppCenterLog.Assert(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
                AppCenter.LogLevel = LogLevel.Verbose;
                AppCenterLog.Info(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
                AppCenterLog.Info(LogTag, "AppCenter.Configured=" + AppCenter.Configured);

                // Set callbacks
                Crashes.ShouldProcessErrorReport    = ShouldProcess;
                Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
                Crashes.GetErrorAttachments         = GetErrorAttachmentsCallback;
                Distribute.ReleaseAvailable         = OnReleaseAvailable;

                // Event handlers
                Crashes.SendingErrorReport      += SendingErrorReportHandler;
                Crashes.SentErrorReport         += SentErrorReportHandler;
                Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;
                Push.PushNotificationReceived   += PrintNotification;

                AppCenterLog.Assert(LogTag, "AppCenter.Configured=" + AppCenter.Configured);

                if (!StartType.OneCollector.Equals(StartTypeUtils.GetPersistedStartType()))
                {
                    AppCenter.SetLogUrl("https://in-integration.dev.avalanch.es");
                }

                Distribute.SetInstallUrl("https://install.portal-server-core-integration.dev.avalanch.es");
                Distribute.SetApiUrl("https://api-gateway-core-integration.dev.avalanch.es/v0.1");
                Auth.SetConfigUrl("https://config-integration.dev.avalanch.es");
                Data.SetTokenExchangeUrl("https://token-exchange-mbaas-integration.dev.avalanch.es/v0.1");

                AppCenter.Start(GetTokensString(), typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Auth), typeof(Data));
                if (Current.Properties.ContainsKey(Constants.UserId) && Current.Properties[Constants.UserId] is string id)
                {
                    AppCenter.SetUserId(id);
                }

                // Work around for SetUserId race condition.
                AppCenter.Start(typeof(Push));
                AppCenter.IsEnabledAsync().ContinueWith(enabled =>
                {
                    AppCenterLog.Info(LogTag, "AppCenter.Enabled=" + enabled.Result);
                });
                AppCenter.GetInstallIdAsync().ContinueWith(installId =>
                {
                    AppCenterLog.Info(LogTag, "AppCenter.InstallId=" + installId.Result);
                });
                AppCenterLog.Info(LogTag, "AppCenter.SdkVersion=" + AppCenter.SdkVersion);
                Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
                {
                    AppCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
                });
                Crashes.GetLastSessionCrashReportAsync().ContinueWith(task =>
                {
                    AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.StackTrace=" + task.Result?.StackTrace);
                });
            }
        }
Ejemplo n.º 11
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var acEnabled = await AppCenter.IsEnabledAsync();

            DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync();

            DistributeEnabledSwitchCell.IsEnabled = acEnabled;
            PushEnabledSwitchCell.On = await Push.IsEnabledAsync();

            PushEnabledSwitchCell.IsEnabled = acEnabled;
            AuthEnabledSwitchCell.On        = await Auth.IsEnabledAsync();

            AuthEnabledSwitchCell.IsEnabled = acEnabled;
            RumEnabledSwitchCell.On         = _rumStarted && await RealUserMeasurements.IsEnabledAsync();

            RumEnabledSwitchCell.IsEnabled  = acEnabled;
            EventFilterEnabledSwitchCell.On = _eventFilterStarted && await EventFilterHolder.Implementation?.IsEnabledAsync();

            EventFilterEnabledSwitchCell.IsEnabled = acEnabled && EventFilterHolder.Implementation != null;
            if (!Application.Current.Properties.ContainsKey(AccountId))
            {
                SignInInformationButton.Text = "Authentication status unknown";
            }
            else if (Application.Current.Properties[AccountId] is string)
            {
                SignInInformationButton.Text = "User is authenticated";
            }
            else
            {
                SignInInformationButton.Text = "User is not authenticated";
            }
        }
Ejemplo n.º 12
0
        protected override void OnStart()
        {
            if (!AppCenter.Configured)
            {
                AppCenterLog.Assert(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
                AppCenter.LogLevel = LogLevel.Verbose;
                AppCenterLog.Info(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
                AppCenterLog.Info(LogTag, "AppCenter.Configured=" + AppCenter.Configured);

                // Set callbacks
                Crashes.ShouldProcessErrorReport    = ShouldProcess;
                Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
                Crashes.GetErrorAttachments         = GetErrorAttachmentsCallback;
                Distribute.ReleaseAvailable         = OnReleaseAvailable;

                // Event handlers
                Crashes.SendingErrorReport      += SendingErrorReportHandler;
                Crashes.SentErrorReport         += SentErrorReportHandler;
                Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;
                Push.PushNotificationReceived   += PrintNotification;

                AppCenterLog.Assert(LogTag, "AppCenter.Configured=" + AppCenter.Configured);

                var updateTrack = TrackUpdateUtils.GetPersistedUpdateTrack();
                if (updateTrack != null)
                {
                    Distribute.UpdateTrack = updateTrack.Value;
                }
                if (Current.Properties.TryGetValue(Constants.AutomaticUpdateCheckKey, out object persistedObject) && !(bool)persistedObject)
                {
                    Distribute.DisableAutomaticCheckForUpdate();
                }
                AppCenter.Start(GetTokensString(), typeof(Analytics), typeof(Crashes), typeof(Distribute));
                if (Current.Properties.ContainsKey(Constants.UserId) && Current.Properties[Constants.UserId] is string id)
                {
                    AppCenter.SetUserId(id);
                }

                // Work around for SetUserId race condition.
                AppCenter.Start(typeof(Push));
                AppCenter.IsEnabledAsync().ContinueWith(enabled =>
                {
                    AppCenterLog.Info(LogTag, "AppCenter.Enabled=" + enabled.Result);
                });
                AppCenter.GetInstallIdAsync().ContinueWith(installId =>
                {
                    AppCenterLog.Info(LogTag, "AppCenter.InstallId=" + installId.Result);
                });
                AppCenterLog.Info(LogTag, "AppCenter.SdkVersion=" + AppCenter.SdkVersion);
                Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
                {
                    AppCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
                });
                Crashes.GetLastSessionCrashReportAsync().ContinueWith(task =>
                {
                    AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.StackTrace=" + task.Result?.StackTrace);
                });
            }
        }
Ejemplo n.º 13
0
        async void UpdateDistributeEnabled(object sender, ToggledEventArgs e)
        {
            await Distribute.SetEnabledAsync(e.Value);

            var acEnabled = await AppCenter.IsEnabledAsync();

            RefreshDistributeEnabled(acEnabled);
        }
Ejemplo n.º 14
0
 private void UpdateState()
 {
     AppCenterEnabled.IsChecked = AppCenter.IsEnabledAsync().Result;
     CrashesEnabled.IsChecked   = Crashes.IsEnabledAsync().Result;
     AnalyticsEnabled.IsChecked = Analytics.IsEnabledAsync().Result;
     AnalyticsEnabled.IsEnabled = AppCenterEnabled.IsChecked.Value;
     CrashesEnabled.IsEnabled   = AppCenterEnabled.IsChecked.Value;
 }
Ejemplo n.º 15
0
        async void UpdatePushEnabled(object sender, ToggledEventArgs e)
        {
            await Push.SetEnabledAsync(e.Value);

            var acEnabled = await AppCenter.IsEnabledAsync();

            RefreshPushEnabled(acEnabled);
        }
 protected override async void UpdateState()
 {
     CrashesEnabledSwitch.CheckedChange -= UpdateEnabled;
     CrashesEnabledSwitch.Enabled = true;
     CrashesEnabledSwitch.Checked = await Crashes.IsEnabledAsync();
     CrashesEnabledSwitch.Enabled = await AppCenter.IsEnabledAsync();
     CrashesEnabledSwitch.CheckedChange += UpdateEnabled;
 }
 private void UpdateState()
 {
     AppCenterEnabled.Checked             = AppCenter.IsEnabledAsync().Result;
     AppCenterAllowNetworkRequest.Checked = AppCenter.IsNetworkRequestsAllowed;
     AnalyticsEnabled.Checked             = Analytics.IsEnabledAsync().Result;
     CrashesEnabled.Checked   = Crashes.IsEnabledAsync().Result;
     AnalyticsEnabled.Enabled = AppCenterEnabled.Checked;
     CrashesEnabled.Enabled   = AppCenterEnabled.Checked;
 }
Ejemplo n.º 18
0
        public void SetEnabledSameValue()
        {
            AppCenter.Start("appsecret", typeof(MockAppCenterService));
            AppCenter.SetEnabledAsync(AppCenter.IsEnabledAsync().Result).RunNotAsync();

            MockAppCenterService.Mock.VerifySet(service => service.InstanceEnabled = It.IsAny <bool>(), Times.Never());
            _settingsMock.Verify(settings => settings.SetValue(AppCenter.EnabledKey, It.IsAny <bool>()), Times.Never());
            _channelGroupMock.Verify(channelGroup => channelGroup.SetEnabled(It.IsAny <bool>()), Times.Never());
        }
        protected override async void UpdateState()
        {
            AppCenterEnabledSwitch.CheckedChange -= UpdateEnabled;
            AppCenterEnabledSwitch.Checked        = await AppCenter.IsEnabledAsync();

            AppCenterEnabledSwitch.CheckedChange += UpdateEnabled;
            LogLevelLabel.Text      = LogLevelNames[AppCenter.LogLevel];
            LogWriteLevelLabel.Text = LogLevelNames[mLogWriteLevel];
        }
Ejemplo n.º 20
0
        public void GetEnabled()
        {
            _settingsMock.SetupSequence(settings => settings.GetValue(AppCenter.EnabledKey, It.IsAny <bool>()))
            .Returns(true).Returns(false);

            Assert.IsTrue(AppCenter.IsEnabledAsync().Result);
            Assert.IsFalse(AppCenter.IsEnabledAsync().Result);
            _settingsMock.Verify(settings => settings.GetValue(AppCenter.EnabledKey, It.IsAny <bool>()),
                                 Times.Exactly(2));
        }
Ejemplo n.º 21
0
        protected override async void UpdateState()
        {
            DistributeEnabledSwitch.CheckedChange -= UpdateDistributeEnabled;
            DistributeEnabledSwitch.Enabled        = true;
            DistributeEnabledSwitch.Checked        = await Distribute.IsEnabledAsync();

            DistributeEnabledSwitch.Enabled = await AppCenter.IsEnabledAsync();

            DistributeEnabledSwitch.CheckedChange += UpdateDistributeEnabled;
        }
Ejemplo n.º 22
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var acEnabled = await AppCenter.IsEnabledAsync();

            RefreshDistributeEnabled(acEnabled);
            EventFilterEnabledSwitchCell.On = _eventFilterStarted && await EventFilterHolder.Implementation?.IsEnabledAsync();

            EventFilterEnabledSwitchCell.IsEnabled = acEnabled && EventFilterHolder.Implementation != null;
        }
        protected override async void UpdateState()
        {
            AnalyticsEnabledSwitch.CheckedChange -= UpdateEnabled;
            AnalyticsEnabledSwitch.Enabled        = true;
            AnalyticsEnabledSwitch.Checked        = await Analytics.IsEnabledAsync();

            AnalyticsEnabledSwitch.Enabled = await AppCenter.IsEnabledAsync();

            AnalyticsEnabledSwitch.CheckedChange += UpdateEnabled;
            PropertiesCountLabel.Text             = mEventProperties.Count.ToString();
        }
Ejemplo n.º 24
0
        public void SetEnabledDifferentValueAfterConfigure()
        {
            AppCenter.Start("appsecret", typeof(MockAppCenterService));
            var setVal = !AppCenter.IsEnabledAsync().Result;

            AppCenter.SetEnabledAsync(setVal).RunNotAsync();

            MockAppCenterService.Mock.VerifySet(service => service.InstanceEnabled = setVal, Times.Once());
            _settingsMock.Verify(settings => settings.SetValue(AppCenter.EnabledKey, setVal), Times.Once());
            _channelGroupMock.Verify(channelGroup => channelGroup.SetEnabled(setVal), Times.Once());
        }
Ejemplo n.º 25
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            var acEnabled = await AppCenter.IsEnabledAsync();

            DistributeEnabledSwitchCell.On = await Distribute.IsEnabledAsync();

            DistributeEnabledSwitchCell.IsEnabled = acEnabled;
            PushEnabledSwitchCell.On = await Push.IsEnabledAsync();

            PushEnabledSwitchCell.IsEnabled = acEnabled;
        }
        public async Task Init()
        {
            bool isAppCenterEnabled = await AppCenter.IsEnabledAsync();

            if (!isAppCenterEnabled)
            {
                await InitializeAnalyticsReport();
                await InitializeCrashReport();

                string appSecret = $"android={AppConstants.AppCenterAndroidKey};ios={AppConstants.AppCenteriOSKey}";
                AppCenter.Start(appSecret, typeof(Analytics), typeof(Crashes));
            }
        }
Ejemplo n.º 27
0
        public void SetEnabledSameValue()
        {
            _channelGroupMock.Setup(
                group => group.AddChannel(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <TimeSpan>(), It.IsAny <int>()))
            .Returns(new Mock <IChannelUnit>().Object);
            AppCenter.Start("appsecret", typeof(MockAppCenterService));
            AppCenter.SetEnabledAsync(AppCenter.IsEnabledAsync().Result).Wait();

            MockAppCenterService.Instance.MockInstance.VerifySet(
                service => service.InstanceEnabled = It.IsAny <bool>(), Times.Never());
            _settingsMock.Verify(settings => settings.SetValue(AppCenter.EnabledKey, It.IsAny <bool>()), Times.Never());
            _channelGroupMock.Verify(channelGroup => channelGroup.SetEnabled(It.IsAny <bool>()), Times.Never());
        }
Ejemplo n.º 28
0
        protected override void OnStart()
        {
            if (!AppCenter.Configured)
            {
                AppCenterLog.Assert(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
                AppCenter.LogLevel = LogLevel.Verbose;
                AppCenterLog.Info(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
                AppCenterLog.Info(LogTag, "AppCenter.Configured=" + AppCenter.Configured);

                // Set callbacks
                Crashes.ShouldProcessErrorReport    = ShouldProcess;
                Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;
                Crashes.GetErrorAttachments         = GetErrorAttachments;
                Distribute.ReleaseAvailable         = OnReleaseAvailable;

                // Event handlers
                Crashes.SendingErrorReport      += SendingErrorReportHandler;
                Crashes.SentErrorReport         += SentErrorReportHandler;
                Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;
                Push.PushNotificationReceived   += PrintNotification;

                AppCenterLog.Assert(LogTag, "AppCenter.Configured=" + AppCenter.Configured);

                var appSecrets = GetAppSecretDictionary();
                AppCenter.Start($"uwp={appSecrets[XamarinDevice.UWP]};android={appSecrets[XamarinDevice.Android]};ios={appSecrets[XamarinDevice.iOS]}", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Auth), typeof(Data));
                if (Current.Properties.ContainsKey(Constants.UserId) && Current.Properties[Constants.UserId] is string id)
                {
                    AppCenter.SetUserId(id);
                }

                // Work around for SetUserId race condition.
                AppCenter.Start(typeof(Push));
                AppCenter.IsEnabledAsync().ContinueWith(enabled =>
                {
                    AppCenterLog.Info(LogTag, "AppCenter.Enabled=" + enabled.Result);
                });
                AppCenter.GetInstallIdAsync().ContinueWith(installId =>
                {
                    AppCenterLog.Info(LogTag, "AppCenter.InstallId=" + installId.Result);
                });
                AppCenterLog.Info(LogTag, "AppCenter.SdkVersion=" + AppCenter.SdkVersion);
                Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
                {
                    AppCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
                });
                Crashes.GetLastSessionCrashReportAsync().ContinueWith(task =>
                {
                    AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.StackTrace=" + task.Result?.StackTrace);
                });
            }
        }
        /// <summary>
        /// Extension method that provides a <see cref="LoggerConfiguration" /> and starts <see cref="AppCenter"/>.
        /// </summary>
        /// <param name="loggerConfiguration">The logger configuration.</param>
        /// <param name="appCenterSecret">The application center secret.</param>
        /// <param name="restrictedToMinimumLevel">The minimum log level.</param>
        /// <param name="formatProvider">The format provider.</param>
        /// <param name="properties">The properties.</param>
        /// <param name="types">The <see cref="AppCenter"/> types.</param>
        /// <returns>
        /// The logger configuration with an AppCenterSink.
        /// </returns>
        public static LoggerConfiguration AppCenterCrashes(
            this LoggerSinkConfiguration loggerConfiguration,
            string appCenterSecret,
            LogEventLevel restrictedToMinimumLevel  = LogEventLevel.Error,
            ITextFormatter formatProvider           = null,
            IDictionary <string, string> properties = null,
            params Type[] types)
        {
            if (!(string.IsNullOrEmpty(appCenterSecret) || AppCenter.IsEnabledAsync().GetAwaiter().GetResult()))
            {
                AppCenter.Start(appCenterSecret, types);
            }

            return(loggerConfiguration.AppCenterCrashes(restrictedToMinimumLevel, formatProvider, properties));
        }
Ejemplo n.º 30
0
        public void SetEnabledDifferentValueAfterConfigure()
        {
            _channelGroupMock.Setup(
                group => group.AddChannel(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <TimeSpan>(), It.IsAny <int>()))
            .Returns(new Mock <IChannelUnit>().Object);
            AppCenter.Start("appsecret", typeof(MockAppCenterService));
            var setVal = !AppCenter.IsEnabledAsync().Result;

            AppCenter.SetEnabledAsync(setVal).Wait();

            MockAppCenterService.Instance.MockInstance.VerifySet(service => service.InstanceEnabled = setVal,
                                                                 Times.Once());
            _settingsMock.Verify(settings => settings.SetValue(AppCenter.EnabledKey, setVal), Times.Once());
            _channelGroupMock.Verify(channelGroup => channelGroup.SetEnabled(setVal), Times.Once());
        }