Exemplo n.º 1
0
        private async Task ProvideDiagnosisKeys()
        {
            var diagnosisKeyPaths = await PrepareDiagnosisKeyFilesAsync();

            if (diagnosisKeyPaths.Count == 0)
            {
                status.Text = "No diagnosisKey file found";
                return;
            }

            try
            {
                await EnClient.ProvideDiagnosisKeysAsync(diagnosisKeyPaths);
            }
            catch (TimeoutException exception)
            {
                Logger.E(exception);
            }
            catch (ENException enException)
            {
                ShowENException(enException);
            }
            catch (ApiException apiException)
            {
                ShowApiException("ProvideDiagnosisKeys", apiException);
            }
        }
Exemplo n.º 2
0
        public Task ExceptionOccurredAsync(Exception exception)
        {
            Logger.E(exception);

            return(Task.CompletedTask);
        }
Exemplo n.º 3
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();

            Logger.D("ViewDidLoad");

            PrepareDirs();

            IList <ExposureNotificationStatus> statuses = await ExposureNotificationClientManager.Shared.GetStatusesAsync();

            long version = await ExposureNotificationClientManager.Shared.GetVersionAsync();

            ShowStatus(statuses, version);

            buttonEnableEn.TouchUpInside += async(sender, e) =>
            {
                status.Text = "Enable Exposure Notification is clicked.\n";

                try
                {
                    await ExposureNotificationClientManager.Shared.StartAsync();

                    IList <ExposureNotificationStatus> statuses = await ExposureNotificationClientManager.Shared.GetStatusesAsync();

                    long version = await ExposureNotificationClientManager.Shared.GetVersionAsync();

                    ShowStatus(statuses, version);
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonShowTeksHistory.TouchUpInside += async(sender, e) =>
            {
                status.Text = "Show TEKs History is clicked.\n";
                try
                {
                    List <TemporaryExposureKey> teks = await ExposureNotificationClientManager.Shared.GetTemporaryExposureKeyHistoryAsync();

                    ShowTeks(teks);
                    await SaveTeksAsync(teks);
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonDetectExposure.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await DetectExposure();
                }
                catch (TaskCanceledException exception)
                {
                    Logger.E(exception);
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonRequestPreauthorizedKeys.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await RequestPreauthorizedKeys();
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonRequestReleaseKeys.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await RequestReleaseKeys();
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonUploadDiagnosisKeys.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await UploadDiagnosisKeys();
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };
            buttonDownloadDiagnosisKeys.TouchUpInside += async(sender, e) =>
            {
                try
                {
                    await DownloadDiagnosisKeys();
                }
                catch (ENException enException)
                {
                    ShowENException(enException);
                }
                catch (NSErrorException exception)
                {
                    exception.LogD();
                }
            };

            _diagnosisKeyServerConfiguration = await LoadDiagnosisKeyServerConfiguration();

            _diagnosisKeyServer = new DiagnosisKeyServer(_diagnosisKeyServerConfiguration);
            ShowServerConfiguration(_diagnosisKeyServerConfiguration);
        }