diff --git a/Covid19Radar/Covid19Radar/ViewModels/EndOfService/EndOfServiceNoticePageViewModel.cs b/Covid19Radar/Covid19Radar/ViewModels/EndOfService/EndOfServiceNoticePageViewModel.cs new file mode 100644 index 000000000..6c69bd683 --- /dev/null +++ b/Covid19Radar/Covid19Radar/ViewModels/EndOfService/EndOfServiceNoticePageViewModel.cs @@ -0,0 +1,47 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. +using System; +using Covid19Radar.Common; +using Covid19Radar.Resources; +using Covid19Radar.Services.Logs; +using Covid19Radar.Views.EndOfService; +using Prism.Navigation; +using Xamarin.Forms; + +namespace Covid19Radar.ViewModels.EndOfService +{ + public class EndOfServiceNoticePageViewModel : ViewModelBase + { + public string CheckDetailsLinkReadText => $"{AppResources.EndOfServiceNoticePageTextLink} {AppResources.Button}"; + + private readonly ILoggerService _loggerService; + + private readonly long FullStopDateTime = TimeZoneInfo.ConvertTime(new DateTime(2023, 4, 1, 0, 0, 0), AppConstants.TIMEZONE_JST).ToUnixEpoch(); + + public EndOfServiceNoticePageViewModel( + INavigationService navigationService, + ILoggerService loggerService + ) : base(navigationService) + { + _loggerService = loggerService; + } + + public Command OnTerminationProcedureButton => new Command(async () => + { + _loggerService.StartMethod(); + + if (FullStopDateTime <= Utils.JstNow().ToUnixEpoch()) + { + await NavigationService.NavigateAsync(nameof(SurveyRequestPage)); + } + else + { + await NavigationService.NavigateAsync(nameof(TerminationOfUsePage)); + } + + _loggerService.EndMethod(); + }); + } +} + diff --git a/Covid19Radar/Covid19Radar/ViewModels/HelpPage/SendLogCompletePageViewModel.cs b/Covid19Radar/Covid19Radar/ViewModels/HelpPage/SendLogCompletePageViewModel.cs index 79604d16e..0f68266b1 100644 --- a/Covid19Radar/Covid19Radar/ViewModels/HelpPage/SendLogCompletePageViewModel.cs +++ b/Covid19Radar/Covid19Radar/ViewModels/HelpPage/SendLogCompletePageViewModel.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Covid19Radar.Services.Logs; using Covid19Radar.Views; +using Covid19Radar.Views.EndOfService; using Prism.Navigation; using Xamarin.Essentials; using Xamarin.Forms; @@ -71,7 +72,7 @@ public override void Initialize(INavigationParameters parameters) private async Task NavigateToHomeAsync() { - _ = await NavigationService.NavigateAsync($"/{nameof(MenuPage)}/{nameof(NavigationPage)}/{nameof(HomePage)}"); + _ = await NavigationService.NavigateAsync($"/{nameof(MenuPage)}/{nameof(NavigationPage)}/{nameof(EndOfServiceNoticePage)}"); } } } diff --git a/Covid19Radar/Covid19Radar/Views/EndOfService/EndOfServiceNoticePage.xaml b/Covid19Radar/Covid19Radar/Views/EndOfService/EndOfServiceNoticePage.xaml index e20542be1..c14e2094c 100644 --- a/Covid19Radar/Covid19Radar/Views/EndOfService/EndOfServiceNoticePage.xaml +++ b/Covid19Radar/Covid19Radar/Views/EndOfService/EndOfServiceNoticePage.xaml @@ -38,6 +38,7 @@