Skip to content

Commit

Permalink
Fix detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
RenanLukas committed Jun 6, 2024
1 parent a3ea9f7 commit 79ab3a8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.appbar.CollapsingToolbarLayout
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.elevation.ElevationOverlayProvider
import com.google.android.material.snackbar.Snackbar
import dagger.hilt.android.AndroidEntryPoint
import org.greenrobot.eventbus.EventBus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import org.wordpress.android.ui.bloggingprompts.BloggingPromptsPostTagProvider.C
import org.wordpress.android.ui.pages.SnackbarMessageHolder
import org.wordpress.android.ui.reader.ReaderTypes.ReaderPostListType.TAG_FOLLOWED
import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderPostNewUiState
import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderPostUiState
import org.wordpress.android.ui.reader.discover.ReaderCardUiState.ReaderRecommendedBlogsCardUiState.ReaderRecommendedBlogUiState
import org.wordpress.android.ui.reader.discover.ReaderNavigationEvents.ShowBlogPreview
import org.wordpress.android.ui.reader.discover.ReaderNavigationEvents.ShowPostsByTag
Expand Down Expand Up @@ -243,8 +242,8 @@ class ReaderDiscoverViewModel @Inject constructor(
onButtonClicked = this@ReaderDiscoverViewModel::onButtonClicked,
onItemClicked = this@ReaderDiscoverViewModel::onPostItemClicked,
onItemRendered = this@ReaderDiscoverViewModel::onItemRendered,
onMoreButtonClicked = this@ReaderDiscoverViewModel::onMoreButtonClickedNew,
onMoreDismissed = this@ReaderDiscoverViewModel::onMoreMenuDismissedNew,
onMoreButtonClicked = this@ReaderDiscoverViewModel::onMoreButtonClicked,
onMoreDismissed = this@ReaderDiscoverViewModel::onMoreMenuDismissed,
onVideoOverlayClicked = this@ReaderDiscoverViewModel::onVideoOverlayClicked,
onPostHeaderViewClicked = this@ReaderDiscoverViewModel::onPostHeaderClicked,
)
Expand Down Expand Up @@ -363,13 +362,6 @@ class ReaderDiscoverViewModel @Inject constructor(
}
}

private fun onTagItemClicked(tagSlug: String) {
launch(ioDispatcher) {
val readerTag = readerUtilsWrapper.getTagFromTagName(tagSlug, FOLLOWED)
_navigationEvents.postValue(Event(ShowPostsByTag(readerTag)))
}
}

private fun onPostItemClicked(postId: Long, blogId: Long) {
launch {
findPost(postId, blogId)?.let {
Expand Down Expand Up @@ -435,39 +427,15 @@ class ReaderDiscoverViewModel @Inject constructor(
// TODO malinjir: add on discover clicked listener
}

private fun onMoreButtonClicked(postUiState: ReaderPostUiState) {
private fun onMoreButtonClicked(postUiState: ReaderPostNewUiState) {
changeMoreMenuVisibility(postUiState, true)
}

private fun onMoreMenuDismissed(postUiState: ReaderPostUiState) {
private fun onMoreMenuDismissed(postUiState: ReaderPostNewUiState) {
changeMoreMenuVisibility(postUiState, false)
}

private fun changeMoreMenuVisibility(currentUiState: ReaderPostUiState, show: Boolean) {
launch {
findPost(currentUiState.postId, currentUiState.blogId)?.let { post ->
val moreMenuItems = if (show) {
readerPostMoreButtonUiStateBuilder.buildMoreMenuItems(
post, false, this@ReaderDiscoverViewModel::onButtonClicked
)
} else {
null
}

replaceUiStateItem(currentUiState, currentUiState.copy(moreMenuItems = moreMenuItems))
}
}
}

private fun onMoreButtonClickedNew(postUiState: ReaderPostNewUiState) {
changeMoreMenuVisibilityNew(postUiState, true)
}

private fun onMoreMenuDismissedNew(postUiState: ReaderPostNewUiState) {
changeMoreMenuVisibilityNew(postUiState, false)
}

private fun changeMoreMenuVisibilityNew(currentUiState: ReaderPostNewUiState, show: Boolean) {
private fun changeMoreMenuVisibility(currentUiState: ReaderPostNewUiState, show: Boolean) {
launch {
findPost(currentUiState.postId, currentUiState.blogId)?.let { post ->
val moreMenuItems = if (show) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.wordpress.android.ui.reader.views

import dagger.Reusable
import org.wordpress.android.R
import org.wordpress.android.fluxc.store.AccountStore
import org.wordpress.android.models.ReaderPost
import org.wordpress.android.ui.reader.discover.ReaderPostTagsUiStateBuilder
Expand All @@ -11,7 +10,6 @@ import org.wordpress.android.ui.reader.views.uistates.InteractionSectionUiState
import org.wordpress.android.ui.reader.views.uistates.ReaderBlogSectionUiState
import org.wordpress.android.ui.reader.views.uistates.ReaderPostDetailsHeaderAction
import org.wordpress.android.ui.reader.views.uistates.ReaderPostDetailsHeaderViewUiState.ReaderPostDetailsHeaderUiState
import org.wordpress.android.ui.utils.UiString.UiStringRes
import org.wordpress.android.ui.utils.UiString.UiStringText
import org.wordpress.android.util.DateTimeUtilsWrapper
import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.widget.RelativeLayout
import androidx.core.view.isGone
import com.google.android.material.textview.MaterialTextView
import org.wordpress.android.WordPress
import org.wordpress.android.databinding.ReaderTagHeaderViewBinding
import org.wordpress.android.databinding.ReaderTagHeaderViewNewBinding
import org.wordpress.android.ui.reader.views.ReaderTagHeaderViewUiState.ReaderTagHeaderUiState
import org.wordpress.android.ui.utils.UiHelpers
Expand Down

0 comments on commit 79ab3a8

Please sign in to comment.