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.
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.
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
Validation steps performed
PR checklist