local_notifications icon indicating copy to clipboard operation
local_notifications copied to clipboard

App would crash if send push notification from server

Open grand0147 opened this issue 6 years ago • 1 comments

Since notification from server didn't have PRESENT_WHILE_APP_OPEN_KEY column

public func userNotificationCenter(_ center: UNUserNotificationCenter,
                                       willPresent: UNNotification,
                                       withCompletionHandler: @escaping (UNNotificationPresentationOptions)->()) {
        let showNotificationWhileAppOpen = willPresent.request.content.userInfo[SwiftLocalNotificationsPlugin.PRESENT_WHILE_APP_OPEN_KEY] as! Bool
        if (showNotificationWhileAppOpen) {
            withCompletionHandler([.alert, .sound, .badge])
        }
    }

grand0147 avatar Apr 24 '18 08:04 grand0147

I have not had much free time recently, so I haven't been able to get around to this. I'd suggest checking out flutter_local_notifications, see if that plugin supports this functionality, if you need this right away.

mitchhymel avatar May 01 '18 05:05 mitchhymel