Removing title upsell and switch_account APIs (#70)

This commit is contained in:
Jason Sandlin 2017-02-14 16:24:23 -08:00 коммит произвёл GitHub
Родитель dcf1186072
Коммит 23c9e8679b
32 изменённых файлов: 1 добавлений и 887 удалений

Просмотреть файл

@ -476,7 +476,6 @@
<ClCompile Include="..\..\Source\Shared\WinRT\HttpCallRequestMessage_WinRT.cpp" />
<ClCompile Include="..\..\Source\Shared\WinRT\local_config_winrt.cpp" />
<ClCompile Include="..\..\Source\Shared\WinRT\ServiceCallLoggingConfig_WinRT.cpp" />
<ClCompile Include="..\..\Source\Shared\WinRT\SignInUISettings_WinRT.cpp" />
<ClCompile Include="..\..\Source\Shared\WinRT\Utils_WinRT.cpp" />
<ClCompile Include="..\..\Source\Shared\WinRT\XboxLiveContextSettings_WinRT.cpp" />
<ClCompile Include="..\..\Source\Shared\WinRT\XboxLiveLogCallEventArgs_WinRT.cpp" />
@ -767,9 +766,6 @@
<ClInclude Include="..\..\Source\Shared\WinRT\HttpRequestMessageType_WinRT.h" />
<ClInclude Include="..\..\Source\Shared\WinRT\HttpCallRequestMessage_WinRT.h" />
<ClInclude Include="..\..\Source\Shared\WinRT\ServiceCallLoggingConfig_WinRT.h" />
<ClInclude Include="..\..\Source\Shared\WinRT\SignInUIEmphasisFeature_WinRT.h" />
<ClInclude Include="..\..\Source\Shared\WinRT\SignInUIGameCategory_WinRT.h" />
<ClInclude Include="..\..\Source\Shared\WinRT\SignInUISettings_WinRT.h" />
<ClInclude Include="..\..\Source\Shared\WinRT\XboxLiveContextSettings_WinRT.h" />
<ClInclude Include="..\..\Source\Shared\WinRT\XboxLiveLogCallEventArgs_WinRT.h" />
<ClInclude Include="..\..\Source\Shared\WinRT\XboxLiveServicesSettings_WinRT.h" />

Просмотреть файл

@ -1116,9 +1116,6 @@
<ClCompile Include="..\..\Source\Services\Social\Manager\social_user_group_loaded_event_args.cpp">
<Filter>C++ Source\Social\Manager</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Shared\WinRT\SignInUISettings_WinRT.cpp">
<Filter>C++ Source\Shared\WinRT Source</Filter>
</ClCompile>
<ClCompile Include="..\..\Source\Shared\initiator.cpp">
<Filter>C++ Source\Shared</Filter>
</ClCompile>
@ -2033,9 +2030,6 @@
<ClInclude Include="..\..\Source\Services\Social\Manager\WinRT\SocialUserGroupLoadedEventArgs_WinRT.h">
<Filter>C++ Source\Social\Manager\WinRT</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\Shared\WinRT\SignInUISettings_WinRT.h">
<Filter>C++ Source\Shared\WinRT Source</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\Shared\WinRT\SignInUIGameCategory_WinRT.h">
<Filter>C++ Source\Shared\WinRT Source</Filter>
</ClInclude>

Просмотреть файл

@ -311,9 +311,6 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\HttpRequestMessageType_WinRT.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\Macros_WinRT.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\ServiceCallLoggingConfig_WinRT.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\SignInUIEmphasisFeature_WinRT.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\SignInUIGameCategory_WinRT.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\SignInUISettings_WinRT.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\Utils_WinRT.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\XboxLiveContextSettings_WinRT.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\XboxLiveLogCallEventArgs_WinRT.h" />
@ -702,7 +699,6 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\HttpCallRequestMessage_WinRT.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\local_config_winrt.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\ServiceCallLoggingConfig_WinRT.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\SignInUISettings_WinRT.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\Utils_WinRT.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\XboxLiveContextSettings_WinRT.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\XboxLiveLogCallEventArgs_WinRT.cpp" />

Просмотреть файл

@ -133,15 +133,6 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\ServiceCallLoggingConfig_WinRT.h">
<Filter>XSAPI\Shared\WinRT</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\SignInUIEmphasisFeature_WinRT.h">
<Filter>XSAPI\Shared\WinRT</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\SignInUIGameCategory_WinRT.h">
<Filter>XSAPI\Shared\WinRT</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\SignInUISettings_WinRT.h">
<Filter>XSAPI\Shared\WinRT</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\Utils_WinRT.h">
<Filter>XSAPI\Shared\WinRT</Filter>
</ClInclude>
@ -1124,9 +1115,6 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\ServiceCallLoggingConfig_WinRT.cpp">
<Filter>XSAPI\Shared\WinRT</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\SignInUISettings_WinRT.cpp">
<Filter>XSAPI\Shared\WinRT</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Source\Shared\WinRT\Utils_WinRT.cpp">
<Filter>XSAPI\Shared\WinRT</Filter>
</ClCompile>

Просмотреть файл

@ -492,24 +492,6 @@ public:
/// If you're calling this API from non-UI thread, parameter coreDispatcherObj is requried, so that app locale can be generated.
/// </remarks>
_XSAPIIMP pplx::task<xbox_live_result<sign_in_result>> signin_silently(_In_opt_ Platform::Object^ coreDispatcherObj);
/// <summary>
/// Attempt to silently sign a player into their Xbox Live account.
/// </summary>
/// <param name="coreDispatcherObj">The Windows Runtime core event message dispatcher.</param>
/// <returns>
/// Returns a pplx::task&lt;T&gt; object that represents the state of the asynchronous operation.
/// If silent sign-in is not successfull, result.err() indicates the error.
/// </returns>
/// <remarks>
/// You should only call this method if silent sign-in indicates that user interaction is required.
/// If you're calling this API from non-UI thread, parameter coreDispatcherObj is requried, so that app UI
/// can be rendered and locale can be generated.
/// </remarks>
_XSAPIIMP pplx::task<xbox_live_result<sign_in_result>> switch_account(_In_opt_ Platform::Object^ coreDispatcherObj);
#else
_XSAPIIMP pplx::task<xbox_live_result<sign_in_result>> switch_account();
#endif
/// <summary>

Просмотреть файл

@ -20,160 +20,6 @@ NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_BEGIN
class user_impl_idp;
}
#if UWP_API || UNIT_TEST_SERVICES
class signin_ui_settings
{
public:
/// <summary>
/// Enum for current game category, sign in UI will adjust accordingly based on
/// your game category.
/// </summary>
enum class game_category
{
/// <summary>
/// Enum for setting current title as standard game category.
/// </summary>
standard,
/// <summary>
/// Enum for setting current title as casual game category
/// </summary>
casual
};
/// <summary>
/// Enum for emphasizing Xbox Live features your title has.
/// </summary>
enum class emphasis_feature
{
/// <summary>
/// Enum for emphasizing Xbox Live achievement feature.
/// </summary>
achievements,
/// <summary>
/// Enum for emphasizing Xbox Live connected storage feature.
/// </summary>
connected_storage,
/// <summary>
/// Enum for emphasizing Xbox Live find players feature.
/// </summary>
find_players,
/// <summary>
/// Enum for emphasizing Xbox Live game bar feature.
/// </summary>
game_bar,
/// <summary>
/// Enum for emphasizing Xbox Live game DVR feature.
/// </summary>
game_dvr,
/// <summary>
/// Enum for emphasizing Xbox Live leaderboards feature.
/// </summary>
leaderboards,
/// <summary>
/// Enum for emphasizing Xbox Live multiplayer feature.
/// </summary>
multiplayer,
/// <summary>
/// Enum for emphasizing Xbox Live purchase feature.
/// </summary>
purchase,
/// <summary>
/// Enum for emphasizing Xbox Live shared content feature.
/// </summary>
shared_content,
/// <summary>
/// Enum for emphasizing Xbox Live social feature.
/// </summary>
social,
/// <summary>
/// Enum for emphasizing Xbox Live tournaments feature.
/// </summary>
tournaments
};
/// <summary>
/// Get current game_category setting
/// </summary>
_XSAPIIMP game_category title_category() const { return m_gameCategory; }
/// <summary>
/// Set your title's category, sign in UI will adjust accordingly based on your game category.
/// </summary>
_XSAPIIMP void set_game_category(game_category category) { m_gameCategory = category; }
/// <summary>
/// Specify which emphasized Xbox Live feature you want to show on the sign in page, up to 3.
/// </summary>
_XSAPIIMP void add_emphasis_feature(emphasis_feature feature) { m_features.insert(feature); }
/// <summary>
/// Retrieve the emphasis features added to show on the UI, only first 3 will be displayed.
/// </summary>
_XSAPIIMP const std::set<emphasis_feature>& emphasis_features() const { return m_features; }
/// <summary>
/// Specify the background image you want to show in the sign in page, in raw binary form.
/// </summary>
/// <remarks>
/// An Image can be one of the following format: jpeg, jpg, png, bmp, gif, tiff and ico.
/// The input source will always be stretched to 300X400 pixels , thus the file larger than that
/// is not recommended.
/// </remarks>
_XSAPIIMP void set_background_image(const std::vector<unsigned char>& image);
/// <summary>
/// Retrieve the background color of sign in page the title has set.
/// </summary>
_XSAPIIMP const string_t& background_hex_color() const { return m_backgroundColor; }
/// <summary>
/// Set the background color of your sign in page, in hex string. Example: "0F2C55".
/// </summary>
_XSAPIIMP void set_background_hex_color(const string_t& backgroundColor) { m_backgroundColor = backgroundColor; }
signin_ui_settings() :
m_gameCategory(game_category::standard)
{}
/// <summary>
/// Internal function
/// </summary>
const string_t& _Background_image_base64_encoded() const { return m_backgroundImageBase64Encoded; }
/// <summary>
/// Internal function
/// </summary>
static string_t _Feature_to_string(emphasis_feature);
/// <summary>
/// Internal function
/// </summary>
bool _Enabled();
private:
// Disable copy, settings must be accessed via reference.
signin_ui_settings(const signin_ui_settings&);
signin_ui_settings& operator=(const signin_ui_settings&);
game_category m_gameCategory;
string_t m_backgroundColor;
string_t m_backgroundImageBase64Encoded;
std::set<emphasis_feature> m_features;
};
#endif
/// <summary>
/// Represents the configuration of an Xbox Live application.
/// </summary>
@ -304,17 +150,6 @@ private:
string_t m_titleTelemetryDeviceId;
friend class system::user_impl_idp;
#if UWP_API || UNIT_TEST_SERVICES
public:
/// <summary>
/// Returns the reference to sign in UI settings.
/// </summary>
_XSAPIIMP signin_ui_settings& app_signin_ui_settings() { return m_signinUISettings; }
private:
signin_ui_settings m_signinUISettings;
#endif
};
NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_END

