try fix waiting for image when already shown
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
72c198a1e9
commit
bc039a31c5
@ -689,9 +689,12 @@ class OverlayDialogManager {
|
|||||||
String showLoading(String text,
|
String showLoading(String text,
|
||||||
{bool clickMaskDismiss = false,
|
{bool clickMaskDismiss = false,
|
||||||
bool showCancel = true,
|
bool showCancel = true,
|
||||||
VoidCallback? onCancel}) {
|
VoidCallback? onCancel,
|
||||||
final tag = _tagCount.toString();
|
String? tag}) {
|
||||||
_tagCount++;
|
if (tag == null) {
|
||||||
|
tag = _tagCount.toString();
|
||||||
|
_tagCount++;
|
||||||
|
}
|
||||||
show((setState, close, context) {
|
show((setState, close, context) {
|
||||||
cancel() {
|
cancel() {
|
||||||
dismissAll();
|
dismissAll();
|
||||||
|
@ -480,9 +480,11 @@ class FfiModel with ChangeNotifier {
|
|||||||
if (displays.isNotEmpty) {
|
if (displays.isNotEmpty) {
|
||||||
parent.target?.dialogManager.showLoading(
|
parent.target?.dialogManager.showLoading(
|
||||||
translate('Connected, waiting for image...'),
|
translate('Connected, waiting for image...'),
|
||||||
onCancel: closeConnection);
|
onCancel: closeConnection,
|
||||||
|
tag: '$peerId-waiting-for-image');
|
||||||
_waitForImage[sessionId] = true;
|
_waitForImage[sessionId] = true;
|
||||||
_reconnects = 1;
|
_reconnects = 1;
|
||||||
|
bind.sessionOnWaitingForImageDialogShow(sessionId: sessionId);
|
||||||
}
|
}
|
||||||
Map<String, dynamic> features = json.decode(evt['features']);
|
Map<String, dynamic> features = json.decode(evt['features']);
|
||||||
_pi.features.privacyMode = features['privacy_mode'] == 1;
|
_pi.features.privacyMode = features['privacy_mode'] == 1;
|
||||||
@ -636,6 +638,8 @@ class ImageModel with ChangeNotifier {
|
|||||||
if (waitforImage == true) {
|
if (waitforImage == true) {
|
||||||
_waitForImage[sessionId] = false;
|
_waitForImage[sessionId] = false;
|
||||||
parent.target?.dialogManager.dismissAll();
|
parent.target?.dialogManager.dismissAll();
|
||||||
|
clearWaitingForImage(parent.target?.dialogManager, id);
|
||||||
|
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
for (final cb in callbacksOnFirstImage) {
|
for (final cb in callbacksOnFirstImage) {
|
||||||
cb(id);
|
cb(id);
|
||||||
@ -1681,6 +1685,7 @@ class FFI {
|
|||||||
}
|
}
|
||||||
await canvasModel.updateViewStyle();
|
await canvasModel.updateViewStyle();
|
||||||
await canvasModel.updateScrollStyle();
|
await canvasModel.updateScrollStyle();
|
||||||
|
clearWaitingForImage(dialogManager, id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fetch the image buffer from rust codes.
|
// Fetch the image buffer from rust codes.
|
||||||
@ -1873,3 +1878,12 @@ Future<void> initializeCursorAndCanvas(FFI ffi) async {
|
|||||||
ffi.ffiModel.display.x, ffi.ffiModel.display.y, xCursor, yCursor);
|
ffi.ffiModel.display.x, ffi.ffiModel.display.y, xCursor, yCursor);
|
||||||
ffi.canvasModel.update(xCanvas, yCanvas, scale);
|
ffi.canvasModel.update(xCanvas, yCanvas, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearWaitingForImage(OverlayDialogManager? dialogManager, String id) {
|
||||||
|
final durations = [100, 500, 1000, 2000];
|
||||||
|
for (var duration in durations) {
|
||||||
|
Future.delayed(Duration(milliseconds: duration), () {
|
||||||
|
dialogManager?.dismissByTag('$id-waiting-for-image');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -337,6 +337,14 @@ impl FlutterHandler {
|
|||||||
*self.notify_rendered.write().unwrap() = false;
|
*self.notify_rendered.write().unwrap() = false;
|
||||||
self.renderer.write().unwrap().set_size(width, height);
|
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 {
|
impl InvokeUiSession for FlutterHandler {
|
||||||
|
@ -1216,6 +1216,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) {
|
pub fn main_set_home_dir(_home: String) {
|
||||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user