mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-02 11:11:27 +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.dart';
|
||||||
import 'package:flutter_hbb/common/shared_state.dart';
|
import 'package:flutter_hbb/common/shared_state.dart';
|
||||||
import 'package:flutter_hbb/common/widgets/dialog.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/consts.dart';
|
||||||
import 'package:flutter_hbb/desktop/widgets/remote_toolbar.dart';
|
import 'package:flutter_hbb/desktop/widgets/remote_toolbar.dart';
|
||||||
import 'package:flutter_hbb/models/model.dart';
|
import 'package:flutter_hbb/models/model.dart';
|
||||||
import 'package:flutter_hbb/models/platform_model.dart';
|
import 'package:flutter_hbb/models/platform_model.dart';
|
||||||
|
import 'package:flutter_hbb/utils/multi_window_manager.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
bool isEditOsPassword = false;
|
bool isEditOsPassword = false;
|
||||||
@@ -193,14 +195,26 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
// note
|
// note
|
||||||
if (isDefaultConn &&
|
if (isDefaultConn && !bind.isDisableAccount()) {
|
||||||
bind
|
|
||||||
.sessionGetAuditServerSync(sessionId: sessionId, typ: "conn")
|
|
||||||
.isNotEmpty) {
|
|
||||||
v.add(
|
v.add(
|
||||||
TTextMenu(
|
TTextMenu(
|
||||||
child: Text(translate('Note')),
|
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
|
// divider
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ const String kAppTypeDesktopPortForward = "port forward";
|
|||||||
const String kAppTypeDesktopTerminal = "terminal";
|
const String kAppTypeDesktopTerminal = "terminal";
|
||||||
|
|
||||||
const String kWindowMainWindowOnTop = "main_window_on_top";
|
const String kWindowMainWindowOnTop = "main_window_on_top";
|
||||||
|
const String kWindowRefreshCurrentUser = "refresh_current_user";
|
||||||
const String kWindowGetWindowInfo = "get_window_info";
|
const String kWindowGetWindowInfo = "get_window_info";
|
||||||
const String kWindowGetScreenList = "get_screen_list";
|
const String kWindowGetScreenList = "get_screen_list";
|
||||||
// This method is not used, maybe it can be removed.
|
// This method is not used, maybe it can be removed.
|
||||||
|
|||||||
@@ -776,6 +776,8 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
|||||||
}
|
}
|
||||||
if (call.method == kWindowMainWindowOnTop) {
|
if (call.method == kWindowMainWindowOnTop) {
|
||||||
windowOnTop(null);
|
windowOnTop(null);
|
||||||
|
} else if (call.method == kWindowRefreshCurrentUser) {
|
||||||
|
gFFI.userModel.refreshCurrentUser();
|
||||||
} else if (call.method == kWindowGetWindowInfo) {
|
} else if (call.method == kWindowGetWindowInfo) {
|
||||||
final screen = (await window_size.getWindowInfo()).screen;
|
final screen = (await window_size.getWindowInfo()).screen;
|
||||||
if (screen == null) {
|
if (screen == null) {
|
||||||
|
|||||||
@@ -561,19 +561,21 @@ class _GeneralState extends State<_General> {
|
|||||||
children.add(_OptionCheckBox(
|
children.add(_OptionCheckBox(
|
||||||
context, 'Allow linux headless', kOptionAllowLinuxHeadless));
|
context, 'Allow linux headless', kOptionAllowLinuxHeadless));
|
||||||
}
|
}
|
||||||
children.add(_OptionCheckBox(
|
if (!bind.isDisableAccount()) {
|
||||||
context,
|
children.add(_OptionCheckBox(
|
||||||
'note-at-conn-end-tip',
|
context,
|
||||||
kOptionAllowAskForNoteAtEndOfConnection,
|
'note-at-conn-end-tip',
|
||||||
isServer: false,
|
kOptionAllowAskForNoteAtEndOfConnection,
|
||||||
optSetter: (key, value) async {
|
isServer: false,
|
||||||
if (value && !gFFI.userModel.isLogin) {
|
optSetter: (key, value) async {
|
||||||
final res = await loginDialog();
|
if (value && !gFFI.userModel.isLogin) {
|
||||||
if (res != true) return;
|
final res = await loginDialog();
|
||||||
}
|
if (res != true) return;
|
||||||
await mainSetLocalBoolOption(key, value);
|
}
|
||||||
},
|
await mainSetLocalBoolOption(key, value);
|
||||||
));
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
return _Card(title: 'Other', children: children);
|
return _Card(title: 'Other', children: children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -786,23 +786,24 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
|||||||
showThemeSettings(gFFI.dialogManager);
|
showThemeSettings(gFFI.dialogManager);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SettingsTile.switchTile(
|
if (!bind.isDisableAccount())
|
||||||
title: Text(translate('note-at-conn-end-tip')),
|
SettingsTile.switchTile(
|
||||||
initialValue: _allowAskForNoteAtEndOfConnection,
|
title: Text(translate('note-at-conn-end-tip')),
|
||||||
onToggle: (v) async {
|
initialValue: _allowAskForNoteAtEndOfConnection,
|
||||||
if (v && !gFFI.userModel.isLogin) {
|
onToggle: (v) async {
|
||||||
final res = await loginDialog();
|
if (v && !gFFI.userModel.isLogin) {
|
||||||
if (res != true) return;
|
final res = await loginDialog();
|
||||||
}
|
if (res != true) return;
|
||||||
await mainSetLocalBoolOption(
|
}
|
||||||
kOptionAllowAskForNoteAtEndOfConnection, v);
|
await mainSetLocalBoolOption(
|
||||||
final newValue = mainGetLocalBoolOptionSync(
|
kOptionAllowAskForNoteAtEndOfConnection, v);
|
||||||
kOptionAllowAskForNoteAtEndOfConnection);
|
final newValue = mainGetLocalBoolOptionSync(
|
||||||
setState(() {
|
kOptionAllowAskForNoteAtEndOfConnection);
|
||||||
_allowAskForNoteAtEndOfConnection = newValue;
|
setState(() {
|
||||||
});
|
_allowAskForNoteAtEndOfConnection = newValue;
|
||||||
},
|
});
|
||||||
)
|
},
|
||||||
|
)
|
||||||
]),
|
]),
|
||||||
if (isAndroid)
|
if (isAndroid)
|
||||||
SettingsSection(title: Text(translate('Hardware Codec')), tiles: [
|
SettingsSection(title: Text(translate('Hardware Codec')), tiles: [
|
||||||
|
|||||||
@@ -1101,6 +1101,9 @@ class FfiModel with ChangeNotifier {
|
|||||||
|
|
||||||
void _queryAuditGuid(String peerId) async {
|
void _queryAuditGuid(String peerId) async {
|
||||||
try {
|
try {
|
||||||
|
if (bind.isDisableAccount()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (bind
|
if (bind
|
||||||
.sessionGetAuditServerSync(sessionId: sessionId, typ: "conn/active")
|
.sessionGetAuditServerSync(sessionId: sessionId, typ: "conn/active")
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
|
|||||||
Reference in New Issue
Block a user