Просмотреть файл

@ -9,9 +9,6 @@
//*********************************************************
#include "pch.h"
#include "AppConfiguration_WinRT.h"
#if UWP_API || UNIT_TEST_SERVICES
#include "SignInUISettings_WinRT.h"
#endif
using namespace Concurrency;
using namespace Platform;
@ -31,12 +28,5 @@ XboxLiveAppConfiguration::XboxLiveAppConfiguration(
{
}
#if UWP_API || UNIT_TEST_SERVICES
SignInUISettings^
XboxLiveAppConfiguration::AppSignInUISettings::get()
{
return ref new SignInUISettings(m_cppObj);
}
#endif
NAMESPACE_MICROSOFT_XBOX_SERVICES_END

Просмотреть файл

@ -16,10 +16,6 @@
NAMESPACE_MICROSOFT_XBOX_SERVICES_BEGIN
#if UWP_API || UNIT_TEST_SERVICES
ref class SignInUISettings;
#endif
/// <summary>
/// Represents the configuration of an Xbox Live application.
/// </summary>
@ -54,13 +50,6 @@ public:
/// </summary>
DEFINE_PTR_PROP_GET_STR_OBJ(Sandbox, sandbox);
#if UWP_API || UNIT_TEST_SERVICES
property SignInUISettings^ AppSignInUISettings
{
SignInUISettings^ get();
}
#endif
internal:
XboxLiveAppConfiguration(
_In_ std::shared_ptr<xbox::services::xbox_live_app_config> cppObj

Просмотреть файл

@ -1,75 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
NAMESPACE_MICROSOFT_XBOX_SERVICES_BEGIN
/// <summary>
/// Enum for emphasizing Xbox Live features your title has.
/// </summary>
public enum class SignInUIEmphasisFeature
{
/// <summary>
/// Enum for emphasizing Xbox Live achievement feature.
/// </summary>
Achievements = xbox::services::signin_ui_settings::emphasis_feature::achievements,
/// <summary>
/// Enum for emphasizing Xbox Live connected storage feature.
/// </summary>
ConnectedStorage = xbox::services::signin_ui_settings::emphasis_feature::connected_storage,
/// <summary>
/// Enum for emphasizing Xbox Live find players feature.
/// </summary>
FindPlayers = xbox::services::signin_ui_settings::emphasis_feature::find_players,
/// <summary>
/// Enum for emphasizing Xbox Live game bar feature.
/// </summary>
GameBar = xbox::services::signin_ui_settings::emphasis_feature::game_bar,
/// <summary>
/// Enum for emphasizing Xbox Live game DVR feature.
/// </summary>
GameDVR = xbox::services::signin_ui_settings::emphasis_feature::game_dvr,
/// <summary>
/// Enum for emphasizing Xbox Live leaderboards feature.
/// </summary>
Leaderboards = xbox::services::signin_ui_settings::emphasis_feature::leaderboards,
/// <summary>
/// Enum for emphasizing Xbox Live multiplayer feature.
/// </summary>
Multiplayer = xbox::services::signin_ui_settings::emphasis_feature::multiplayer,
/// <summary>
/// Enum for emphasizing Xbox Live purchase feature.
/// </summary>
Purchase = xbox::services::signin_ui_settings::emphasis_feature::purchase,
/// <summary>
/// Enum for emphasizing Xbox Live shared content feature.
/// </summary>
SharedContent = xbox::services::signin_ui_settings::emphasis_feature::shared_content,
/// <summary>
/// Enum for emphasizing Xbox Live social feature.
/// </summary>
Social = xbox::services::signin_ui_settings::emphasis_feature::social,
/// <summary>
/// Enum for emphasizing Xbox Live tournaments feature.
/// </summary>
Tournaments = xbox::services::signin_ui_settings::emphasis_feature::tournaments,
};
NAMESPACE_MICROSOFT_XBOX_SERVICES_END

Просмотреть файл

@ -1,31 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
NAMESPACE_MICROSOFT_XBOX_SERVICES_BEGIN
/// <summary>
/// Enum for current game category, sign in UI will adjust accordingly based on
/// your game category.
/// </summary>
public enum class SignInUIGameCategory
{
/// <summary>
/// Enum for setting current title as standard game category.
/// </summary>
Standard = xbox::services::signin_ui_settings::game_category::standard,
/// <summary>
/// Enum for setting current title as casual game category
/// </summary>
Casual = xbox::services::signin_ui_settings::game_category::casual,
};
NAMESPACE_MICROSOFT_XBOX_SERVICES_END

Просмотреть файл

@ -1,73 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "pch.h"
#include "SignInUISettings_WinRT.h"
using namespace Platform;
using namespace Platform::Collections;
using namespace xbox::services;
NAMESPACE_MICROSOFT_XBOX_SERVICES_BEGIN
SignInUISettings::SignInUISettings(std::shared_ptr<xbox::services::xbox_live_app_config> cppObj):
m_cppObj(std::move(cppObj))
{}
SignInUIGameCategory
SignInUISettings::TitleCategory::get()
{
return static_cast<SignInUIGameCategory>(m_cppObj->app_signin_ui_settings().title_category());
}
void
SignInUISettings::TitleCategory::set(SignInUIGameCategory category)
{
return m_cppObj->app_signin_ui_settings().set_game_category(static_cast<signin_ui_settings::game_category>(category));
}
void
SignInUISettings::AddEmphasisFeature(SignInUIEmphasisFeature feature)
{
return m_cppObj->app_signin_ui_settings().add_emphasis_feature(static_cast<signin_ui_settings::emphasis_feature>(feature));
}
Windows::Foundation::Collections::IVectorView<SignInUIEmphasisFeature>^
SignInUISettings::EmphasisFeatures::get()
{
Vector<SignInUIEmphasisFeature>^ features = ref new Vector<SignInUIEmphasisFeature>();
for (auto featrue : m_cppObj->app_signin_ui_settings().emphasis_features())
{
features->Append(static_cast<SignInUIEmphasisFeature>(featrue));
}
return features->GetView();
}
void
SignInUISettings::SetBackgroundImage(const Platform::Array<byte>^ image)
{
byte* bufferBytes = image->Data;
std::vector<unsigned char> imageBuffer(bufferBytes, bufferBytes + image->Length);
return m_cppObj->app_signin_ui_settings().set_background_image(imageBuffer);
}
String^
SignInUISettings::BackgroundHexColor::get()
{
return ref new String(m_cppObj->app_signin_ui_settings().background_hex_color().c_str());
}
void SignInUISettings::BackgroundHexColor::set(Platform::String^ color)
{
m_cppObj->app_signin_ui_settings().set_background_hex_color(color->Data());
}
NAMESPACE_MICROSOFT_XBOX_SERVICES_END

Просмотреть файл

@ -1,74 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
#include "Macros_WinRT.h"
#include "xsapi/xbox_live_app_config.h"
#include "SignInUISettings_WinRT.h"
#include "SignInUIGameCategory_WinRT.h"
#include "SignInUIEmphasisFeature_WinRT.h"
NAMESPACE_MICROSOFT_XBOX_SERVICES_BEGIN
/// <summary>
/// Represents the configuration of an Xbox Live application.
/// </summary>
public ref class SignInUISettings sealed
{
public:
/// <summary>
/// Current SignInUIGameCategory setting
/// </summary>
property SignInUIGameCategory TitleCategory
{
SignInUIGameCategory get();
void set(SignInUIGameCategory);
}
/// <summary>
/// Specify which emphasized Xbox Live feature you want to show on the sign in page, up to 3.
/// </summary>
void AddEmphasisFeature(SignInUIEmphasisFeature feature);
/// <summary>
/// Retrieve the emphasis features added to show on the UI, only first 3 will be displayed.
/// </summary>
property Windows::Foundation::Collections::IVectorView<SignInUIEmphasisFeature>^ EmphasisFeatures
{
Windows::Foundation::Collections::IVectorView<SignInUIEmphasisFeature>^ get();
}
/// <summary>
/// Specify the background image you want to show in the sign in page, in raw binary form.
/// </summary>
/// <remarks>
/// An Image can be one of the following format: jpeg, jpg, png, bmp, gif, tiff and ico.
/// The input source will always be stretched to 300X400 pixels , thus the file larger than that
/// is not recommended.
/// </remarks>
void SetBackgroundImage(const Platform::Array<byte>^ image);
/// <summary>
/// The background color of sign in page the title has set. Example: "0F2C55".
/// </summary>
property Platform::String^ BackgroundHexColor
{
Platform::String^ get();
void set(Platform::String^ color);
}
internal:
SignInUISettings(std::shared_ptr<xbox::services::xbox_live_app_config> cppObj);
private:
std::shared_ptr<xbox::services::xbox_live_app_config> m_cppObj;
};
NAMESPACE_MICROSOFT_XBOX_SERVICES_END

Просмотреть файл

@ -19,54 +19,6 @@ NAMESPACE_MICROSOFT_XBOX_SERVICES_CPP_BEGIN
static std::mutex g_appConfigSingletonLock;
static std::shared_ptr<xbox_live_app_config> g_appConfigSingleton;
#if UWP_API || UNIT_TEST_SERVICES
void signin_ui_settings::set_background_image(const std::vector<unsigned char>& image)
{
m_backgroundImageBase64Encoded = utility::conversions::to_base64(image);
}
bool signin_ui_settings::_Enabled()
{
// If any of these settings are being set, enable UI customization
return !m_backgroundColor.empty() ||
!m_backgroundImageBase64Encoded.empty() ||
m_features.size() > 0 ||
m_gameCategory != signin_ui_settings::game_category::standard;
}
string_t signin_ui_settings::_Feature_to_string(emphasis_feature feature)
{
switch (feature)
{
case signin_ui_settings::emphasis_feature::achievements:
return _T("Achievements");
case signin_ui_settings::emphasis_feature::connected_storage:
return _T("ConnectedStorage");
case signin_ui_settings::emphasis_feature::find_players:
return _T("FindPlayers");
case signin_ui_settings::emphasis_feature::game_bar:
return _T("Gamebar");
case signin_ui_settings::emphasis_feature::game_dvr:
return _T("GameDVR");
case signin_ui_settings::emphasis_feature::leaderboards:
return _T("Leaderboards");
case signin_ui_settings::emphasis_feature::multiplayer:
return _T("Multiplayer");
case signin_ui_settings::emphasis_feature::purchase:
return _T("Purchase");
case signin_ui_settings::emphasis_feature::shared_content:
return _T("SharedContent");
case signin_ui_settings::emphasis_feature::social:
return _T("Social");
case signin_ui_settings::emphasis_feature::tournaments:
return _T("Tournaments");
default:
return _T("");
}
}
#endif
std::shared_ptr<xbox_live_app_config>
xbox_live_app_config::get_app_config_singleton()
{

Просмотреть файл

@ -127,23 +127,6 @@ XboxLiveUser::SignInSilentlyAsync(
return ASYNC_FROM_TASK(task);
}
IAsyncOperation<SignInResult^>^
XboxLiveUser::SwitchAccountAsync(
_In_opt_ Platform::Object^ coreDispatcher
)
{
xbox_live_context_settings::_Set_dispatcher(coreDispatcher);
auto task = GetUserImpl()->switch_account()
.then([](xbox_live_result<sign_in_result> t)
{
THROW_IF_ERR(t);
return ref new SignInResult(t.payload());
});
return ASYNC_FROM_TASK(task);
}
IAsyncOperation<GetTokenAndSignatureResult^>^
wrap_result(_In_ pplx::task<xbox::services::xbox_live_result<token_and_signature_result>> inner)
{

Просмотреть файл

@ -108,22 +108,6 @@ public:
_In_opt_ Platform::Object^ coreDispatcher
);
/// <summary>
/// Display UI allowing a user to switch to another Xbox Live account.
/// </summary>
/// <param name="coreDispatcher">The Windows Runtime core event message dispatcher.</param>
/// <returns>
/// An interface for tracking the progress of the asynchronous call.
/// </returns>
/// <remarks>
/// This is cast as Platform::Object^ instead of Windows::UI::Core::CoreDispatcher^ to avoid the
/// [Windows::Foundation::Metadata::WebHostHidden] requirement.
/// </remarks>
Windows::Foundation::IAsyncOperation<SignInResult^>^
SwitchAccountAsync(
_In_opt_ Platform::Object^ coreDispatcher
);
/// <summary>
/// Retrieves an authorization token and digital signature for an HTTP request by this user,
/// with no request body.

Просмотреть файл

@ -29,8 +29,7 @@ enum class xbox_shell_sign_in_status
{
success = sign_in_status::success,
user_interaction_required = sign_in_status::user_interaction_required,
user_cancel = sign_in_status::user_cancel,
switch_account
user_cancel = sign_in_status::user_cancel
};
struct sign_in_and_auth_result

Просмотреть файл

@ -95,19 +95,6 @@ xbox_live_user::signin_silently(_In_opt_ Platform::Object^ coreDispatcherObj)
xbox_live_context_settings::_Set_dispatcher(coreDispatcherObj);
return m_user_impl->sign_in_impl(false, false);
}
pplx::task<xbox_live_result<sign_in_result>>
xbox_live_user::switch_account(_In_opt_ Platform::Object^ coreDispatcherObj)
{
xbox_live_context_settings::_Set_dispatcher(coreDispatcherObj);
return m_user_impl->switch_account();
}
#else
pplx::task<xbox_live_result<sign_in_result>>
xbox_live_user::switch_account()
{
return m_user_impl->switch_account();
}
#endif
xbox_live_user::xbox_live_user()

Просмотреть файл

@ -32,7 +32,6 @@ public:
#if XSAPI_U
virtual pplx::task<XBOX_LIVE_NAMESPACE::xbox_live_result<void>> signout() = 0;
#endif
virtual pplx::task<XBOX_LIVE_NAMESPACE::xbox_live_result<sign_in_result>> switch_account() { return pplx::task_from_exception<XBOX_LIVE_NAMESPACE::xbox_live_result<sign_in_result>>(std::exception()); }
virtual pplx::task<xbox_live_result<void>> sign_in_impl(
_In_ const string_t& userDelegationTicket,
@ -144,8 +143,6 @@ public:
_In_ bool forceRefresh
) override;
pplx::task<XBOX_LIVE_NAMESPACE::xbox_live_result<sign_in_result>> switch_account() override;
// Not supported for user_impl_idp
pplx::task<XBOX_LIVE_NAMESPACE::xbox_live_result<void>> sign_in_impl(
_In_ const string_t& userDelegationTicket,
@ -232,9 +229,6 @@ public:
_In_ bool forceRefresh
) override;
// Not supported for user_impl_server
pplx::task<xbox::services::xbox_live_result<sign_in_result>> switch_account() override;
pplx::task<xbox::services::xbox_live_result<void>> sign_in_impl(
_In_ const string_t& userDelegationTicket,
_In_ bool forceRefresh

Просмотреть файл

@ -149,70 +149,6 @@ user_impl_idp::sign_in_impl(_In_ bool showUI, _In_ bool forceRefresh)
return utils::create_exception_free_task<sign_in_result>(task);
}
pplx::task<xbox_live_result<sign_in_result>>
user_impl_idp::switch_account()
{
// Switch account only supported for SUA, for MUA, caller need to create a new xbox live user object for switching
if (!is_multi_user_application())
{
std::weak_ptr<user_impl_idp> thisWeakPtr = std::dynamic_pointer_cast<user_impl_idp>(shared_from_this());
auto task = initialize_provider()
.then([thisWeakPtr]()
{
return create_task([thisWeakPtr]()
{
std::shared_ptr<user_impl_idp> pThis(thisWeakPtr.lock());
if (pThis == nullptr)
{
throw std::runtime_error("user_impl shutting down");
}
auto request = ref new WebTokenRequest(pThis->m_provider);
request->Properties->Insert("SwitchAccount", "");
request->Properties->Insert("Url", PLATFORM_STRING_FROM_STRING_T(pThis->m_authConfig->xbox_live_endpoint()));
request->Properties->Insert("Target", PLATFORM_STRING_FROM_STRING_T(pThis->m_authConfig->rps_ticket_service()));
request->Properties->Insert("Policy", PLATFORM_STRING_FROM_STRING_T(pThis->m_authConfig->rps_ticket_policy()));
pThis->user_signed_out();
WebTokenRequestResult^ tokenResult = pThis->request_token_from_idp(
xbox_live_context_settings::_s_dispatcher,
true,
request
);
xbox_live_result<token_and_signature_result> result = pThis->convert_web_token_request_result(tokenResult);
if (result.err())
{
return xbox_live_result<sign_in_result>(result.err(), result.err_message());
}
else
{
auto& payload = result.payload();
if (payload.token_request_result() == nullptr)
{
pThis->user_signed_in(payload.xbox_user_id(), payload.gamertag(), payload.age_group(), payload.privileges(), payload.web_account_id());
return xbox_live_result<sign_in_result>(sign_in_status::success);
}
else
{
return xbox_live_result<sign_in_result>(convert_web_token_request_status(payload.token_request_result()));
}
}
});
}, pplx::task_continuation_context::use_arbitrary());
return utils::create_exception_free_task<sign_in_result>(task);
}
else
{
return pplx::task_from_result(xbox_live_result<sign_in_result>(xbox_live_error_code::unsupported, "Switching account is not supported for multi-user application, please create new xbox live user object."));
}
}
pplx::task<void>
user_impl_idp::initialize_provider()
@ -356,42 +292,8 @@ user_impl_idp::internal_get_token_and_signature_helper(
if (promptForCredentialsIfNeeded)
{
// Sign in UI settings
auto& uiSettings = xbox_live_app_config::get_app_config_singleton()->app_signin_ui_settings();
String^ pfn = Windows::ApplicationModel::Package::Current->Id->FamilyName;
request->Properties->Insert("PackageFamilyName", pfn);
if (uiSettings._Enabled())
{
if (!uiSettings.background_hex_color().empty())
{
request->Properties->Insert("PreferredColor", PLATFORM_STRING_FROM_STRING_T(uiSettings.background_hex_color()));
}
if (uiSettings.title_category() == signin_ui_settings::game_category::casual)
{
request->Properties->Insert("CasualGame", "");
}
if (!uiSettings._Background_image_base64_encoded().empty())
{
request->Properties->Insert("TitleUpsellImage", PLATFORM_STRING_FROM_STRING_T(uiSettings._Background_image_base64_encoded()));
}
auto featureCount = uiSettings.emphasis_features().size();
if (featureCount > 0)
{
featureCount = __min(3, featureCount);
string_t bullets;
auto iter = uiSettings.emphasis_features().begin();
for (size_t i = 0; i < featureCount; i++,iter++)
{
bullets += signin_ui_settings::_Feature_to_string(*iter) + _T(",");
}
request->Properties->Insert("TitleUpsellFeatures", PLATFORM_STRING_FROM_STRING_T(bullets));
}
}
}
WebTokenRequestResult^ tokenResult = request_token_from_idp(

Просмотреть файл

@ -22,13 +22,6 @@ user_impl_server::sign_in_impl(_In_ bool showUI, _In_ bool forceRefresh)
throw std::exception("not supported.");
}
pplx::task<xbox_live_result<sign_in_result>>
user_impl_server::switch_account()
{
throw std::exception("not supported.");
}
user_impl_server::user_impl_server(void *) :
user_impl()
{

Просмотреть файл

@ -18,7 +18,6 @@
<Grid Margin="57,46,0,0" Height="52" VerticalAlignment="Top" HorizontalAlignment="Left" Width="411" >
<Button x:Name="SignInButton" Content="Sign In" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Click="SignInButton_Click" Margin="-3,0,302,0" Height="38"/>
<Button x:Name="SwitchAccountButton" Content="Switch Account" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Click="SwitchAccountButton_Click" Margin="115,0,163,0" Height="38"/>
</Grid>
<StackPanel Margin="57,111,0,0" Height="196" VerticalAlignment="Top" HorizontalAlignment="Left" Width="411" >

Просмотреть файл

@ -61,12 +61,6 @@ namespace Social
bool APIExist = Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.System.UserPicker", "IsSupported");
m_isMultiUserApplication = APIExist && Windows.System.UserPicker.IsSupported();
// Hide switch user button as it is not supported on multi-user application
if (m_isMultiUserApplication)
{
SwitchAccountButton.Visibility = Visibility.Collapsed;
}
// Only show the file picker for PC
var deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;
if (deviceFamily != "Windows.Desktop")
@ -136,11 +130,6 @@ namespace Social
SignIn();
}
private void SwitchAccountButton_Click(object sender, RoutedEventArgs e)
{
SwitchAccount();
}
void ClearLogs()
{
OutputStackPanel.Children.Clear();
@ -218,26 +207,6 @@ namespace Social
});
}
async void SwitchAccount()
{
UserInfoLabel.Text = "Trying to Switch Account...";
Log(UserInfoLabel.Text);
// SwtichAccount only support Single User Application, so there will be only one user
try
{
var userToSwitch = m_xboxliveContexts.First().Value.User;
var signInResult = await userToSwitch.SwitchAccountAsync(Windows.UI.Xaml.Window.Current.CoreWindow.Dispatcher);
HandleSignInResult(signInResult, userToSwitch);
}
catch (Exception e)
{
Log("SwitchAccountAsync failed. Exception: " + e.ToString());
}
}
public async void LogEvent(String str)
{
await UIDispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,

Просмотреть файл

@ -81,8 +81,6 @@ void App::SetWindow(CoreWindow^ window)
Platform::Agile<Windows::UI::Core::CoreWindow> agileWindow(window);
m_agileWindow = agileWindow;
SignInUISetup();
}
// Initializes scene resources, or loads a previously saved app state.
@ -203,29 +201,3 @@ void App::OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args)
m_deviceResources->ValidateDevice();
}
void App::SignInUISetup()
{
auto& uiSettings = xbox::services::xbox_live_app_config::get_app_config_singleton()->app_signin_ui_settings();
uiSettings.set_background_hex_color(L"0F2C55");
uiSettings.set_game_category(xbox::services::signin_ui_settings::game_category::casual);
uiSettings.add_emphasis_feature(xbox::services::signin_ui_settings::emphasis_feature::achievements);
uiSettings.add_emphasis_feature(xbox::services::signin_ui_settings::emphasis_feature::connected_storage);
uiSettings.add_emphasis_feature(xbox::services::signin_ui_settings::emphasis_feature::find_players);
Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::Storage::StorageFolder^ installedLocation = package->InstalledLocation;
auto imagePath = installedLocation->Path + _T("\\Assets\\background.jpg");
std::ifstream in(imagePath->Data(), std::ios::in | std::ios::binary);
if (in)
{
std::vector<unsigned char> fileData;
in.seekg(0, std::ios::end);
size_t fileSizeInBytes = static_cast<size_t>(in.tellg());
fileData.resize(fileSizeInBytes);
in.seekg(0, std::ios::beg);
in.read(reinterpret_cast<char*>(&fileData[0]), fileData.size());
uiSettings.set_background_image(fileData);
}
}

