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

DebugPage の実装 #178

Merged
merged 26 commits into from
Sep 2, 2021
Merged

Conversation

i-maruyama
Copy link
Contributor

@i-maruyama i-maruyama commented May 14, 2021

Issue 番号 / Issue ID

目的 / Purpose

  • DebugPage の実装。当初予定の追加機能は別 issue とし、シンプルなものに限定しました。

破壊的変更をもたらしますか / Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request の種類 / Pull Request type

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

検証方法 / How to test

  • Debug_Mock ビルドでの実行テスト
  • Release ビルドには影響しないことのチェック(コードレビューレベルで良い)

プロプロセッサによって Release ビルドでは、メニューに表示されません。

コードの入手 / Get the code

git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
dotnet restore

コードの検証 / Test the code

  1. Debug_Mock ビルドで実行します。
  2. メニューからデバッグページを選択
  3. 情報やボタンがあることを確認
  4. リロードやナビゲーションが動くことを確認

確認事項 / What to check

  • 機能ボタンは、主に SettingsPageViewModel.cs から取ってきているだけで、もともとユーザーが実施可能であったものです。
  • ナビゲーションは、主に App.xaml.cs から取ってきているだけですが、 SplashPage などもとは到達不可能なページが含まれます。
  • いくつかの機能は、現状の Debug_Mock では不十分です。

その他 / Other information

スクリーンショットを #160 に貼っておきます。


Internal IDs:

  • NFR 2532

@fumiya-kume
Copy link
Contributor

[提案] PR のタイトルをPRの内容を説明したものに変更してみませんか?

