Skip to content

Commit 67ff85f

Browse files
committed
fix: prevent deep link URLs from reaching GoRouter causing 'Page Not Found' error
1 parent e9b88e2 commit 67ff85f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

android/app/src/main/kotlin/com/zarz/spotiflac/MainActivity.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,11 @@ class MainActivity: AudioServiceFragmentActivity() {
13401340
return respObj.toString()
13411341
}
13421342

1343+
// Disable Flutter's built-in deep linking so that incoming ACTION_VIEW URLs
1344+
// (Spotify, Deezer, Tidal, YouTube Music) are NOT forwarded to GoRouter.
1345+
// We handle these URLs ourselves via receive_sharing_intent + ShareIntentService.
1346+
override fun shouldHandleDeeplinking(): Boolean = false
1347+
13431348
override fun onNewIntent(intent: Intent) {
13441349
super.onNewIntent(intent)
13451350
// Update the intent so receive_sharing_intent can access the new data

lib/app.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ final _routerProvider = Provider<GoRouter>((ref) {
4747
builder: (context, state) => const WhatsNewScreen(),
4848
),
4949
],
50+
// Safety net: if a deep link URL (e.g. Spotify/Deezer) somehow reaches
51+
// GoRouter, redirect to home instead of showing "Page Not Found".
52+
errorBuilder: (context, state) => const MainShell(),
5053
);
5154
});
5255

0 commit comments

Comments
 (0)