Making sidecar configurable via config file instead of hardcoded (#16)
This commit is contained in:
Родитель
42d6ecafc5
Коммит
8f10cc4af5
|
@ -161,6 +161,16 @@ bool local_config::use_first_party_token()
|
|||
return get_bool_from_config(_T("FirstParty"), false, false);
|
||||
}
|
||||
|
||||
string_t local_config::sidecar_pfn()
|
||||
{
|
||||
return get_value_from_config(_T("SidecarPFN"), false, _T(""));
|
||||
}
|
||||
|
||||
string_t local_config::sidecar_appchannel()
|
||||
{
|
||||
return get_value_from_config(_T("SidecarAppChannel"), false, _T(""));
|
||||
}
|
||||
|
||||
#if XSAPI_I
|
||||
string_t local_config::apns_environment()
|
||||
{
|
||||
|
|
|
@ -46,6 +46,8 @@ public:
|
|||
virtual string_t sandbox();
|
||||
virtual string_t client_secret();
|
||||
virtual bool use_first_party_token();
|
||||
virtual string_t sidecar_pfn();
|
||||
virtual string_t sidecar_appchannel();
|
||||
|
||||
virtual string_t get_value_from_local_storage(_In_ const string_t& name);
|
||||
virtual xbox_live_result<void> write_value_to_local_storage(_In_ const string_t& name, _In_ const string_t& value);
|
||||
|
|
|
@ -127,6 +127,8 @@ namespace app_service {
|
|||
std::mutex m_pendingRequestsLock;
|
||||
pplx::event m_connectionReady;
|
||||
HWND m_hWnd = NULL;
|
||||
Platform::String^ m_pfn = _T("");
|
||||
Platform::String^ m_appChannelName = _T("");
|
||||
|
||||
pplx::task<AppServiceConnection^> ensure_connection();
|
||||
void on_service_closed(_In_ AppServiceConnection ^sender, _In_ AppServiceClosedEventArgs ^args);
|
||||
|
@ -148,9 +150,9 @@ namespace app_service {
|
|||
|
||||
m_connectionReady.reset();
|
||||
m_connection = ref new AppServiceConnection();
|
||||
//TODO cuwaters: remove the hardcoded app identity information
|
||||
m_connection->AppServiceName = "xblsidecar-33535007";
|
||||
m_connection->PackageFamilyName = "38133JasonSandlin.8845AE5E9DE2_txz1v18ddy4v6";//Windows::ApplicationModel::Package::Current->Id->FamilyName;
|
||||
m_connection->AppServiceName = m_appChannelName;
|
||||
m_connection->PackageFamilyName = m_pfn;
|
||||
|
||||
return create_task(m_connection->OpenAsync())
|
||||
.then([](pplx::task<AppServiceConnectionStatus> statusTask)
|
||||
{
|
||||
|
@ -231,9 +233,8 @@ namespace app_service {
|
|||
}
|
||||
|
||||
REQUEST message = { requestTracker->request_id(), params... };
|
||||
//TODO: cuwaters remove hard-coded app identity bits
|
||||
auto createWindowTask = uiMode == ui_mode::allowed ?
|
||||
concurrency::create_task(Windows::System::Launcher::LaunchUriAsync(ref new Windows::Foundation::Uri("xblsidecar-33535007://"))) :
|
||||
concurrency::create_task(Windows::System::Launcher::LaunchUriAsync(ref new Windows::Foundation::Uri(m_appChannelName))) :
|
||||
task_from_result(true);
|
||||
|
||||
return createWindowTask
|
||||
|
@ -271,11 +272,15 @@ namespace app_service {
|
|||
}
|
||||
} // anonymous namespace
|
||||
|
||||
pplx::task<xbox_live_result<sign_in_result_message>> sign_in(
|
||||
_In_ bool showUI,
|
||||
_In_ bool forceRefresh
|
||||
pplx::task<xbox_live_result<sign_in_result_message>> sign_in(
|
||||
_In_ bool showUI,
|
||||
_In_ bool forceRefresh,
|
||||
_In_ std::shared_ptr<local_config> config
|
||||
)
|
||||
{
|
||||
{
|
||||
m_pfn = ref new Platform::String(config->sidecar_pfn().c_str());
|
||||
m_appChannelName = ref new Platform::String(config->sidecar_appchannel().c_str());
|
||||
|
||||
auto task = send_app_service_request_and_wait_for_response<sign_in_request_message>(
|
||||
showUI ? ui_mode::allowed : ui_mode::not_allowed,
|
||||
showUI,
|
||||
|
@ -291,9 +296,13 @@ namespace app_service {
|
|||
_In_ const string_t& headers,
|
||||
_In_ const std::vector<unsigned char>& bytes,
|
||||
_In_ bool promptForCredentialsIfNeeded,
|
||||
_In_ bool forceRefresh
|
||||
_In_ bool forceRefresh,
|
||||
_In_ std::shared_ptr<local_config> config
|
||||
)
|
||||
{
|
||||
{
|
||||
m_pfn = ref new Platform::String(config->sidecar_pfn().c_str());
|
||||
m_appChannelName = ref new Platform::String(config->sidecar_appchannel().c_str());
|
||||
|
||||
auto task = send_app_service_request_and_wait_for_response<token_and_signature_request_message>(
|
||||
promptForCredentialsIfNeeded ? ui_mode::allowed : ui_mode::not_allowed,
|
||||
httpMethod,
|
||||
|
@ -308,9 +317,13 @@ namespace app_service {
|
|||
}
|
||||
|
||||
pplx::task<xbox_live_result<achievements_ui_result_message>> show_title_achievements_ui(
|
||||
_In_ uint32_t titleId
|
||||
_In_ uint32_t titleId,
|
||||
_In_ std::shared_ptr<local_config> config
|
||||
)
|
||||
{
|
||||
{
|
||||
m_pfn = ref new Platform::String(config->sidecar_pfn().c_str());
|
||||
m_appChannelName = ref new Platform::String(config->sidecar_appchannel().c_str());
|
||||
|
||||
auto task = send_app_service_request_and_wait_for_response<achievements_ui_request_message>(
|
||||
ui_mode::allowed,
|
||||
titleId);
|
||||
|
|
|
@ -25,7 +25,8 @@ namespace app_service
|
|||
pplx::task<xbox_live_result<sign_in_result_message>>
|
||||
sign_in(
|
||||
_In_ bool showUI,
|
||||
_In_ bool forceRefresh
|
||||
_In_ bool forceRefresh,
|
||||
_In_ std::shared_ptr<local_config> config
|
||||
);
|
||||
|
||||
pplx::task<xbox::services::xbox_live_result<token_and_signature_result_message> >
|
||||
|
@ -36,15 +37,17 @@ namespace app_service
|
|||
_In_ const string_t& headers,
|
||||
_In_ const std::vector<unsigned char>& bytes,
|
||||
_In_ bool promptForCredentialsIfNeeded,
|
||||
_In_ bool forceRefresh
|
||||
_In_ bool forceRefresh,
|
||||
_In_ std::shared_ptr<local_config> config
|
||||
);
|
||||
|
||||
pplx::task<xbox::services::xbox_live_result<achievements_ui_result_message>>
|
||||
show_title_achievements_ui(
|
||||
_In_ uint32_t titleId
|
||||
_In_ uint32_t titleId,
|
||||
_In_ std::shared_ptr<local_config> config
|
||||
);
|
||||
|
||||
void set_hwnd(_In_ HWND hWnd);
|
||||
void set_hwnd(_In_ HWND hWnd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ pplx::task<xbox_live_result<sign_in_result>> user_impl_sidecar::sign_in_impl(
|
|||
)
|
||||
{
|
||||
std::weak_ptr<user_impl_sidecar> thisWeakPtr = std::dynamic_pointer_cast<user_impl_sidecar>(shared_from_this());
|
||||
auto task = app_service::client::sign_in(showUI, forceRefresh)
|
||||
auto task = app_service::client::sign_in(showUI, forceRefresh, m_localConfig)
|
||||
.then([thisWeakPtr](xbox_live_result<app_service::sign_in_result_message> result)
|
||||
{
|
||||
std::shared_ptr<user_impl_sidecar> pThis(thisWeakPtr.lock());
|
||||
|
@ -77,7 +77,8 @@ user_impl_sidecar::internal_get_token_and_signature(
|
|||
headers,
|
||||
bytes,
|
||||
promptForCredentialsIfNeeded,
|
||||
forceRefresh
|
||||
forceRefresh,
|
||||
m_localConfig
|
||||
)
|
||||
.then([thisWeakPtr](xbox_live_result<app_service::token_and_signature_result_message> result)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче