Skip to content

Commit

Permalink
Merge pull request #200 from appunite/dependabot/gradle/koin-3.5.3
Browse files Browse the repository at this point in the history
chore(deps): bump koin from 3.5.0 to 3.5.3
  • Loading branch information
nowakweronika authored Jan 26, 2024
2 parents b0f2126 + ea68f56 commit 7a34ccd
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import org.hamcrest.Matchers.allOf
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.koin.compose.KoinContext
import org.koin.core.context.GlobalContext
import org.koin.dsl.module
import strikt.api.expectThat
Expand Down Expand Up @@ -81,8 +82,10 @@ abstract class AbsLoginScreenTest {
.respondWith(Instrumentation.ActivityResult(Activity.RESULT_OK, null))

composeTestRule.setContent {
LoudiusTheme {
LoginScreen()
KoinContext {
LoudiusTheme {
LoginScreen()
}
}
}

Expand Down Expand Up @@ -110,8 +113,10 @@ abstract class AbsLoginScreenTest {
.respondWith(Instrumentation.ActivityResult(Activity.RESULT_OK, null))

composeTestRule.setContent {
LoudiusTheme {
LoginScreen()
KoinContext {
LoudiusTheme {
LoginScreen()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.appunite.loudius.util.Register
import com.appunite.loudius.util.waitUntilLoadingDoesNotExist
import org.junit.Rule
import org.junit.Test
import org.koin.compose.KoinContext
import strikt.api.expectThat
import strikt.assertions.containsExactly

Expand All @@ -49,8 +50,10 @@ abstract class AbsPullRequestsScreenTest {
Register.issues(mockWebServer)

composeTestRule.setContent {
LoudiusTheme {
PullRequestsScreen { _, _, _, _ -> }
KoinContext {
LoudiusTheme {
PullRequestsScreen { _, _, _, _ -> }
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.appunite.loudius.util.waitUntilLoadingDoesNotExist
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.koin.compose.KoinContext
import strikt.api.expectThat
import strikt.assertions.containsExactly

Expand All @@ -53,8 +54,10 @@ abstract class AbsReviewersScreenTest {
fun whenResponseIsCorrectThenReviewersAreVisible() {
with(integrationTestRule) {
composeTestRule.setContent {
LoudiusTheme {
ReviewersScreen { }
KoinContext {
LoudiusTheme {
ReviewersScreen { }
}
}
}

Expand All @@ -76,8 +79,10 @@ abstract class AbsReviewersScreenTest {
Register.comment(mockWebServer)

composeTestRule.setContent {
LoudiusTheme {
ReviewersScreen { }
KoinContext {
LoudiusTheme {
ReviewersScreen { }
}
}
}

Expand Down Expand Up @@ -107,8 +112,10 @@ abstract class AbsReviewersScreenTest {
fun whenClickOnNotifyAndDoNotCommentThenShowError() {
with(integrationTestRule) {
composeTestRule.setContent {
LoudiusTheme {
ReviewersScreen { }
KoinContext {
LoudiusTheme {
ReviewersScreen { }
}
}
}

Expand Down
95 changes: 49 additions & 46 deletions app/src/main/java/com/appunite/loudius/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,65 +37,68 @@ import com.appunite.loudius.ui.login.LoginScreen
import com.appunite.loudius.ui.pullrequests.PullRequestsScreen
import com.appunite.loudius.ui.reviewers.ReviewersScreen
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.compose.KoinContext

class MainActivity : ComponentActivity() {

private val viewModel by viewModel<MainViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
LoudiusTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
val navController = rememberNavController()

LaunchedEffect(viewModel.state.authFailureEvent) {
navigateToLoginOnAuthFailure(navController)
}

NavHost(
navController = navController,
startDestination = Screen.Login.route
KoinContext {
LoudiusTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
composable(route = Screen.Login.route) {
LoginScreen()
val navController = rememberNavController()

LaunchedEffect(viewModel.state.authFailureEvent) {
navigateToLoginOnAuthFailure(navController)
}
composable(
route = Screen.Authenticating.route,
deepLinks = Screen.Authenticating.deepLinks

NavHost(
navController = navController,
startDestination = Screen.Login.route
) {
AuthenticatingScreen(
onNavigateToPullRequest = {
navController.navigate(Screen.PullRequests.route) {
popUpTo(Screen.Login.route) { inclusive = true }
}
},
onNavigateToLogin = {
navController.navigate(Screen.Login.route) {
popUpTo(Screen.Login.route) { inclusive = true }
composable(route = Screen.Login.route) {
LoginScreen()
}
composable(
route = Screen.Authenticating.route,
deepLinks = Screen.Authenticating.deepLinks
) {
AuthenticatingScreen(
onNavigateToPullRequest = {
navController.navigate(Screen.PullRequests.route) {
popUpTo(Screen.Login.route) { inclusive = true }
}
},
onNavigateToLogin = {
navController.navigate(Screen.Login.route) {
popUpTo(Screen.Login.route) { inclusive = true }
}
}
}
)
}
composable(route = Screen.PullRequests.route) {
PullRequestsScreen { owner, repo, pullRequestNumber, submissionTime ->
val route = Screen.Reviewers.constructRoute(
owner = owner,
repo = repo,
pullRequestNumber = pullRequestNumber,
submissionDate = submissionTime
)
navController.navigate(route)
}
}
composable(
route = Screen.Reviewers.route,
arguments = Screen.Reviewers.arguments
) {
ReviewersScreen { navController.popBackStack() }
composable(route = Screen.PullRequests.route) {
PullRequestsScreen { owner, repo, pullRequestNumber, submissionTime ->
val route = Screen.Reviewers.constructRoute(
owner = owner,
repo = repo,
pullRequestNumber = pullRequestNumber,
submissionDate = submissionTime
)
navController.navigate(route)
}
}
composable(
route = Screen.Reviewers.route,
arguments = Screen.Reviewers.arguments
) {
ReviewersScreen { navController.popBackStack() }
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ Topbar is a component on the top of the screen.
| Variant | Snapshot |
|--------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Topbar with back navigation**<br />[Source Code](../components/src/main/java/com/appunite/loudius/components/components/LoudiusTopAppBar.kt#L61-L70) | <img src="src/test/snapshots/images/com.appunite.loudius_PaparazziShowkaseTests_preview_tests[Default Group-LoudiusTopAppBar,1,light].png" /> |
| **Topbar with no navigation**<br /> [Source Code](../components/src/main/java/com/appunite/loudius/components/components/LoudiusTopAppBar.kt#L72-L80) | <img src="src/test/snapshots/images/com.appunite.loudius_PaparazziShowkaseTests_preview_tests[Default Group-LoudiusTopAppBarWithoutBackButton,1,light].png" /> |
| **Topbar with no navigation**<br /> [Source Code](../components/src/main/java/com/appunite/loudius/components/components/LoudiusTopAppBar.kt#L72-L80) | <img src="src/test/snapshots/images/com.appunite.loudius_PaparazziShowkaseTests_preview_tests[Default Group-LoudiusTopAppBarWithoutBackButton,1,light].png" /> |
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ googleServices = "4.4.0"
junit = "4.13.2"
junitBom = "5.10.1"
junitVersion = "1.1.5"
koin = "3.5.0"
koin = "3.5.3"
kotlinxCoroutines = "1.7.3"
kotlinxDatetime = "0.4.1"
kotlinxDatetimeVersion = "0.4.1"
Expand Down

0 comments on commit 7a34ccd

Please sign in to comment.