diff options
| author | Albin <albin@mullvad.net> | 2022-12-05 17:43:19 +0100 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2022-12-08 15:38:29 +0100 |
| commit | a5096f519222b9112bfe0e0ed89c3a9012cf7bd2 (patch) | |
| tree | 33b287ca517d04c1dafed7fc3ba9d7677f86d3d7 /android | |
| parent | 4696b089d3b9adfb09c31c2c76aa3e47cc407b46 (diff) | |
| download | mullvadvpn-a5096f519222b9112bfe0e0ed89c3a9012cf7bd2.tar.xz mullvadvpn-a5096f519222b9112bfe0e0ed89c3a9012cf7bd2.zip | |
Bump kotlin version
Diffstat (limited to 'android')
20 files changed, 55 insertions, 64 deletions
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index aece31fa53..8231417ebe 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -2,7 +2,6 @@ import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties import com.android.build.gradle.internal.tasks.factory.dependsOn import java.io.FileInputStream import java.util.Properties -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id(Dependencies.Plugin.androidApplicationId) @@ -105,7 +104,6 @@ android { } composeOptions { - kotlinCompilerVersion = Versions.kotlin kotlinCompilerExtensionVersion = Versions.kotlinCompilerExtensionVersion } @@ -115,6 +113,7 @@ android { } kotlinOptions { + allWarningsAsErrors = false jvmTarget = Versions.jvmTarget freeCompilerArgs = listOf( "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", @@ -164,17 +163,6 @@ configure<org.owasp.dependencycheck.gradle.extension.DependencyCheckExtension> { skipConfigurations = listOf("lintClassPath") } -tasks.withType<KotlinCompile>().all { - kotlinOptions { - allWarningsAsErrors = false - - kotlinOptions.freeCompilerArgs = listOf( - "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", - "-Xuse-experimental=kotlinx.coroutines.ObsoleteCoroutinesApi" - ) - } -} - tasks.register("copyExtraAssets", Copy::class) { from("$repoRootPath/dist-assets") include("relays.json") diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt index 52795f0964..89df8ac582 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt @@ -9,7 +9,7 @@ import kotlinx.coroutines.async import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking const val PROBLEM_REPORT_FILE = "problem_report.txt" @@ -42,7 +42,7 @@ class MullvadProblemReport { } fun collect() { - commandChannel.sendBlocking(Command.Collect()) + commandChannel.trySendBlocking(Command.Collect()) } suspend fun load(): String { @@ -56,13 +56,13 @@ class MullvadProblemReport { fun send(): Deferred<Boolean> { val result = CompletableDeferred<Boolean>() - commandChannel.sendBlocking(Command.Send(result)) + commandChannel.trySendBlocking(Command.Send(result)) return result } fun deleteReportFile() { - commandChannel.sendBlocking(Command.Delete()) + commandChannel.trySendBlocking(Command.Delete()) } private fun spawnActor() = GlobalScope.actor<Command>(Dispatchers.Default, Channel.UNLIMITED) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ipc/HandlerFlow.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ipc/HandlerFlow.kt index 40cad5e5e1..de512c7cc4 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ipc/HandlerFlow.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ipc/HandlerFlow.kt @@ -8,7 +8,7 @@ import kotlinx.coroutines.CancellationException import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedSendChannelException -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.FlowCollector import kotlinx.coroutines.flow.consumeAsFlow @@ -30,7 +30,7 @@ class HandlerFlow<T>( val extractedData = extractor(message) try { - channel.sendBlocking(extractedData) + channel.trySendBlocking(extractedData) } catch (exception: Exception) { when (exception) { is ClosedSendChannelException, is CancellationException -> { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/DaemonInstance.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/DaemonInstance.kt index 8b900038fc..0d1750f625 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/DaemonInstance.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/DaemonInstance.kt @@ -8,7 +8,7 @@ import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import net.mullvad.mullvadvpn.util.Intermittent private const val RELAYS_FILE = "relays.json" @@ -28,11 +28,11 @@ class DaemonInstance(val vpnService: MullvadVpnService) { val intermittentDaemon = Intermittent<MullvadDaemon>() fun start() { - commandChannel.sendBlocking(Command.START) + commandChannel.trySendBlocking(Command.START) } fun stop() { - commandChannel.sendBlocking(Command.STOP) + commandChannel.trySendBlocking(Command.STOP) } fun onDestroy() { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt index 0bf7e54606..f7a179a35e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/ForegroundNotificationManager.kt @@ -6,7 +6,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.onStart import net.mullvad.mullvadvpn.model.DeviceState @@ -33,7 +33,7 @@ class ForegroundNotificationManager( private val tunnelStateNotification = TunnelStateNotification(service) private var loggedIn by observable(false) { _, _, _ -> - updater.sendBlocking(UpdaterMessage.UpdateAction()) + updater.trySendBlocking(UpdaterMessage.UpdateAction()) } private val tunnelState @@ -46,12 +46,12 @@ class ForegroundNotificationManager( private set var lockedToForeground by observable(false) { _, _, _ -> - updater.sendBlocking(UpdaterMessage.UpdateNotification()) + updater.trySendBlocking(UpdaterMessage.UpdateNotification()) } init { connectionProxy.onStateChange.subscribe(this) { newState -> - updater.sendBlocking(UpdaterMessage.NewTunnelState(newState)) + updater.trySendBlocking(UpdaterMessage.NewTunnelState(newState)) } intermittentDaemon.registerListener(this) { daemon -> @@ -66,7 +66,7 @@ class ForegroundNotificationManager( } } - updater.sendBlocking(UpdaterMessage.UpdateNotification()) + updater.trySendBlocking(UpdaterMessage.UpdateNotification()) } fun onDestroy() { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt index db8b2e99d2..b363dbbe5f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt @@ -5,7 +5,7 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import kotlinx.coroutines.flow.collect import net.mullvad.mullvadvpn.ipc.Event import net.mullvad.mullvadvpn.ipc.Request @@ -64,17 +64,17 @@ class AccountCache(private val endpoint: ServiceEndpoint) { endpoint.dispatcher.apply { registerHandler(Request.CreateAccount::class) { _ -> - commandChannel.sendBlocking(Command.CreateAccount) + commandChannel.trySendBlocking(Command.CreateAccount) } registerHandler(Request.Login::class) { request -> request.account?.let { account -> - commandChannel.sendBlocking(Command.Login(account)) + commandChannel.trySendBlocking(Command.Login(account)) } } registerHandler(Request.Logout::class) { _ -> - commandChannel.sendBlocking(Command.Logout) + commandChannel.trySendBlocking(Command.Logout) } registerHandler(Request.FetchAccountExpiry::class) { _ -> diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AuthTokenCache.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AuthTokenCache.kt index 1ea2acec39..add7a7ed06 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AuthTokenCache.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AuthTokenCache.kt @@ -6,7 +6,7 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import net.mullvad.mullvadvpn.ipc.Event import net.mullvad.mullvadvpn.ipc.Request @@ -27,7 +27,7 @@ class AuthTokenCache(endpoint: ServiceEndpoint) { init { endpoint.dispatcher.registerHandler(Request.FetchAuthToken::class) { _ -> - requestQueue.sendBlocking(Command.Fetch) + requestQueue.trySendBlocking(Command.Fetch) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ConnectionProxy.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ConnectionProxy.kt index 94cc9f05b8..03808dcb94 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ConnectionProxy.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ConnectionProxy.kt @@ -5,7 +5,7 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import net.mullvad.mullvadvpn.ipc.Event import net.mullvad.mullvadvpn.ipc.Request import net.mullvad.mullvadvpn.model.TunnelState @@ -46,15 +46,15 @@ class ConnectionProxy(val vpnPermission: VpnPermission, endpoint: ServiceEndpoin } fun connect() { - commandChannel.sendBlocking(Command.CONNECT) + commandChannel.trySendBlocking(Command.CONNECT) } fun reconnect() { - commandChannel.sendBlocking(Command.RECONNECT) + commandChannel.trySendBlocking(Command.RECONNECT) } fun disconnect() { - commandChannel.sendBlocking(Command.DISCONNECT) + commandChannel.trySendBlocking(Command.DISCONNECT) } fun onDestroy() { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/CustomDns.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/CustomDns.kt index 7c22cef50c..b708e1b290 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/CustomDns.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/CustomDns.kt @@ -6,7 +6,7 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import net.mullvad.mullvadvpn.ipc.Request import net.mullvad.mullvadvpn.model.DnsOptions @@ -37,21 +37,21 @@ class CustomDns(private val endpoint: ServiceEndpoint) { endpoint.dispatcher.apply { registerHandler(Request.AddCustomDnsServer::class) { request -> - commandChannel.sendBlocking(Command.AddDnsServer(request.address)) + commandChannel.trySendBlocking(Command.AddDnsServer(request.address)) } registerHandler(Request.RemoveCustomDnsServer::class) { request -> - commandChannel.sendBlocking(Command.RemoveDnsServer(request.address)) + commandChannel.trySendBlocking(Command.RemoveDnsServer(request.address)) } registerHandler(Request.ReplaceCustomDnsServer::class) { request -> - commandChannel.sendBlocking( + commandChannel.trySendBlocking( Command.ReplaceDnsServer(request.oldAddress, request.newAddress) ) } registerHandler(Request.SetEnableCustomDns::class) { request -> - commandChannel.sendBlocking(Command.SetEnabled(request.enable)) + commandChannel.trySendBlocking(Command.SetEnabled(request.enable)) } } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt index df769abad9..4fbc1fab4b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/LocationInfoCache.kt @@ -7,7 +7,7 @@ import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import kotlinx.coroutines.delay import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.flatMapLatest @@ -51,12 +51,12 @@ class LocationInfoCache(private val endpoint: ServiceEndpoint) { when (newState) { is TunnelState.Disconnected -> { location = lastKnownRealLocation - fetchRequestChannel.sendBlocking(RequestFetch.ForRealLocation) + fetchRequestChannel.trySendBlocking(RequestFetch.ForRealLocation) } is TunnelState.Connecting -> location = newState.location is TunnelState.Connected -> { location = newState.location - fetchRequestChannel.sendBlocking(RequestFetch.ForRelayLocation) + fetchRequestChannel.trySendBlocking(RequestFetch.ForRelayLocation) } is TunnelState.Disconnecting -> { when (newState.actionAfterDisconnect) { @@ -76,7 +76,7 @@ class LocationInfoCache(private val endpoint: ServiceEndpoint) { endpoint.connectivityListener.connectivityNotifier.subscribe(this) { isConnected -> if (isConnected && state is TunnelState.Disconnected) { - fetchRequestChannel.sendBlocking(RequestFetch.ForRealLocation) + fetchRequestChannel.trySendBlocking(RequestFetch.ForRealLocation) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/RelayListListener.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/RelayListListener.kt index a65c313f54..1f59de4074 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/RelayListListener.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/RelayListListener.kt @@ -6,7 +6,7 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import net.mullvad.mullvadvpn.ipc.Event import net.mullvad.mullvadvpn.ipc.Request import net.mullvad.mullvadvpn.model.Constraint @@ -27,7 +27,7 @@ class RelayListListener(endpoint: ServiceEndpoint) { private val daemon = endpoint.intermittentDaemon private var selectedRelayLocation by observable<LocationConstraint?>(null) { _, _, _ -> - commandChannel.sendBlocking(Command.SetRelayLocation) + commandChannel.trySendBlocking(Command.SetRelayLocation) } var relayList by observable<RelayList?>(null) { _, _, relays -> diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt index bf8cab7e5b..4868f80fd2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/ServiceEndpoint.kt @@ -10,7 +10,7 @@ import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.SendChannel import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import net.mullvad.mullvadvpn.ipc.DispatchingHandler import net.mullvad.mullvadvpn.ipc.Event import net.mullvad.mullvadvpn.ipc.Request @@ -62,11 +62,11 @@ class ServiceEndpoint( init { dispatcher.apply { registerHandler(Request.RegisterListener::class) { request -> - commands.sendBlocking(Command.RegisterListener(request.listener)) + commands.trySendBlocking(Command.RegisterListener(request.listener)) } registerHandler(Request.UnregisterListener::class) { request -> - commands.sendBlocking(Command.UnregisterListener(request.listenerId)) + commands.trySendBlocking(Command.UnregisterListener(request.listenerId)) } } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SettingsListener.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SettingsListener.kt index c39c64b862..b44daaf0d6 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SettingsListener.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/SettingsListener.kt @@ -5,7 +5,7 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import net.mullvad.mullvadvpn.ipc.Event import net.mullvad.mullvadvpn.ipc.Request import net.mullvad.mullvadvpn.model.DnsOptions @@ -45,15 +45,15 @@ class SettingsListener(endpoint: ServiceEndpoint) { endpoint.dispatcher.apply { registerHandler(Request.SetAllowLan::class) { request -> - commandChannel.sendBlocking(Command.SetAllowLan(request.allow)) + commandChannel.trySendBlocking(Command.SetAllowLan(request.allow)) } registerHandler(Request.SetAutoConnect::class) { request -> - commandChannel.sendBlocking(Command.SetAutoConnect(request.autoConnect)) + commandChannel.trySendBlocking(Command.SetAutoConnect(request.autoConnect)) } registerHandler(Request.SetWireGuardMtu::class) { request -> - commandChannel.sendBlocking(Command.SetWireGuardMtu(request.mtu)) + commandChannel.trySendBlocking(Command.SetWireGuardMtu(request.mtu)) } } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/VoucherRedeemer.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/VoucherRedeemer.kt index 1c7465d700..c1433b7a3c 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/VoucherRedeemer.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/VoucherRedeemer.kt @@ -5,7 +5,7 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ClosedReceiveChannelException import kotlinx.coroutines.channels.actor -import kotlinx.coroutines.channels.sendBlocking +import kotlinx.coroutines.channels.trySendBlocking import net.mullvad.mullvadvpn.ipc.Event import net.mullvad.mullvadvpn.ipc.Request @@ -17,7 +17,7 @@ class VoucherRedeemer(private val endpoint: ServiceEndpoint) { init { endpoint.dispatcher.registerHandler(Request.SubmitVoucher::class) { request -> - voucherChannel.sendBlocking(request.voucher) + voucherChannel.trySendBlocking(request.voucher) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ListItemsAdapter.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ListItemsAdapter.kt index fac7314534..a97f2af3d2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ListItemsAdapter.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ListItemsAdapter.kt @@ -44,7 +44,7 @@ class ListItemsAdapter : RecyclerView.Adapter<ListItemsAdapter.ViewHolder>() { override fun onBindViewHolder(holder: ViewHolder, position: Int) { (holder.itemView as ListItemView).update(getItem(position)) - holder.itemView.listItemListener = listItemListener + (holder.itemView as ListItemView).listItemListener = listItemListener } override fun onViewRecycled(holder: ViewHolder) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/RedeemVoucherDialogFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/RedeemVoucherDialogFragment.kt index e12a9cdeef..f03cbf5d93 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/RedeemVoucherDialogFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/RedeemVoucherDialogFragment.kt @@ -141,6 +141,7 @@ class RedeemVoucherDialogFragment : DialogFragment() { when (result) { is VoucherSubmissionResult.Ok -> handleAddedTime(result.submission.timeAdded) is VoucherSubmissionResult.Error -> showError(result.error) + else -> { /* NOOP */ } } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragments/SplitTunnelingFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragments/SplitTunnelingFragment.kt index 494753845f..36ad3e1374 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragments/SplitTunnelingFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragments/SplitTunnelingFragment.kt @@ -53,8 +53,9 @@ class SplitTunnelingFragment : BaseFragment(R.layout.collapsed_title_layout) { private val listItemListener = object : ListItemListener { override fun onItemAction(item: ListItemData) { when (item.widget) { - is ImageState -> toggleExcludeChannel.offer(item) - is SwitchState -> toggleSystemAppsVisibility.offer(!item.widget.isChecked) + is ImageState -> toggleExcludeChannel.trySend(item) + is SwitchState -> toggleSystemAppsVisibility.trySend(!item.widget.isChecked) + else -> { /* NOOP */ } } } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/RelayListListener.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/RelayListListener.kt index 13c1c3dabe..aebe1f0a4f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/RelayListListener.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/RelayListListener.kt @@ -95,6 +95,7 @@ class RelayListListener( return relayList?.findItemForLocation(location, true) } + else -> { /* NOOP */ } } return null diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/FlowUtils.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/FlowUtils.kt index de76ff5b0b..4d715a9aec 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/FlowUtils.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/FlowUtils.kt @@ -20,7 +20,7 @@ import net.mullvad.mullvadvpn.ui.serviceconnection.ServiceConnectionState import net.mullvad.talpid.util.EventNotifier fun <T> SendChannel<T>.safeOffer(element: T): Boolean { - return runCatching { offer(element) }.getOrDefault(false) + return runCatching { trySend(element).isSuccess }.getOrDefault(false) } fun Animation.transitionFinished(): Flow<Unit> = callbackFlow<Unit> { diff --git a/android/buildSrc/src/main/kotlin/Versions.kt b/android/buildSrc/src/main/kotlin/Versions.kt index 46497de0e4..6b1196b485 100644 --- a/android/buildSrc/src/main/kotlin/Versions.kt +++ b/android/buildSrc/src/main/kotlin/Versions.kt @@ -4,9 +4,9 @@ object Versions { const val junit = "4.13.2" const val jvmTarget = "1.8" const val koin = "2.2.3" - const val kotlin = "1.5.31" - const val kotlinCompilerExtensionVersion = "1.0.5" - const val kotlinx = "1.5.2" + const val kotlin = "1.7.20" + const val kotlinCompilerExtensionVersion = "1.3.2" + const val kotlinx = "1.6.4" const val leakCanary = "2.8.1" const val mockk = "1.12.3" const val turbine = "0.7.0" |
