|
|
@ -109,13 +109,13 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra |
|
|
|
if (_platform.canUsePushNotifications) { |
|
|
|
if (_platform.canUsePushNotifications) { |
|
|
|
final localNotificationsPlugin = await PushUtils.initLocalNotifications(); |
|
|
|
final localNotificationsPlugin = await PushUtils.initLocalNotifications(); |
|
|
|
Global.onPushNotificationReceived = (final accountID) async { |
|
|
|
Global.onPushNotificationReceived = (final accountID) async { |
|
|
|
final account = _accountsBloc.accounts.value.find(accountID); |
|
|
|
final account = _accountsBloc.accounts.value.tryFind(accountID); |
|
|
|
if (account == null) { |
|
|
|
if (account == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final allAppImplementations = Provider.of<Iterable<AppImplementation>>(context, listen: false); |
|
|
|
final allAppImplementations = Provider.of<Iterable<AppImplementation>>(context, listen: false); |
|
|
|
final app = allAppImplementations.find('notifications') as NotificationsAppInterface?; |
|
|
|
final app = allAppImplementations.tryFind('notifications') as NotificationsAppInterface?; |
|
|
|
|
|
|
|
|
|
|
|
if (app == null) { |
|
|
|
if (app == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -124,7 +124,7 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra |
|
|
|
await _accountsBloc.getAppsBlocFor(account).getAppBloc<NotificationsBlocInterface>(app).refresh(); |
|
|
|
await _accountsBloc.getAppsBlocFor(account).getAppBloc<NotificationsBlocInterface>(app).refresh(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
Global.onPushNotificationClicked = (final pushNotificationWithAccountID) async { |
|
|
|
Global.onPushNotificationClicked = (final pushNotificationWithAccountID) async { |
|
|
|
final account = _accountsBloc.accounts.value.find(pushNotificationWithAccountID.accountID); |
|
|
|
final account = _accountsBloc.accounts.value.tryFind(pushNotificationWithAccountID.accountID); |
|
|
|
if (account == null) { |
|
|
|
if (account == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -132,7 +132,7 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra |
|
|
|
|
|
|
|
|
|
|
|
final allAppImplementations = Provider.of<Iterable<AppImplementation>>(context, listen: false); |
|
|
|
final allAppImplementations = Provider.of<Iterable<AppImplementation>>(context, listen: false); |
|
|
|
|
|
|
|
|
|
|
|
final notificationsApp = allAppImplementations.find('notifications') as NotificationsAppInterface?; |
|
|
|
final notificationsApp = allAppImplementations.tryFind('notifications') as NotificationsAppInterface?; |
|
|
|
if (notificationsApp != null) { |
|
|
|
if (notificationsApp != null) { |
|
|
|
_accountsBloc |
|
|
|
_accountsBloc |
|
|
|
.getAppsBlocFor(account) |
|
|
|
.getAppsBlocFor(account) |
|
|
@ -140,7 +140,7 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra |
|
|
|
.deleteNotification(pushNotificationWithAccountID.subject.nid!); |
|
|
|
.deleteNotification(pushNotificationWithAccountID.subject.nid!); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final app = allAppImplementations.find(pushNotificationWithAccountID.subject.app!) ?? notificationsApp; |
|
|
|
final app = allAppImplementations.tryFind(pushNotificationWithAccountID.subject.app) ?? notificationsApp; |
|
|
|
if (app == null) { |
|
|
|
if (app == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|