Skip to content

Commit

Permalink
refactor: Move settings related usecases to a new package
Browse files Browse the repository at this point in the history
  • Loading branch information
Lastaapps committed Jul 14, 2024
1 parent f84f5e4 commit 70f369d
Show file tree
Hide file tree
Showing 28 changed files with 97 additions and 74 deletions.
28 changes: 28 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package cz.lastaapps.menza.features.main.domain.usecase
import cz.lastaapps.api.main.domain.usecase.wallet.WalletGetBalanceUC
import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
import cz.lastaapps.menza.features.settings.domain.usecase.GetBalanceWarningThresholdUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetBalanceWarningThresholdUC
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filterNotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import cz.lastaapps.core.ui.vm.VMState
import cz.lastaapps.menza.features.main.domain.usecase.CheckLowBalanceUC
import cz.lastaapps.menza.features.main.domain.usecase.GetSelectedMenzaUC
import cz.lastaapps.menza.features.main.domain.usecase.IsFlipUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetSettingsEverOpenedUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetSettingsEverOpenedUC
import kotlinx.coroutines.flow.collectLatest

internal class MainViewModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,6 @@ import cz.lastaapps.menza.features.settings.data.datasource.OrderSettings
import cz.lastaapps.menza.features.settings.domain.MainSettingsRepo
import cz.lastaapps.menza.features.settings.domain.OrderRepo
import cz.lastaapps.menza.features.settings.domain.usecase.FullAppReloadUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetBalanceWarningThresholdUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetDishLanguageUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetDishListModeUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetImageScaleRangeUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetImageScaleUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetImagesOnMeteredUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetOliverRowUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetSettingsEverOpenedUC
import cz.lastaapps.menza.features.settings.domain.usecase.OnSettingsOpenedUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetBalanceWarningThresholdUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetDishLanguageUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetDishListModeUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetImageScaleUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetImagesOnMeteredUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetOliverRow
import cz.lastaapps.menza.features.settings.domain.usecase.SetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.initialmenza.GetInitialMenzaModeUI
import cz.lastaapps.menza.features.settings.domain.usecase.initialmenza.GetInitialMenzaUC
import cz.lastaapps.menza.features.settings.domain.usecase.initialmenza.GetPreferredMenzaUC
Expand All @@ -64,6 +47,23 @@ import cz.lastaapps.menza.features.settings.domain.usecase.menzaorder.IsMenzaOrd
import cz.lastaapps.menza.features.settings.domain.usecase.menzaorder.SetMenzaOrderFromTopUC
import cz.lastaapps.menza.features.settings.domain.usecase.menzaorder.ToggleMenzaVisibilityUC
import cz.lastaapps.menza.features.settings.domain.usecase.menzaorder.UpdateMenzaOrderUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetBalanceWarningThresholdUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetDishLanguageUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetDishListModeUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetImageScaleRangeUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetImageScaleUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetImagesOnMeteredUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetOliverRowUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetSettingsEverOpenedUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.OnSettingsOpenedUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetBalanceWarningThresholdUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetDishLanguageUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetDishListModeUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetImageScaleUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetImagesOnMeteredUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetOliverRow
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.theme.GetAppThemeUC
import cz.lastaapps.menza.features.settings.domain.usecase.theme.GetDarkModeUC
import cz.lastaapps.menza.features.settings.domain.usecase.theme.GetThemeListUC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -17,7 +17,7 @@
* along with Menza. If not, see <https://www.gnu.org/licenses/>.
*/

package cz.lastaapps.menza.features.settings.domain.usecase
package cz.lastaapps.menza.features.settings.domain.usecase.settings

import cz.lastaapps.core.domain.UCContext
import cz.lastaapps.core.domain.UseCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import cz.lastaapps.core.ui.vm.StateViewModel
import cz.lastaapps.core.ui.vm.VMContext
import cz.lastaapps.core.ui.vm.VMState
import cz.lastaapps.menza.features.settings.domain.model.DishLanguage
import cz.lastaapps.menza.features.settings.domain.usecase.SetDishLanguageUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetDishLanguageUC

internal class DishLanguageViewModel(
context: VMContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ import cz.lastaapps.menza.features.settings.domain.model.DarkMode.Dark
import cz.lastaapps.menza.features.settings.domain.model.InitialSelectionBehaviour
import cz.lastaapps.menza.features.settings.domain.model.PriceType
import cz.lastaapps.menza.features.settings.domain.usecase.FullAppReloadUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetBalanceWarningThresholdUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetImagesOnMeteredUC
import cz.lastaapps.menza.features.settings.domain.usecase.GetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.OnSettingsOpenedUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetBalanceWarningThresholdUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetImagesOnMeteredUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.initialmenza.GetInitialMenzaModeUI
import cz.lastaapps.menza.features.settings.domain.usecase.initialmenza.GetPreferredMenzaUC
import cz.lastaapps.menza.features.settings.domain.usecase.initialmenza.SetInitialMenzaUC
import cz.lastaapps.menza.features.settings.domain.usecase.initialmenza.SetPreferredMenzaUC
import cz.lastaapps.menza.features.settings.domain.usecase.menzaorder.GetOrderedVisibleMenzaListUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetBalanceWarningThresholdUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetImagesOnMeteredUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.OnSettingsOpenedUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetBalanceWarningThresholdUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetImagesOnMeteredUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.theme.GetAppThemeUC
import cz.lastaapps.menza.features.settings.domain.usecase.theme.GetDarkModeUC
import kotlinx.collections.immutable.ImmutableList
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved
* Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved
*
* This file is part of Menza.
*
Expand All @@ -24,8 +24,8 @@ import cz.lastaapps.core.ui.vm.StateViewModel
import cz.lastaapps.core.ui.vm.VMContext
import cz.lastaapps.core.ui.vm.VMState
import cz.lastaapps.menza.features.settings.domain.model.PriceType
import cz.lastaapps.menza.features.settings.domain.usecase.GetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.SetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.GetPriceTypeUC
import cz.lastaapps.menza.features.settings.domain.usecase.settings.SetPriceTypeUC
import kotlinx.coroutines.flow.first

internal class PriceTypeViewModel internal constructor(
Expand Down
Loading

0 comments on commit 70f369d

Please sign in to comment.