mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-21 22:03:11 -07:00
Migrate currency converter endpoints
This commit is contained in:
parent
c77f1de84c
commit
f1efe82c7e
7 changed files with 67 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -290,6 +290,7 @@ __pycache__/
|
||||||
# Calculator specific
|
# Calculator specific
|
||||||
Generated Files/
|
Generated Files/
|
||||||
src/GraphControl/GraphingImplOverrides.props
|
src/GraphControl/GraphingImplOverrides.props
|
||||||
|
src/CalcViewModel/DataLoaders/DataLoaderConstants.h
|
||||||
!/build/config/TRexDefs/**
|
!/build/config/TRexDefs/**
|
||||||
!src/Calculator/TemporaryKey.pfx
|
!src/Calculator/TemporaryKey.pfx
|
||||||
!src/CalculatorUnitTests/CalculatorUnitTests_TemporaryKey.pfx
|
!src/CalculatorUnitTests/CalculatorUnitTests_TemporaryKey.pfx
|
|
@ -54,6 +54,12 @@ Read our [privacy statement](https://go.microsoft.com/fwlink/?LinkId=521839) to
|
||||||
Telemetry is disabled in development builds by default, and can be enabled with the `SEND_TELEMETRY`
|
Telemetry is disabled in development builds by default, and can be enabled with the `SEND_TELEMETRY`
|
||||||
build flag.
|
build flag.
|
||||||
|
|
||||||
|
## Currency Converter
|
||||||
|
Windows Calculator includes a currency converter feature that uses mock data in developer builds. The data that
|
||||||
|
Microsoft uses for the currency converter feature (e.g., in the retail version of the application) is not licensed
|
||||||
|
for your use. The mock data will be clearly identifiable as it references planets instead of countries,
|
||||||
|
and remains static regardless of selected inputs.
|
||||||
|
|
||||||
## Reporting Security Issues
|
## Reporting Security Issues
|
||||||
Security issues and bugs should be reported privately, via email, to the
|
Security issues and bugs should be reported privately, via email, to the
|
||||||
Microsoft Security Response Center (MSRC) at <[secure@microsoft.com](mailto:secure@microsoft.com)>.
|
Microsoft Security Response Center (MSRC) at <[secure@microsoft.com](mailto:secure@microsoft.com)>.
|
||||||
|
|
|
@ -408,6 +408,23 @@
|
||||||
<Project>{311e866d-8b93-4609-a691-265941fee101}</Project>
|
<Project>{311e866d-8b93-4609-a691-265941fee101}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemDefinitionGroup Condition="!Exists('DataLoaders\DataLoaderConstants.h')">
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalOptions>/DUSE_MOCK_DATA %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<Choose>
|
||||||
|
<When Condition="Exists('DataLoaders\DataLoaderConstants.h')">
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="DataLoaders\DataLoaderConstants.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
</When>
|
||||||
|
<Otherwise>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="DataLoaders\DataLoaderMockConstants.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Otherwise>
|
||||||
|
</Choose>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="DataLoaders\DefaultFromToCurrency.json" />
|
<None Include="DataLoaders\DefaultFromToCurrency.json" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
|
|
@ -213,6 +213,12 @@
|
||||||
<ClInclude Include="Common\TraceActivity.h">
|
<ClInclude Include="Common\TraceActivity.h">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="DataLoaders\DataLoaderMockConstants.h">
|
||||||
|
<Filter>DataLoaders</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="DataLoaders\DataLoaderConstants.h">
|
||||||
|
<Filter>DataLoaders</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="DataLoaders\DefaultFromToCurrency.json">
|
<None Include="DataLoaders\DefaultFromToCurrency.json">
|
||||||
|
|
|
@ -685,6 +685,23 @@ void CurrencyDataLoader::GuaranteeSelectedUnits()
|
||||||
isConversionTargetSet = true;
|
isConversionTargetSet = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If still not set for either source or target, just select the first currency in the list
|
||||||
|
|
||||||
|
if (!m_currencyUnits.empty())
|
||||||
|
{
|
||||||
|
if (!isConversionSourceSet)
|
||||||
|
{
|
||||||
|
m_currencyUnits[0].isConversionSource = true;
|
||||||
|
isConversionSourceSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isConversionTargetSet)
|
||||||
|
{
|
||||||
|
m_currencyUnits[0].isConversionTarget = true;
|
||||||
|
isConversionTargetSet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrencyDataLoader::NotifyDataLoadFinished(bool didLoad)
|
void CurrencyDataLoader::NotifyDataLoadFinished(bool didLoad)
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "CurrencyHttpClient.h"
|
#include "CurrencyHttpClient.h"
|
||||||
|
|
||||||
|
#ifdef USE_MOCK_DATA
|
||||||
|
#include "DataLoaderMockConstants.h"
|
||||||
|
#else
|
||||||
|
#include "DataLoaderConstants.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace CalculatorApp::DataLoaders;
|
using namespace CalculatorApp::DataLoaders;
|
||||||
using namespace Platform;
|
using namespace Platform;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Windows::Foundation;
|
using namespace Windows::Foundation;
|
||||||
using namespace Windows::Web::Http;
|
using namespace Windows::Web::Http;
|
||||||
|
|
||||||
static constexpr auto sc_MetadataUriLocalizeFor = L"https://go.microsoft.com/fwlink/?linkid=2041093&localizeFor=";
|
|
||||||
static constexpr auto sc_RatiosUriRelativeTo = L"https://go.microsoft.com/fwlink/?linkid=2041339&localCurrency=";
|
|
||||||
|
|
||||||
CurrencyHttpClient::CurrencyHttpClient() :
|
CurrencyHttpClient::CurrencyHttpClient() :
|
||||||
m_client(ref new HttpClient()),
|
m_client(ref new HttpClient()),
|
||||||
m_responseLanguage(L"en-US")
|
m_responseLanguage(L"en-US")
|
||||||
|
|
13
src/CalcViewModel/DataLoaders/DataLoaderMockConstants.h
Normal file
13
src/CalcViewModel/DataLoaders/DataLoaderMockConstants.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace CalculatorApp
|
||||||
|
{
|
||||||
|
namespace DataLoaders
|
||||||
|
{
|
||||||
|
static constexpr auto sc_MetadataUriLocalizeFor = L"https://go.microsoft.com/fwlink/?linkid=2091028&localizeFor=";
|
||||||
|
static constexpr auto sc_RatiosUriRelativeTo = L"https://go.microsoft.com/fwlink/?linkid=2091307&localCurrency=";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue