From a34b4885cb6ef94710f78d88a2f2f8e35ef25d28 Mon Sep 17 00:00:00 2001 From: ARIYAMA Keiji Date: Thu, 23 Dec 2021 10:49:16 +0900 Subject: [PATCH 1/3] Show user-profile is not supported dialog. --- .../Services/ExposureNotificationApiService.cs | 6 +++++- Covid19Radar/Covid19Radar/Services/DialogService.cs | 8 ++++++++ Covid19Radar/Covid19Radar/Services/IDialogService.cs | 1 + .../ViewModels/HomePage/HomePageViewModel.cs | 9 ++++++++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Covid19Radar/Covid19Radar.Android/Services/ExposureNotificationApiService.cs b/Covid19Radar/Covid19Radar.Android/Services/ExposureNotificationApiService.cs index 79032b857..6bc912fb1 100644 --- a/Covid19Radar/Covid19Radar.Android/Services/ExposureNotificationApiService.cs +++ b/Covid19Radar/Covid19Radar.Android/Services/ExposureNotificationApiService.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Android.Content; using Android.Gms.Common.Apis; using Chino; using Chino.Android.Google; @@ -48,6 +47,11 @@ public override async Task StartExposureNotificationAsync() apiException.Status.StartResolutionForResult(Platform.CurrentActivity, REQUEST_EN_START); return false; } + else if(apiException.StatusCode == CommonStatusCodes.ApiNotConnected) + { + throw new ENException(ENException.Code_Android.FAILED_NOT_SUPPORTED, + "StartExposureNotificationAsync ApiNotConnected"); + } else { throw apiException; diff --git a/Covid19Radar/Covid19Radar/Services/DialogService.cs b/Covid19Radar/Covid19Radar/Services/DialogService.cs index 35df8e7b7..e7df67890 100644 --- a/Covid19Radar/Covid19Radar/Services/DialogService.cs +++ b/Covid19Radar/Covid19Radar/Services/DialogService.cs @@ -55,6 +55,14 @@ public async Task ShowLocationOffWarningAsync() AppResources.ButtonCancel); } + public async Task ShowUserProfileNotSupportAsync() + { + await AlertAsync( + "User-profile is not suppoted", + "ユーザープロファイルはサポートしていません。", + AppResources.ButtonOk); + } + public async Task ConfirmAsync(string message, string title = null, string okText = null, string cancelText = null) => await UserDialogs.Instance.ConfirmAsync(message, title, okText, cancelText); diff --git a/Covid19Radar/Covid19Radar/Services/IDialogService.cs b/Covid19Radar/Covid19Radar/Services/IDialogService.cs index e670e184b..9628e6901 100644 --- a/Covid19Radar/Covid19Radar/Services/IDialogService.cs +++ b/Covid19Radar/Covid19Radar/Services/IDialogService.cs @@ -11,5 +11,6 @@ public interface IDialogService Task ShowExposureNotificationOffWarningAsync(); Task ShowBluetoothOffWarningAsync(); Task ShowLocationOffWarningAsync(); + Task ShowUserProfileNotSupportAsync(); } } diff --git a/Covid19Radar/Covid19Radar/ViewModels/HomePage/HomePageViewModel.cs b/Covid19Radar/Covid19Radar/ViewModels/HomePage/HomePageViewModel.cs index 522a0fc94..f4ab2a2f4 100644 --- a/Covid19Radar/Covid19Radar/ViewModels/HomePage/HomePageViewModel.cs +++ b/Covid19Radar/Covid19Radar/ViewModels/HomePage/HomePageViewModel.cs @@ -202,6 +202,12 @@ private async Task StartExposureNotificationAsync() } } else if ( + statusCodes.Contains(ExposureNotificationStatus.Code_Android.USER_PROFILE_NOT_SUPPORT) + ) + { + await dialogService.ShowUserProfileNotSupportAsync(); + } + else if ( statusCodes.Contains(ExposureNotificationStatus.Code_Android.LOCATION_DISABLED) ) { @@ -266,7 +272,8 @@ private async Task UpdateView() || statusCodes.Contains(ExposureNotificationStatus.Code_iOS.Unauthorized) || statusCodes.Contains(ExposureNotificationStatus.Code_Android.BLUETOOTH_DISABLED) || statusCodes.Contains(ExposureNotificationStatus.Code_iOS.BluetoothOff) - || statusCodes.Contains(ExposureNotificationStatus.Code_Android.LOCATION_DISABLED); + || statusCodes.Contains(ExposureNotificationStatus.Code_Android.LOCATION_DISABLED) + || statusCodes.Contains(ExposureNotificationStatus.Code_Android.USER_PROFILE_NOT_SUPPORT); var canConfirmExposure = _userDataRepository.IsCanConfirmExposure(); if (isStopped) From c0d7629bf426031553c56394af6320cf4059cbc3 Mon Sep 17 00:00:00 2001 From: ARIYAMA Keiji Date: Sun, 9 Jan 2022 04:36:17 +0900 Subject: [PATCH 2/3] Show user-profile is not supported dialog at tutorial. --- .../Tutorial/TutorialPage4ViewModel.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Covid19Radar/Covid19Radar/ViewModels/Tutorial/TutorialPage4ViewModel.cs b/Covid19Radar/Covid19Radar/ViewModels/Tutorial/TutorialPage4ViewModel.cs index 40eb180ba..134104995 100644 --- a/Covid19Radar/Covid19Radar/ViewModels/Tutorial/TutorialPage4ViewModel.cs +++ b/Covid19Radar/Covid19Radar/ViewModels/Tutorial/TutorialPage4ViewModel.cs @@ -13,15 +13,18 @@ namespace Covid19Radar.ViewModels { public class TutorialPage4ViewModel : ViewModelBase, IExposureNotificationEventCallback { + private readonly IDialogService dialogService; private readonly ILoggerService loggerService; private readonly AbsExposureNotificationApiService exposureNotificationApiService; public TutorialPage4ViewModel( INavigationService navigationService, + IDialogService dialogService, ILoggerService loggerService, AbsExposureNotificationApiService exposureNotificationApiService ) : base(navigationService) { + this.dialogService = dialogService; this.loggerService = loggerService; this.exposureNotificationApiService = exposureNotificationApiService; } @@ -41,6 +44,12 @@ AbsExposureNotificationApiService exposureNotificationApiService catch (ENException exception) { loggerService.Exception("ENException", exception); + + if (exception.Code == ENException.Code_Android.FAILED_NOT_SUPPORTED) + { + ShowStatuses(); + return; + } await NavigationService.NavigateAsync(nameof(TutorialPage6)); } finally @@ -48,6 +57,16 @@ AbsExposureNotificationApiService exposureNotificationApiService loggerService.EndMethod(); } }); + + private async void ShowStatuses() + { + var statusCodes = await exposureNotificationApiService.GetStatusCodesAsync(); + if (statusCodes.Contains(ExposureNotificationStatus.Code_Android.USER_PROFILE_NOT_SUPPORT)) + { + await dialogService.ShowUserProfileNotSupportAsync(); + } + } + public Command OnClickDisable => new Command(async () => { loggerService.StartMethod(); From 5832d7bb8bb5922b152270e5fc47e4244f2b29c5 Mon Sep 17 00:00:00 2001 From: ARIYAMA Keiji Date: Tue, 8 Feb 2022 15:45:40 +0900 Subject: [PATCH 3/3] Create test-resources. --- .../Covid19Radar/Resources/AppResources.Designer.cs | 12 ++++++++++++ .../Covid19Radar/Resources/AppResources.ja.resx | 9 +++++++++ .../Covid19Radar/Resources/AppResources.resx | 9 +++++++++ .../Covid19Radar/Resources/AppResources.zh-Hans.resx | 9 +++++++++ Covid19Radar/Covid19Radar/Services/DialogService.cs | 4 ++-- 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs b/Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs index 55791d0ea..7ba8af7c7 100644 --- a/Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs +++ b/Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs @@ -1888,5 +1888,17 @@ public static string ThresholdTextOperatorEqual { return ResourceManager.GetString("ThresholdTextOperatorEqual", resourceCulture); } } + + public static string UserProfileNotSupportDialogTitle { + get { + return ResourceManager.GetString("UserProfileNotSupportDialogTitle", resourceCulture); + } + } + + public static string UserProfileNotSupportDialogDescription { + get { + return ResourceManager.GetString("UserProfileNotSupportDialogDescription", resourceCulture); + } + } } } diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx b/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx index 39f07cefe..c102f7ea3 100644 --- a/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx +++ b/Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx @@ -1230,4 +1230,13 @@ と同じ + + 複数ユーザーはサポートしていません + 複数ユーザーはサポートしていません + + + COCOAは複数ユーザーでの利用をサポートしていません。管理者(所有者)で実行してください。 + COCOAは複数ユーザーでの利用をサポートしていません。管理者(所有者)で実行してください。 + + diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.resx b/Covid19Radar/Covid19Radar/Resources/AppResources.resx index c78632564..c5fcea133 100644 --- a/Covid19Radar/Covid19Radar/Resources/AppResources.resx +++ b/Covid19Radar/Covid19Radar/Resources/AppResources.resx @@ -1341,4 +1341,13 @@ Note: this app does not collect users’ location information. と同じ + + Multi user profile is not supported + TODO:複数ユーザーはサポートしていません + + + COCOA is not supported multi user profile. Please run as device owner. + TODO:COCOAは複数ユーザーでの利用をサポートしていません。管理者(所有者)で実行してください。 + + diff --git a/Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx b/Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx index 046a167a7..787e20f93 100644 --- a/Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx +++ b/Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx @@ -1239,4 +1239,13 @@ と同じ + + Multi user profile is not supported + TODO:複数ユーザーはサポートしていません + + + COCOA is not supported multi user profile. Please run as device owner. + TODO:COCOAは複数ユーザーでの利用をサポートしていません。管理者(所有者)で実行してください。 + + diff --git a/Covid19Radar/Covid19Radar/Services/DialogService.cs b/Covid19Radar/Covid19Radar/Services/DialogService.cs index c15c9b0ed..ccf79101f 100644 --- a/Covid19Radar/Covid19Radar/Services/DialogService.cs +++ b/Covid19Radar/Covid19Radar/Services/DialogService.cs @@ -58,8 +58,8 @@ public async Task ShowLocationOffWarningAsync() public async Task ShowUserProfileNotSupportAsync() { await AlertAsync( - "User-profile is not suppoted", - "ユーザープロファイルはサポートしていません。", + AppResources.UserProfileNotSupportDialogDescription, + AppResources.UserProfileNotSupportDialogTitle, AppResources.ButtonOk); }