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

Commit

Permalink
Merge pull request #633 from keiji/cocoa2/userprofile_not_supported
Browse files Browse the repository at this point in the history
Cocoa2/userprofile not supported
  • Loading branch information
cocoa-dev004 authored May 22, 2022
2 parents 8bae0ef + 073b165 commit 3ca8566
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public override async Task<bool> 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 new AndroidGooglePlayServicesApiException(
Expand Down
12 changes: 12 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.

11 changes: 11 additions & 0 deletions Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,7 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>ホーム画面へ</value>
<comment>ホーム画面へ</comment>
</data>

<data name="CircledDigitOneImageText" xml:space="preserve">
<value>1</value>
<comment>1</comment>
Expand All @@ -1422,4 +1423,14 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>3</value>
<comment>3</comment>
</data>

<data name="UserProfileNotSupportDialogTitle" xml:space="preserve">
<value>複数ユーザーはサポートしていません</value>
<comment>複数ユーザーはサポートしていません</comment>
</data>
<data name="UserProfileNotSupportDialogDescription" xml:space="preserve">
<value>COCOAは複数ユーザーでの利用をサポートしていません。管理者(所有者)で実行してください。</value>
<comment>COCOAは複数ユーザーでの利用をサポートしていません。管理者(所有者)で実行してください。</comment>
</data>

</root>
10 changes: 10 additions & 0 deletions Covid19Radar/Covid19Radar/Resources/AppResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,7 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>Return to Home screen</value>
<comment>ホーム画面へ</comment>
</data>

<data name="CircledDigitOneImageText" xml:space="preserve">
<value>1</value>
<comment>1</comment>
Expand All @@ -1529,4 +1530,13 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>3</value>
<comment>3</comment>
</data>

<data name="UserProfileNotSupportDialogTitle" xml:space="preserve">
<value>Multi user profile is not supported</value>
<comment>TODO:複数ユーザーはサポートしていません</comment>
</data>
<data name="UserProfileNotSupportDialogDescription" xml:space="preserve">
<value>COCOA is not supported multi user profile. Please run as device owner.</value>
<comment>TODO:COCOAは複数ユーザーでの利用をサポートしていません。管理者(所有者)で実行してください。</comment>
</data>
</root>
11 changes: 11 additions & 0 deletions Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,7 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>返回首页</value>
<comment>ホーム画面へ</comment>
</data>

<data name="CircledDigitOneImageText" xml:space="preserve">
<value>1</value>
<comment>1</comment>
Expand All @@ -1427,4 +1428,14 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>3</value>
<comment>3</comment>
</data>

<data name="UserProfileNotSupportDialogTitle" xml:space="preserve">
<value>Multi user profile is not supported</value>
<comment>TODO:複数ユーザーはサポートしていません</comment>
</data>
<data name="UserProfileNotSupportDialogDescription" xml:space="preserve">
<value>COCOA is not supported multi user profile. Please run as device owner.</value>
<comment>TODO:COCOAは複数ユーザーでの利用をサポートしていません。管理者(所有者)で実行してください。</comment>
</data>

</root>
7 changes: 7 additions & 0 deletions Covid19Radar/Covid19Radar/Services/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ public async Task<bool> ShowLocalNotificationOffWarningAsync()
AppResources.ButtonCancel);
}

public async Task ShowUserProfileNotSupportAsync()
{
await AlertAsync(
AppResources.UserProfileNotSupportDialogDescription,
AppResources.UserProfileNotSupportDialogTitle,
AppResources.ButtonOk);
}

public async Task<bool> ConfirmAsync(string message, string title = null, string okText = null, string cancelText = null) =>
await UserDialogs.Instance.ConfirmAsync(message, title, okText, cancelText);
Expand Down
1 change: 1 addition & 0 deletions Covid19Radar/Covid19Radar/Services/IDialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ public interface IDialogService
Task ShowTemporarilyUnavailableWarningAsync();
Task ShowHomePageUnknownErrorWaringAsync();
Task<bool> ShowLocalNotificationOffWarningAsync();
Task ShowUserProfileNotSupportAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ INavigationParameters navigaitonParameters
{
_ = await NavigationService.NavigateAsync(nameof(HowToEnableExposureNotificationsPage));
}
else if (
statusCodes.Contains(ExposureNotificationStatus.Code_Android.USER_PROFILE_NOT_SUPPORT)
)
{
await dialogService.ShowUserProfileNotSupportAsync();
}
}
catch (AndroidGooglePlayServicesApiException ex)
{
Expand Down Expand Up @@ -426,7 +432,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);
}
catch (AndroidGooglePlayServicesApiException exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ public class TutorialPage4ViewModel : ViewModelBase, IExposureNotificationEventC
{
public string TutorialPage4LinkReadText => $"{AppResources.TutorialPage4Link} {AppResources.Button}";

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;
}
Expand All @@ -44,13 +47,29 @@ 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
{
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();
Expand Down

0 comments on commit 3ca8566

Please sign in to comment.