-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize the actual list pane for achievements UI
- Loading branch information
Showing
23 changed files
with
301 additions
and
91 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
20 changes: 20 additions & 0 deletions
20
...re/application/src/commonMain/kotlin/dev/omico/wwm/application/WwmApplicationComponent.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,20 @@ | ||
/* | ||
* Copyright 2024 Omico. All Rights Reserved. | ||
*/ | ||
package dev.omico.wwm.application | ||
|
||
import com.slack.circuit.foundation.Circuit | ||
import dev.omico.wwm.data.AchievementsRepository | ||
import dev.omico.wwm.feature.achievements.addAchievementsFeature | ||
import dev.omico.wwm.ui.WwmUiComponent | ||
|
||
class WwmApplicationComponent : WwmUiComponent { | ||
override val circuit: Circuit by lazy(::provideCircuit) | ||
|
||
override fun provideCircuit(): Circuit = | ||
Circuit.Builder() | ||
.addAchievementsFeature() | ||
.build() | ||
|
||
override val achievementsRepository: AchievementsRepository by lazy(::provideAchievementsRepository) | ||
} |
11 changes: 0 additions & 11 deletions
11
wwm/core/application/src/commonMain/kotlin/dev/omico/wwm/application/WwmCircuit.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
plugins { | ||
id("wwm.kotlin.multiplatform") | ||
} | ||
|
||
kotlin { | ||
sourceSets { | ||
commonMain { | ||
dependencies { | ||
implementation(project(":wwm-core-foundation")) | ||
implementation(project(":wwm-core-resources")) | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
wwm/core/data/src/commonMain/kotlin/dev/omico/wwm/data/AchievementsRepository.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,16 @@ | ||
/* | ||
* Copyright 2024 Omico. All Rights Reserved. | ||
*/ | ||
package dev.omico.wwm.data | ||
|
||
import dev.omico.wwm.resources.model.game.WwLocale | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface AchievementsRepository { | ||
val achievements: Flow<WwmAchievements> | ||
suspend fun load() | ||
suspend fun reloadAchievements() | ||
suspend fun reloadAchievementCategories() | ||
suspend fun reloadAchievementGroups() | ||
suspend fun reloadMultiText(locale: WwLocale) | ||
} |
20 changes: 20 additions & 0 deletions
20
wwm/core/data/src/commonMain/kotlin/dev/omico/wwm/data/WwmAchievements.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,20 @@ | ||
/* | ||
* Copyright 2024 Omico. All Rights Reserved. | ||
*/ | ||
package dev.omico.wwm.data | ||
|
||
import dev.omico.wwm.resources.model.game.WwAchievementCategories | ||
import dev.omico.wwm.resources.model.game.WwAchievementGroups | ||
import dev.omico.wwm.resources.model.game.WwAchievements | ||
import dev.omico.wwm.resources.model.game.WwMultiText | ||
|
||
data class WwmAchievements( | ||
val achievements: WwAchievements = emptyList(), | ||
val achievementCategories: WwAchievementCategories = emptyList(), | ||
val achievementGroups: WwAchievementGroups = emptyList(), | ||
val multiText: WwMultiText = emptyList(), | ||
) { | ||
companion object { | ||
val Empty: WwmAchievements = WwmAchievements() | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
wwm/core/data/src/commonMain/kotlin/dev/omico/wwm/data/WwmDataComponent.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,11 @@ | ||
/* | ||
* Copyright 2024 Omico. All Rights Reserved. | ||
*/ | ||
package dev.omico.wwm.data | ||
|
||
import dev.omico.wwm.data.internal.AchievementsRepositoryImpl | ||
|
||
interface WwmDataComponent { | ||
val achievementsRepository: AchievementsRepository | ||
fun provideAchievementsRepository(): AchievementsRepository = AchievementsRepositoryImpl() | ||
} |
48 changes: 48 additions & 0 deletions
48
...core/data/src/commonMain/kotlin/dev/omico/wwm/data/internal/AchievementsRepositoryImpl.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,48 @@ | ||
/* | ||
* Copyright 2024 Omico. All Rights Reserved. | ||
*/ | ||
package dev.omico.wwm.data.internal | ||
|
||
import dev.omico.wwm.data.AchievementsRepository | ||
import dev.omico.wwm.data.WwmAchievements | ||
import dev.omico.wwm.resources.WwmResources | ||
import dev.omico.wwm.resources.model.game.WwAchievementCategories | ||
import dev.omico.wwm.resources.model.game.WwAchievementGroups | ||
import dev.omico.wwm.resources.model.game.WwAchievements | ||
import dev.omico.wwm.resources.model.game.WwLocale | ||
import dev.omico.wwm.resources.model.game.WwMultiText | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.combine | ||
|
||
internal class AchievementsRepositoryImpl : AchievementsRepository { | ||
private val wwAchievements: MutableStateFlow<WwAchievements> = MutableStateFlow(emptyList()) | ||
private val wwAchievementCategories: MutableStateFlow<WwAchievementCategories> = MutableStateFlow(emptyList()) | ||
private val wwAchievementGroups: MutableStateFlow<WwAchievementGroups> = MutableStateFlow(emptyList()) | ||
private val wwMultiText: MutableStateFlow<WwMultiText> = MutableStateFlow(emptyList()) | ||
|
||
override val achievements: Flow<WwmAchievements> = | ||
combine( | ||
wwAchievements, | ||
wwAchievementCategories, | ||
wwAchievementGroups, | ||
wwMultiText, | ||
::WwmAchievements, | ||
) | ||
|
||
override suspend fun load() { | ||
reloadAchievements() | ||
reloadAchievementCategories() | ||
reloadAchievementGroups() | ||
} | ||
|
||
override suspend fun reloadAchievements(): Unit = wwAchievements.emit(WwmResources.loadAchievements()) | ||
|
||
override suspend fun reloadAchievementCategories(): Unit = | ||
wwAchievementCategories.emit(WwmResources.loadAchievementCategories()) | ||
|
||
override suspend fun reloadAchievementGroups(): Unit = | ||
wwAchievementGroups.emit(WwmResources.loadAchievementGroups()) | ||
|
||
override suspend fun reloadMultiText(locale: WwLocale): Unit = wwMultiText.emit(WwmResources.loadMultiText(locale)) | ||
} |
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
Oops, something went wrong.