Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv
FILTER_ORDERS_BY_STATUS_DIALOG_OPTION_SELECTED,
ORDER_FILTER_LIST_CLEAR_MENU_BUTTON_TAPPED,

// -- Filter History (shared by order and product lists, property: source = orders/products)
FILTER_HISTORY_BUTTON_TAPPED,
FILTER_HISTORY_PAST_FILTER_APPLIED,
FILTER_HISTORY_PAST_FILTER_REMOVED,
FILTER_HISTORY_CLEARED,

ORDERS_LIST_BULK_UPDATE_SELECTION_ENABLED,
ORDERS_LIST_BULK_UPDATE_REQUESTED,
ORDERS_LIST_BULK_UPDATE_CONFIRMED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ class AnalyticsTracker private constructor(
const val KEY_DATE = "date"
const val KEY_GRANULARITY = "granularity"
const val KEY_SOURCE = "source"
const val VALUE_FILTER_HISTORY_SOURCE_ORDERS = "orders"
const val VALUE_FILTER_HISTORY_SOURCE_PRODUCTS = "products"
const val KEY_WAITING_TIME = "waiting_time"
const val KEY_IS_NON_ATOMIC = "is_non_atomic"
const val KEY_CAUSE = "cause"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.woocommerce.android.ui.filters

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.woocommerce.android.extensions.navigateBackWithResult
import com.woocommerce.android.ui.base.BaseFragment
import com.woocommerce.android.ui.base.UIMessageResolver
import com.woocommerce.android.ui.compose.composeView
import com.woocommerce.android.ui.main.AppBarStatus
import com.woocommerce.android.viewmodel.MultiLiveEvent
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class FilterHistoryFragment : BaseFragment() {
private val viewModel: FilterHistoryViewModel by viewModels()

@Inject lateinit var uiMessageResolver: UIMessageResolver

override val activityAppBarStatus: AppBarStatus
get() = AppBarStatus.Hidden

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return composeView {
FilterHistoryScreen(viewModel)
}
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel.event.observe(viewLifecycleOwner) { event ->
when (event) {
is MultiLiveEvent.Event.Exit -> findNavController().navigateUp()
is MultiLiveEvent.Event.ExitWithResult<*> -> {
navigateBackWithResult(
FilterHistoryViewModel.FILTER_HISTORY_RESULT_KEY,
event.data
)
}
is MultiLiveEvent.Event.ShowSnackbar -> uiMessageResolver.showSnack(event.message)
else -> event.isHandled = false
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.woocommerce.android.ui.filters

import android.os.Parcelable
import com.woocommerce.android.tools.SelectedSite
import dagger.Reusable
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import kotlinx.parcelize.Parcelize
import org.wordpress.android.fluxc.model.LocalOrRemoteId.LocalId
import org.wordpress.android.fluxc.persistence.dao.FilterHistoryDao
import org.wordpress.android.fluxc.persistence.entity.FilterHistoryEntity
Expand Down Expand Up @@ -79,8 +81,9 @@ enum class FilterHistoryType {
* @param readableString human-readable summary of the filter, shown in the history list.
* @param payload canonical serialization of the selection, decoded by the per-surface consumer.
*/
@Parcelize
data class SavedFilter(
val id: Long,
val readableString: String,
val payload: String
)
) : Parcelable
Loading
Loading