add test mode, update cm_test

This commit is contained in:
csf
2022-10-20 23:05:34 +09:00
parent bd68969dac
commit afa94d5907
3 changed files with 52 additions and 10 deletions

View File

@@ -43,6 +43,9 @@ var version = "";
int androidVersion = 0;
DesktopType? desktopType;
/// * debug or test only, DO NOT enable in release build
bool isTest = false;
typedef F = String Function(String);
typedef FMethod = String Function(String, dynamic);

View File

@@ -92,6 +92,7 @@ class ServerModel with ChangeNotifier {
_serverId = IDTextEditingController(text: _emptyIdShow);
Timer.periodic(Duration(seconds: 1), (timer) async {
if (isTest) return timer.cancel();
var status = await bind.mainGetOnlineStatue();
if (status > 0) {
status = 1;
@@ -343,6 +344,7 @@ class ServerModel with ChangeNotifier {
// force
updateClientState([String? json]) async {
if (isTest) return;
var res = await bind.cmGetClientsState();
try {
final List clientsJson = jsonDecode(res);