aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/git/config
diff options
context:
space:
mode:
authorFabian Henneke <FabianHenneke@users.noreply.github.com>2020-08-26 10:06:36 +0200
committerGitHub <noreply@github.com>2020-08-26 13:36:36 +0530
commitad17fa7cc5003cf362c74019afa13e9d28d0f4e7 (patch)
tree38fb4bbc7bfa26fab0ab7833387df577a0bfa736 /app/src/main/java/com/zeapo/pwdstore/git/config
parentd0b15cec49a41ec1ea51890ac7b7c8cb8515f6a4 (diff)
downloadHardenedPass-ad17fa7cc5003cf362c74019afa13e9d28d0f4e7.tar.gz
HardenedPass-ad17fa7cc5003cf362c74019afa13e9d28d0f4e7.zip
Rename ConnectionMode to AuthMode and remove clone_ prefix (#1053)
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/git/config')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt b/app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt
index 2efae40c..b9c572fc 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/config/GitSettings.kt
@@ -29,7 +29,7 @@ enum class Protocol(val pref: String) {
}
}
-enum class ConnectionMode(val pref: String) {
+enum class AuthMode(val pref: String) {
SshKey("ssh-key"),
Password("username/password"),
OpenKeychain("OpenKeychain"),
@@ -38,10 +38,10 @@ enum class ConnectionMode(val pref: String) {
companion object {
- private val map = values().associateBy(ConnectionMode::pref)
- fun fromString(type: String?): ConnectionMode {
+ private val map = values().associateBy(AuthMode::pref)
+ fun fromString(type: String?): AuthMode {
return map[type ?: return SshKey]
- ?: throw IllegalArgumentException("$type is not a valid ConnectionMode")
+ ?: throw IllegalArgumentException("$type is not a valid AuthMode")
}
}
}
@@ -60,8 +60,8 @@ object GitSettings {
putString(PreferenceKeys.GIT_REMOTE_PROTOCOL, value.pref)
}
}
- var connectionMode
- get() = ConnectionMode.fromString(settings.getString(PreferenceKeys.GIT_REMOTE_AUTH))
+ var authMode
+ get() = AuthMode.fromString(settings.getString(PreferenceKeys.GIT_REMOTE_AUTH))
private set(value) {
settings.edit {
putString(PreferenceKeys.GIT_REMOTE_AUTH, value.pref)
@@ -110,18 +110,18 @@ object GitSettings {
MissingUsername,
}
- fun updateConnectionSettingsIfValid(newProtocol: Protocol, newConnectionMode: ConnectionMode, newUrl: String, newBranch: String): UpdateConnectionSettingsResult {
+ fun updateConnectionSettingsIfValid(newProtocol: Protocol, newAuthMode: AuthMode, newUrl: String, newBranch: String): UpdateConnectionSettingsResult {
val parsedUrl = try {
URIish(newUrl)
} catch (_: Exception) {
return UpdateConnectionSettingsResult.FailedToParseUrl
}
- if (newConnectionMode != ConnectionMode.None && parsedUrl.user.isNullOrBlank())
+ if (newAuthMode != AuthMode.None && parsedUrl.user.isNullOrBlank())
return UpdateConnectionSettingsResult.MissingUsername
url = newUrl
protocol = newProtocol
- connectionMode = newConnectionMode
+ authMode = newAuthMode
branch = newBranch
return UpdateConnectionSettingsResult.Valid
}