-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add email to user information display
Add user's email to the UI of PresenceLight. * Add a new property `Email` to `AppState` in `src/PresenceLight.Core/Configuration/AppState.cs` to store the user's email. * Create `GetProfileAndPresenceHandler` in `src/PresenceLight.Core/GraphServices/GetProfileAndPresenceHandler.cs` to extract and return the user's email. * Modify `MainWindow.xaml.cs` in `src/DesktopClient/PresenceLight/MainWindow.xaml.cs` to retrieve and store the user's email in the `AppState`. * Update `LoginDisplay.razor` in `src/PresenceLight.Razor/Components/Shared/LoginDisplay.razor` to display the user's email along with their name. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/isaacrlevin/presencelight?shareId=XXXX-XXXX-XXXX-XXXX).
- Loading branch information
1 parent
23969bd
commit b18c99f
Showing
4 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/PresenceLight.Core/GraphServices/GetProfileAndPresenceHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using MediatR; | ||
using Microsoft.Graph.Models; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace PresenceLight.Core.GraphServices | ||
{ | ||
internal class GetProfileAndPresenceHandler : IRequestHandler<GetProfileAndPresenceCommand, (User User, Presence Presence, string Email)> | ||
{ | ||
GraphWrapper _graph; | ||
|
||
public GetProfileAndPresenceHandler(GraphWrapper graph) | ||
{ | ||
_graph = graph; | ||
} | ||
|
||
public async Task<(User User, Presence Presence, string Email)> Handle(GetProfileAndPresenceCommand command, CancellationToken cancellationToken) | ||
{ | ||
var (user, presence) = await _graph.GetProfileAndPresence(cancellationToken); | ||
var email = user.Mail; | ||
return (user, presence, email); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters