forked from MarathonLabs/marathon
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose device events as a flow rather than channel
- Loading branch information
Sergey Chelombitko
committed
Dec 17, 2024
1 parent
3bf38c3
commit c536f82
Showing
15 changed files
with
108 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
core/src/main/kotlin/com/malinskiy/marathon/device/DeviceEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.malinskiy.marathon.device | ||
|
||
sealed class DeviceEvent { | ||
abstract val device: Device | ||
|
||
class DeviceConnected(override val device: Device) : DeviceEvent() | ||
class DeviceDisconnected(override val device: Device) : DeviceEvent() | ||
} |
10 changes: 3 additions & 7 deletions
10
core/src/main/kotlin/com/malinskiy/marathon/device/DeviceProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
package com.malinskiy.marathon.device | ||
|
||
import kotlinx.coroutines.channels.Channel | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface DeviceProvider : AutoCloseable { | ||
sealed class DeviceEvent { | ||
class DeviceConnected(val device: Device) : DeviceEvent() | ||
class DeviceDisconnected(val device: Device) : DeviceEvent() | ||
} | ||
|
||
val deviceInitializationTimeoutMillis: Long | ||
suspend fun initialize() | ||
suspend fun terminate() | ||
fun subscribe(): Channel<DeviceEvent> | ||
|
||
val deviceEvents: Flow<DeviceEvent> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
...ndroid/ddmlib/src/test/kotlin/com/malinskiy/marathon/android/AndroidDeviceProviderSpek.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.