Beispiel #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();
        }
Beispiel #2
0
        private async void IsUpdate(bool isIos, string version, bool expected)
        {
            string content = GetTestJson(JSON_VERSION1);

            var jsonContent = new StringContent(
                content,
                Encoding.UTF8,
                "application/json"
                );
            var client = HttpClientUtils.CreateHttpClient(HttpStatusCode.OK, jsonContent);

            _mockClientService.Setup(x => x.Create()).Returns(client);

            _mockEssentialsService.Setup(x => x.IsIos).Returns(isIos);
            _mockEssentialsService.Setup(x => x.AppVersion).Returns(version);

            ICheckVersionService service = CreateService();

            bool isUpdated = await service.IsUpdateVersionExistAsync();

            Assert.Equal(expected, isUpdated);
        }