-
-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathFromScreen.kt
More file actions
28 lines (26 loc) · 1.09 KB
/
FromScreen.kt
File metadata and controls
28 lines (26 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.mitteloupe.whoami.launcher
import androidx.activity.ComponentActivity
import androidx.activity.compose.LocalActivity
import androidx.appcompat.app.AppCompatActivity
import com.mitteloupe.whoami.di.testAppDependenciesEntryPoint
import com.mitteloupe.whoami.test.launcher.AppLauncher
import com.mitteloupe.whoami.test.launcher.fromComposable
import com.mitteloupe.whoami.test.test.TypedAndroidComposeTestRule
import com.mitteloupe.whoami.ui.main.AppNavHost
import com.mitteloupe.whoami.ui.theme.WhoAmITheme
fun <ACTIVITY : ComponentActivity> fromScreen(
composeContentTestRule: TypedAndroidComposeTestRule<ACTIVITY>,
startDestination: Any
) = AppLauncher {
fromComposable(composeContentTestRule) {
WhoAmITheme {
val activity = LocalActivity.current as AppCompatActivity
with(testAppDependenciesEntryPoint(activity).appNavHostDependencies) {
AppNavHost(
supportFragmentManager = activity.supportFragmentManager,
startDestination = startDestination
)
}
}
}.launch()
}