-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from 2rabs/rt/top-feature-compose
👍 トップ機能モジュールを KMP で再構成
- Loading branch information
Showing
19 changed files
with
222 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package club.nito.app.di | ||
|
||
import club.nito.feature.top.di.topFeatureModule | ||
import org.koin.core.module.Module | ||
|
||
val featureModules: List<Module> = listOf( | ||
topFeatureModule, | ||
) |
79 changes: 79 additions & 0 deletions
79
core/ui/src/commonMain/kotlin/club/nito/core/ui/UiStateBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package club.nito.core.ui | ||
|
||
import kotlinx.coroutines.flow.SharingStarted | ||
import kotlinx.coroutines.flow.StateFlow | ||
import kotlinx.coroutines.flow.combine | ||
import kotlinx.coroutines.flow.map | ||
import kotlinx.coroutines.flow.stateIn | ||
|
||
public fun <T1, R> StateMachine.buildUiState( | ||
flow: StateFlow<T1>, | ||
transform: (T1) -> R, | ||
): StateFlow<R> = flow.map(transform = transform) | ||
.stateIn( | ||
scope = stateMachineScope, | ||
started = SharingStarted.WhileSubscribed(5_000), | ||
initialValue = transform( | ||
flow.value, | ||
), | ||
) | ||
|
||
public fun <T1, T2, R> StateMachine.buildUiState( | ||
flow: StateFlow<T1>, | ||
flow2: StateFlow<T2>, | ||
transform: (T1, T2) -> R, | ||
): StateFlow<R> = combine( | ||
flow = flow, | ||
flow2 = flow2, | ||
transform = transform, | ||
).stateIn( | ||
scope = stateMachineScope, | ||
started = SharingStarted.WhileSubscribed(5_000), | ||
initialValue = transform( | ||
flow.value, | ||
flow2.value, | ||
), | ||
) | ||
|
||
public fun <T1, T2, T3, R> StateMachine.buildUiState( | ||
flow: StateFlow<T1>, | ||
flow2: StateFlow<T2>, | ||
flow3: StateFlow<T3>, | ||
transform: (T1, T2, T3) -> R, | ||
): StateFlow<R> = combine( | ||
flow = flow, | ||
flow2 = flow2, | ||
flow3 = flow3, | ||
transform = transform, | ||
).stateIn( | ||
scope = stateMachineScope, | ||
started = SharingStarted.WhileSubscribed(5_000), | ||
initialValue = transform( | ||
flow.value, | ||
flow2.value, | ||
flow3.value, | ||
), | ||
) | ||
|
||
public fun <T1, T2, T3, T4, R> StateMachine.buildUiState( | ||
flow: StateFlow<T1>, | ||
flow2: StateFlow<T2>, | ||
flow3: StateFlow<T3>, | ||
flow4: StateFlow<T4>, | ||
transform: (T1, T2, T3, T4) -> R, | ||
): StateFlow<R> = combine( | ||
flow = flow, | ||
flow2 = flow2, | ||
flow3 = flow3, | ||
flow4 = flow4, | ||
transform = transform, | ||
).stateIn( | ||
scope = stateMachineScope, | ||
started = SharingStarted.WhileSubscribed(5_000), | ||
initialValue = transform( | ||
flow.value, | ||
flow2.value, | ||
flow3.value, | ||
flow4.value, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
feature/top/src/androidMain/kotlin/club/nito/feature/top/Platform.android.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
feature/top/src/androidMain/kotlin/club/nito/feature/top/TopEvent.kt
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
feature/top/src/androidMain/kotlin/club/nito/feature/top/TopIntent.kt
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
feature/top/src/androidMain/kotlin/club/nito/feature/top/TopScreenUiState.kt
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
feature/top/src/commonMain/kotlin/club/nito/feature/top/Greeting.kt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
feature/top/src/commonMain/kotlin/club/nito/feature/top/Platform.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
feature/top/src/commonMain/kotlin/club/nito/feature/top/TopScreenEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package club.nito.feature.top | ||
|
||
sealed class TopScreenEvent { | ||
/** | ||
* Navigate to schedule list screen | ||
*/ | ||
data object NavigateToScheduleList : TopScreenEvent() | ||
|
||
/** | ||
* Navigate to settings screen | ||
*/ | ||
data object NavigateToSettings : TopScreenEvent() | ||
} |
30 changes: 30 additions & 0 deletions
30
feature/top/src/commonMain/kotlin/club/nito/feature/top/TopScreenIntent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package club.nito.feature.top | ||
|
||
import club.nito.core.domain.model.ParticipantSchedule | ||
|
||
sealed class TopScreenIntent { | ||
/** | ||
* Click schedule list | ||
*/ | ||
data object ClickScheduleList : TopScreenIntent() | ||
|
||
/** | ||
* Click settings | ||
*/ | ||
data object ClickSettings : TopScreenIntent() | ||
|
||
/** | ||
* Click show confirm participate dialog | ||
*/ | ||
data class ClickShowConfirmParticipateDialog(val schedule: ParticipantSchedule) : TopScreenIntent() | ||
|
||
/** | ||
* Click participate schedule | ||
*/ | ||
data class ClickParticipateSchedule(val schedule: ParticipantSchedule) : TopScreenIntent() | ||
|
||
/** | ||
* Click dismiss confirm participate dialog | ||
*/ | ||
data object ClickDismissConfirmParticipateDialog : TopScreenIntent() | ||
} |
Oops, something went wrong.