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

Commit

Permalink
Handle DiagnosisKeysDataMappingApplied event.
Browse files Browse the repository at this point in the history
  • Loading branch information
keiji committed Nov 21, 2021
1 parent 0b99b1b commit 9437b64
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
<Version>1.2.1</Version>
</PackageReference>
<PackageReference Include="Chino.Android">
<Version>1.0.0-rc05</Version>
<Version>1.0.0-rc06</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions Covid19Radar/Covid19Radar.iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ private void RegisterPlatformTypes(IContainer container)
container.Register<IExternalNavigationService, ExternalNavigationService>(Reuse.Singleton);
}

public void DiagnosisKeysDataMappingApplied()
{
_exposureDetectionService.Value.DiagnosisKeysDataMappingApplied();
}

public void PreExposureDetected()
{
var exposureConfiguration = GetEnClient().ExposureConfiguration;
Expand Down
2 changes: 1 addition & 1 deletion Covid19Radar/Covid19Radar.iOS/Covid19Radar.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
<Version>2.0.6</Version>
</PackageReference>
<PackageReference Include="Chino.iOS">
<Version>1.0.0-rc05</Version>
<Version>1.0.0-rc06</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Covid19Radar/Covid19Radar/Covid19Radar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="4.6.0.967" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.6.0" />
<PackageReference Include="CommonServiceLocator" Version="2.0.6" />
<PackageReference Include="Chino.Common" Version="1.0.0-rc05" />
<PackageReference Include="Chino.Common" Version="1.0.0-rc06" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\CustomDatePicker.cs" />
Expand Down
33 changes: 15 additions & 18 deletions Covid19Radar/Covid19Radar/Services/ExposureDetectionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace Covid19Radar.Services
{
public interface IExposureDetectionService
{
public void DiagnosisKeysDataMappingApplied();

public void PreExposureDetected(ExposureConfiguration exposureConfiguration, string enVersion);

public void ExposureDetected(ExposureConfiguration exposureConfiguration, string enVersion, IList<DailySummary> dailySummaries, IList<ExposureWindow> exposureWindows);
Expand Down Expand Up @@ -53,6 +55,19 @@ IExposureDataCollectServer exposureDataCollectServer
_exposureDataCollectServer = exposureDataCollectServer;
}

public void DiagnosisKeysDataMappingApplied()
{
_loggerService.StartMethod();

if (_exposureConfigurationRepository.IsDiagnosisKeysDataMappingConfigurationUpdated())
{
_exposureConfigurationRepository.SetDiagnosisKeysDataMappingAppliedDateTime(DateTime.UtcNow);
_exposureConfigurationRepository.SetDiagnosisKeysDataMappingConfigurationUpdated(false);
}

_loggerService.EndMethod();
}

public void PreExposureDetected(ExposureConfiguration exposureConfiguration, string enVersion)
{
_loggerService.Debug("PreExposureDetected");
Expand All @@ -64,12 +79,6 @@ public void ExposureDetected(ExposureConfiguration exposureConfiguration, string

_ = Task.Run(async () =>
{
if (_exposureConfigurationRepository.IsDiagnosisKeysDataMappingConfigurationUpdated())
{
_exposureConfigurationRepository.SetDiagnosisKeysDataMappingAppliedDateTime(DateTime.UtcNow);
_exposureConfigurationRepository.SetDiagnosisKeysDataMappingConfigurationUpdated(false);
}

await _userDataRepository.SetExposureDataAsync(
dailySummaries.ToList(),
exposureWindows.ToList()
Expand Down Expand Up @@ -106,12 +115,6 @@ public void ExposureDetected(ExposureConfiguration exposureConfiguration, string

_ = Task.Run(async() =>
{
if (_exposureConfigurationRepository.IsDiagnosisKeysDataMappingConfigurationUpdated())
{
_exposureConfigurationRepository.SetDiagnosisKeysDataMappingAppliedDateTime(DateTime.UtcNow);
_exposureConfigurationRepository.SetDiagnosisKeysDataMappingConfigurationUpdated(false);
}

bool isNewExposureDetected = _userDataRepository.AppendExposureData(
exposureSummary,
exposureInformations.ToList(),
Expand Down Expand Up @@ -142,12 +145,6 @@ public void ExposureNotDetected(ExposureConfiguration exposureConfiguration, str

_ = Task.Run(async () =>
{
if (_exposureConfigurationRepository.IsDiagnosisKeysDataMappingConfigurationUpdated())
{
_exposureConfigurationRepository.SetDiagnosisKeysDataMappingAppliedDateTime(DateTime.UtcNow);
_exposureConfigurationRepository.SetDiagnosisKeysDataMappingConfigurationUpdated(false);
}

await _exposureDataCollectServer.UploadExposureDataAsync(
exposureConfiguration,
DeviceInfo.Model,
Expand Down
Binary file removed TempNugetFeed/Chino.Android.1.0.0-rc05.nupkg
Binary file not shown.
Binary file added TempNugetFeed/Chino.Android.1.0.0-rc06.nupkg
Binary file not shown.
Binary file removed TempNugetFeed/Chino.Common.1.0.0-rc05.nupkg
Binary file not shown.
Binary file added TempNugetFeed/Chino.Common.1.0.0-rc06.nupkg
Binary file not shown.
Binary file removed TempNugetFeed/Chino.iOS.1.0.0-rc05.nupkg
Binary file not shown.
Binary file added TempNugetFeed/Chino.iOS.1.0.0-rc06.nupkg
Binary file not shown.

0 comments on commit 9437b64

Please sign in to comment.