mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-12-04 15:46:07 +00:00
fix(flutter): leave no orphan "waiting for image" dialog on reconnect (#17357)
OverlayDialogManager.show() keeps one dialog per tag. Showing a second dialog under a tag that is already open replaces the map entry but leaves the first overlay inserted, so neither dismissByTag() nor dismissAll() can remove it. The waiting-for-image dialog can be shown twice before the first frame. On a reconnect to a Windows host with several Windows sessions, the client already has the session selected, so handle_peer_info() reports the wait and the automatic send_selected_session_id() reports it again. The first overlay then stays on top of the remote view after video starts, and after Cancel it stays over the peer list, blocking taps. Dismiss any waiting dialog of the session before showing a new one. Fixes #17233 Claude-Session: https://claude.ai/code/session_01JAxkkig1bcC5Xrr1uwX47b Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
21c7bb71ce
commit
805b5a5a23
2 files changed
+70
No files matched your search
@@ -1188,6 +1188,8 @@ class FfiModel with ChangeNotifier {
|
||||
}
|
||||
|
||||
if (waitForFirstImage.isFalse) return;
|
||||
// A second show under the same tag would orphan the first overlay: no dismiss can reach it.
|
||||
clearWaitingForImage(dialogManager, sessionId);
|
||||
dialogManager.show(
|
||||
(setState, close, context) => CustomAlertDialog(
|
||||
title: null,
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:flutter_hbb/consts.dart';
|
||||
import 'package:flutter_hbb/generated_bridge.dart';
|
||||
import 'package:flutter_hbb/models/platform_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
class _Binding extends Fake implements RustdeskImpl {
|
||||
@override
|
||||
String translate(
|
||||
{required String name, required String locale, dynamic hint}) =>
|
||||
name;
|
||||
|
||||
@override
|
||||
String mainGetLocalOption({required String key, dynamic hint}) => '';
|
||||
|
||||
@override
|
||||
String getLocalFlutterOption({required String k, dynamic hint}) => '';
|
||||
|
||||
@override
|
||||
bool isDisableAb({dynamic hint}) => false;
|
||||
|
||||
@override
|
||||
bool isDisableAccount({dynamic hint}) => false;
|
||||
|
||||
@override
|
||||
bool isDisableGroupPanel({dynamic hint}) => false;
|
||||
|
||||
@override
|
||||
Future<void> sessionOnWaitingForImageDialogShow(
|
||||
{required SessionID sessionId, dynamic hint}) async {}
|
||||
|
||||
@override
|
||||
Future<void> sessionInputOsPassword(
|
||||
{required SessionID sessionId,
|
||||
required String value,
|
||||
dynamic hint}) async {}
|
||||
}
|
||||
|
||||
void main() {
|
||||
setUpAll(() async {
|
||||
isTest = true;
|
||||
platformFFI.setBindingForTesting(_Binding());
|
||||
await initGlobalFFI();
|
||||
});
|
||||
|
||||
// A reconnect to an already selected Windows session reports the wait twice.
|
||||
testWidgets('no waiting dialog is left after a repeated wait is dismissed',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
navigatorKey: globalKey,
|
||||
home: const Scaffold(),
|
||||
));
|
||||
final model = gFFI.ffiModel;
|
||||
model.waitForFirstImage.value = true;
|
||||
for (var i = 0; i < 2; i++) {
|
||||
model.showConnectedWaitingForImage(gFFI.dialogManager, gFFI.sessionId,
|
||||
'success', 'Successful', kMsgboxTextWaitingForImage);
|
||||
}
|
||||
await tester.pump();
|
||||
expect(find.text(kMsgboxTextWaitingForImage), findsWidgets);
|
||||
|
||||
// Both the first frame and leaving the remote page end in dismissAll().
|
||||
gFFI.dialogManager.dismissAll();
|
||||
await tester.pump(const Duration(seconds: 2));
|
||||
expect(find.text(kMsgboxTextWaitingForImage), findsNothing);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user