NetworkMockInitializer

Singleton initializer for the network mock module's repositories.

This object is responsible for constructing and holding the single instances of MockStateRepository and MockConfigRepository for the lifetime of the process. It is initialised once from devview-networkmock's NetworkMock.initModule() and read by both devview-networkmock (UI) and devview-networkmock-ktor (Ktor plugin).

Initialisation Order

The following order is guaranteed by rememberModules:

  1. com.worldline.devview.utils.RequiresDataStore.initDataStore — initialises NetworkMockDataStoreDelegate so DataStore is ready

  2. NetworkMock.initModule() — calls initialize, passing the DataStore from the delegate explicitly

Why an object

devview-networkmock-ktor has no Compose context and no access to the NetworkMock class (which lives in devview-networkmock). A process-level singleton in core is the only location both modules can read repositories from without creating a circular dependency.

See also

Functions

Link copied to clipboard
fun initialize(dataStore: DataStore<Preferences>, configPath: String, resourceLoader: suspend (String) -> ByteArray)

Initialises the repositories for the network mock module.