mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-21 12:11:06 +03:00
show login dialog when clicking note if not logged in (#13856)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -6,10 +6,12 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:flutter_hbb/common/shared_state.dart';
|
||||
import 'package:flutter_hbb/common/widgets/dialog.dart';
|
||||
import 'package:flutter_hbb/common/widgets/login.dart';
|
||||
import 'package:flutter_hbb/consts.dart';
|
||||
import 'package:flutter_hbb/desktop/widgets/remote_toolbar.dart';
|
||||
import 'package:flutter_hbb/models/model.dart';
|
||||
import 'package:flutter_hbb/models/platform_model.dart';
|
||||
import 'package:flutter_hbb/utils/multi_window_manager.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
bool isEditOsPassword = false;
|
||||
@@ -193,14 +195,26 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
|
||||
);
|
||||
}
|
||||
// note
|
||||
if (isDefaultConn &&
|
||||
bind
|
||||
.sessionGetAuditServerSync(sessionId: sessionId, typ: "conn")
|
||||
.isNotEmpty) {
|
||||
if (isDefaultConn && !bind.isDisableAccount()) {
|
||||
v.add(
|
||||
TTextMenu(
|
||||
child: Text(translate('Note')),
|
||||
onPressed: () => showAuditDialog(ffi)),
|
||||
onPressed: () async {
|
||||
bool isLogin =
|
||||
bind.mainGetLocalOption(key: 'access_token').isNotEmpty;
|
||||
if (!isLogin) {
|
||||
final res = await loginDialog();
|
||||
if (res != true) return;
|
||||
// Desktop: send message to main window to refresh login status
|
||||
// Web: login is required before connection, so no need to refresh
|
||||
// Mobile: same isolate, no need to send message
|
||||
if (isDesktop) {
|
||||
rustDeskWinManager.call(
|
||||
WindowType.Main, kWindowRefreshCurrentUser, "");
|
||||
}
|
||||
}
|
||||
showAuditDialog(ffi);
|
||||
}),
|
||||
);
|
||||
}
|
||||
// divider
|
||||
|
||||
Reference in New Issue
Block a user