Merge pull request #5302 from 21pages/fix

fix waiting for image, should not await dialogManager.show
This commit is contained in:
RustDesk 2023-08-09 15:19:13 +08:00 committed by GitHub
commit f022cbb93f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 14 deletions

View File

@ -425,19 +425,18 @@ class FfiModel with ChangeNotifier {
closeConnection();
}
Future.delayed(Duration.zero, () async {
await dialogManager.show(
(setState, close, context) => CustomAlertDialog(
title: null,
content: SelectionArea(child: msgboxContent(type, title, text)),
actions: [
dialogButton("Cancel", onPressed: onClose, isOutline: true)
],
onCancel: onClose),
tag: '$sessionId-waiting-for-image',
);
_waitForImageDialogShow[sessionId] = true;
});
dialogManager.show(
(setState, close, context) => CustomAlertDialog(
title: null,
content: SelectionArea(child: msgboxContent(type, title, text)),
actions: [
dialogButton("Cancel", onPressed: onClose, isOutline: true)
],
onCancel: onClose),
tag: '$sessionId-waiting-for-image',
);
_waitForImageDialogShow[sessionId] = true;
bind.sessionOnWaitingForImageDialogShow(sessionId: sessionId);
}
_updateSessionWidthHeight(SessionID sessionId) {
@ -1902,7 +1901,7 @@ Future<void> initializeCursorAndCanvas(FFI ffi) async {
}
clearWaitingForImage(OverlayDialogManager? dialogManager, SessionID sessionId) {
final durations = [100, 500, 1000, 2000];
final durations = [0, 100, 500, 1000, 2000];
for (var duration in durations) {
Future.delayed(Duration(milliseconds: duration), () {
dialogManager?.dismissByTag('$sessionId-waiting-for-image');

View File

@ -345,6 +345,14 @@ impl FlutterHandler {
*self.notify_rendered.write().unwrap() = false;
self.renderer.write().unwrap().set_size(width, height);
}
pub fn on_waiting_for_image_dialog_show(&self) {
#[cfg(any(feature = "flutter_texture_render"))]
{
*self.notify_rendered.write().unwrap() = false;
}
// rgba array render will notify every frame
}
}
impl InvokeUiSession for FlutterHandler {

View File

@ -1266,6 +1266,12 @@ pub fn session_change_prefer_codec(session_id: SessionID) {
}
}
pub fn session_on_waiting_for_image_dialog_show(session_id: SessionID) {
if let Some(session) = SESSIONS.read().unwrap().get(&session_id) {
session.ui_handler.on_waiting_for_image_dialog_show();
}
}
pub fn main_set_home_dir(_home: String) {
#[cfg(any(target_os = "android", target_os = "ios"))]
{