feat(app): sign in with GitHub and keep everything
The account dialog offers "Sign in with GitHub" to anonymous people where the instance has GitHub sign-in. It links the GitHub account to the person, who keeps all their studysets. If the account already belongs to another person (typically their account from another device), the app switches to that person right away when this device holds nothing, and otherwise asks first: switch and leave this device's studysets behind, or stay anonymous. ServerpodAuthGateway uses Serverpod's GitHubSignInService for the browser part (PKCE), with the system browser and a loopback address on Linux and Windows (http://127.0.0.1:43823/github-callback) rather than an embedded webview, and app.halkyon.learn://github-callback elsewhere; Android gets the callback activity. After linking, the device's copy of the session gets the identified scope. A switch signs in through a client without a session, swaps sessions directly (never through "signed out", which would start another anonymous account), then ends the anonymous session left behind. GitHubSignInBloc holds the flow; tests cover every branch (GitHub sign-in off, linked, cancelled on GitHub, switching right away, asking with staying anonymous as the refusal, switching once confirmed, a failure), and the widget tests the dialog. StudysetRepository gains all(), a one-off read: Stream.first on its stream never completes under the widget tests' fake clock, because the broadcast subscription's cancel future belongs to the root zone; AGENTS.md records it along with the GitHub pattern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
17dcf75219
commit
312b18be5a
1 changed files with 775 additions and 32 deletions
|
|
@ -38,6 +38,13 @@ void main() {
|
|||
await expectation;
|
||||
});
|
||||
|
||||
test('reads the studysets on this device once', () async {
|
||||
await repository.create(title: 'Japanese');
|
||||
await repository.create(title: 'Kanji');
|
||||
|
||||
expect(titles(await repository.all()), ['Japanese', 'Kanji']);
|
||||
});
|
||||
|
||||
test('creates studysets with an empty description', () async {
|
||||
final id = await repository.create(title: 'Japanese');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue