simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -88,14 +88,10 @@ class DevToolsSettings {
|
||||
if (trimmed.isEmpty) return null;
|
||||
final uri = Uri.tryParse(trimmed);
|
||||
if (uri == null || !uri.hasScheme) return null;
|
||||
if (uri.scheme == 'https') {
|
||||
// always fine
|
||||
} else if (uri.scheme == 'http' && allowsHttpCustomEndpoint) {
|
||||
// dev only
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (uri.host.isEmpty) return null;
|
||||
final schemeAllowed =
|
||||
uri.scheme == 'https' ||
|
||||
(uri.scheme == 'http' && allowsHttpCustomEndpoint);
|
||||
if (!schemeAllowed || uri.host.isEmpty) return null;
|
||||
return trimmed.endsWith('/')
|
||||
? trimmed.substring(0, trimmed.length - 1)
|
||||
: trimmed;
|
||||
|
||||
Reference in New Issue
Block a user