Merge remote-tracking branch 'upstream/master' into settings

This commit is contained in:
Eric Tian 2021-02-06 20:41:24 -08:00
commit 19a1409d37
12 changed files with 49 additions and 22 deletions

View file

@ -30,7 +30,7 @@ jobs:
displayName: Send resources to Touchdown Build displayName: Send resources to Touchdown Build
inputs: inputs:
teamId: 86 teamId: 86
authId: d3dd8113-65b3-4526-bdca-a00a7d1c37ba authId: bf6d44ca-3210-4cfa-833f-c79f164ea27b
authKey: $(LocServiceKey) authKey: $(LocServiceKey)
isPreview: false isPreview: false
relativePathRoot: src/Calculator/Resources/en-US/ relativePathRoot: src/Calculator/Resources/en-US/

View file

@ -16,8 +16,8 @@ pr: none
variables: variables:
versionMajor: 10 versionMajor: 10
versionMinor: 2101 versionMinor: 2102
versionBuild: $[counter('10.2101.*', 0)] versionBuild: $[counter('10.2102.*', 0)]
versionPatch: 0 versionPatch: 0
name: '$(versionMajor).$(versionMinor).$(versionBuild).$(versionPatch)' name: '$(versionMajor).$(versionMinor).$(versionBuild).$(versionPatch)'

View file

@ -10,7 +10,7 @@ These manual tests are run before every release of the Calculator app.
**Test 1** **Test 1**
Steps: Steps:
1. From the Standard Calculator page, input “3”, “+”, “3”, “Enter” on the keyboard 1. From the Standard Calculator page, input “3”, “+”, “3”, “Enter” on the keyboard
Expected: “6” shows up in the display *Expected: “6” shows up in the display *
2. Input “4”, “-”, “2”, “=” using the in-app buttons 2. Input “4”, “-”, “2”, “=” using the in-app buttons
*Expected: “2” shows up in the display* *Expected: “2” shows up in the display*

View file

@ -4,6 +4,7 @@
#include "Header Files/CalcEngine.h" #include "Header Files/CalcEngine.h"
#include "Command.h" #include "Command.h"
#include "ExpressionCommand.h" #include "ExpressionCommand.h"
#include "winerror_cross_platform.h"
constexpr int ASCII_0 = 48; constexpr int ASCII_0 = 48;

View file

@ -13,7 +13,9 @@
* Author: * Author:
\****************************************************************************/ \****************************************************************************/
#include <iomanip>
#include <string> #include <string>
#include <sstream>
#include "Header Files/CalcEngine.h" #include "Header Files/CalcEngine.h"
#include "Header Files/CalcUtils.h" #include "Header Files/CalcUtils.h"
#include "NumberFormattingUtils.h" #include "NumberFormattingUtils.h"

View file

@ -17,6 +17,7 @@
/*** ***/ /*** ***/
/**************************************************************************/ /**************************************************************************/
#include "Header Files/CalcEngine.h" #include "Header Files/CalcEngine.h"
#include "winerror_cross_platform.h"
using namespace std; using namespace std;
using namespace CalcEngine; using namespace CalcEngine;

View file

@ -6,6 +6,7 @@
#include <memory> // for std::shared_ptr #include <memory> // for std::shared_ptr
#include <vector> #include <vector>
#include "Command.h" #include "Command.h"
#include "sal_cross_platform.h"
class ISerializeCommandVisitor; class ISerializeCommandVisitor;

View file

