mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-03-15 04:23:17 +08:00
remote device
This commit is contained in:
@@ -102,7 +102,7 @@ class _ToolbarState extends State<Toolbar> {
|
||||
tooltip: localizations.mobileConnect,
|
||||
icon: const Icon(Icons.phone_iphone, size: 22),
|
||||
onPressed: () async {
|
||||
final ips = await localIps();
|
||||
final ips = await localIps(readCache: false);
|
||||
phoneConnect(ips, widget.proxyServer.port);
|
||||
}),
|
||||
const Expanded(child: SizedBox()), //自动扩展挤压
|
||||
|
||||
@@ -92,7 +92,7 @@ class _SocketLaunchState extends State<SocketLaunch> with WindowListener, Widget
|
||||
}
|
||||
|
||||
Future<void> appExit() async {
|
||||
await widget.proxyServer.stop();
|
||||
widget.proxyServer.stop();
|
||||
started = false;
|
||||
await windowManager.destroy();
|
||||
exit(0);
|
||||
|
||||
@@ -441,6 +441,8 @@ class RequestPageState extends State<RequestPage> {
|
||||
|
||||
if (retry > 3) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).removeCurrentSnackBar();
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text(localizations.remoteConnectDisconnect),
|
||||
action: SnackBarAction(
|
||||
|
||||
@@ -123,7 +123,10 @@ class _RemoteDevicePageState extends State<RemoteDevicePage> {
|
||||
leading: const Icon(Icons.qr_code_scanner_outlined),
|
||||
dense: true,
|
||||
title: Text(localizations.scanCode),
|
||||
onTap: () => connectRemote(context))),
|
||||
onTap: () {
|
||||
Navigator.maybePop(context);
|
||||
connectRemote();
|
||||
})),
|
||||
CustomPopupMenuItem(
|
||||
height: 32,
|
||||
child: ListTile(
|
||||
@@ -351,7 +354,7 @@ class _RemoteDevicePageState extends State<RemoteDevicePage> {
|
||||
}
|
||||
|
||||
///扫码连接
|
||||
connectRemote(BuildContext context) async {
|
||||
connectRemote() async {
|
||||
AppLocalizations localizations = AppLocalizations.of(context)!;
|
||||
String? scanRes = await QrCodeScanner.scan(context);
|
||||
if (scanRes == null) return;
|
||||
@@ -372,9 +375,10 @@ class _RemoteDevicePageState extends State<RemoteDevicePage> {
|
||||
var port = uri.queryParameters['port'];
|
||||
|
||||
doConnect(host!, int.parse(port!));
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.mounted) {
|
||||
if (mounted) {
|
||||
FlutterToastr.show(localizations.invalidQRCode, context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ Future<InternetAddress> localAddress() async {
|
||||
List<String>? ipList;
|
||||
|
||||
/// 获取本机所有ip
|
||||
Future<List<String>> localIps() async {
|
||||
if (ipList != null) {
|
||||
Future<List<String>> localIps({bool readCache = true}) async {
|
||||
if (readCache && ipList != null) {
|
||||
return ipList!;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user