Support also mymuseum url
This commit is contained in:
parent
f0e41adace
commit
959b494b12
@ -100,13 +100,25 @@ class _ScannerDialogState extends State<ScannerDialog> {
|
|||||||
if (barcode.format == BarcodeFormat.qrCode && code.isNotEmpty) {
|
if (barcode.format == BarcodeFormat.qrCode && code.isNotEmpty) {
|
||||||
isProcessing = true;
|
isProcessing = true;
|
||||||
|
|
||||||
RegExp regExp = RegExp(r'^(?:https:\/\/web\.mymuseum\.be\/([^\/]+)\/([^\/]+)\/([^\/]+)|([^\/]+))$'); // myinfomate
|
RegExp regExp = RegExp(r'^(?:https:\/\/web\.myinfomate\.be\/([^\/]+)\/([^\/]+)\/([^\/]+)|([^\/]+))$'); // myinfomate
|
||||||
|
RegExp regExp2 = RegExp(r'^(?:https:\/\/web\.mymuseum\.be\/([^\/]+)\/([^\/]+)\/([^\/]+)|([^\/]+))$'); // myinfomate
|
||||||
var match = regExp.firstMatch(code);
|
var match = regExp.firstMatch(code);
|
||||||
String? instanceId = match?.group(1);
|
var match2 = regExp2.firstMatch(code);
|
||||||
String? configurationId = match?.group(2);
|
String? instanceId;
|
||||||
String? sectionId = match?.group(3) ?? match?.group(4);
|
String? configurationId;
|
||||||
|
String? sectionId;
|
||||||
|
|
||||||
if (match == null || sectionId == null) {
|
if(match == null) {
|
||||||
|
instanceId = match2?.group(1);
|
||||||
|
configurationId = match2?.group(2);
|
||||||
|
sectionId = match2?.group(3) ?? match2?.group(4);
|
||||||
|
} else {
|
||||||
|
instanceId = match.group(1);
|
||||||
|
configurationId = match.group(2);
|
||||||
|
sectionId = match.group(3) ?? match.group(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((match == null && match2 == null) || sectionId == null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text("L'URL ne correspond pas au format attendu."), backgroundColor: kMainColor2),
|
SnackBar(content: Text("L'URL ne correspond pas au format attendu."), backgroundColor: kMainColor2),
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user