Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions client/deepdame/lib/core/network/stomp_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ class StompService {
Stream<Map<String, dynamic>> subscribe(String destination) {
final controller = StreamController<Map<String, dynamic>>.broadcast();
void Function()? unsubscribe;
StreamSubscription<StompState>? stateSub;

void doSubscribe() {
unsubscribe?.call();
unsubscribe = _client?.subscribe(
destination: destination,
callback: (frame) {
Expand All @@ -85,19 +87,19 @@ class StompService {
);
}

if (isConnected) {
doSubscribe();
} else {
late StreamSubscription<StompState> sub;
sub = state.listen((s) {
if (s == StompState.connected) {
doSubscribe();
unawaited(sub.cancel());
}
});
}
// Keep the listener alive for the full stream lifetime so every
// reconnect re-registers the subscription with the new STOMP session.
stateSub = state.listen((s) {
if (s == StompState.connected) doSubscribe();
});

if (isConnected) doSubscribe();

controller.onCancel = () {
unsubscribe?.call();
unawaited(stateSub?.cancel());
};

controller.onCancel = () => unsubscribe?.call();
return controller.stream;
}

Expand Down
2 changes: 1 addition & 1 deletion client/deepdame/lib/features/settings/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ class _LogoutTile extends ConsumerWidget {

if (confirmed != true) return;
await ref.read(authControllerProvider.notifier).logout();
// Router redirect handles navigation to the login screen
if (context.mounted) context.goNamed('login');
}
}

Expand Down
2 changes: 1 addition & 1 deletion client/deepdame/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 2.0.24+25
version: 2.0.25+26

environment:
sdk: ^3.10.4
Expand Down
Loading