From 63f78e59758dab70bf5855d9c1a6ba426027fbf1 Mon Sep 17 00:00:00 2001 From: davidliu Date: Wed, 27 Apr 2022 01:13:57 +0900 Subject: [PATCH] Fix validate url creation (#110) --- lib/src/utils.dart | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 9979a60..136d077 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -1,10 +1,9 @@ import 'dart:async'; import 'dart:math' as math; -import 'package:flutter/foundation.dart'; - import 'package:collection/collection.dart'; import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; import 'package:meta/meta.dart'; @@ -152,17 +151,13 @@ class Utils { final useSecure = uri.isSecureScheme || forceSecure; final httpScheme = useSecure ? 'https' : 'http'; final wsScheme = useSecure ? 'wss' : 'ws'; - final lastSegment = validate ? 'validate' : 'rtc'; + final lastSegments = validate ? ['rtc', 'validate'] : ['rtc']; final pathSegments = List.from(uri.pathSegments); // strip path segment used for LiveKit if already exists pathSegments.removeWhere((e) => e.isEmpty); - if (pathSegments.isNotEmpty && - ['rtc', 'validate'].contains(uri.pathSegments.last)) { - pathSegments.removeLast(); - } - pathSegments.add(lastSegment); + pathSegments.addAll(lastSegments); final clientInfo = await _clientInfo();