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

Oauth updates #1642

Open
wants to merge 51 commits into
base: develop
Choose a base branch
from
Open

Oauth updates #1642

wants to merge 51 commits into from

Conversation

gwbischof
Copy link
Contributor

@gwbischof gwbischof commented Dec 17, 2024

Oauth updates.
This PR depends on thunder-app/lemmy_api_client#28
This can be tested against the lemmy instance at hopandzip.com which I deployed with the lemmy:main

@gwbischof gwbischof marked this pull request as ready for review January 7, 2025 01:11
Copy link
Member

@micahmo micahmo left a comment

Choose a reason for hiding this comment

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

Hey, I just wanted to say, nice going on this!! I know it was a beast to get working, but in the end the code doesn't seem too crazy!

I left a few comments, mostly stylistic things. I haven't actually tested the flow yet but I would love to!

@@ -527,3 +527,78 @@ void showInputDialog<T>({
}),
);
}

/// Shows a dialog which takes input and offers suggestions
Future<String?> showBlockingInputDialog<T>({
Copy link
Member

Choose a reason for hiding this comment

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

This seems pretty similar to showInputDialog. Is there any way to combine these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

showInputDialog doesn't block, so it didn't work to display the dialog where you enter your username on your first oauth login. So I modified it to create showBlockingInputDialog. So yea, they are pretty similar. I think showInputDialog is used in one other place in the code, maybe we could make that one blocking also?

Copy link
Member

Choose a reason for hiding this comment

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

By blocking, do you just mean that the user can't tap outside the dialog area or press back to cancel it?

Is it possible that we can just have a flag for whether it's blocking or not?

We do use the existing one in several places, all of which should continue to be cancelable by the user.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By blocking I mean showBlockingInputDialog will wait for the user to click accept before running the code that follows it. So you can await showBlockingInputDialog and that doesn't work with showInputDialog

https://github.com/thunder-app/thunder/pull/1642/files#diff-4144a1c5223a9dd35fda6e4094acae17e6f1d3f1886b50f47977d043c54f5317R192

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will investigate and see if I can parameterize showInputDialog

Copy link
Member

Choose a reason for hiding this comment

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

Ahh ok I gotcha! In that case, I think it makes sense to transition showInputDialog into a awaitable method. Existing code that doesn't care to await can just not do that and let it run in the background. Let me know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, I think that makes sense. I can do that

Copy link
Member

@micahmo micahmo left a comment

Choose a reason for hiding this comment

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

Nice, the code looks good now! I will try to test if/when I get the chance. If everything is working for you and @hjiangsu, don't worry about waiting for me!

@micahmo
Copy link
Member

micahmo commented Jan 14, 2025

I just pushed a small change which adds a heading above the OAuth providers (to make it clear what they are and that they're an alternative to non-SSO login), and I also added a little space between each provider.

image

@hjiangsu
Copy link
Member

Nice, the code looks good now! I will try to test if/when I get the chance. If everything is working for you and @hjiangsu, don't worry about waiting for me!

Sounds good, the changes look good to me after a quick review, and I've already tested a previous implementation of this! However, I'm going to hold off on merging this in until v0.20.0 is closer to release, or at least until Lemmy's API changes are more stable (at the moment, it looks like there's still a lot of major changes to the API that we'll need to support eventually).

This way, we can re-test the implementation closer to the next major release!

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.

3 participants