-
Notifications
You must be signed in to change notification settings - Fork 309
login: Implement browser login #281
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; | |
import '../model/narrow.dart'; | ||
import 'about_zulip.dart'; | ||
import 'login.dart'; | ||
import 'login/browser_login.dart'; | ||
import 'message_list.dart'; | ||
import 'page.dart'; | ||
import 'recent_dm_conversations.dart'; | ||
|
@@ -25,10 +26,29 @@ class ZulipApp extends StatelessWidget { | |
// https://m3.material.io/theme-builder#/custom | ||
colorScheme: ColorScheme.fromSeed(seedColor: kZulipBrandColor)); | ||
return GlobalStoreWidget( | ||
child: MaterialApp( | ||
title: 'Zulip', | ||
theme: theme, | ||
home: const ChooseAccountPage())); | ||
child: BrowserLoginWidget( | ||
child: Builder( | ||
builder: (context) => MaterialApp( | ||
title: 'Zulip', | ||
theme: theme, | ||
home: const ChooseAccountPage(), | ||
navigatorKey: BrowserLoginWidget.of(context).navigatorKey, | ||
// TODO: Migrate to `MaterialApp.router` & `Router`, so that we can receive | ||
// a full Uri instead of just path+query components and also maybe | ||
Comment on lines
+36
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I was going to write that I believe using … But it turns out that's because my engine tree was a few months old! This feature was added recently in flutter/flutter#100624 . Now Dart does see the full URL. Still, I think we can do this orthogonally to any switch to I think that can then replace the job that this |
||
// remove the InheritedWidget + navigatorKey hack. | ||
// See docs: | ||
// https://api.flutter.dev/flutter/widgets/Router-class.html | ||
onGenerateRoute: (settings) { | ||
if (settings.name == null) return null; | ||
final uri = Uri.parse(settings.name!); | ||
if (uri.queryParameters.containsKey('otp_encrypted_api_key')) { | ||
BrowserLoginWidget.of(context).loginFromExternalRoute(context, uri); | ||
return null; | ||
} | ||
return null; | ||
})), | ||
), | ||
); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put API bindings changes in a separate prep commit. That's a helpful way to split up the changes logically to make them easier to understand and review.