Skip to content

Fix demo mode black screen no content #75

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

Merged
merged 2 commits into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/router/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,24 @@ GoRouter createRouter({
' AppStatus: $appStatus',
);

// --- Define Key Paths ---
const rootPath = '/';
const authenticationPath = Routes.authentication;
const feedPath = Routes.feed;
final isGoingToAuth = currentLocation.startsWith(authenticationPath);

// --- Workaround for Demo Environment ---
// In the demo environment, the initial auth state from the in-memory
// client might not be emitted before the first redirect check. If the app
// is still in the `initial` state, we explicitly redirect to the
// authentication page to begin the demo flow, avoiding the black screen.
if (appStatus == AppStatus.initial &&
environment == local_config.AppEnvironment.demo) {
print(
' Redirect (Workaround): In demo mode with initial status. Forcing to authentication.',
);
return authenticationPath;
}

// With the new App startup architecture, the router is only active when
// the app is in a stable, running state. The `redirect` function's
// only responsibility is to handle auth-based route protection.
Expand Down
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: f48dc0555b1a28ed3c51215f3a93403dbbc46ea0
resolved-ref: "9c25c6bff76c554e5220368536fcb9370758f48f"
url: "https://github.com/flutter-news-app-full-source-code/auth-inmemory.git"
source: git
version: "0.0.0"
Expand Down Expand Up @@ -178,7 +178,7 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: "7a1b54f8c0f94f6c04af3404c8110181e080b5c4"
resolved-ref: f648500814ec636a2930498756029d29b363194a
url: "https://github.com/flutter-news-app-full-source-code/core.git"
source: git
version: "0.0.0"
Expand Down Expand Up @@ -426,10 +426,10 @@ packages:
dependency: "direct main"
description:
name: go_router
sha256: c489908a54ce2131f1d1b7cc631af9c1a06fac5ca7c449e959192089f9489431
sha256: "8b1f37dfaf6e958c6b872322db06f946509433bec3de753c3491a42ae9ec2b48"
url: "https://pub.dev"
source: hosted
version: "16.0.0"
version: "16.1.0"
google_fonts:
dependency: "direct main"
description:
Expand Down
Loading