deep link from dead app
All checks were successful
Build and Release FLUX (Multi-Platform) / build-android (push) Successful in 2m41s
Build and Release FLUX (Multi-Platform) / build-web (push) Successful in 1m12s
Build and Release FLUX (Multi-Platform) / build-windows (push) Successful in 7m58s

This commit is contained in:
2026-06-01 10:08:44 +02:00
parent d989b14967
commit 88b1a618bd
5 changed files with 23 additions and 9 deletions

View File

@@ -17,20 +17,20 @@ Future<void> setupInteractedMessage() async {
}
void _handleNotificationTap(RemoteMessage message) {
// Verifichiamo che tipo di notifica è e prendiamo l'ID
final eventType = message.data['eventType'];
final referenceId = message.data['referenceId'];
if (eventType == 'task_assigned' && referenceId != null) {
// Navighiamo verso il form del Task usando la GlobalKey!
// Assicuriamoci che il context sia disponibile
final routePath = '/tasks/form/$referenceId';
final context = AppRouter.rootNavigatorKey.currentContext;
if (context != null) {
// Usiamo .push perché è una rotta di dettaglio fuori dalla shell
// Il path è /tasks/form/:id (vedi il tuo AppRouter)
context.push('/tasks/form/$referenceId');
// Scenario A: App già aperta, naviga all'istante
context.push(routePath);
} else {
debugPrint("Attenzione: Context non trovato per il Deep Link!");
// Scenario B: App chiusa. Il contesto non c'è ancora, congeliamo la rotta!
debugPrint("App in fase di avvio. Congelo la rotta: $routePath");
AppRouter.pendingRoute = routePath;
}
}
}