Skip to content

Conversation

Esam-Bustaty
Copy link
Contributor

Added Authenticator.IsDoneInitializing field so

while (!service.Authenticator.CanAuthenticate())
    yield return null;

can become:

while (!service.Authenticator.IsDoneInitializing)
    yield return null;

if (!service.Authenticator.CanAuthenticate())
{
    // authentication failed
}
else
{
    // authentication succeeded
}

@Esam-Bustaty Esam-Bustaty changed the title Feature: Auth Ready, Solve #32 Feature: Auth Ready Jun 9, 2020
@Esam-Bustaty Esam-Bustaty changed the title Feature: Auth Ready Feature: Auth Ready, resolves #32 Jun 9, 2020
@Esam-Bustaty Esam-Bustaty changed the title Feature: Auth Ready, resolves #32 Feature: Auth Ready, resolves IBM/unity-sdk-core#32 Jun 9, 2020
Copy link
Member

@mamoonraja mamoonraja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one question, overall it does look fine. I will take some time out to do some testing before approving today. Once again thanks a lot for the PR.


private void OnGetToken(DetailedResponse<CloudPakForDataTokenResponse> response, IBMError error)
{
isDoneInitializing = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should isDoneInitializing be called after we throw the error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, yes.

If we move the new line a few lines down (inside else statement) so it's not called when an error happens, then there would be no way left for a consumer class to know if an error happened.

If you think this is not clear enough, maybe we should have an IsWaiting field instead, it would have the opposite value to IsDoneInitializing, and maybe makes thing more clear?

Base automatically changed from master to main February 10, 2021 22:42
@mediumTaj mediumTaj requested a review from kevinkowa April 9, 2021 15:51
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.

2 participants