-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added proxy label to running screen (#202)
* chore: added proxy label to running screen * chore: update based on review and create `GetProxySettings`
- Loading branch information
Showing
6 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
composeApp/src/commonMain/kotlin/org/ooni/probe/domain/GetProxySettings.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.ooni.probe.domain | ||
|
||
import kotlinx.coroutines.flow.first | ||
import org.ooni.probe.data.models.ProxySettings | ||
import org.ooni.probe.data.models.SettingsKey | ||
import org.ooni.probe.data.repositories.PreferenceRepository | ||
|
||
class GetProxySettings( | ||
private val preferencesRepository: PreferenceRepository, | ||
) { | ||
suspend operator fun invoke() = | ||
ProxySettings.newProxySettings( | ||
protocol = getValueForKey(SettingsKey.PROXY_PROTOCOL) as? String, | ||
hostname = getValueForKey(SettingsKey.PROXY_HOSTNAME) as? String, | ||
port = getValueForKey(SettingsKey.PROXY_PORT) as? String, | ||
) | ||
|
||
private suspend fun getValueForKey(settingsKey: SettingsKey) = preferencesRepository.getValueByKey(settingsKey).first() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters