예제 #1
0
        public override async void Initialize(INavigationParameters parameters)
        {
            base.Initialize(parameters);

            loggerService.StartMethod();

            // It seems the life cycle methods are not called after background fetch in iOS.
            // The days of use will be updated at this time.
            MessagingCenter.Unsubscribe <object>(this, AppConstants.IosOnActivatedMessage);
            MessagingCenter.Subscribe <object>(this, AppConstants.IosOnActivatedMessage, async(sender) =>
            {
                await UpdateView();
            });

            // Check Version
            _ = Task.Run(async() => {
                bool isUpdated = await checkVersionService.IsUpdateVersionExistAsync();
                if (isUpdated)
                {
                    MainThread.BeginInvokeOnMainThread(async() =>
                    {
                        await UserDialogs.Instance.AlertAsync(
                            AppResources.AppUtilsGetNewVersionDescription,
                            AppResources.AppUtilsGetNewVersionTitle,
                            AppResources.ButtonOk
                            );
                        await Browser.OpenAsync(essentialsService.StoreUrl, BrowserLaunchMode.External);
                    });
                }
            });

            // Load necessary files asynchronous
            _ = exposureConfigurationRepository.GetExposureConfigurationAsync();
            _ = exposureRiskCalculationConfigurationRepository
                .GetExposureRiskCalculationConfigurationAsync(preferCache: false);

            await localNotificationService.PrepareAsync();

            await StartExposureNotificationAsync();

            ExposureDetectionAsync();

            loggerService.EndMethod();
        }
예제 #2
0
        public override async void Initialize(INavigationParameters parameters)
        {
            loggerService.StartMethod();

            // It seems the life cycle methods are not called after background fetch in iOS.
            // The days of use will be updated at this time.
            MessagingCenter.Unsubscribe <object>(this, AppConstants.IosOnActivatedMessage);
            MessagingCenter.Subscribe <object>(this, AppConstants.IosOnActivatedMessage, (sender) =>
            {
                SettingDaysOfUse();
            });

            var startDate = userDataService.GetStartDate();

            StartDate = startDate.ToLocalTime().ToString("D");

            SettingDaysOfUse();

            // Check Version
            AppUtils.CheckVersion(loggerService);
            try
            {
                await exposureNotificationService.StartExposureNotification();

                await exposureNotificationService.FetchExposureKeyAsync();

                var statusMessage = await exposureNotificationService.UpdateStatusMessageAsync();

                loggerService.Info($"Exposure notification status: {statusMessage}");

                base.Initialize(parameters);

                loggerService.EndMethod();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());

                loggerService.Exception("Failed to exposure notification status.", ex);
                loggerService.EndMethod();
            }

            await localNotificationService.PrepareAsync();
        }
예제 #3
0
        public override async void Initialize(INavigationParameters parameters)
        {
            base.Initialize(parameters);

            loggerService.StartMethod();

            // It seems the life cycle methods are not called after background fetch in iOS.
            // The days of use will be updated at this time.
            MessagingCenter.Unsubscribe <object>(this, AppConstants.IosOnActivatedMessage);
            MessagingCenter.Subscribe <object>(this, AppConstants.IosOnActivatedMessage, async(sender) =>
            {
                await UpdateView();
            });

            // Check Version
            AppUtils.CheckVersion(loggerService);

            // Load necessary files asynchronous
            _ = exposureConfigurationRepository.GetExposureConfigurationAsync();
            _ = exposureRiskCalculationConfigurationRepository
                .GetExposureRiskCalculationConfigurationAsync(preferCache: false);

            await localNotificationService.PrepareAsync();

            await StartExposureNotificationAsync();

            _ = Task.Run(async() => {
                try
                {
                    await exposureDetectionBackgroundService.ExposureDetectionAsync();
                }
                finally
                {
                    await UpdateView();
                }
            });

            loggerService.EndMethod();
        }