Просмотреть файл

@ -35,8 +35,6 @@ namespace Sample
void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
void OnDisplayContentsInvalidated(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
void SignInUISetup();
private:
std::shared_ptr<DX::DeviceResources> m_deviceResources;
std::shared_ptr<Game> m_main;

Просмотреть файл

@ -34,7 +34,6 @@ Game::Game(const std::shared_ptr<DX::DeviceResources>& deviceResources) :
void Game::RegisterInputKeys()
{
m_input->RegisterKey(Windows::System::VirtualKey::S, ButtonPress::SignIn);
m_input->RegisterKey(Windows::System::VirtualKey::X, ButtonPress::SwitchAccount);
m_input->RegisterKey(Windows::System::VirtualKey::Number1, ButtonPress::ToggleSocialGroup1);
m_input->RegisterKey(Windows::System::VirtualKey::Number2, ButtonPress::ToggleSocialGroup2);
m_input->RegisterKey(Windows::System::VirtualKey::Number3, ButtonPress::ToggleSocialGroup3);
@ -183,11 +182,6 @@ void Game::OnGameUpdate()
{
SignIn();
}
if (m_input->IsKeyDown(ButtonPress::SwitchAccount))
{
SwitchAccount();
}
}
}
break;
@ -633,32 +627,6 @@ void Game::SignInSilently()
}
void Game::SwitchAccount()
{
std::weak_ptr<Game> thisWeakPtr = shared_from_this();
auto asyncOp = m_user->switch_account(nullptr);
create_task(asyncOp)
.then([thisWeakPtr](xbox::services::xbox_live_result<xbox::services::system::sign_in_result> t)
{
std::shared_ptr<Game> pThis(thisWeakPtr.lock());
if (pThis == nullptr)
{
return;
}
if (!t.err())
{
auto result = t.payload();
pThis->HandleSignInResult(result);
}
else
{
pThis->Log(L"Failed switching account");
}
}, task_continuation_context::use_current());
}
void Game::HandleSignout(_In_ std::shared_ptr<xbox::services::system::xbox_live_user> user)
{
std::shared_ptr<xbox::services::xbox_live_context> xblContext = GetXboxLiveContext();

Просмотреть файл

@ -18,7 +18,6 @@
enum ButtonPress
{
SignIn,
SwitchAccount,
ToggleSocialGroup1,
ToggleSocialGroup2,
ToggleSocialGroup3,
@ -55,7 +54,6 @@ namespace Sample
void SignIn();
void SignInSilently();
void SwitchAccount();
void HandleSignInResult(_In_ const xbox::services::system::sign_in_result &result);

Просмотреть файл

@ -81,8 +81,6 @@ void App::SetWindow(CoreWindow^ window)
Platform::Agile<Windows::UI::Core::CoreWindow> agileWindow(window);
m_agileWindow = agileWindow;
SignInUISetup();
}
// Initializes scene resources, or loads a previously saved app state.
@ -203,29 +201,3 @@ void App::OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args)
m_deviceResources->ValidateDevice();
}
void App::SignInUISetup()
{
auto& uiSettings = xbox::services::xbox_live_app_config::get_app_config_singleton()->app_signin_ui_settings();
uiSettings.set_background_hex_color(L"0F2C55");
uiSettings.set_game_category(xbox::services::signin_ui_settings::game_category::casual);
uiSettings.add_emphasis_feature(xbox::services::signin_ui_settings::emphasis_feature::achievements);
uiSettings.add_emphasis_feature(xbox::services::signin_ui_settings::emphasis_feature::connected_storage);
uiSettings.add_emphasis_feature(xbox::services::signin_ui_settings::emphasis_feature::find_players);
Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::Storage::StorageFolder^ installedLocation = package->InstalledLocation;
auto imagePath = installedLocation->Path + _T("\\Assets\\background.jpg");
std::ifstream in(imagePath->Data(), std::ios::in | std::ios::binary);
if (in)
{
std::vector<unsigned char> fileData;
in.seekg(0, std::ios::end);
size_t fileSizeInBytes = static_cast<size_t>(in.tellg());
fileData.resize(fileSizeInBytes);
in.seekg(0, std::ios::beg);
in.read(reinterpret_cast<char*>(&fileData[0]), fileData.size());
uiSettings.set_background_image(fileData);
}
}

