@@ -200,6 +200,10 @@ public class AwesomeNotifications:
200
200
eventName: lostEvent. eventName,
201
201
notificationReceived: lostEvent. notificationContent)
202
202
}
203
+
204
+ RefreshSchedulesReceiver ( )
205
+ . refreshSchedules ( )
206
+
203
207
} catch {
204
208
if !( error is AwesomeNotificationsException ) {
205
209
ExceptionFactory
@@ -514,9 +518,6 @@ public class AwesomeNotifications:
514
518
515
519
UNUserNotificationCenter . current ( ) . delegate = self
516
520
517
- RefreshSchedulesReceiver ( )
518
- . refreshSchedules ( )
519
-
520
521
AwesomeNotifications . didFinishLaunch = true
521
522
if AwesomeNotifications . completionHandlerGetInitialAction != nil {
522
523
AwesomeNotifications
@@ -620,33 +621,46 @@ public class AwesomeNotifications:
620
621
. jsonDataToNotificationModel (
621
622
jsonData: jsonData)
622
623
{
623
- StatusBarManager
624
- . shared
625
- . showNotificationOnStatusBar (
626
- withNotificationModel: notificationModel,
627
- whenFinished: { ( notificationDisplayed: Bool , mustPlaySound: Bool ) in
628
-
629
- if !notificationDisplayed && self . _originalNotificationCenterDelegate != nil {
630
- self . _originalNotificationCenterDelegate?
631
- . userNotificationCenter ? (
632
- center,
633
- willPresent: notification,
634
- withCompletionHandler: completionHandler)
635
- }
636
- else {
637
- if notificationDisplayed {
638
- if mustPlaySound {
639
- completionHandler ( [ . alert, . badge, . sound] )
624
+ do {
625
+ try StatusBarManager
626
+ . shared
627
+ . showNotificationOnStatusBar (
628
+ withNotificationModel: notificationModel,
629
+ whenFinished: { ( notificationDisplayed: Bool , mustPlaySound: Bool ) in
630
+
631
+ if !notificationDisplayed && self . _originalNotificationCenterDelegate != nil {
632
+ self . _originalNotificationCenterDelegate?
633
+ . userNotificationCenter ? (
634
+ center,
635
+ willPresent: notification,
636
+ withCompletionHandler: completionHandler)
637
+ }
638
+ else {
639
+ if notificationDisplayed {
640
+ if mustPlaySound {
641
+ completionHandler ( [ . alert, . badge, . sound] )
642
+ }
643
+ else {
644
+ completionHandler ( [ . alert, . badge] )
645
+ }
640
646
}
641
647
else {
642
- completionHandler ( [ . alert , . badge ] )
648
+ completionHandler ( [ ] )
643
649
}
644
650
}
645
- else {
646
- completionHandler ( [ ] )
647
- }
648
- }
649
- } )
651
+ } )
652
+ } catch {
653
+ if !( error is AwesomeNotificationsException ) {
654
+ ExceptionFactory
655
+ . shared
656
+ . registerNewAwesomeException (
657
+ className: TAG,
658
+ code: ExceptionCode . CODE_UNKNOWN_EXCEPTION,
659
+ message: " An unknow exception was found while displaying a notification on Statusbar " ,
660
+ detailedCode: ExceptionCode . DETAILED_UNEXPECTED_ERROR,
661
+ originalException: error)
662
+ }
663
+ }
650
664
651
665
}
652
666
else {
0 commit comments