-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8514305
commit 2248312
Showing
19 changed files
with
377 additions
and
75 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
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
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
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
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
40 changes: 39 additions & 1 deletion
40
...plat/common/market/src/commonMain/kotlin/monster/scoop/xplat/common/market/ScoopAction.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 |
---|---|---|
@@ -1,5 +1,43 @@ | ||
package monster.scoop.xplat.common.market | ||
|
||
import kotlinx.datetime.LocalDateTime | ||
import monster.scoop.xplat.domain.story.api.StoriesError | ||
import monster.scoop.xplat.domain.story.api.Story | ||
import org.mobilenativefoundation.market.Market | ||
import org.mobilenativefoundation.market.StatefulMarket | ||
import org.mobilenativefoundation.market.StatefulMarket.PagingState.Data.Status | ||
|
||
sealed interface ScoopAction : Market.Action | ||
typealias StoryState = StatefulMarket.ItemState<Int, Story, StoriesError> | ||
|
||
sealed interface ScoopAction : Market.Action { | ||
sealed interface Stories : ScoopAction { | ||
data class SetStories(val stories: List<Story>) : Stories | ||
data class PushStories(val stories: List<Story>) : Stories | ||
|
||
data class SetStory(val storyId: Int, val storyState: StoryState) : Stories | ||
|
||
sealed interface Paging : Stories { | ||
data class SetInitial(val prefetchPosition: Int?, val anchorPosition: Int?) : Stories | ||
data class SetLoading(val prefetchPosition: Int?, val anchorPosition: Int?) : Stories | ||
data class SetError(val error: StoriesError, val prefetchPosition: Int?, val anchorPosition: Int?) : Stories | ||
|
||
data class SetData( | ||
val stories: List<Story>, | ||
val anchorPosition: Int?, | ||
val prefetchPosition: Int?, | ||
val lastModified: LocalDateTime, | ||
val lastRefreshed: LocalDateTime, | ||
val status: Status<StoriesError> | ||
) : Paging | ||
|
||
data class UpdateData( | ||
val allIds: List<Int>? = null, | ||
val anchorPosition: Int? = null, | ||
val prefetchPosition: Int? = null, | ||
val lastModified: LocalDateTime? = null, | ||
val lastRefreshed: LocalDateTime? = null, | ||
val status: Status<StoriesError>? = null | ||
) : Paging | ||
} | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
...plat/common/market/src/commonMain/kotlin/monster/scoop/xplat/common/market/ScoopMarket.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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package monster.scoop.xplat.common.market | ||
|
||
import org.mobilenativefoundation.market.Market | ||
import org.mobilenativefoundation.market.StatefulMarket | ||
|
||
typealias ScoopMarket = Market<ScoopState> | ||
|
||
typealias ScoopMarket = StatefulMarket<ScoopState> |
13 changes: 10 additions & 3 deletions
13
...xplat/common/market/src/commonMain/kotlin/monster/scoop/xplat/common/market/ScoopState.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 |
---|---|---|
@@ -1,11 +1,18 @@ | ||
package monster.scoop.xplat.common.market | ||
|
||
import monster.scoop.xplat.domain.story.api.StoriesState | ||
import org.mobilenativefoundation.market.Market | ||
import org.mobilenativefoundation.market.StatefulMarket | ||
|
||
data class ScoopState( | ||
val stories: StoriesState = StoriesState() | ||
) : Market.State | ||
override val subStates: Map<String, StatefulMarket.SubState> = subStates() | ||
) : StatefulMarket.State | ||
|
||
private fun subStates(): Map<String, StatefulMarket.SubState> = buildMap { | ||
"stories" to StoriesState() | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.