diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-05-05 10:10:35 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-05-05 10:10:35 +0200 |
| commit | 7325107e01d8ff4c9cd405de36ccaa254d4e40c8 (patch) | |
| tree | 56b2393ad55b45a5948f47b67bee42ea3952a072 /android/app | |
| parent | 4a70cd51f5b67ece14740c5cefcf969772f63088 (diff) | |
| parent | c8f58f3be8cfe3c4f0ee9716a0f8c19be24fbdb0 (diff) | |
| download | mullvadvpn-7325107e01d8ff4c9cd405de36ccaa254d4e40c8.tar.xz mullvadvpn-7325107e01d8ff4c9cd405de36ccaa254d4e40c8.zip | |
Merge branch 'device-ignore-stale-pubkey'
Diffstat (limited to 'android/app')
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/AccountAndDevice.kt (renamed from android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceConfig.kt) | 4 | ||||
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceEvent.kt | 2 | ||||
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceState.kt | 10 | ||||
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt | 8 | ||||
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/DaemonDeviceDataSource.kt | 4 |
5 files changed, 14 insertions, 14 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceConfig.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/AccountAndDevice.kt index b8f5664e30..1a4ed323b9 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceConfig.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/AccountAndDevice.kt @@ -4,7 +4,7 @@ import android.os.Parcelable import kotlinx.parcelize.Parcelize @Parcelize -data class DeviceConfig( - val token: String, +data class AccountAndDevice( + val account_token: String, val device: Device ) : Parcelable diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceEvent.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceEvent.kt index 24703e7066..1f2b68fbe5 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceEvent.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceEvent.kt @@ -5,6 +5,6 @@ import kotlinx.parcelize.Parcelize @Parcelize data class DeviceEvent( - val device: DeviceConfig?, + val device: AccountAndDevice?, val remote: Boolean ) : Parcelable diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceState.kt index a4fd52cabb..1ae927a9b3 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/model/DeviceState.kt @@ -8,7 +8,7 @@ sealed class DeviceState : Parcelable { object InitialState : DeviceState() @Parcelize - data class DeviceRegistered(val deviceConfig: DeviceConfig) : DeviceState() + data class DeviceRegistered(val accountAndDevice: AccountAndDevice) : DeviceState() @Parcelize object DeviceNotRegistered : DeviceState() @@ -18,16 +18,16 @@ sealed class DeviceState : Parcelable { } fun deviceName(): String? { - return (this as? DeviceRegistered)?.deviceConfig?.device?.name + return (this as? DeviceRegistered)?.accountAndDevice?.device?.name } fun token(): String? { - return (this as? DeviceRegistered)?.deviceConfig?.token + return (this as? DeviceRegistered)?.accountAndDevice?.account_token } companion object { - fun fromDeviceConfig(deviceConfig: DeviceConfig?): DeviceState { - return deviceConfig?.let { DeviceRegistered(it) } ?: DeviceNotRegistered + fun from(accountAndDevice: AccountAndDevice?): DeviceState { + return accountAndDevice?.let { DeviceRegistered(it) } ?: DeviceNotRegistered } } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt index 2aefe71a91..9c02fc551f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt @@ -3,9 +3,9 @@ package net.mullvad.mullvadvpn.service import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asSharedFlow +import net.mullvad.mullvadvpn.model.AccountAndDevice import net.mullvad.mullvadvpn.model.AppVersionInfo import net.mullvad.mullvadvpn.model.Device -import net.mullvad.mullvadvpn.model.DeviceConfig import net.mullvad.mullvadvpn.model.DeviceEvent import net.mullvad.mullvadvpn.model.DeviceState import net.mullvad.mullvadvpn.model.DnsOptions @@ -126,7 +126,7 @@ class MullvadDaemon(vpnService: MullvadVpnService) { return listDevices(daemonInterfaceAddress, accountToken) } - fun getDevice(): DeviceConfig? = getDevice(daemonInterfaceAddress) + fun getDevice(): AccountAndDevice? = getDevice(daemonInterfaceAddress) fun updateDevice() = updateDevice(daemonInterfaceAddress) @@ -216,7 +216,7 @@ class MullvadDaemon(vpnService: MullvadVpnService) { accountToken: String? ): List<Device>? - private external fun getDevice(daemonInterfaceAddress: Long): DeviceConfig? + private external fun getDevice(daemonInterfaceAddress: Long): AccountAndDevice? private external fun updateDevice(daemonInterfaceAddress: Long) private external fun removeDevice( daemonInterfaceAddress: Long, @@ -262,7 +262,7 @@ class MullvadDaemon(vpnService: MullvadVpnService) { } private fun notifyDeviceEvent(event: DeviceEvent) { - _deviceStateUpdates.tryEmit(DeviceState.fromDeviceConfig(event.device)) + _deviceStateUpdates.tryEmit(DeviceState.from(event.device)) } private fun notifyRemoveDeviceEvent(event: RemoveDeviceEvent) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/DaemonDeviceDataSource.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/DaemonDeviceDataSource.kt index dd0769c5e7..c782999f6a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/DaemonDeviceDataSource.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/DaemonDeviceDataSource.kt @@ -32,8 +32,8 @@ class DaemonDeviceDataSource( endpoint.dispatcher.registerHandler(Request.RefreshDeviceState::class) { tracker.newBackgroundJob("refreshDeviceJob") { daemon.getDevice() - .let { deviceConfig -> - Event.DeviceStateEvent(DeviceState.fromDeviceConfig(deviceConfig)) + .let { accountAndDevice -> + Event.DeviceStateEvent(DeviceState.from(accountAndDevice)) } .also { event -> endpoint.sendEvent(event) } } |
