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

Commit

Permalink
Add UseStable button in InqueryPage.
Browse files Browse the repository at this point in the history
  • Loading branch information
keiji committed Jan 15, 2022
1 parent 66a6784 commit 3979fcd
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,10 @@
<value>GitHubを開く</value>
<comment>GitHubを開く</comment>
</data>
<data name="InqueryBetaViaGitHubInstallStable" xml:space="preserve">
<value>安定版をインストール</value>
<comment>安定版をインストール</comment>
</data>

<data name="Beta_Splash_WelcomeBeta" xml:space="preserve">
<value>COCOA(Beta)へようこそ!</value>
Expand Down
6 changes: 5 additions & 1 deletion Covid19Radar/Covid19Radar/Resources/AppResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,10 @@ Note: this app does not collect users’ location information.</value>
<value>Open GitHub</value>
<comment>GitHubを開く</comment>
</data>
<data name="InqueryBetaViaGitHubInstallStable" xml:space="preserve">
<value>Use Stable veriosn</value>
<comment>安定版をインストール</comment>
</data>

<data name="Beta_Splash_WelcomeBeta" xml:space="preserve">
<value>Welcome COCOA(Beta)!!</value>
Expand Down Expand Up @@ -1365,7 +1369,7 @@ Note: this app does not collect users’ location information.</value>
<comment>COCOA(Beta)を利用する</comment>
</data>
<data name="Beta_Splash_InstallStable" xml:space="preserve">
<value>Use Stable veriosn.</value>
<value>Use Stable veriosn</value>
<comment>安定版をインストール</comment>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Threading.Tasks;
using Covid19Radar.Resources;
using Covid19Radar.Services;
using Covid19Radar.Services.Logs;
using Covid19Radar.Views;
using Prism.Navigation;
Expand All @@ -16,14 +17,20 @@ namespace Covid19Radar.ViewModels
public class InqueryPageViewModel : ViewModelBase
{
private readonly ILoggerService loggerService;
private readonly IEssentialsService essentialService;

public Func<string, BrowserLaunchMode, Task> BrowserOpenAsync = Browser.OpenAsync;
public Func<string, string, string[], Task> ComposeEmailAsync { get; set; } = Email.ComposeAsync;

public InqueryPageViewModel(INavigationService navigationService, ILoggerService loggerService) : base(navigationService)
public InqueryPageViewModel(
INavigationService navigationService,
ILoggerService loggerService,
IEssentialsService eseentialService
) : base(navigationService)
{
Title = AppResources.InqueryPageTitle;
this.loggerService = loggerService;
this.essentialService = eseentialService;
}

public Command OpenGitHub => new Command(async () =>
Expand All @@ -32,6 +39,16 @@ public InqueryPageViewModel(INavigationService navigationService, ILoggerService
await BrowserOpenAsync(url, BrowserLaunchMode.External);
});

public Command OnClickUseStable => new Command(async () =>
{
loggerService.StartMethod();

var url = essentialService.StoreUrl;
await BrowserOpenAsync(url, BrowserLaunchMode.External);

loggerService.EndMethod();
});

public Command OnClickQuestionCommand => new Command(async () =>
{
loggerService.StartMethod();
Expand Down
9 changes: 9 additions & 0 deletions Covid19Radar/Covid19Radar/Views/HelpPage/InqueryPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@
Style="{StaticResource DefaultButton}"
Text="{x:Static resources:AppResources.InqueryBetaViaGitHub}" />

<Button
AutomationProperties.IsInAccessibleTree="True"
TabIndex="7"
Margin="0,10,0,10"
Command="{Binding Path=OnClickUseStable}"
Style="{StaticResource DefaultButton}"
Text="{x:Static resources:AppResources.InqueryBetaViaGitHubInstallStable}"
/>

<BoxView Style="{StaticResource DefaultLineStyle}" />

</StackLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Threading.Tasks;
using Covid19Radar.Services;
using Covid19Radar.Services.Logs;
using Covid19Radar.ViewModels;
using Moq;
Expand All @@ -18,20 +19,24 @@ public class InqueryPageViewModelTests
private readonly MockRepository mockRepository;
private readonly Mock<INavigationService> mockNavigationService;
private readonly Mock<ILoggerService> mockLoggerService;
private readonly Mock<IEssentialsService> mockEssentialsService;


public InqueryPageViewModelTests()
{
mockRepository = new MockRepository(MockBehavior.Default);
mockNavigationService = mockRepository.Create<INavigationService>();
mockLoggerService = mockRepository.Create<ILoggerService>();
mockEssentialsService = mockRepository.Create<IEssentialsService>();
}

private InqueryPageViewModel CreateViewModel()
{
var vm = new InqueryPageViewModel(
mockNavigationService.Object,
mockLoggerService.Object);
mockLoggerService.Object,
mockEssentialsService.Object
);
return vm;
}

Expand Down

0 comments on commit 3979fcd

Please sign in to comment.