Skip to content

Commit

Permalink
Merge pull request #221 from hieuwu/feature/wipe-out-xml
Browse files Browse the repository at this point in the history
Get rid of unused class & files
  • Loading branch information
hieuwu authored Oct 12, 2023
2 parents 22b65e8 + 1fd6e6e commit 130c13b
Show file tree
Hide file tree
Showing 21 changed files with 20 additions and 657 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
package com.hieuwu.groceriesstore.presentation.account

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hieuwu.groceriesstore.domain.models.UserModel
import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase
import com.hieuwu.groceriesstore.domain.usecases.SignOutUseCase
import com.hieuwu.groceriesstore.presentation.utils.ObservableViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import javax.inject.Inject
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class AccountViewModel @Inject constructor(
private val getProfileUseCase: GetProfileUseCase,
private val signOutUseCase: SignOutUseCase
) : ObservableViewModel() {
) : ViewModel() {

private val _user: MutableStateFlow<UserModel?> = MutableStateFlow(null)
val user: MutableStateFlow<UserModel?>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.hieuwu.groceriesstore.presentation.cart

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hieuwu.groceriesstore.domain.models.LineItemModel
import com.hieuwu.groceriesstore.domain.models.OrderModel
import com.hieuwu.groceriesstore.domain.usecases.UpdateCartItemUseCase
import com.hieuwu.groceriesstore.presentation.utils.ObservableViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
Expand All @@ -16,7 +16,7 @@ import timber.log.Timber
@HiltViewModel
class CartViewModel @Inject constructor(
private val updateCartItemUseCase: UpdateCartItemUseCase
) : ObservableViewModel() {
) : ViewModel() {

val order: StateFlow<OrderModel?> =
updateCartItemUseCase.getCurrentCart()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.hieuwu.groceriesstore.presentation.checkout

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hieuwu.groceriesstore.domain.models.OrderModel
import com.hieuwu.groceriesstore.domain.models.UserModel
import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase
import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase
import com.hieuwu.groceriesstore.domain.usecases.SubmitOrderUseCase
import com.hieuwu.groceriesstore.presentation.utils.ObservableViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
Expand All @@ -22,8 +22,7 @@ class CheckOutViewModel @Inject constructor(
private val getCurrentCartUseCase: GetCurrentCartUseCase,
private val getProfileUseCase: GetProfileUseCase,
private val submitOrderUseCase: SubmitOrderUseCase
) :
ObservableViewModel() {
) : ViewModel() {
private val _user =
getCurrentUser()!!.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), null)
val user: StateFlow<UserModel?>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hieuwu.groceriesstore.presentation.explore

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hieuwu.groceriesstore.data.database.entities.LineItem
import com.hieuwu.groceriesstore.data.database.entities.Order
Expand All @@ -11,7 +12,6 @@ import com.hieuwu.groceriesstore.domain.usecases.CreateNewOrderUseCase
import com.hieuwu.groceriesstore.domain.usecases.GetCategoriesListUseCase
import com.hieuwu.groceriesstore.domain.usecases.GetCurrentCartUseCase
import com.hieuwu.groceriesstore.domain.usecases.SearchProductUseCase
import com.hieuwu.groceriesstore.presentation.utils.ObservableViewModel
import com.hieuwu.groceriesstore.utilities.OrderStatus
import dagger.hilt.android.lifecycle.HiltViewModel
import java.util.*
Expand All @@ -30,7 +30,7 @@ class ExploreViewModel @Inject constructor(
private val searchProductUseCase: SearchProductUseCase,
private val createNewOrderUseCase: CreateNewOrderUseCase,
private val addToCartUseCase: AddToCartUseCase
) : ObservableViewModel() {
) : ViewModel() {

private val _currentCart: StateFlow<OrderModel?> =
getCurrentCard()!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ package com.hieuwu.groceriesstore.presentation.favourite

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.asLiveData
import androidx.lifecycle.viewModelScope
import com.hieuwu.groceriesstore.data.repository.RecipeRepository
import com.hieuwu.groceriesstore.domain.models.RecipeModel
import com.hieuwu.groceriesstore.presentation.utils.ObservableViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.stateIn
import javax.inject.Inject

@HiltViewModel
class FavouriteViewModel @Inject constructor(private val recipeRepository: RecipeRepository) :
ObservableViewModel() {
ViewModel() {

private var _recipesList: MutableLiveData<List<RecipeModel>> =
recipeRepository.getFromLocal().stateIn(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.hieuwu.groceriesstore.presentation.notificationsettings

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hieuwu.groceriesstore.domain.models.UserModel
import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase
import com.hieuwu.groceriesstore.domain.usecases.UserSettingsUseCase
import com.hieuwu.groceriesstore.presentation.utils.ObservableViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
Expand All @@ -16,8 +16,7 @@ import javax.inject.Inject
class NotificationSettingsViewModel @Inject constructor(
private val userSettingsUseCase: UserSettingsUseCase,
private val getProfileUseCase: GetProfileUseCase,
) :
ObservableViewModel() {
) : ViewModel() {
private val _user: MutableStateFlow<UserModel?> = MutableStateFlow(null)
val user: MutableStateFlow<UserModel?>
get() = _user
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.hieuwu.groceriesstore.presentation.onboarding

import android.content.SharedPreferences
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hieuwu.groceriesstore.domain.usecases.RefreshAppDataUseCase
import com.hieuwu.groceriesstore.presentation.utils.ObservableViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
Expand All @@ -15,7 +15,7 @@ import javax.inject.Inject
class OnboardingViewModel @Inject constructor(
private val refreshAppDataUseCase: RefreshAppDataUseCase,
private val sharedPreferences: SharedPreferences
) : ObservableViewModel() {
) : ViewModel() {

private val _isSyncedSuccessful = MutableStateFlow(false)
val isSyncedSuccessful: StateFlow<Boolean>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.hieuwu.groceriesstore.presentation.productdetail

import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hieuwu.groceriesstore.data.database.entities.LineItem
import com.hieuwu.groceriesstore.data.database.entities.Order
import com.hieuwu.groceriesstore.data.repository.OrderRepository
import com.hieuwu.groceriesstore.domain.models.OrderModel
import com.hieuwu.groceriesstore.domain.usecases.GetProductDetailUseCase
import com.hieuwu.groceriesstore.presentation.utils.ObservableViewModel
import com.hieuwu.groceriesstore.utilities.OrderStatus
import dagger.hilt.android.lifecycle.HiltViewModel
import java.util.*
Expand All @@ -23,7 +23,7 @@ class ProductDetailViewModel @Inject constructor(
savedStateHandle: SavedStateHandle,
getProductDetailUseCase: GetProductDetailUseCase,
private val orderRepository: OrderRepository
) : ObservableViewModel() {
) : ViewModel() {

private val args = ProductDetailFragmentArgs.fromSavedStateHandle(savedStateHandle)

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ class ProductListFragment : Fragment() {
}

private fun showFilterDialog() {
val bottomSheetDialogFragment = FilterFragment()
bottomSheetDialogFragment.show(
activity?.supportFragmentManager!!,
bottomSheetDialogFragment.tag
)
// Do nothing. Add filter feature later
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.hieuwu.groceriesstore.presentation.updateprofile

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hieuwu.groceriesstore.domain.models.UserModel
import com.hieuwu.groceriesstore.domain.usecases.GetProfileUseCase
import com.hieuwu.groceriesstore.domain.usecases.UpdateProfileUseCase
import com.hieuwu.groceriesstore.presentation.utils.ObservableViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
Expand All @@ -16,8 +16,7 @@ import javax.inject.Inject
class UpdateProfileViewModel @Inject constructor(
private val updateProfileUseCase: UpdateProfileUseCase,
private val getProfileUseCase: GetProfileUseCase,
) :
ObservableViewModel() {
) : ViewModel() {
private val _user: MutableStateFlow<UserModel?> = MutableStateFlow(null)
val user: MutableStateFlow<UserModel?>
get() = _user
Expand Down
Loading

0 comments on commit 130c13b

Please sign in to comment.