From 3b6edc51762b39686f5ab1fc4f0a3663640761b3 Mon Sep 17 00:00:00 2001
From: cocoa-dev003 <66989607+cocoa-dev003@users.noreply.github.com>
Date: Mon, 17 Oct 2022 11:16:50 +0900
Subject: [PATCH 1/2] Fixed SurveyPage layout
---
.../Covid19Radar/Model/SurveyContent.cs | 4 +-
.../Resources/AppResources.Designer.cs | 35 ++++++++++--
.../Resources/AppResources.ja.resx | 43 +++++++++------
.../Covid19Radar/Resources/AppResources.resx | 28 +++++++---
.../Resources/AppResources.zh-Hans.resx | 28 +++++++---
.../Covid19Radar/Services/SurveyService.cs | 11 ++--
.../EndOfService/SurveyPageViewModel.cs | 36 +++++++------
.../Views/EndOfService/SurveyPage.xaml | 53 ++++++++++++++-----
.../Services/SurveyServiceTests.cs | 35 ++++++------
.../EndOfService/SurveyPageViewModelTests.cs | 22 ++++----
.../TerminationOfUsePageViewModelTests.cs | 8 +--
11 files changed, 202 insertions(+), 101 deletions(-)
diff --git a/Covid19Radar/Covid19Radar/Model/SurveyContent.cs b/Covid19Radar/Covid19Radar/Model/SurveyContent.cs
index d5376b386..6c74d0d1f 100644
--- a/Covid19Radar/Covid19Radar/Model/SurveyContent.cs
+++ b/Covid19Radar/Covid19Radar/Model/SurveyContent.cs
@@ -15,8 +15,8 @@ public class SurveyContent
[JsonProperty("q2")]
public int Q2 { get; set; }
- [JsonProperty("q3")]
- public long Q3 { get; set; }
+ [JsonProperty("start_date")]
+ public long? StartDate { get; set; }
[JsonProperty("exposure_data")]
public SurveyExposureData ExposureData { get; set; }
diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs b/Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs
index 08d5cddef..bcc98f1fe 100644
--- a/Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs
+++ b/Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs
@@ -2954,6 +2954,33 @@ public static string SubmitDiagnosisKeysPageTitle {
}
}
+ ///
+ /// Looks up a localized string similar to TODO.
+ ///
+ public static string SurveyPageAppStartDateSwitch {
+ get {
+ return ResourceManager.GetString("SurveyPageAppStartDateSwitch", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to TODO.
+ ///
+ public static string SurveyPageAppStartDateText {
+ get {
+ return ResourceManager.GetString("SurveyPageAppStartDateText", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to TODO.
+ ///
+ public static string SurveyPageDescription {
+ get {
+ return ResourceManager.GetString("SurveyPageDescription", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to TODO.
///
@@ -3047,18 +3074,18 @@ public static string SurveyPageQ2A2 {
///
/// Looks up a localized string similar to TODO.
///
- public static string SurveyPageQ2Text {
+ public static string SurveyPageQ2Description {
get {
- return ResourceManager.GetString("SurveyPageQ2Text", resourceCulture);
+ return ResourceManager.GetString("SurveyPageQ2Description", resourceCulture);
}
}
///
/// Looks up a localized string similar to TODO.
///
- public static string SurveyPageQuestion3 {
+ public static string SurveyPageQ2Text {
get {
- return ResourceManager.GetString("SurveyPageQuestion3", resourceCulture);
+ return ResourceManager.GetString("SurveyPageQ2Text", resourceCulture);
}
}
diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx b/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx
index a58c2cd48..d91fb182e 100644
--- a/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx
+++ b/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx
@@ -1660,32 +1660,40 @@ COCOAのソースコードは次のURLから入手できます。
利用調査
- アンケート
- アンケート
+ 利用者に関するアンケート
+ 利用者に関するアンケート
Q1:年代
Q1:年代
- Q2:日常的な通勤通学の有無
- Q2:日常的な通勤通学の有無
+ Q2:週に1回以上の通勤通学の有無
+ Q2:週に1回以上の通勤通学の有無
-
- Q3:アプリ利用開始日
- Q3:アプリ利用開始日
+
+ (公共交通機関とは、鉄道・電車・乗り合いバスのことです)
+ (公共交通機関とは、鉄道・電車・乗り合いバスのことです)
- 接触情報提供のお願い
- 接触情報提供のお願い
+ 接触通知発生回数の調査
+ 接触通知発生回数の調査
- 保存している接触情報を添付してよろしいですか。送信を許可する場合はチェックを入れてください。
- 保存している接触情報を添付してよろしいですか。送信を許可する場合はチェックを入れてください。
+ 2022年4月7日以降の接触通知発生回数(個人情報は含まれません)を添付してよろしいですか。送信を許可する場合はチェックを入れてください。
+ 2022年4月7日以降の接触通知発生回数(個人情報は含まれません)を添付してよろしいですか。送信を許可する場合はチェックを入れてください。
+
+
+ アプリ利用開始日
+ アプリ利用開始日
+
+
+ ({0})
+ ({0})
- 接触情報の提供
- 接触情報の提供
+ 接触通知発生回数
+ 接触通知発生回数
選択してください
@@ -1711,8 +1719,13 @@ COCOAのソースコードは次のURLから入手できます。
無し
無し
+
+ 回答を確定した後、利用を終了することで回答が送信されます。
+一度送信された調査への回答の訂正・取り消しはできませんので、ご注意ください。
+ 回答を確定した後、利用を終了することで回答が送信されます。一度送信された調査への回答の訂正・取り消しはできませんので、ご注意ください。
+
- 利用終了の確認へ
- 利用終了の確認へ
+ 回答を確定する
+ 回答を確定する
diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.resx b/Covid19Radar/Covid19Radar/Resources/AppResources.resx
index 782a40818..55ceb8730 100644
--- a/Covid19Radar/Covid19Radar/Resources/AppResources.resx
+++ b/Covid19Radar/Covid19Radar/Resources/AppResources.resx
@@ -1763,7 +1763,7 @@ By collecting the number of notifications, we can use it to understand how many
TODO
- アンケート
+ 利用者に関するアンケート
TODO
@@ -1771,23 +1771,31 @@ By collecting the number of notifications, we can use it to understand how many
TODO
- Q2:日常的な通勤通学の有無
+ Q2:週に1回以上の通勤通学の有無
-
+
TODO
- Q3:アプリ利用開始日
+ (公共交通機関とは、鉄道・電車・乗り合いバスのことです)
TODO
- 接触情報提供のお願い
+ 接触通知発生回数の調査
TODO
- 保存している接触情報を添付してよろしいですか。送信を許可する場合はチェックを入れてください。
+ 2022年4月7日以降の接触通知発生回数(個人情報は含まれません)を添付してよろしいですか。送信を許可する場合はチェックを入れてください。
+
+
+ TODO
+ アプリ利用開始日
+
+
+ TODO
+ ({0})
TODO
- 接触情報の提供
+ 接触通知発生回数
TODO
@@ -1813,8 +1821,12 @@ By collecting the number of notifications, we can use it to understand how many
TODO
無し
+
+ TODO
+ 回答を確定した後、利用を終了することで回答が送信されます。一度送信された調査への回答の訂正・取り消しはできませんので、ご注意ください。
+
TODO
- 利用終了の確認へ
+ 回答を確定する
diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx b/Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx
index 899dd2989..9e0d7faa0 100644
--- a/Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx
+++ b/Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx
@@ -1660,7 +1660,7 @@ COCOAのソースコードは次のURLから入手できます。
TODO
- アンケート
+ 利用者に関するアンケート
TODO
@@ -1668,23 +1668,31 @@ COCOAのソースコードは次のURLから入手できます。
TODO
- Q2:日常的な通勤通学の有無
+ Q2:週に1回以上の通勤通学の有無
-
+
TODO
- Q3:アプリ利用開始日
+ (公共交通機関とは、鉄道・電車・乗り合いバスのことです)
TODO
- 接触情報提供のお願い
+ 接触通知発生回数の調査
TODO
- 保存している接触情報を添付してよろしいですか。送信を許可する場合はチェックを入れてください。
+ 2022年4月7日以降の接触通知発生回数(個人情報は含まれません)を添付してよろしいですか。送信を許可する場合はチェックを入れてください。
+
+
+ TODO
+ アプリ利用開始日
+
+
+ TODO
+ ({0})
TODO
- 接触情報の提供
+ 接触通知発生回数
TODO
@@ -1710,8 +1718,12 @@ COCOAのソースコードは次のURLから入手できます。
TODO
無し
+
+ TODO
+ 回答を確定した後、利用を終了することで回答が送信されます。一度送信された調査への回答の訂正・取り消しはできませんので、ご注意ください。
+
TODO
- 利用終了の確認へ
+ 回答を確定する
diff --git a/Covid19Radar/Covid19Radar/Services/SurveyService.cs b/Covid19Radar/Covid19Radar/Services/SurveyService.cs
index 596a344e1..ef867a7da 100644
--- a/Covid19Radar/Covid19Radar/Services/SurveyService.cs
+++ b/Covid19Radar/Covid19Radar/Services/SurveyService.cs
@@ -13,7 +13,7 @@ namespace Covid19Radar.Services
{
public interface ISurveyService
{
- Task BuildSurveyContent(int q1, int q2, DateTime q3, bool isExposureDataProvision);
+ Task BuildSurveyContent(int q1, int q2, bool isAppStartDate, bool isExposureDataProvision);
Task SubmitSurvey(SurveyContent surveyContent);
}
@@ -21,23 +21,26 @@ public class SurveyService : ISurveyService
{
private readonly IEventLogService _eventLogService;
private readonly IExposureDataRepository _exposureDataRepository;
+ private readonly IUserDataRepository _userDataRepository;
public SurveyService(
IEventLogService eventLogService,
- IExposureDataRepository exposureDataRepository
+ IExposureDataRepository exposureDataRepository,
+ IUserDataRepository userDataRepository
)
{
_eventLogService = eventLogService;
_exposureDataRepository = exposureDataRepository;
+ _userDataRepository = userDataRepository;
}
- public async Task BuildSurveyContent(int q1, int q2, DateTime q3, bool isExposureDataProvision)
+ public async Task BuildSurveyContent(int q1, int q2, bool isAppStartDate, bool isExposureDataProvision)
{
var surveyContent = new SurveyContent
{
Q1 = q1,
Q2 = q2,
- Q3 = q3.ToUnixEpoch(),
+ StartDate = isAppStartDate ? (long?)_userDataRepository.GetStartDate().ToLocalTime().ToUnixEpoch() : null,
ExposureData = isExposureDataProvision ? await GetExopsureData() : null
};
return surveyContent;
diff --git a/Covid19Radar/Covid19Radar/ViewModels/EndOfService/SurveyPageViewModel.cs b/Covid19Radar/Covid19Radar/ViewModels/EndOfService/SurveyPageViewModel.cs
index 033563055..7d7f12385 100644
--- a/Covid19Radar/Covid19Radar/ViewModels/EndOfService/SurveyPageViewModel.cs
+++ b/Covid19Radar/Covid19Radar/ViewModels/EndOfService/SurveyPageViewModel.cs
@@ -7,6 +7,7 @@
using Covid19Radar.Common;
using Covid19Radar.Model;
using Covid19Radar.Repository;
+using Covid19Radar.Resources;
using Covid19Radar.Services;
using Covid19Radar.Services.Logs;
using Covid19Radar.Views.EndOfService;
@@ -20,9 +21,6 @@ public class SurveyPageViewModel : ViewModelBase
private void IsTerminationOfUsePageButtonEnabledChanged()
=> OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsTerminationOfUsePageButtonEnabled)));
- public DateTime MimimumStartDate
- => AppConstants.COCOA_FIRST_RELEASE_DATE.ToLocalTime();
-
private int _selectedIndexQ1;
public int SelectedIndexQ1
{
@@ -63,17 +61,18 @@ public SurveyAnswerPickerItem SelectedItemQ2
set => SetProperty(ref _selectedItemQ2, value);
}
- private DateTime _q3Answer;
- public DateTime Q3Answer
+ private string _appStartDateText;
+ public string AppStartDateText
{
- get => _q3Answer;
- set
- {
- if (SetProperty(ref _q3Answer, value))
- {
- IsTerminationOfUsePageButtonEnabledChanged();
- }
- }
+ get => _appStartDateText;
+ set => SetProperty(ref _appStartDateText, value);
+ }
+
+ private bool _isAppStartDate;
+ public bool IsAppStartDate
+ {
+ get => _isAppStartDate;
+ set => SetProperty(ref _isAppStartDate, value);
}
private bool _isExposureDataProvision;
@@ -84,7 +83,7 @@ public bool IsExposureDataProvision
}
public bool IsTerminationOfUsePageButtonEnabled
- => _selectedIndexQ1 > 0 && _selectedIndexQ2 > 0 && _q3Answer != null;
+ => _selectedIndexQ1 > 0 && _selectedIndexQ2 > 0;
private readonly IUserDataRepository _userDataRepository;
private readonly ISurveyService _surveyService;
@@ -108,8 +107,13 @@ public override void Initialize(INavigationParameters parameters)
SelectedIndexQ2 = 0;
DateTime startDate = _userDataRepository.GetStartDate();
- Q3Answer = startDate.ToLocalTime();
+ AppStartDateText = string.Format(
+ AppResources.SurveyPageAppStartDateText,
+ startDate.ToLocalTime().ToString("yyyy年MM月dd日")
+ );
+
+ IsAppStartDate = false;
IsExposureDataProvision = false;
}
@@ -118,7 +122,7 @@ public override void Initialize(INavigationParameters parameters)
SurveyContent surveyContent = await _surveyService.BuildSurveyContent(
SelectedItemQ1.Value,
SelectedItemQ2.Value,
- Q3Answer,
+ IsAppStartDate,
IsExposureDataProvision);
var navigationParameters = TerminationOfUsePage.BuildNavigationParams(surveyContent);
diff --git a/Covid19Radar/Covid19Radar/Views/EndOfService/SurveyPage.xaml b/Covid19Radar/Covid19Radar/Views/EndOfService/SurveyPage.xaml
index 1899280fd..a487304c9 100644
--- a/Covid19Radar/Covid19Radar/Views/EndOfService/SurveyPage.xaml
+++ b/Covid19Radar/Covid19Radar/Views/EndOfService/SurveyPage.xaml
@@ -18,17 +18,17 @@
+
-
+
+
-
+ TextColor="{StaticResource SecondaryText}"
+ Text="{x:Static resources:AppResources.SurveyPageQ2Description}" />
@@ -82,6 +80,31 @@
Style="{StaticResource DefaultLabel}"
Text="{x:Static resources:AppResources.SurveyPageExposureDataProvisionDescription}" />
+
+
+
+
+
+
+
@@ -98,6 +121,10 @@
HorizontalOptions="End"
VerticalOptions="Center" />
+