-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly setup hilt hierarchy for SttInputDeviceWrapper
- Loading branch information
Showing
3 changed files
with
25 additions
and
46 deletions.
There are no files selected for viewing
33 changes: 5 additions & 28 deletions
33
app/src/androidTest/kotlin/org/stypox/dicio/screenshot/FakeSttInputDeviceWrapper.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,39 +1,16 @@ | ||
package org.stypox.dicio.screenshot | ||
|
||
import android.content.Context | ||
import androidx.datastore.core.DataStore | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.StateFlow | ||
import okhttp3.OkHttpClient | ||
import org.stypox.dicio.di.LocaleManager | ||
import org.stypox.dicio.di.SttInputDeviceWrapper | ||
import org.stypox.dicio.io.input.InputEvent | ||
import org.stypox.dicio.io.input.SttInputDevice | ||
import org.stypox.dicio.settings.datastore.InputDevice | ||
import org.stypox.dicio.settings.datastore.UserSettings | ||
import org.stypox.dicio.ui.home.SttState | ||
|
||
class FakeSttInputDeviceWrapper( | ||
@ApplicationContext appContext: Context, | ||
dataStore: DataStore<UserSettings>, | ||
localeManager: LocaleManager, | ||
okHttpClient: OkHttpClient | ||
) : SttInputDeviceWrapper(appContext, dataStore, localeManager, okHttpClient) { | ||
val fakeUiState: MutableStateFlow<SttState> = MutableStateFlow(SttState.NotInitialized) | ||
class FakeSttInputDeviceWrapper : SttInputDeviceWrapper { | ||
override val uiState: MutableStateFlow<SttState> = MutableStateFlow(SttState.NotInitialized) | ||
|
||
override fun buildInputDevice(setting: InputDevice): SttInputDevice { | ||
return object : SttInputDevice { | ||
override val uiState: StateFlow<SttState> get() = fakeUiState | ||
|
||
override fun tryLoad(thenStartListeningEventListener: ((InputEvent) -> Unit)?) { | ||
} | ||
|
||
override fun onClick(eventListener: (InputEvent) -> Unit) { | ||
} | ||
override fun tryLoad(thenStartListeningEventListener: ((InputEvent) -> Unit)?) { | ||
} | ||
|
||
override suspend fun destroy() { | ||
} | ||
} | ||
override fun onClick(eventListener: (InputEvent) -> Unit) { | ||
} | ||
} |
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