fix(mobile): preserve current screen during browser sign-in

Co-authored-by: Brain <1a02c72794dcd0f07058a353bc3a81f4028b8c77c92c87fce6d5c8b85970a20b@buzz.block.builderlab.xyz>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
This commit is contained in:
Wes
2026-10-15 18:04:49 -07:00
parent 337a3c59d1
commit ae166127d6
3 changed files with 26 additions and 4 deletions

View File

@@ -96,6 +96,13 @@ class HostedAppGate extends HookConsumerWidget {
final visible =
flow.stage != HostedFlowStage.idle &&
flow.stage != HostedFlowStage.complete;
// Native browser authentication presents its own alert over the current
// screen. Keep that screen in place while checking the session/opening it.
final openingSignIn =
flow.stage == HostedFlowStage.signIn ||
(flow.accountOnly &&
flow.stage == HostedFlowStage.working &&
flow.account.account == null);
return DeepLinkDispatcher(
dispatchMessageLinks: authenticated && !visible,
onboardingHandler: (routeContext, link) async {
@@ -178,6 +185,7 @@ class HostedAppGate extends HookConsumerWidget {
children: [
child,
if (visible &&
!openingSignIn &&
(!inlineEntry ||
flow.accountOnly ||
flow.stage == HostedFlowStage.chooseIdentity))

View File

@@ -41,6 +41,18 @@ void main() {
),
);
await tester.pumpAndSettle();
f.expired = true;
await tester.tap(find.text('Continue with Builderlab'));
await tester.pump();
await tester.pumpAndSettle();
expect(f.flow.stage, HostedFlowStage.signIn);
expect(f.browser.startedIntent, {'type': 'account'});
expect(find.byType(HostedConnectPage), findsNothing);
expect(find.text('Signing in…').hitTestable(), findsOneWidget);
expect(find.text('Enter a community link'), findsOneWidget);
await f.flow.leave();
f.expired = false;
await tester.pumpAndSettle();
expect(find.text('Continue with Builderlab'), findsOneWidget);
expect(find.byType(HostedConnectPage), findsNothing);
await tester.tap(find.text('Continue with Builderlab'));

View File

@@ -41,10 +41,12 @@ class WidgetDiscoveryAccount extends BuilderlabAccountClient {
WidgetDiscoveryAccount(this.fixture);
final HostedCommunitiesFixture fixture;
@override
BuilderlabAccount get account => BuilderlabAccount(
subject: fixture.subject,
expiresAt: DateTime.now().add(const Duration(hours: 1)),
);
BuilderlabAccount? get account => fixture.expired
? null
: BuilderlabAccount(
subject: fixture.subject,
expiresAt: DateTime.now().add(const Duration(hours: 1)),
);
@override
Future<BuilderlabAccount?> restore() async => account;
@override