flutter_local_notifications icon indicating copy to clipboard operation
flutter_local_notifications copied to clipboard

The sample code flutterLocalNotificationsPlugin.initialize has the same end result on both branch conditions. Why?

Open snowch opened this issue 5 months ago • 1 comments

Describe the bug

Documentation bug?

The sample has the following code where both conditions have the same action, what is the rationale for this?

Some inline documentation would be useful to explain why both conditions are shown even though they have the same end result.

  await flutterLocalNotificationsPlugin.initialize(
    initializationSettings,
    onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) {
      switch (notificationResponse.notificationResponseType) {
        case NotificationResponseType.selectedNotification:
          selectNotificationStream.add(notificationResponse.payload);
          break;
        case NotificationResponseType.selectedNotificationAction:
          if (notificationResponse.actionId == navigationActionId) {
            selectNotificationStream.add(notificationResponse.payload);
          }
          break;
      }
    },

snowch avatar Jan 17 '24 18:01 snowch

I'll need to revisit the example app code when I can to check. Support for actions was a community contribution and I believe it was like this help make it explicit that only certain notification actions were allowed to navigate to another page. This is why there's the check on the action ID as some of the code snippets for notification actions will result in notifications with multiple actions

MaikuB avatar Jan 23 '24 12:01 MaikuB