Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

完全停止判断処理を追加 #1161

Merged
merged 3 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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.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 = new DateTime(2023, 4, 1, 0, 0, 0).ToUnixEpoch();
This conversation was marked as resolved.
Show resolved Hide resolved

public EndOfServiceNoticePageViewModel(
INavigationService navigationService,
ILoggerService loggerService
) : base(navigationService)
{
_loggerService = loggerService;
}

public Command OnTerminationProcedureButton => new Command(async () =>
{
_loggerService.StartMethod();

if (FullStopDateTime <= DateTime.Now.ToUnixEpoch())
This conversation was marked as resolved.
Show resolved Hide resolved
{
await NavigationService.NavigateAsync(nameof(SurveyRequestPage));
}
else
{
await NavigationService.NavigateAsync(nameof(TerminationOfUsePage));
}

_loggerService.EndMethod();
});
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<Label
Margin="0, 20, 0, 0"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{Binding CheckDetailsLinkReadText}"
Style="{StaticResource LinkLabelStyleMedium}"
HorizontalTextAlignment="Center"
Text="{x:Static resources:AppResources.EndOfServiceNoticePageTextLink}">
Expand All @@ -47,6 +48,7 @@
</Label>
<Button
AutomationProperties.IsInAccessibleTree="True"
Command="{Binding Path=OnTerminationProcedureButton}"
Style="{StaticResource DefaultButton}"
Text="{x:Static resources:AppResources.EndOfServiceNoticePageButton}" />
</StackLayout>
Expand Down