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

Cocoa2/userprofile not supported #633

Merged
7 commits merged into from
May 22, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 apiException;
Expand Down
13 changes: 13 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.

9 changes: 9 additions & 0 deletions Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1423,4 +1423,13 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<comment>ホーム画面へ</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>
9 changes: 9 additions & 0 deletions Covid19Radar/Covid19Radar/Resources/AppResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1529,4 +1529,13 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<comment>ホーム画面へ</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>
9 changes: 9 additions & 0 deletions Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1428,4 +1428,13 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<comment>ホーム画面へ</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>
9 changes: 8 additions & 1 deletion Covid19Radar/Covid19Radar/Services/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public async Task<bool> ShowLocationOffWarningAsync()
AppResources.ButtonCancel);
}

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

public async Task ShowHomePageUnknownErrorWaringAsync()
{
await AlertAsync(
Expand All @@ -72,7 +80,6 @@ public async Task<bool> ShowLocalNotificationOffWarningAsync()
AppResources.ButtonCancel);
}


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 @@ -11,6 +11,7 @@ public interface IDialogService
Task<bool> ShowExposureNotificationOffWarningAsync();
Task<bool> ShowBluetoothOffWarningAsync();
Task<bool> ShowLocationOffWarningAsync();
Task ShowUserProfileNotSupportAsync();
Task ShowHomePageUnknownErrorWaringAsync();
Task<bool> ShowLocalNotificationOffWarningAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ INavigationParameters navigaitonParameters
}
}
else if (
statusCodes.Contains(ExposureNotificationStatus.Code_Android.USER_PROFILE_NOT_SUPPORT)
)
{
await dialogService.ShowUserProfileNotSupportAsync();
}
else if (
statusCodes.Contains(ExposureNotificationStatus.Code_Android.LOCATION_DISABLED)
)
{
Expand Down Expand Up @@ -410,7 +416,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -41,13 +44,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