예제 #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)
        {
            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();
        }
예제 #3
0
        public async Task ExportAsync(string filePath)
        {
            _loggerService.StartMethod();

            try
            {
                long enVersion = await _exposureNotificationApiService.GetVersionAsync();

                List <DailySummary> dailySummaryList = await _exposureDataRepository.GetDailySummariesAsync();

                List <ExposureWindow> exposureWindowList = await _exposureDataRepository.GetExposureWindowsAsync();

                ExposureConfiguration exposureConfiguration = await _exposureConfigurationRepository.GetExposureConfigurationAsync();

                var exposureData = new ExposureData(
                    _essentialsService.Platform,
                    _essentialsService.PlatformVersion,
                    _essentialsService.Model,
                    _essentialsService.DeviceType,
                    _essentialsService.AppVersion,
                    _essentialsService.BuildNumber,
                    enVersion.ToString(),
                    dailySummaryList,
                    exposureWindowList,
                    exposureConfiguration
                    );

                string exposureDataJson = JsonConvert.SerializeObject(exposureData, Formatting.Indented);

                await File.WriteAllTextAsync(filePath, exposureDataJson);
            }
            finally
            {
                _loggerService.EndMethod();
            }
        }