From bda076ac1d106578c37c6ee441051c47a2ceec60 Mon Sep 17 00:00:00 2001 From: Satoshi Nakamura Date: Thu, 25 Jun 2020 13:08:22 +0900 Subject: [PATCH 1/3] update HomePage #534 --- Covid19Radar/Covid19Radar/App.xaml | 4 + .../Resources/AppResources.ja.resx | 8 ++ .../Covid19Radar/Resources/AppResources.resx | 8 ++ .../ViewModels/HomePage/HomePageViewModel.cs | 21 ++++ .../Covid19Radar/Views/HomePage/HomePage.xaml | 117 ++++++++++++++---- 5 files changed, 132 insertions(+), 26 deletions(-) diff --git a/Covid19Radar/Covid19Radar/App.xaml b/Covid19Radar/Covid19Radar/App.xaml index 46191112..449f60ab 100644 --- a/Covid19Radar/Covid19Radar/App.xaml +++ b/Covid19Radar/Covid19Radar/App.xaml @@ -26,6 +26,8 @@ #A4A4A4 #000000 #FFFFFF + #31BA81 + #E6D200 @@ -50,6 +52,8 @@ + 󰸞 + 󱈸 diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx b/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx index b219a670..3b9ad365 100644 --- a/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx +++ b/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx @@ -361,6 +361,14 @@ アプリを周りの人に知らせる アプリを周りの人に知らせる + + 接触確認の設定はすべて有効です。 + 接触確認の設定はすべて有効です。 + + + 機能が無効になっています。設定ページで接触の検出と通知をONにしてください。 + 機能が無効になっています。設定ページで接触の検出と通知をONにしてください。 + ホーム ホーム diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.resx b/Covid19Radar/Covid19Radar/Resources/AppResources.resx index 358b723e..11e723f0 100644 --- a/Covid19Radar/Covid19Radar/Resources/AppResources.resx +++ b/Covid19Radar/Covid19Radar/Resources/AppResources.resx @@ -498,6 +498,14 @@ Share this app アプリを周りの人に知らせる + + Contact confirmation settings are all enabled. + 接触確認の設定はすべて有効です。 + + + Contact confirmation settings are disabled. Please turn on notifications and recording on the SettingsPage. + 機能が無効になっています。設定ページで接触の検出と通知をONにしてください。 + Home ホーム diff --git a/Covid19Radar/Covid19Radar/ViewModels/HomePage/HomePageViewModel.cs b/Covid19Radar/Covid19Radar/ViewModels/HomePage/HomePageViewModel.cs index 8b57dc8e..674a34ae 100644 --- a/Covid19Radar/Covid19Radar/ViewModels/HomePage/HomePageViewModel.cs +++ b/Covid19Radar/Covid19Radar/ViewModels/HomePage/HomePageViewModel.cs @@ -28,6 +28,13 @@ public string PastDate set { SetProperty(ref _pastDate, value); } } + private bool _IsAvailable; + public bool IsAvailable + { + get => _IsAvailable; + set => SetProperty(ref _IsAvailable, value); + } + public HomePageViewModel(INavigationService navigationService, UserDataService userDataService, ExposureNotificationService exposureNotificationService) : base(navigationService, userDataService, exposureNotificationService) { Title = AppResources.HomePageTitle; @@ -39,6 +46,20 @@ public HomePageViewModel(INavigationService navigationService, UserDataService u TimeSpan timeSpan = DateTime.Now - userData.StartDateTime; PastDate = timeSpan.Days.ToString(); + + IsAvailable = userData.IsExposureNotificationEnabled && userData.IsNotificationEnabled; + this.userDataService.UserDataChanged += OnUserDataChanged; + } + + public override void Destroy() + { + base.Destroy(); + userDataService.UserDataChanged -= OnUserDataChanged; + } + + private void OnUserDataChanged(object sender, UserDataModel e) + { + IsAvailable = e.IsExposureNotificationEnabled && e.IsNotificationEnabled; } public override async void Initialize(INavigationParameters parameters) diff --git a/Covid19Radar/Covid19Radar/Views/HomePage/HomePage.xaml b/Covid19Radar/Covid19Radar/Views/HomePage/HomePage.xaml index f0f2a244..2ce4026f 100644 --- a/Covid19Radar/Covid19Radar/Views/HomePage/HomePage.xaml +++ b/Covid19Radar/Covid19Radar/Views/HomePage/HomePage.xaml @@ -26,33 +26,98 @@ Padding="15" BackgroundColor="#EEEEEE" Spacing="15"> - - - - + +