Implement event handling and logging improvements

- Updated `ChatMuteList` to implement `UserMuteStateChanged` methods with logging and event handling.
- Modified `UserDisplayInfo` methods to log informational messages instead of throwing exceptions.
- Introduced `m_notificationPositionHint` in `SystemUI` and updated `SetNotificationPositionHint` to log changes.
- Updated header files to declare new static members for better accessibility.
This commit is contained in:
Serenity
2025-06-03 06:15:14 -04:00
parent 9d6d26d584
commit 07e5a6de1e
5 changed files with 57 additions and 10 deletions

View File

@@ -6,10 +6,12 @@ namespace winrt::Windows::Xbox::Chat::implementation
{
winrt::event_token ChatMuteList::UserMuteStateChanged(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::Chat::UserMuteStateChangedEventArgs> const& handler)
{
LOG_NOT_IMPLEMENTED(); throw hresult_not_implemented();
LOG_WARNING("ChatMuteList::UserMuteStateChanged(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::Chat::UserMuteStateChangedEventArgs> const& handler) Stubbed!!");
return m_muteEvent.add(handler);
}
void ChatMuteList::UserMuteStateChanged(winrt::event_token const& token) noexcept
{
LOG_NOT_IMPLEMENTED(); throw hresult_not_implemented();
LOG_WARNING("ChatMuteList::UserMuteStateChanged(winrt::event_token const& token) Stubbed!!");
m_muteEvent.remove(token);
}
}

View File

@@ -9,6 +9,8 @@ namespace winrt::Windows::Xbox::Chat::implementation
static winrt::event_token UserMuteStateChanged(winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::Chat::UserMuteStateChangedEventArgs> const& handler);
static void UserMuteStateChanged(winrt::event_token const& token) noexcept;
private:
inline static winrt::event<winrt::Windows::Foundation::EventHandler<winrt::Windows::Xbox::Chat::UserMuteStateChangedEventArgs>> m_muteEvent;
};
}
namespace winrt::Windows::Xbox::Chat::factory_implementation

View File

