Add base url setup to sign in test

This commit is contained in:
Kirill Kamakin
2022-12-06 21:33:10 +01:00
parent 8c3ec9a40d
commit 77395a07f4
8 changed files with 120 additions and 4 deletions

View File

@@ -28,7 +28,8 @@ class BaseURLViewModel @Inject constructor(
logger.v { "saveBaseUrl() called with: baseURL = $baseURL" }
_uiState.value = OperationUiState.Progress()
val hasPrefix = ALLOWED_PREFIXES.any { baseURL.startsWith(it) }
val url = baseURL.takeIf { hasPrefix } ?: WITH_PREFIX_FORMAT.format(baseURL)
var url = baseURL.takeIf { hasPrefix } ?: WITH_PREFIX_FORMAT.format(baseURL)
url = url.trimStart().trimEnd { it == '/' || it.isWhitespace() }
viewModelScope.launch { checkBaseURL(url) }
}