Skip to content

Commit 52b442b

Browse files
committed
Change method name
1 parent 4957708 commit 52b442b

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

app/src/main/kotlin/io/homeassistant/companion/android/webview/WebViewActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ class WebViewActivity :
13911391
loadedUrl = url
13921392
clearHistory = !keepHistory
13931393
lifecycleScope.launch {
1394-
if (presenter.isSecurityLevelSet()) {
1394+
if (!presenter.shouldSetSecurityLevel()) {
13951395
webView.loadUrl(url)
13961396
waitForConnection()
13971397
} else {

app/src/main/kotlin/io/homeassistant/companion/android/webview/WebViewPresenter.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ interface WebViewPresenter {
5353
suspend fun isSsidUsed(): Boolean
5454

5555
/**
56-
* Checks if the security level has been configured for the current server.
56+
* Checks whether the user needs to configure their insecure connection preference.
5757
*
58-
* @return `true` if the server has no plain text URLs, or if the allowInsecureConnection
59-
* flag has been explicitly set (to either true or false). Returns `false` if
60-
* the server has plain text URLs and the user hasn't yet chosen a security level.
58+
* @return `true` if the server uses a plain text (HTTP) URL and the user has not yet set their
59+
* preference for allowing insecure connections, `false` otherwise
6160
*/
62-
suspend fun isSecurityLevelSet(): Boolean
61+
suspend fun shouldSetSecurityLevel(): Boolean
6362

6463
suspend fun getAuthorizationHeader(): String
6564

app/src/main/kotlin/io/homeassistant/companion/android/webview/WebViewPresenterImpl.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,11 @@ class WebViewPresenterImpl @Inject constructor(
355355
override suspend fun isSsidUsed(): Boolean =
356356
serverManager.getServer(serverId)?.connection?.internalSsids?.isNotEmpty() == true
357357

358-
override suspend fun isSecurityLevelSet(): Boolean {
358+
override suspend fun shouldSetSecurityLevel(): Boolean {
359359
if (serverManager.getServer(serverId)?.connection?.hasPlainTextUrl() == false) {
360-
return true
360+
return false
361361
}
362-
return serverManager.integrationRepository(serverId).getAllowInsecureConnection() != null
362+
return serverManager.integrationRepository(serverId).getAllowInsecureConnection() == null
363363
}
364364

365365
override suspend fun getAuthorizationHeader(): String {

0 commit comments

Comments
 (0)