mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 02:57:22 +00:00
fix: web/mobile, skip querying onlines, if not in main page (#9535)
* fix: web, skip querying onlines, if not in main page Signed-off-by: fufesou <linlong1266@gmail.com> * fix: web/mobile, skip querying onlines Signed-off-by: fufesou <linlong1266@gmail.com> * Set isInMainPage to false after router is changed. Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
@@ -19,6 +19,9 @@ class StateGlobal {
|
||||
final RxBool showRemoteToolBar = false.obs;
|
||||
final svcStatus = SvcStatus.notReady.obs;
|
||||
final RxBool isFocused = false.obs;
|
||||
// for mobile and web
|
||||
bool isInMainPage = true;
|
||||
bool isWebVisible = true;
|
||||
|
||||
final isPortrait = false.obs;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'dart:html';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_hbb/models/state_model.dart';
|
||||
|
||||
import 'package:flutter_hbb/web/bridge.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
@@ -28,7 +29,15 @@ class PlatformFFI {
|
||||
context.callMethod('setByName', [name, value]);
|
||||
}
|
||||
|
||||
PlatformFFI._();
|
||||
PlatformFFI._() {
|
||||
window.document.addEventListener(
|
||||
'visibilitychange',
|
||||
(event) => {
|
||||
stateGlobal.isWebVisible =
|
||||
window.document.visibilityState == 'visible'
|
||||
});
|
||||
}
|
||||
|
||||
static final PlatformFFI instance = PlatformFFI._();
|
||||
|
||||
static get localeName => window.navigator.language;
|
||||
|
||||
Reference in New Issue
Block a user