summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2023-07-09 16:48:34 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2023-07-09 16:48:34 +0530
commit6f3f7e4b4c6a7eb8efe4e7a2cb3fea8d7ef1bb5d (patch)
tree3557f667c51ff362442978da01da53981edad01b /app
parent378ce98cd029a4e054ca2e5914a560f3ac706771 (diff)
refactor: adopt Kotlin 1.9's `data object`s
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/app/passwordstore/util/auth/BiometricAuthenticator.kt6
-rw-r--r--app/src/main/java/app/passwordstore/util/git/ErrorMessages.kt8
-rw-r--r--app/src/main/java/app/passwordstore/util/settings/GitSettings.kt4
3 files changed, 9 insertions, 9 deletions
diff --git a/app/src/main/java/app/passwordstore/util/auth/BiometricAuthenticator.kt b/app/src/main/java/app/passwordstore/util/auth/BiometricAuthenticator.kt
index ddc52ff2..4b91bee6 100644
--- a/app/src/main/java/app/passwordstore/util/auth/BiometricAuthenticator.kt
+++ b/app/src/main/java/app/passwordstore/util/auth/BiometricAuthenticator.kt
@@ -37,13 +37,13 @@ object BiometricAuthenticator {
* An incorrect biometric was entered, but the prompt UI is offering the option to retry the
* operation.
*/
- object Retry : Result()
+ data object Retry : Result()
/** The biometric hardware is unavailable or disabled on a software or hardware level. */
- object HardwareUnavailableOrDisabled : Result()
+ data object HardwareUnavailableOrDisabled : Result()
/** The prompt was dismissed. */
- object Cancelled : Result()
+ data object Cancelled : Result()
}
fun canAuthenticate(activity: FragmentActivity): Boolean {
diff --git a/app/src/main/java/app/passwordstore/util/git/ErrorMessages.kt b/app/src/main/java/app/passwordstore/util/git/ErrorMessages.kt
index 41ed8e9a..8ce0125b 100644
--- a/app/src/main/java/app/passwordstore/util/git/ErrorMessages.kt
+++ b/app/src/main/java/app/passwordstore/util/git/ErrorMessages.kt
@@ -28,17 +28,17 @@ sealed class GitException(@StringRes res: Int, vararg fmt: String) :
/** Encapsulates possible errors from a [org.eclipse.jgit.api.PullCommand]. */
sealed class PullException(@StringRes res: Int, vararg fmt: String) : GitException(res, *fmt) {
- object PullRebaseFailed : PullException(R.string.git_pull_rebase_fail_error)
+ data object PullRebaseFailed : PullException(R.string.git_pull_rebase_fail_error)
- object PullMergeFailed : PullException(R.string.git_pull_merge_fail_error)
+ data object PullMergeFailed : PullException(R.string.git_pull_merge_fail_error)
}
/** Encapsulates possible errors from a [org.eclipse.jgit.api.PushCommand]. */
sealed class PushException(@StringRes res: Int, vararg fmt: String) : GitException(res, *fmt) {
- object NonFastForward : PushException(R.string.git_push_nff_error)
+ data object NonFastForward : PushException(R.string.git_push_nff_error)
- object RemoteRejected : PushException(R.string.git_push_other_error)
+ data object RemoteRejected : PushException(R.string.git_push_other_error)
class Generic(message: String) : PushException(R.string.git_push_generic_error, message)
}
diff --git a/app/src/main/java/app/passwordstore/util/settings/GitSettings.kt b/app/src/main/java/app/passwordstore/util/settings/GitSettings.kt
index e01e6317..b7422c99 100644
--- a/app/src/main/java/app/passwordstore/util/settings/GitSettings.kt
+++ b/app/src/main/java/app/passwordstore/util/settings/GitSettings.kt
@@ -135,9 +135,9 @@ constructor(
class AuthModeMismatch(val newProtocol: Protocol, val validModes: List<AuthMode>) :
UpdateConnectionSettingsResult()
- object Valid : UpdateConnectionSettingsResult()
+ data object Valid : UpdateConnectionSettingsResult()
- object FailedToParseUrl : UpdateConnectionSettingsResult()
+ data object FailedToParseUrl : UpdateConnectionSettingsResult()
}
fun updateConnectionSettingsIfValid(