Skip to content

Commit

Permalink
Refactor notifications to new API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Jun 25, 2024
1 parent 9e8d40c commit 0f43387
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/pages/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {
Future(() => _checkForUpdates(notifyIfLatest: false, notifyIfError: false));

_robotNotificationListener = RobotNotificationsListener(
connection: ntConnection,
ntConnection: widget.ntConnection,
onNotification: (title, description, icon) {
setState(() {
ColorScheme colorScheme = Theme.of(context).colorScheme;
Expand Down
7 changes: 6 additions & 1 deletion lib/services/nt_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ class NTConnection {
}

NT4Subscription subscribeAll(String topic, [double period = 0.1]) {
return _ntClient.subscribeAll(topic, period);
return _ntClient.subscribe(
topic: topic,
options: NT4SubscriptionOptions(
periodicRateSeconds: period,
all: true,
));
}

void unSubscribe(NT4Subscription subscription) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/robot_notifications_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import 'package:elastic_dashboard/services/nt_connection.dart';

class RobotNotificationsListener {
bool _alertFirstRun = true;
final NTConnection connection;
final NTConnection ntConnection;
final Function(String title, String description, Icon icon) onNotification;

RobotNotificationsListener({
required this.connection,
required this.ntConnection,
required this.onNotification,
});

Expand Down

0 comments on commit 0f43387

Please sign in to comment.