Просмотреть файл

@ -34,7 +34,6 @@ Game::Game(const std::shared_ptr<DX::DeviceResources>& deviceResources) :
void Game::RegisterInputKeys()
{
m_input->RegisterKey(Windows::System::VirtualKey::S, ButtonPress::SignIn);
m_input->RegisterKey(Windows::System::VirtualKey::X, ButtonPress::SwitchAccount);
m_input->RegisterKey(Windows::System::VirtualKey::Number1, ButtonPress::ToggleSocialGroup1);
m_input->RegisterKey(Windows::System::VirtualKey::Number2, ButtonPress::ToggleSocialGroup2);
m_input->RegisterKey(Windows::System::VirtualKey::Number3, ButtonPress::ToggleSocialGroup3);
@ -183,11 +182,6 @@ void Game::OnGameUpdate()
{
SignIn();
}
if (m_input->IsKeyDown(ButtonPress::SwitchAccount))
{
SwitchAccount();
}
}
}
break;
@ -633,32 +627,6 @@ void Game::SignInSilently()
}
void Game::SwitchAccount()
{
std::weak_ptr<Game> thisWeakPtr = shared_from_this();
auto asyncOp = m_user->switch_account(nullptr);
create_task(asyncOp)
.then([thisWeakPtr](xbox::services::xbox_live_result<xbox::services::system::sign_in_result> t)
{
std::shared_ptr<Game> pThis(thisWeakPtr.lock());
if (pThis == nullptr)
{
return;
}
if (!t.err())
{
auto result = t.payload();
pThis->HandleSignInResult(result);
}
else
{
pThis->Log(L"Failed switching account");
}
}, task_continuation_context::use_current());
}
void Game::HandleSignout(_In_ std::shared_ptr<xbox::services::system::xbox_live_user> user)
{
std::shared_ptr<xbox::services::xbox_live_context> xblContext = GetXboxLiveContext();

Просмотреть файл

@ -18,7 +18,6 @@
enum ButtonPress
{
SignIn,
SwitchAccount,
ToggleSocialGroup1,
ToggleSocialGroup2,
ToggleSocialGroup3,
@ -55,7 +54,6 @@ namespace Sample
void SignIn();
void SignInSilently();
void SwitchAccount();
void HandleSignInResult(_In_ const xbox::services::system::sign_in_result &result);

Просмотреть файл

@ -34,7 +34,6 @@ Game::Game(const std::shared_ptr<DX::DeviceResources>& deviceResources) :
void Game::RegisterInputKeys()
{
m_input->RegisterKey(Windows::System::VirtualKey::S, ButtonPress::SignIn);
m_input->RegisterKey(Windows::System::VirtualKey::X, ButtonPress::SwitchAccount);
m_input->RegisterKey(Windows::System::VirtualKey::Number1, ButtonPress::ToggleSocialGroup1);
m_input->RegisterKey(Windows::System::VirtualKey::Number2, ButtonPress::ToggleSocialGroup2);
m_input->RegisterKey(Windows::System::VirtualKey::Number3, ButtonPress::ToggleSocialGroup3);
@ -183,11 +182,6 @@ void Game::OnGameUpdate()
{
SignIn();
}
if (m_input->IsKeyDown(ButtonPress::SwitchAccount))
{
SwitchAccount();
}
}
}
break;
@ -633,32 +627,6 @@ void Game::SignInSilently()
}
void Game::SwitchAccount()
{
std::weak_ptr<Game> thisWeakPtr = shared_from_this();
auto asyncOp = m_user->switch_account(nullptr);
create_task(asyncOp)
.then([thisWeakPtr](xbox::services::xbox_live_result<xbox::services::system::sign_in_result> t)
{
std::shared_ptr<Game> pThis(thisWeakPtr.lock());
if (pThis == nullptr)
{
return;
}
if (!t.err())
{
auto result = t.payload();
pThis->HandleSignInResult(result);
}
else
{
pThis->Log(L"Failed switching account");
}
}, task_continuation_context::use_current());
}
void Game::HandleSignout(_In_ std::shared_ptr<xbox::services::system::xbox_live_user> user)
{
std::shared_ptr<xbox::services::xbox_live_context> xblContext = GetXboxLiveContext();

Просмотреть файл

@ -18,7 +18,6 @@
enum ButtonPress
{
SignIn,
SwitchAccount,
ToggleSocialGroup1,
ToggleSocialGroup2,
ToggleSocialGroup3,
@ -55,7 +54,6 @@ namespace Sample
void SignIn();
void SignInSilently();
void SwitchAccount();
void HandleSignInResult(_In_ const xbox::services::system::sign_in_result &result);

Просмотреть файл

@ -24,11 +24,6 @@ public:
_In_ bool forceRefresh
) override;
virtual pplx::task<xbox::services::xbox_live_result<sign_in_result>> switch_account() override
{
return pplx::task_from_result(xbox::services::xbox_live_result<sign_in_result>());
}
virtual pplx::task<xbox_live_result<void>> sign_in_impl(
_In_ const string_t& userDelegationTicket,
_In_ bool forceRefresh