mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-25 05:09:04 +08:00
flutter add peer_has_password
This commit is contained in:
parent
bb8540b040
commit
1f751ddb04
@ -494,7 +494,8 @@ abstract class BasePeerCard extends StatelessWidget {
|
||||
|
||||
@protected
|
||||
MenuEntryBase<String> _removeAction(
|
||||
String id, Future<void> Function() reloadFunc) {
|
||||
String id, Future<void> Function() reloadFunc,
|
||||
{bool isLan = false}) {
|
||||
return MenuEntryButton<String>(
|
||||
childBuilder: (TextStyle? style) => Text(
|
||||
translate('Remove'),
|
||||
@ -502,7 +503,11 @@ abstract class BasePeerCard extends StatelessWidget {
|
||||
),
|
||||
proc: () {
|
||||
() async {
|
||||
await bind.mainRemovePeer(id: id);
|
||||
if (isLan) {
|
||||
// TODO
|
||||
} else {
|
||||
await bind.mainRemovePeer(id: id);
|
||||
}
|
||||
removePreference(id);
|
||||
await reloadFunc();
|
||||
}();
|
||||
@ -656,7 +661,9 @@ class RecentPeerCard extends BasePeerCard {
|
||||
menuItems.add(_removeAction(peer.id, () async {
|
||||
await bind.mainLoadRecentPeers();
|
||||
}));
|
||||
menuItems.add(_unrememberPasswordAction(peer.id));
|
||||
if (await bind.mainPeerHasPassword(id: peer.id)) {
|
||||
menuItems.add(_unrememberPasswordAction(peer.id));
|
||||
}
|
||||
menuItems.add(_addFavAction(peer.id));
|
||||
return menuItems;
|
||||
}
|
||||
@ -686,7 +693,9 @@ class FavoritePeerCard extends BasePeerCard {
|
||||
menuItems.add(_removeAction(peer.id, () async {
|
||||
await bind.mainLoadFavPeers();
|
||||
}));
|
||||
menuItems.add(_unrememberPasswordAction(peer.id));
|
||||
if (await bind.mainPeerHasPassword(id: peer.id)) {
|
||||
menuItems.add(_unrememberPasswordAction(peer.id));
|
||||
}
|
||||
menuItems.add(_rmFavAction(peer.id, () async {
|
||||
await bind.mainLoadFavPeers();
|
||||
}));
|
||||
@ -714,8 +723,7 @@ class DiscoveredPeerCard extends BasePeerCard {
|
||||
}
|
||||
menuItems.add(_wolAction(peer.id));
|
||||
menuItems.add(MenuEntryDivider());
|
||||
menuItems.add(_renameAction(peer.id, false));
|
||||
menuItems.add(_unrememberPasswordAction(peer.id));
|
||||
menuItems.add(_removeAction(peer.id, () async {}));
|
||||
return menuItems;
|
||||
}
|
||||
}
|
||||
@ -742,8 +750,9 @@ class AddressBookPeerCard extends BasePeerCard {
|
||||
menuItems.add(MenuEntryDivider());
|
||||
menuItems.add(_renameAction(peer.id, false));
|
||||
menuItems.add(_removeAction(peer.id, () async {}));
|
||||
menuItems.add(_unrememberPasswordAction(peer.id));
|
||||
menuItems.add(_addFavAction(peer.id));
|
||||
if (await bind.mainPeerHasPassword(id: peer.id)) {
|
||||
menuItems.add(_unrememberPasswordAction(peer.id));
|
||||
}
|
||||
menuItems.add(_editTagAction(peer.id));
|
||||
return menuItems;
|
||||
}
|
||||
@ -751,7 +760,8 @@ class AddressBookPeerCard extends BasePeerCard {
|
||||
@protected
|
||||
@override
|
||||
MenuEntryBase<String> _removeAction(
|
||||
String id, Future<void> Function() reloadFunc) {
|
||||
String id, Future<void> Function() reloadFunc,
|
||||
{bool isLan = false}) {
|
||||
return MenuEntryButton<String>(
|
||||
childBuilder: (TextStyle? style) => Text(
|
||||
translate('Remove'),
|
||||
|
@ -24,9 +24,9 @@ use crate::ui_interface::{
|
||||
get_option, get_options, get_peer, get_peer_option, get_socks, get_uuid, get_version,
|
||||
goto_install, has_hwcodec, has_rendezvous_service, is_can_screen_recording, is_installed,
|
||||
is_installed_daemon, is_installed_lower_version, is_process_trusted, is_rdp_service_open,
|
||||
is_share_rdp, post_request, send_to_cm, set_local_option, set_option, set_options,
|
||||
set_peer_option, set_permanent_password, set_socks, store_fav, test_if_valid_server, update_me,
|
||||
update_temporary_password, using_public_server,
|
||||
is_share_rdp, peer_has_password, post_request, send_to_cm, set_local_option, set_option,
|
||||
set_options, set_peer_option, set_permanent_password, set_socks, store_fav,
|
||||
test_if_valid_server, update_me, update_temporary_password, using_public_server,
|
||||
};
|
||||
use crate::{
|
||||
client::file_trait::FileManager,
|
||||
@ -578,6 +578,10 @@ pub fn main_forget_password(id: String) {
|
||||
forget_password(id)
|
||||
}
|
||||
|
||||
pub fn main_peer_has_password(id: String) -> bool {
|
||||
peer_has_password(id)
|
||||
}
|
||||
|
||||
pub fn main_get_recent_peers() -> String {
|
||||
if !config::APP_DIR.read().unwrap().is_empty() {
|
||||
let peers: Vec<HashMap<&str, String>> = PeerConfig::peers()
|
||||
|
Loading…
Reference in New Issue
Block a user