@ -4,6 +4,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include "sal_cross_platform.h"
namespace CalcManager::NumberFormattingUtils namespace CalcManager::NumberFormattingUtils
{ {

View file

@ -60,7 +60,7 @@ bool IsGraphingModeAvailable()
} }
Box<bool> ^ _isGraphingModeEnabledCached = nullptr; Box<bool> ^ _isGraphingModeEnabledCached = nullptr;
bool IsGraphingModeEnabled() bool IsGraphingModeEnabled(User ^ currentUser = nullptr)
{ {
if (!IsGraphingModeAvailable()) if (!IsGraphingModeAvailable())
{ {
@ -72,17 +72,19 @@ bool IsGraphingModeEnabled()
return _isGraphingModeEnabledCached->Value; return _isGraphingModeEnabledCached->Value;
} }
User ^ firstUser; if (!currentUser)
create_task(User::FindAllAsync(UserType::LocalUser)).then([&firstUser](IVectorView<User ^> ^ users) { {
firstUser = users->GetAt(0); }).wait(); return true;
auto namedPolicyData = NamedPolicy::GetPolicyFromPathForUser(firstUser, L"Education", L"AllowGraphingCalculator"); }
auto namedPolicyData = NamedPolicy::GetPolicyFromPathForUser(currentUser, L"Education", L"AllowGraphingCalculator");
_isGraphingModeEnabledCached = namedPolicyData->GetBoolean() == true; _isGraphingModeEnabledCached = namedPolicyData->GetBoolean() == true;
return _isGraphingModeEnabledCached->Value; return _isGraphingModeEnabledCached->Value;
} }
// The order of items in this list determines the order of items in the menu. // The order of items in this list determines the order of items in the menu.
static const list<NavCategoryInitializer> s_categoryManifest = [] { static list<NavCategoryInitializer> s_categoryManifest = [] {
auto res = list<NavCategoryInitializer>{ NavCategoryInitializer{ ViewMode::Standard, auto res = list<NavCategoryInitializer>{ NavCategoryInitializer{ ViewMode::Standard,
STANDARD_ID, STANDARD_ID,
L"Standard", L"Standard",
@ -108,7 +110,7 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
bool supportGraphingCalculator = IsGraphingModeAvailable(); bool supportGraphingCalculator = IsGraphingModeAvailable();
if (supportGraphingCalculator) if (supportGraphingCalculator)
{ {
const bool isEnabled = IsGraphingModeEnabled(); bool isEnabled = IsGraphingModeEnabled();
res.push_back(NavCategoryInitializer{ ViewMode::Graphing, res.push_back(NavCategoryInitializer{ ViewMode::Graphing,
GRAPHING_ID, GRAPHING_ID,
L"Graphing", L"Graphing",
@ -276,6 +278,25 @@ static const list<NavCategoryInitializer> s_categoryManifest = [] {
return res; return res;
}(); }();
void NavCategory::InitializeCategoryManifest(User ^ user)
{
int i = 0;
for (NavCategoryInitializer category : s_categoryManifest)
{
if (category.viewMode == ViewMode::Graphing)
{
auto navCatInit = s_categoryManifest.begin();
std::advance(navCatInit, i);
(*navCatInit).isEnabled = IsGraphingModeEnabled(user);
break;
}
else
{
i++;
}
}
}
// This function should only be used when storing the mode to app data. // This function should only be used when storing the mode to app data.
int NavCategory::Serialize(ViewMode mode) int NavCategory::Serialize(ViewMode mode)
{ {

View file

@ -92,7 +92,7 @@ namespace CalculatorApp
const MyVirtualKey virtualKey; const MyVirtualKey virtualKey;
const wchar_t* const accessKey; const wchar_t* const accessKey;
const bool supportsNegative; const bool supportsNegative;
const bool isEnabled; bool isEnabled;
}; };
private private
@ -140,6 +140,8 @@ namespace CalculatorApp
static bool IsDateCalculatorViewMode(ViewMode mode); static bool IsDateCalculatorViewMode(ViewMode mode);
static bool IsConverterViewMode(ViewMode mode); static bool IsConverterViewMode(ViewMode mode);
static void InitializeCategoryManifest(Windows::System::User ^ user);
static Platform::String ^ GetFriendlyName(ViewMode mode); static Platform::String ^ GetFriendlyName(ViewMode mode);
static Platform::String ^ GetNameResourceKey(ViewMode mode); static Platform::String ^ GetNameResourceKey(ViewMode mode);
static CategoryGroupType GetGroupType(ViewMode mode); static CategoryGroupType GetGroupType(ViewMode mode);

View file

@ -225,12 +225,12 @@ void App::OnLaunched(LaunchActivatedEventArgs ^ args)
// If the app got pre-launch activated, then save that state in a flag // If the app got pre-launch activated, then save that state in a flag
m_preLaunched = true; m_preLaunched = true;
} }
NavCategory::InitializeCategoryManifest(args->User);
OnAppLaunch(args, args->Arguments); OnAppLaunch(args, args->Arguments);
} }
void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument)
{ {
// Uncomment the following lines to display frame-rate and per-frame CPU usage info. // Uncomment the following lines to display frame-rate and per-frame CPU usage info.
//#if _DEBUG //#if _DEBUG
// if (IsDebuggerPresent()) // if (IsDebuggerPresent())

View file

@ -1,13 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources> <packageSources>
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" /> <clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="EEApps" value="https://eeapps.blob.core.windows.net/eeapps/index.json" /> <add key="EEApps" value="https://eeapps.blob.core.windows.net/eeapps/index.json" />
</packageSources> </packageSources>
<config> <disabledPackageSources>
<add key="dependencyversion" value="Highest" /> <clear />
</config> </disabledPackageSources>
</configuration> </configuration>