我通过 Firebase 消息发送用户通知以检查他们的日历。当用户单击通知消息时,我希望应用程序导航到日历页面。
问题是,如果他们点击消息,那么他们必须先登录。
一旦他们登录,它就会进入主页,而不是我想要的页面。
该页面如何保持登录状态,以便它进入我的应用程序中的日历屏幕。
这是 Firebase Messaging 的入口点所在的位置。这是在我的 Main.Dart 中
Future<void> setupInteractedMessage() async {
// Get any messages which caused the application to open from
// a terminated state.
RemoteMessage? initialMessage =
await FirebaseMessaging.instance.getInitialMessage();
// If the message also contains a data property with a "type" of "chat",
// navigate to a chat screen
if (initialMessage != null) {
_handleMessage(initialMessage);
}
// Also handle any interaction when the app is in the background via a
// Stream listener
FirebaseMessaging.onMessageOpenedApp.listen(_handleMessage);
}
void _handleMessage(RemoteMessage message) {
if (message.data['type'] == 'calendar') {
Logger().w('Calendar is selected. Need to Navigate here');
}
}