diff --git a/src/client/spark/Notifications/INotificationService.cs b/src/client/spark/Notifications/INotificationService.cs
index eb3823cc7..282fcd3ca 100644
--- a/src/client/spark/Notifications/INotificationService.cs
+++ b/src/client/spark/Notifications/INotificationService.cs
@@ -25,20 +25,28 @@ namespace bts.shell {
}
static class NotificationServiceExtensions {
+ /// TODO: remove this extension and force callers to use the appropriate 'link' method in (it is smelly, and is NOT ACTUALLY STRONGLY TYPED)
public static IDisposable link(this INotificationService notification_service, IPredicate predicate, SoundNotification sound) {
if (predicate is IPredicate orp)
return notification_service.link_to_order(orp, sound);
+ if (predicate is IPredicate osp) {
+ // Note: watch out for implicit types as generic type arguments (although OrderSecurity can be implicitly cast to OrderTuple, IPredicate CANNOT be implicitly cast to IPredicate)
+ return notification_service.link_to_order(PredicateBuilder.create(ot => osp.trigger(new OrderSecurity(ot.Item1, ot.Item2))), sound);
+ }
if (predicate is IPredicate ap)
return notification_service.link_to_activity(ap, sound);
- throw new ArgumentException(nameof(predicate));
+ Log.Ui.error($"Unable to activate sound-trigger (unrecognized predicate type '{typeof(T)}').");
+ return Disposable.empty;
}
+ /// TODO: remove this extension and force callers to use the appropriate 'link' method in (it is smelly, and is NOT ACTUALLY STRONGLY TYPED)
public static IDisposable link(this INotificationService notification_service, INotificationPredicate toast_notification_predicate) {
if (toast_notification_predicate is INotificationPredicate orp)
return notification_service.link_to_order(orp);
if (toast_notification_predicate is INotificationPredicate ap)
return notification_service.link_to_activity(ap);
- throw new ArgumentException(nameof(toast_notification_predicate));
+ Log.Ui.error($"Unable to activate toast-notification-trigger (unrecognized predicate type '{typeof(T)}').");
+ return Disposable.empty;
}
}