fix #616: support QR for uri link
This commit is contained in:
parent
7fe58afa9c
commit
93aac0bc99
@ -1964,14 +1964,16 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
|
|||||||
command = '--connect';
|
command = '--connect';
|
||||||
id = uri.path.substring("/new/".length);
|
id = uri.path.substring("/new/".length);
|
||||||
} else if (uri.authority == "config") {
|
} else if (uri.authority == "config") {
|
||||||
final config = uri.path.substring("/".length);
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
// add a timer to make showToast work
|
final config = uri.path.substring("/".length);
|
||||||
Timer(Duration(seconds: 1), () {
|
// add a timer to make showToast work
|
||||||
importConfig(null, null, config);
|
Timer(Duration(seconds: 1), () {
|
||||||
});
|
importConfig(null, null, config);
|
||||||
|
});
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
} else if (uri.authority == "password") {
|
} else if (uri.authority == "password") {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
final password = uri.path.substring("/".length);
|
final password = uri.path.substring("/".length);
|
||||||
if (password.isNotEmpty) {
|
if (password.isNotEmpty) {
|
||||||
Timer(Duration(seconds: 1), () async {
|
Timer(Duration(seconds: 1), () async {
|
||||||
|
@ -8,6 +8,7 @@ import 'package:qr_code_scanner/qr_code_scanner.dart';
|
|||||||
import 'package:zxing2/qrcode.dart';
|
import 'package:zxing2/qrcode.dart';
|
||||||
|
|
||||||
import '../../common.dart';
|
import '../../common.dart';
|
||||||
|
import '../../consts.dart';
|
||||||
import '../widgets/dialog.dart';
|
import '../widgets/dialog.dart';
|
||||||
|
|
||||||
class ScanPage extends StatefulWidget {
|
class ScanPage extends StatefulWidget {
|
||||||
@ -60,7 +61,11 @@ class _ScanPageState extends State<ScanPage> {
|
|||||||
var reader = QRCodeReader();
|
var reader = QRCodeReader();
|
||||||
try {
|
try {
|
||||||
var result = reader.decode(bitmap);
|
var result = reader.decode(bitmap);
|
||||||
showServerSettingFromQr(result.text);
|
if (result.text.startsWith(kUniLinksPrefix)) {
|
||||||
|
handleUriLink(uriString: result.text);
|
||||||
|
} else {
|
||||||
|
showServerSettingFromQr(result.text);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showToast('No QR code found');
|
showToast('No QR code found');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user