Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Widget DeveloperId and Sign-in detection to handle login states cleanly #12

Merged
merged 3 commits into from
Nov 14, 2023

Conversation

dkbennett
Copy link
Member

@dkbennett dkbennett commented Nov 11, 2023

Summary of the pull request

Widgets were not handling Sign-in events correctly or showing the sign-in page when it needed to, such as when the developer account the Widget was set to use was not logged in. This updates DeveloperId selection and signin related code to better handle these scenarios.

References and relevant issues

Closes https://github.com/microsoft/DevHomeADOExtension/issues/82
Closes #20

Detailed description of the pull request / Additional comments

  • Refactors the selectedDevId into the base class to reduce code duplication.
  • Updated the default DevId selection code to be less duplicated than before now that selectedDevId is in the base class.
  • Updated the IsUserLoggedIn method to account for SelectedDeveloperId not being logged in after set. An example of this is after the user pins a widget they decide to log out of that user, but there are still other users logged in. Previously the widget would show an adaptive card error becuase there was no DevId. now it instead shows the SignIn page because it detects that the DeveloperId is no longer signed in.
  • Updated the Signin page for widgets to direct the user to Account Settings page to sign in, as we cannot do the signin flow from the Widget becuase it requires the main window Id of DevHome, which we do not have. This will serve as a temporary solution until/if we can solve the signin button working from widgets.
  • Updated the DeveloperId Changed event handling to RequestContentData when the specified developerId signs back in. This makes the widgets come back to life after the developer for which they were configured signs back in after a sign-out event.

Validation steps performed

  • Tests pass
  • Tested many scenarios of sign-in and sign-out with widgets configured, confirming behavior when a developer Id signs out after configuring, and then signs back in. Also verified when no developers are signed in the page is shown.
  • Verified all 3 widget types still function as expected with the Default DeveloperId logic being refactored.

PR checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated

@dkbennett dkbennett merged commit d1e77cc into main Nov 14, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error handling on widget UI when you sign out of one account and the other remains signed in
3 participants