@i-maruyama i-maruyama changed the title Issue#160 DebugPage の実装(#160) May 14, 2021
@i-maruyama i-maruyama changed the title DebugPage の実装(#160) DebugPage の実装 May 14, 2021
@i-maruyama
Copy link
Contributor Author

ありがとうございます。変更しました。(まだ慣れてません)


namespace Covid19Radar.ViewModels
{
public class DebugPageViewModel : ViewModelBase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[提案] Debug Page 関連は他の画面と少し毛色が違うのでディレクトリ切ってそこに入れませんか?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このページだけのディレクトリを作るのは避けたいのですが、既存のもの(HelpPage, Settings..)だとどれが良いでしょうか?現状のページ配置も、それほど意味を見出せないのですが・・

・・・と、私は悩んで、どれでもいいかとなってしまっています。

Copy link
Contributor

@fumiya-kume fumiya-kume May 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DebugはDebugというだけでドメインが違うので単体でフォルダを切る価値があると思いました。
下手にフォルダの中に入れるのではなく、Viewの直下においても良いかもですね。

現状のページ配置も、それほど意味を見出せないのですが・・.

それな...

Copy link
Contributor Author

@i-maruyama i-maruyama May 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

もし開発チームに意向があればこちらに届けば反映する、という方針にして、ここは見えるようにおいておきます。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは要検討ですね。
itemGroupのような仕掛けでReleaseビルドに含めないようにするのなら、1つのディレクトリ(たとえばDebugPageなど)に集約されていることに意味はあると思います。

一方で、今の名前空間がViewViewModelといった分け方なので、そこにいきなり機能単位のDebugPageが来るのは違和感が拭えません。

となると、View/DebugPageViewModel/DebugPageのようにするのが納得感がある反面、ディレクトリが深くなっただけで1つのファイルしか保存していないなら今のままでいいじゃないかという…

まずはここは課題として残しておき、機能面やその他の場所を見ていきましょう。どこに配置するかは頃合いを見て決めると言うことで。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参考までに、元々あったデバッグページは設定ページと同じディレクトリに置いてありました。
https://github.com/cocoa-mhlw/cocoa/tree/4c4aca39b02dcb1bd89569674b65b0ef6a357bae/Covid19Radar/Covid19Radar/Views/Settings

同じ場所に置くと GitHub の History ボタンから履歴が見やすくなると思います。

Copy link
Contributor Author

@i-maruyama i-maruyama May 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同じ場所に置くと GitHub の History ボタンから履歴が見やすくなると思います。

少なくとも HomePage/ よりは、まともな根拠と思いますので、Settings/ に変えたいですね。ました。
80128f5

x:Class="Covid19Radar.Views.DebugPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

必要ですか?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

安全のための HomePage.xaml からの流用です。とりあえず,このまま同じにしておきますので、一斉除去する機会に掃除してください。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここはVisual Studioさんも指摘している箇所なので、適宜(次に何か手を加えるタイミングででも)消しておいてもらえるとうれしいです!(見落としが発生するかもしれないので、いったんUnresolveにしておきますね。

Screen Shot 2021-05-15 at 23 21 44

ちなみに、開発に参加している人たちがお互いのコードを確認して、気がついたことを指摘する行程をコードレビューと言います。オープンソースでは一般的で、コードをよりよいものにすることを目的としていて、コードの欠点を見つけることは目的としていないのでご安心ください。

コードレビューはコミッター(コードの取り込みを決定する権限のある人)だけでなく、コントリビューター相互で行われる場合があります。

大きいPull Requestだとコードレビューで出てくる指摘も多くなりますし、指摘と修正のやりとりにかかる期間も長くなります。コミッターからの指摘に応じてすぐに直してもらっても、次に同じPull Requestを見るまで期間が空いてしまったりします。なので、さまざまなコントリビューターにレビューに参加してもらえているのは本当にありがたい限りです。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちら初心者(GitHubも)でして、お手数ですが Resolve / Unresolve も適宜お願いいたします。

この部分については、HomePage からの流用であっても xmlns:ffimageloading は不要ですね。(今のDebugPage は画像を使っていないので)
そういうご指摘だったということを今理解しました。なので一つ上の私の解答は、的外れです。

おかげさまで今回、驚くことや学ぶことは多く、皆さんに感謝しています。(迅速なレビューとGitHub PR上のコミット、オンラインの実行テストなど)

i-maruyama and others added 6 commits May 15, 2021 03:07
…el.cs

Co-authored-by: kuu(Fumiya Kume) <kuxu2525@yahoo.co.jp>
…el.cs

Co-authored-by: kuu(Fumiya Kume) <kuxu2525@yahoo.co.jp>
…el.cs

Co-authored-by: kuu(Fumiya Kume) <kuxu2525@yahoo.co.jp>
…el.cs

Co-authored-by: kuu(Fumiya Kume) <kuxu2525@yahoo.co.jp>
@i-maruyama
Copy link
Contributor Author

ありがとうございました。一応エミューレータの再起動を確認してプッシュしました。

@Takym
Copy link
Contributor

Takym commented May 16, 2021

i-maruyama#1 にて Release ビルド時にデバッグページを除外する為の設定をプロジェクトファイルに追加しました。

@i-maruyama
Copy link
Contributor Author

i-maruyama#1 にて Release ビルド時にデバッグページを除外する為の設定をプロジェクトファイルに追加しました。

このようにするのですね。ありがとうございます。取り込みます。
ただ申し訳ないことにこちらの力不足で、 Release ビルドで正しく削除されたかの確認方法が分かりません。

@Takym
Copy link
Contributor

Takym commented May 22, 2021

i-maruyama#1 にて Release ビルド時にデバッグページを除外する為の設定をプロジェクトファイルに追加しました。

このようにするのですね。ありがとうございます。取り込みます。
ただ申し訳ないことにこちらの力不足で、 Release ビルドで正しく削除されたかの確認方法が分かりません。

返信が遅れて申し訳ありません。
Visual Studio からビルド構成を Release に変更するとソリューションエクスプローラからデバッグページ関連のファイルが見えなくなります。ソリューションエクスプローラにはコンパイルするファイルのみ表示されますので、除外されている事が確認できます。

`Release` ビルド時にデバッグページを除外して容量を削減する
@i-maruyama
Copy link
Contributor Author

Visual Studio からビルド構成を Release に変更するとソリューションエクスプローラからデバッグページ関連のファイルが見えなくなります。ソリューションエクスプローラにはコンパイルするファイルのみ表示されますので、除外されている事が確認できます。

確認しました。Covid19Radar.csproj へのPRをマージして、現在のディレクトリ Settings に変更しました。

@Takym
Copy link
Contributor

Takym commented May 26, 2021

確認しました所、下記の2点が気になりました。

  • Covid19Radar/Covid19Radar.Android/Covid19Radar.Android.csproj に意味の無い変更が含まれています。競合を避ける為に元に戻しておくべきだと思います。
  • リソースファイルからライセンス通知が取り除かれてしまっています。ファイルが多いので大変ではありますが、元に戻しておくべきでしょう。

@i-maruyama
Copy link
Contributor Author

i-maruyama commented May 26, 2021

確認しました所、下記の2点が気になりました。

ありがとうございました。1ファイルだけステージングするのを忘れて、
全ファイルコミットしてしまいました。この完全にミスしたコミット
857bc1c
をリバートし、再度ディレクトリ名だけ変更した1ファイルをコミットしなおしています。

リソースファイルからライセンス通知が取り除かれてしまっています。

これもご確認ありがとうございました。( #182 と似た感じでしょうか?)

再度まとめると、もともと 8fbbc10 では、
変更ファイルは5つでした。

これに、 @Takym さんから PR された Covid19Radar.csproj への変更をマージし、
現在は、6つのファイルが変更されていることになります。

@keiji keiji changed the base branch from master to develop June 7, 2021 07:16
var str = new[] { "Build: " + os, "Ver: " + AppSettings.Instance.AppVersion,
"Region: " + string.Join(",", AppSettings.Instance.SupportedRegions), "CdnUrl: " + AppSettings.Instance.CdnUrlBase,
"ApiUrl: " + AppSettings.Instance.ApiUrlBase, "Agree: " + agree, "StartDate: " + userDataService.GetStartDate().ToLocalTime().ToString("F"),
"DaysOfUse: " + userDataService.GetDaysOfUse(), "ExposureCount: " + exposureNotificationService.GetExposureCountToDisplay(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v1.2.4 に対応するため、GetExposureCountToDisplayにしました。

#if DEBUG
MenuItems.Add(new MainMenuModel()
{
Icon = "\uf013",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本質的ではないのですが、虫Icon があるようですね。そちらにしたくなってきました。

var exposureNotificationStatus = await Xamarin.ExposureNotifications.ExposureNotification.IsEnabledAsync();
var exposureNotificationMessage = await exposureNotificationService.UpdateStatusMessageAsync();
// ../../settings.json
var str = new[] { "Build: " + os, "Ver: " + AppSettings.Instance.AppVersion,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting.json から設定される AppSettings.Instance.AppVersion,Write  は、意味のない情報のようで、ログや、バージョンチェックで使われるのは, EssentialsService.AppVersion のようですね。
何を表示させるか?は、もう少し議論が必要だと思います。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

表示するのはEssentialsService.AppVersionにしましょう。

@cocoa-dev cocoa-dev added the confirmed 開発内部管理用 label Jun 30, 2021
@keiji
Copy link
Collaborator

keiji commented Jul 5, 2021

@i-maruyama Pull Requestの向き先をfeature/debug_pageに変えてもいいですか?

@i-maruyama
Copy link
Contributor Author

お願いします。

@keiji keiji changed the base branch from develop to feature/debug_page July 6, 2021 12:57
@keiji
Copy link
Collaborator

keiji commented Jul 6, 2021

向き先変えました! お手数ですがコンフリクトの解消お願いします!

Copy link
Collaborator

@keiji keiji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug_Mockでテストしました。
各ページを直接表示する機能はデザイン調整などに威力を発揮しそうですね。

追記
コンフリクトの解消もお願いします。

Screen Shot 2021-07-12 at 10 35 25

Screen Shot 2021-07-12 at 10 35 30

Screen Shot 2021-07-12 at 10 35 35

Screen Shot 2021-07-12 at 10 35 46

Screen Shot 2021-07-12 at 10 35 51

Screen Shot 2021-07-12 at 10 35 51

Screen Shot 2021-07-12 at 10 35 56

Screen Shot 2021-07-12 at 10 36 00

Comment on lines +32 to +41
#if DEBUG
MenuItems.Add(new MainMenuModel()
{
Icon = "\uf013",
PageName = nameof(DebugPage),
Title = "debug",
IconColor = "#019AE8",
TextColor = "#000"
});
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

デバッグ画面のカラムは一番下に置きましょう(あまり主張したくないので)。

{
Icon = "\uf013",
PageName = nameof(DebugPage),
Title = "debug",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Title = "debug",
Title = "Debug",

Comment on lines +52 to +60
var termsUpdateInfo = await termsUpdateService.GetTermsUpdateInfo();
if (termsUpdateService.IsReAgree(TermsType.TermsOfService, termsUpdateInfo))
{
agree += "-TermsOfService";
}
else if (termsUpdateService.IsReAgree(TermsType.PrivacyPolicy, termsUpdateInfo))
{
agree += "-PrivacyPolicy";
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここはtermsUpdateInfoに含まれているTermsOfServicePrivacyPolicyの最新の値(更新日付?)を表示する方が良いかなと思いました。

ここは「利用許諾」と「プライバシーポリシー」が更新されている経路だと理解しています。

一般的にデバッグ画面に到達したときにはすでプライバシーポリシーの再同意が行われている状態になるので、-TermsOfService-PrivacyPolicyがつくことは極めて稀(実行中に規約類が更新されるタイミング?)なので、前述通り、TermsOfServicePrivacyPolicyの最新の値(更新日付?)を表示する方が良いかと思います。

string agree;
if (termsUpdateService.IsAllAgreed())
{
agree = "exists";// (mainly) navigate from SplashPage to HomePage
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
agree = "exists";// (mainly) navigate from SplashPage to HomePage
agree = "All agreed"; // (mainly) navigate from SplashPage to HomePage

}
else
{
agree = "not exists"; // navigate from SplashPage to TutorialPage1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

デバッグ画面に到達するには初期設定が必要と理解しているので、ここの経路に到達することはないかと思いますが、仮にこの経路があるとすれば、

Suggested change
agree = "not exists"; // navigate from SplashPage to TutorialPage1
agree = "Not agreed"; // navigate from SplashPage to TutorialPage1

Comment on lines +27 to +39
string os;
switch (Device.RuntimePlatform)
{
case Device.Android:
os = "Android";
break;
case Device.iOS:
os = "iOS";
break;
default:
os = "unknown";
break;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Device.RuntimePlatformをそのまま使えば、OSプラットフォームの文字列をとることができます。Windowsとかも入ってしまいますが、そもそもビルドできないので考慮しなくて良いと思います。

Suggested change
string os;
switch (Device.RuntimePlatform)
{
case Device.Android:
os = "Android";
break;
case Device.iOS:
os = "iOS";
break;
default:
os = "unknown";
break;
}
string os = Device.RuntimePlatform;

var exposureNotificationStatus = await Xamarin.ExposureNotifications.ExposureNotification.IsEnabledAsync();
var exposureNotificationMessage = await exposureNotificationService.UpdateStatusMessageAsync();
// ../../settings.json
var str = new[] { "Build: " + os, "Ver: " + AppSettings.Instance.AppVersion,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文字列連結は + ではなく、$を付けた変数を展開する記法を使ってください。
$"Build: {os}, Version: {EssentialsService.AppVersion}" のようになります。

あと、VerVersionにするなど、短い単語であれば可能な限り略称を使わないようにしてください。

Comment on lines +104 to +107
<Button
Command="{prism:NavigateTo 'DebugPage'}"
Style="{StaticResource DefaultButton}"
Text="DebugPage" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DebugPageからDebugPageを開けるのはあまり意味がないと思うので、削除してください。

Comment on lines +92 to +95
<Button
Command="{prism:NavigateTo 'NavigationPage'}"
Style="{StaticResource DefaultButton}"
Text="NavigationPage" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ドロワーがある空白のページが開くだけなので削除して良いと思います。

Comment on lines +96 to +99
<Button
Command="{prism:NavigateTo 'MenuPage'}"
Style="{StaticResource DefaultButton}"
Text="MenuPage" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

タップしても何も起きないので、削除して良いと思います。

@keiji
Copy link
Collaborator

keiji commented Aug 20, 2021

@i-maruyama
お忙しいようであればこちら引き取りますがいかがですか?

@i-maruyama
Copy link
Contributor Author

申し訳ありません。こちらのVisualStudio にエラーがでる状態が解消できずにおりますので、
引き取っていただけるとありがたいです。

頂いているレビューコメントも、おっしゃっている方向で変更することに同意いたします。

@keiji keiji self-assigned this Aug 23, 2021
@keiji
Copy link
Collaborator

keiji commented Sep 2, 2021

@i-maruyama コンフリクト解消のためのPull Requestを出しました。

i-maruyama#2

このPRをマージいただいた後、このPRをfeature/debug_pageに取り込んで、そこからさらに作業をする予定です。

@keiji keiji merged commit 5dbdf98 into cocoa-mhlw:feature/debug_page Sep 2, 2021
@keiji keiji mentioned this pull request Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
confirmed 開発内部管理用
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DebugPage の追加
5 participants