Skip to content

Commit

Permalink
Remove no longer necessary suspend modifier from DeviceProvider#initi…
Browse files Browse the repository at this point in the history
…alize()
  • Loading branch information
Sergey Chelombitko committed Dec 30, 2024
1 parent 2f9c3d2 commit 306d790
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.malinskiy.marathon.device
import kotlinx.coroutines.flow.Flow

interface DeviceProvider : AutoCloseable {
val deviceEvents: Flow<DeviceEvent>
val deviceInitializationTimeoutMillis: Long
suspend fun initialize()
suspend fun terminate()

val deviceEvents: Flow<DeviceEvent>
fun initialize()
suspend fun terminate()
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Scheduler(
}
}

private suspend fun initializeDeviceProvider(scope: CoroutineScope) {
private fun initializeDeviceProvider(scope: CoroutineScope) {
logger.debug("Initializing device provider")
deviceProvider.initialize()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class DdmlibDeviceProvider(
private val job = SupervisorJob()
private val coroutineScope = CoroutineScope(job + dispatcher)

override val deviceInitializationTimeoutMillis: Long = 180_000

override val deviceEvents: Flow<DeviceEvent>
get() = channel.consumeAsFlow()

override suspend fun initialize() {
override val deviceInitializationTimeoutMillis: Long = 180_000

override fun initialize() {
DdmPreferences.setTimeOut(DEFAULT_DDM_LIB_TIMEOUT)
@Suppress("DEPRECATION")
AndroidDebugBridge.initIfNeeded(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ class StubDeviceProvider : DeviceProvider {
private val channel: Channel<DeviceEvent> = unboundedChannel()
var providingLogic: (suspend (Channel<DeviceEvent>) -> Unit)? = null

override val deviceInitializationTimeoutMillis: Long = 180_000
override suspend fun initialize() = Unit

override val deviceEvents: Flow<DeviceEvent>
get() {
providingLogic?.let {
Expand All @@ -29,6 +26,10 @@ class StubDeviceProvider : DeviceProvider {
return channel.consumeAsFlow()
}

override val deviceInitializationTimeoutMillis: Long = 180_000

override fun initialize() = Unit

override suspend fun terminate() {
channel.close()
}
Expand Down

0 comments on commit 306d790

Please sign in to comment.