DemoViewModel

class DemoViewModel @Inject constructor(reporter: ShuttleVisibilityReporter, shuttle: Shuttle, serviceConnectionFactory: ShuttleServiceConnectionFactory) : ViewModel

The MVVM ViewModel used to connect with the RemoteService.

Parameters

reporter

reports feedback to increase visibility

shuttle

used to store and retrieve cargo

serviceConnectionFactory

creates variations of service connections

Constructors

Link copied to clipboard
@Inject
constructor(reporter: ShuttleVisibilityReporter, shuttle: Shuttle, serviceConnectionFactory: ShuttleServiceConnectionFactory)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun addCloseable(closeable: AutoCloseable)
fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
Link copied to clipboard
fun initMessaging(context: Context?, lifecycle: Lifecycle)

Initializes the IPC messenger and binds the lifecycle-aware service connection to RemoteService. Subsequent calls are no-ops so it is safe to call from androidx.fragment.app.Fragment.onCreate.

Link copied to clipboard
fun transportImageCargoUsingShuttleAndIPC(context: Context?, cargoId: String, @RawRes imageId: Int): Flow<IOResult>?

Transports the image cargo WITH using Shuttle and is used to demonstrate successful transportation of oversized cargo.

Link copied to clipboard
fun transportImageCargoWithoutUsingShuttle(context: Context?, cargoId: String, @RawRes imageId: Int): Flow<IOResult>?

Transports the image cargo WITHOUT using Shuttle and is used to demonstrate process crashes when transporting oversized cargo.