@@ -6,39 +6,40 @@ namespace winrt::Windows::Xbox::System::implementation
{
hstring UserDisplayInfo::Gamertag()
{
LOG_NOT_IMPLEMENTED();
LOG_INFO("UserDisplayInfo::Gamertag() called");
hstring gamertag = L"durangler" + m_gamertag;
return gamertag;
}
uint32_t UserDisplayInfo::GamerScore()
{
LOG_NOT_IMPLEMENTED(); return 0;
LOG_INFO("UserDisplayInfo::GamerScore() called");
return 0;
}
hstring UserDisplayInfo::ApplicationDisplayName()
{
LOG_NOT_IMPLEMENTED();
LOG_INFO("UserDisplayInfo::GameDisplayName() called");
return winrt::to_hstring("WinDurango");
}
hstring UserDisplayInfo::GameDisplayName()
{
LOG_NOT_IMPLEMENTED();
LOG_INFO("UserDisplayInfo::GameDisplayName() called");
hstring gamertag = L"durangler" + m_gamertag;
return gamertag;
}
int32_t UserDisplayInfo::Reputation()
{
LOG_NOT_IMPLEMENTED();
LOG_INFO("UserDisplayInfo::Reputation() called");
return 1;
}
winrt::Windows::Xbox::System::UserAgeGroup UserDisplayInfo::AgeGroup()
{
Logger::Info("UserDisplayInfo::AgeGroup() called");
LOG_INFO("UserDisplayInfo::AgeGroup() called");
return UserAgeGroup::Unknown;
}
winrt::Windows::Foundation::Collections::IVectorView<uint32_t> UserDisplayInfo::Privileges()
{
LOG_NOT_IMPLEMENTED();
LOG_INFO("UserDisplayInfo::Privileges() called");
auto vector = winrt::single_threaded_vector<uint32_t>();
vector.Append(1);
return vector.GetView();

View File

@@ -8,8 +8,11 @@
void* g_pD3D11XEventFunc = nullptr;
void* g_pWDWaitForKeyboardFunc = nullptr;
namespace winrt::Windows::Xbox::UI::implementation
{
winrt::Windows::Xbox::UI::NotificationPositionHint SystemUI::m_notificationPositionHint =
winrt::Windows::Xbox::UI::NotificationPositionHint::TopRight;
winrt::Windows::Foundation::IAsyncAction SystemUI::ShowEpgAsync(winrt::Windows::Xbox::System::IUser requestingUser, winrt::Windows::Foundation::Collections::IIterable<winrt::Windows::Foundation::Collections::IKeyValuePair<hstring, winrt::Windows::Foundation::IInspectable>> propertySet)
{
LOG_NOT_IMPLEMENTED(); throw hresult_not_implemented();
@@ -114,7 +117,44 @@ namespace winrt::Windows::Xbox::UI::implementation
}
void SystemUI::SetNotificationPositionHint(winrt::Windows::Xbox::UI::NotificationPositionHint const& value)
{
LOG_NOT_IMPLEMENTED(); throw hresult_not_implemented();
LOG_WARNING("SystemUI::SetNotificationPositionHint called.. Function Stubbed!!!");
switch (value)
{
case winrt::Windows::Xbox::UI::NotificationPositionHint::BottomCenter:
LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to BottomCenter.\n");
m_notificationPositionHint = value;
break;
case winrt::Windows::Xbox::UI::NotificationPositionHint::BottomLeft:
LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to BottomLeft.\n");
m_notificationPositionHint = value;
break;
case winrt::Windows::Xbox::UI::NotificationPositionHint::BottomRight:
LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to BottomRight.\n");
m_notificationPositionHint = value;
break;
case winrt::Windows::Xbox::UI::NotificationPositionHint::TopCenter:
LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to TopCenter.\n");
m_notificationPositionHint = value;
break;
case winrt::Windows::Xbox::UI::NotificationPositionHint::TopLeft:
LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to TopLeft.\n");
m_notificationPositionHint = value;
break;
case winrt::Windows::Xbox::UI::NotificationPositionHint::TopRight:
LOG_WARNING("SystemUI::SetNotificationPositionHint: Setting NotificationPositionHint to TopRight.\n");
m_notificationPositionHint = value;
break;
default:
LOG_WARNING("SystemUI::SetNotificationPositionHint: Received unknown value! Defaulting to TopRight.\n");
m_notificationPositionHint = winrt::Windows::Xbox::UI::NotificationPositionHint::TopRight;
break;
}
}
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::UI::WebAuthenticationResult> SystemUI::AuthenticateAsync(winrt::Windows::Xbox::System::IUser requestingUser, winrt::Windows::Xbox::UI::WebAuthenticationOptions options, winrt::Windows::Foundation::Uri requestUri, winrt::Windows::Foundation::Uri callbackUri)
{

View File

@@ -34,7 +34,9 @@ namespace winrt::Windows::Xbox::UI::implementation
static winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::UI::WebAuthenticationResult> AuthenticateAsync(winrt::Windows::Xbox::System::IUser requestingUser, winrt::Windows::Xbox::UI::WebAuthenticationOptions options, winrt::Windows::Foundation::Uri requestUri, winrt::Windows::Foundation::Uri callbackUri);
static winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Xbox::UI::WebAuthenticationResult> AuthenticateAsync(winrt::Windows::Xbox::System::IUser requestingUser, winrt::Windows::Xbox::UI::WebAuthenticationOptions options, winrt::Windows::Foundation::Uri requestUri);
static winrt::Windows::Foundation::Uri GetCurrentApplicationCallbackUri(winrt::Windows::Xbox::System::IUser const& requestingUser);
static winrt::Windows::Xbox::UI::NotificationPositionHint m_notificationPositionHint;
};
}
namespace winrt::Windows::Xbox::UI::factory_implementation
{