Skip to content

Commit

Permalink
WTA #71: Fixed import and detekt issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob3075 committed May 13, 2023
1 parent c9ee155 commit 264e583
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.jacob.wakatimeapp.navigation

import com.jacob.wakatimeapp.details.ui.DetailsPageNavigator
import com.jacob.wakatimeapp.details.ui.destinations.DetailsPageDestination
import com.jacob.wakatimeapp.home.ui.HomePageNavigator
import com.jacob.wakatimeapp.home.ui.destinations.HomePageDestination
import com.jacob.wakatimeapp.login.ui.LoginPageNavigator
import com.jacob.wakatimeapp.navigation.destinations.DetailsPageDestination
import com.jacob.wakatimeapp.navigation.destinations.HomePageDestination
import com.jacob.wakatimeapp.navigation.destinations.SearchProjectsDestination
import com.jacob.wakatimeapp.search.ui.SearchProjectsNavigator
import com.jacob.wakatimeapp.search.ui.destinations.SearchProjectsDestination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator

class ApplicationNavigator(private val navigator: DestinationsNavigator) :
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.jacob.wakatimeapp.details.ui

import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.jacob.wakatimeapp.details.domain.usecases.GetProjectStatsUC
Expand All @@ -12,14 +13,17 @@ import timber.log.Timber

@HiltViewModel
internal class DetailsPageViewModel @Inject constructor(
savedStateHandle: SavedStateHandle,
private val getProjectStatsUC: GetProjectStatsUC,
) : ViewModel() {
private val args = savedStateHandle.navArgs<DetailsPageNavArgs>()

private val _viewState = MutableStateFlow<DetailsPageViewState>(DetailsPageViewState.Loading)
val viewState = _viewState.asStateFlow()

init {
viewModelScope.launch {
val data = getProjectStatsUC("WakaTimeApp.Compose")
val data = getProjectStatsUC(args.projectName)
Timber.w(data.toString())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ private fun SearchProjectsScreen(
when (val stateInstance = state) {
is Loaded -> SearchProjectsLoaded(
state = stateInstance,
modifier = modifier,
updateSearchQuery = viewModel::updateSearchQuery,
onProjectItemClicked = { navigator.toProjectDetailsPage(it.name) },
modifier = modifier,
)

Loading -> WtaAnimation(
Expand All @@ -65,15 +65,14 @@ private fun SearchProjectsScreen(
@Composable
private fun SearchProjectsLoaded(
state: Loaded,
modifier: Modifier = Modifier,
updateSearchQuery: (TextFieldValue) -> Unit,
onProjectItemClicked: (ProjectDetails) -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.statusBarsPadding()
.padding(
horizontal = MaterialTheme.spacing.medium,
),
modifier = modifier
.statusBarsPadding()
.padding(horizontal = MaterialTheme.spacing.medium),
) {
Spacer(modifier = Modifier.height(MaterialTheme.spacing.medium))
SearchBar(
Expand Down
1 change: 1 addition & 0 deletions tools/detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ empty-blocks:
active: true

exceptions:
excludes: [ '**/build/**' ]
active: true
ExceptionRaisedInUnexpectedLocation:
active: true
Expand Down

0 comments on commit 264e583

Please sign in to comment.