Skip to content

Commit

Permalink
chore: Merge CircuitState & CircuitUiEvent to a single Contract file (#…
Browse files Browse the repository at this point in the history
…409)

* chore: move CircuitState & CircuitUiEvent to a Contract file

* chore: fix detekt issues
  • Loading branch information
mslalith authored Mar 2, 2024
1 parent 0e0338d commit b99ab25
Show file tree
Hide file tree
Showing 41 changed files with 142 additions and 169 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.mslalith.focuslauncher.feature.appdrawerpage

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.common.model.LoadingState
import dev.mslalith.focuslauncher.core.model.AppDrawerViewType
Expand All @@ -16,3 +17,8 @@ data class AppDrawerPageState(
val searchBarQuery: String,
val eventSink: (AppDrawerPageUiEvent) -> Unit
) : CircuitUiState

sealed interface AppDrawerPageUiEvent : CircuitUiEvent {
data class UpdateSearchQuery(val query: String) : AppDrawerPageUiEvent
data object ReloadIconPack : AppDrawerPageUiEvent
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package dev.mslalith.focuslauncher.feature.appdrawerpage.bottomsheet.moreoptions

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.model.app.App
import dev.mslalith.focuslauncher.core.model.appdrawer.AppDrawerItem

data class AppMoreOptionsBottomSheetState(
val appDrawerItem: AppDrawerItem,
val eventSink: (AppMoreOptionsBottomSheetUiEvent) -> Unit
) : CircuitUiState

sealed interface AppMoreOptionsBottomSheetUiEvent : CircuitUiEvent {
data object GoBack : AppMoreOptionsBottomSheetUiEvent
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package dev.mslalith.focuslauncher.feature.appdrawerpage.bottomsheet.updateappdisplayname

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.model.app.App

data class UpdateAppDisplayNameBottomSheetState(
val app: App,
val eventSink: (UpdateAppDisplayNameBottomSheetUiEvent) -> Unit
) : CircuitUiState

sealed interface UpdateAppDisplayNameBottomSheetUiEvent : CircuitUiEvent {
data class UpdateDisplayName(val displayName: String) : UpdateAppDisplayNameBottomSheetUiEvent
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
package dev.mslalith.focuslauncher.feature.clock24.bottomsheet.clockwidgetsettings

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.model.ClockAlignment

data class ClockWidgetSettingsBottomSheetState(
val currentTime: String,
val showClock24: Boolean,
val use24Hour: Boolean,
val clockAlignment: ClockAlignment,
val clock24AnimationDuration: Int,
val eventSink: (ClockWidgetSettingsBottomSheetUiEvent) -> Unit
) : CircuitUiState

sealed interface ClockWidgetSettingsBottomSheetUiEvent : CircuitUiEvent {
data object ToggleClock24 : ClockWidgetSettingsBottomSheetUiEvent
data object ToggleUse24Hour : ClockWidgetSettingsBottomSheetUiEvent
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.mslalith.focuslauncher.feature.clock24.widget

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.model.ClockAlignment

Expand All @@ -11,3 +12,7 @@ data class ClockWidgetUiComponentState(
val clock24AnimationDuration: Int,
val eventSink: (ClockWidgetUiComponentUiEvent) -> Unit
) : CircuitUiState

sealed interface ClockWidgetUiComponentUiEvent : CircuitUiEvent {
data object RefreshTime : ClockWidgetUiComponentUiEvent
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.mslalith.focuslauncher.feature.favorites

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.model.app.AppWithColor
import kotlinx.collections.immutable.ImmutableList
Expand All @@ -8,3 +9,7 @@ data class FavoritesListUiComponentState(
val favoritesList: ImmutableList<AppWithColor>,
val eventSink: (FavoritesListUiComponentUiEvent) -> Unit
) : CircuitUiState

sealed interface FavoritesListUiComponentUiEvent : CircuitUiEvent {
data object AddDefaultAppsIfRequired : FavoritesListUiComponentUiEvent
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.mslalith.focuslauncher.feature.homepage

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.feature.clock24.widget.ClockWidgetUiComponentState
import dev.mslalith.focuslauncher.feature.favorites.FavoritesListUiComponentState
Expand All @@ -13,3 +14,5 @@ data class HomePageState(
val quoteForYouUiComponentState: QuoteForYouUiComponentState,
val favoritesListUiComponentState: FavoritesListUiComponentState
) : CircuitUiState

sealed interface HomePageUiEvent : CircuitUiEvent
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package dev.mslalith.focuslauncher.feature.lunarcalendar.bottomsheet.lunarphasedetails

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.common.model.State
import dev.mslalith.focuslauncher.core.model.lunarphase.LunarPhaseDetails

data class LunarPhaseDetailsBottomSheetState(
val lunarPhaseDetails: State<LunarPhaseDetails>
) : CircuitUiState

sealed interface LunarPhaseDetailsBottomSheetUiEvent : CircuitUiEvent
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package dev.mslalith.focuslauncher.feature.lunarcalendar.bottomsheet.lunarphasewidgetsettings

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import com.slack.circuit.runtime.screen.Screen
import dev.mslalith.focuslauncher.core.common.model.State
import dev.mslalith.focuslauncher.core.model.CurrentPlace
import dev.mslalith.focuslauncher.core.model.lunarphase.LunarPhaseDetails
Expand All @@ -15,3 +17,10 @@ data class LunarPhaseWidgetSettingsBottomSheetState(
val currentPlace: CurrentPlace,
val eventSink: (LunarPhaseWidgetSettingsBottomSheetUiEvent) -> Unit
) : CircuitUiState

sealed interface LunarPhaseWidgetSettingsBottomSheetUiEvent : CircuitUiEvent {
data object ToggleShowLunarPhase : LunarPhaseWidgetSettingsBottomSheetUiEvent
data object ToggleShowIlluminationPercent : LunarPhaseWidgetSettingsBottomSheetUiEvent
data object ToggleShowUpcomingPhaseDetails : LunarPhaseWidgetSettingsBottomSheetUiEvent
data class Goto(val screen: Screen) : LunarPhaseWidgetSettingsBottomSheetUiEvent
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.mslalith.focuslauncher.feature.lunarcalendar.widget

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.common.model.State
import dev.mslalith.focuslauncher.core.model.lunarphase.LunarPhaseDetails
Expand All @@ -12,3 +13,5 @@ data class LunarCalendarUiComponentState(
val lunarPhaseDetails: State<LunarPhaseDetails>,
val upcomingLunarPhase: State<UpcomingLunarPhase>
) : CircuitUiState

sealed interface LunarCalendarUiComponentUiEvent : CircuitUiEvent
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.mslalith.focuslauncher.feature.quoteforyou.bottomsheet.quotewidgetsettings

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.common.model.State
import dev.mslalith.focuslauncher.core.model.Quote
Expand All @@ -10,3 +11,9 @@ data class QuoteWidgetSettingsBottomSheetState(
val currentQuote: State<Quote>,
val eventSink: (QuoteWidgetSettingsBottomSheetUiEvent) -> Unit
) : CircuitUiState

sealed interface QuoteWidgetSettingsBottomSheetUiEvent : CircuitUiEvent {
data object ToggleShowQuoteWidget : QuoteWidgetSettingsBottomSheetUiEvent
data object FetchQuoteWidget : QuoteWidgetSettingsBottomSheetUiEvent
data object FetchNextQuote : QuoteWidgetSettingsBottomSheetUiEvent
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.mslalith.focuslauncher.feature.quoteforyou.widget

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.common.model.State
import dev.mslalith.focuslauncher.core.model.Quote
Expand All @@ -9,3 +10,7 @@ data class QuoteForYouUiComponentState(
val currentQuote: State<Quote>,
val eventSink: (QuoteForYouUiComponentUiEvent) -> Unit
) : CircuitUiState

sealed interface QuoteForYouUiComponentUiEvent : CircuitUiEvent {
data object FetchNextQuote : QuoteForYouUiComponentUiEvent
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@ package dev.mslalith.focuslauncher.feature.settingspage

import android.content.Context
import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import com.slack.circuit.runtime.screen.Screen

data class SettingsPageState(
val showStatusBar: Boolean,
val canDrawNotificationShade: Boolean,
val showIconPack: Boolean,
val isDefaultLauncher: Boolean,
val showDeveloperOption: Boolean,
val eventSink: (SettingsPageUiEvent) -> Unit
) : CircuitUiState

sealed interface SettingsPageUiEvent : CircuitUiEvent {
data object ToggleStatusBarVisibility : SettingsPageUiEvent
data object ToggleNotificationShade : SettingsPageUiEvent
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
package dev.mslalith.focuslauncher.feature.settingspage.bottomsheet.appdrawersettings

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.model.AppDrawerViewType
import dev.mslalith.focuslauncher.core.model.appdrawer.AppDrawerIconViewType

data class AppDrawerSettingsBottomSheetState(
val appDrawerViewType: AppDrawerViewType,
val appDrawerIconViewType: AppDrawerIconViewType,
val showAppGroupHeader: Boolean,
val showSearchBar: Boolean,
val eventSink: (AppDrawerSettingsBottomSheetUiEvent) -> Unit
) : CircuitUiState

sealed interface AppDrawerSettingsBottomSheetUiEvent : CircuitUiEvent {
data object ToggleSearchBarVisibility : AppDrawerSettingsBottomSheetUiEvent
data object ToggleAppGroupHeaderVisibility : AppDrawerSettingsBottomSheetUiEvent
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package dev.mslalith.focuslauncher.feature.theme

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.model.Theme

data class LauncherThemeState(
val theme: Theme
) : CircuitUiState

sealed interface LauncherThemeUiEvent : CircuitUiEvent
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.mslalith.focuslauncher.feature.theme.bottomsheet.themeselection

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState
import dev.mslalith.focuslauncher.core.model.Theme
import dev.mslalith.focuslauncher.feature.theme.model.ThemeWithIcon
Expand All @@ -10,3 +11,7 @@ data class ThemeSelectionBottomSheetState(
val allThemes: ImmutableList<ThemeWithIcon>,
val eventSink: (ThemeSelectionBottomSheetUiEvent) -> Unit
) : CircuitUiState

sealed interface ThemeSelectionBottomSheetUiEvent : CircuitUiEvent {
data class SelectedTheme(val theme: Theme?) : ThemeSelectionBottomSheetUiEvent
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package dev.mslalith.focuslauncher.screens.about

import com.slack.circuit.runtime.CircuitUiEvent
import com.slack.circuit.runtime.CircuitUiState

data class AboutState(
val eventSink: (AboutUiEvent) -> Unit
) : CircuitUiState

sealed interface AboutUiEvent : CircuitUiEvent {
data object GoBack : AboutUiEvent
Expand Down

This file was deleted.

Loading

0 comments on commit b99ab25

Please sign in to comment.