diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-02-18 17:38:28 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-02-19 12:25:32 +0000 |
| commit | 78fda5e491f8b03339cdddbcbf3732091e716207 (patch) | |
| tree | 5dc81ddaa817c9fdef01c72d8133484133ea55ab /android | |
| parent | c20cb9ad59788dce01560200ba2f35fb5be127ec (diff) | |
| download | mullvadvpn-78fda5e491f8b03339cdddbcbf3732091e716207.tar.xz mullvadvpn-78fda5e491f8b03339cdddbcbf3732091e716207.zip | |
Make `KeygenEvent` failure variants singletons
Diffstat (limited to 'android')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/model/KeygenEvent.kt | 16 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/KeyStatusListener.kt | 2 |
2 files changed, 3 insertions, 15 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/KeygenEvent.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/KeygenEvent.kt index e719484e76..8c476ef5ff 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/KeygenEvent.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/KeygenEvent.kt @@ -17,20 +17,8 @@ sealed class KeygenEvent { } } - class TooManyKeys : KeygenEvent() { - companion object { - @JvmStatic - val INSTANCE = TooManyKeys() - } - } - - class GenerationFailure : KeygenEvent() { - companion object { - @JvmStatic - val INSTANCE = GenerationFailure() - } - } - + object TooManyKeys : KeygenEvent() + object GenerationFailure : KeygenEvent() fun failure(): KeygenFailure? { return when (this) { diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/KeyStatusListener.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/KeyStatusListener.kt index 8d44be4d36..2b8c2245dd 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/KeyStatusListener.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/KeyStatusListener.kt @@ -32,7 +32,7 @@ class KeyStatusListener(val daemon: MullvadDaemon) { newFailure ) } else { - keyStatus = newStatus ?: KeygenEvent.GenerationFailure() + keyStatus = newStatus ?: KeygenEvent.GenerationFailure } } |
