-
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.
- Loading branch information
Showing
21 changed files
with
451 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
plugins { | ||
alias(libs.plugins.kotlinMultiplatform) | ||
alias(libs.plugins.androidLibrary) | ||
alias(libs.plugins.jetbrainsCompose) | ||
alias(libs.plugins.kotlinCocoapods) | ||
} | ||
|
||
kotlin { | ||
androidTarget { | ||
compilations.all { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
} | ||
|
||
jvm("desktop") | ||
|
||
iosX64() | ||
iosArm64() | ||
iosSimulatorArm64() | ||
cocoapods { | ||
summary = "Some description for the Shared Module" | ||
homepage = "Link to the Shared Module homepage" | ||
version = "1.0" | ||
ios.deploymentTarget = "16.0" | ||
podfile = | ||
project.file(project.rootProject.projectDir.path + "/iosApp/FeatureFollowerPodfile") | ||
framework { | ||
baseName = "featureFollower" | ||
} | ||
} | ||
|
||
sourceSets { | ||
commonMain.dependencies { | ||
implementation(project(":core:core")) | ||
implementation(project(":core:ui")) | ||
implementation(project(":core:network")) | ||
} | ||
commonTest.dependencies { | ||
implementation(libs.kotlin.test) | ||
} | ||
} | ||
} | ||
|
||
android { | ||
namespace = "com.stslex.feature.follower" | ||
compileSdk = libs.versions.android.compileSdk.get().toInt() | ||
defaultConfig { | ||
minSdk = libs.versions.android.minSdk.get().toInt() | ||
} | ||
} | ||
|
||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | ||
compilerOptions.freeCompilerArgs.addAll( | ||
"-P", | ||
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$projectDir/build/compose/metrics", | ||
) | ||
} | ||
|
||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | ||
compilerOptions.freeCompilerArgs.addAll( | ||
"-P", | ||
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$projectDir/build/compose/reports", | ||
) | ||
} |
13 changes: 13 additions & 0 deletions
13
...llower/src/commonMain/kotlin/com.stslex.feature.follower/data/model/FollowerDataMapper.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 com.stslex.feature.follower.data.model | ||
|
||
import com.stslex.core.network.clients.profile.model.UserFollowerResponse | ||
|
||
fun UserFollowerResponse.toData(): List<FollowerDataModel> = this | ||
.result | ||
.map { response -> | ||
FollowerDataModel( | ||
uuid = response.uuid, | ||
username = response.username, | ||
avatarUrl = response.avatarUrl, | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
...ollower/src/commonMain/kotlin/com.stslex.feature.follower/data/model/FollowerDataModel.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,7 @@ | ||
package com.stslex.feature.follower.data.model | ||
|
||
data class FollowerDataModel( | ||
val uuid: String, | ||
val username: String, | ||
val avatarUrl: String, | ||
) |
20 changes: 20 additions & 0 deletions
20
...r/src/commonMain/kotlin/com.stslex.feature.follower/data/repository/FollowerRepository.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 @@ | ||
package com.stslex.feature.follower.data.repository | ||
|
||
import com.stslex.feature.follower.data.model.FollowerDataModel | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface FollowerRepository { | ||
|
||
fun getFollowers( | ||
uuid: String, | ||
page: Int, | ||
pageSize: Int | ||
): Flow<List<FollowerDataModel>> | ||
|
||
fun getFollowing( | ||
uuid: String, | ||
page: Int, | ||
pageSize: Int | ||
): Flow<List<FollowerDataModel>> | ||
} | ||
|
38 changes: 38 additions & 0 deletions
38
...c/commonMain/kotlin/com.stslex.feature.follower/data/repository/FollowerRepositoryImpl.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,38 @@ | ||
package com.stslex.feature.follower.data.repository | ||
|
||
import com.stslex.core.network.clients.profile.client.ProfileClient | ||
import com.stslex.feature.follower.data.model.FollowerDataModel | ||
import com.stslex.feature.follower.data.model.toData | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flow | ||
|
||
class FollowerRepositoryImpl( | ||
private val client: ProfileClient | ||
) : FollowerRepository { | ||
|
||
override fun getFollowers( | ||
uuid: String, | ||
page: Int, | ||
pageSize: Int | ||
): Flow<List<FollowerDataModel>> = flow { | ||
val result = client.getFollowers( | ||
uuid = uuid, | ||
page = page, | ||
pageSize = pageSize | ||
).toData() | ||
emit(result) | ||
} | ||
|
||
override fun getFollowing( | ||
uuid: String, | ||
page: Int, | ||
pageSize: Int | ||
): Flow<List<FollowerDataModel>> = flow { | ||
val result = client.getFollowing( | ||
uuid = uuid, | ||
page = page, | ||
pageSize = pageSize | ||
).toData() | ||
emit(result) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
feature/follower/src/commonMain/kotlin/com.stslex.feature.follower/di/FollowerModule.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,35 @@ | ||
package com.stslex.feature.follower.di | ||
|
||
import com.stslex.feature.follower.data.repository.FollowerRepository | ||
import com.stslex.feature.follower.data.repository.FollowerRepositoryImpl | ||
import com.stslex.feature.follower.domain.interactor.FollowerInteractor | ||
import com.stslex.feature.follower.domain.interactor.FollowerInteractorImpl | ||
import com.stslex.feature.follower.navigation.FollowerRouter | ||
import com.stslex.feature.follower.navigation.FollowerRouterImpl | ||
import com.stslex.feature.follower.ui.store.FollowerStore | ||
import org.koin.dsl.module | ||
|
||
val featureFollowerModule = module { | ||
|
||
factory<FollowerRepository> { | ||
FollowerRepositoryImpl( | ||
api = get() | ||
) | ||
} | ||
|
||
factory<FollowerInteractor> { | ||
FollowerInteractorImpl( | ||
repository = get() | ||
) | ||
} | ||
|
||
factory<FollowerRouter> { FollowerRouterImpl(navigator = get()) } | ||
|
||
factory { | ||
FollowerStore( | ||
interactor = get(), | ||
appDispatcher = get(), | ||
router = get(), | ||
) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...src/commonMain/kotlin/com.stslex.feature.follower/domain/interactor/FollowerInteractor.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 @@ | ||
package com.stslex.feature.follower.domain.interactor | ||
|
||
import com.stslex.feature.follower.ui.model.FollowerModel | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface FollowerInteractor { | ||
|
||
fun getFollowers( | ||
uuid: String, | ||
page: Int, | ||
pageSize: Int | ||
): Flow<List<FollowerModel>> | ||
|
||
fun getFollowing( | ||
uuid: String, | ||
page: Int, | ||
pageSize: Int | ||
): Flow<List<FollowerModel>> | ||
} | ||
|
35 changes: 35 additions & 0 deletions
35
...commonMain/kotlin/com.stslex.feature.follower/domain/interactor/FollowerInteractorImpl.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,35 @@ | ||
package com.stslex.feature.follower.domain.interactor | ||
|
||
import com.stslex.feature.follower.data.repository.FollowerRepository | ||
import com.stslex.feature.follower.domain.model.toUI | ||
import com.stslex.feature.follower.ui.model.FollowerModel | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
|
||
class FollowerInteractorImpl( | ||
private val repository: FollowerRepository | ||
) : FollowerInteractor { | ||
|
||
override fun getFollowers( | ||
uuid: String, | ||
page: Int, pageSize: Int | ||
): Flow<List<FollowerModel>> = repository | ||
.getFollowers( | ||
uuid = uuid, | ||
page = page, | ||
pageSize = pageSize | ||
) | ||
.map { it.toUI() } | ||
|
||
override fun getFollowing( | ||
uuid: String, | ||
page: Int, | ||
pageSize: Int | ||
): Flow<List<FollowerModel>> = repository | ||
.getFollowing( | ||
uuid = uuid, | ||
page = page, | ||
pageSize = pageSize | ||
) | ||
.map { it.toUI() } | ||
} |
12 changes: 12 additions & 0 deletions
12
...follower/src/commonMain/kotlin/com.stslex.feature.follower/domain/model/FollowerMapper.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,12 @@ | ||
package com.stslex.feature.follower.domain.model | ||
|
||
import com.stslex.feature.follower.data.model.FollowerDataModel | ||
import com.stslex.feature.follower.ui.model.FollowerModel | ||
|
||
fun List<FollowerDataModel>.toUI(): List<FollowerModel> = map { it.toUI() } | ||
|
||
fun FollowerDataModel.toUI(): FollowerModel = FollowerModel( | ||
uuid = uuid, | ||
username = username, | ||
avatarUrl = avatarUrl, | ||
) |
7 changes: 7 additions & 0 deletions
7
...e/follower/src/commonMain/kotlin/com.stslex.feature.follower/navigation/FollowerRouter.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,7 @@ | ||
package com.stslex.feature.follower.navigation | ||
|
||
import com.stslex.core.ui.navigation.Router | ||
import com.stslex.feature.follower.ui.store.FollowerStoreComponent.Navigation | ||
|
||
interface FollowerRouter : Router<Navigation> | ||
|
13 changes: 13 additions & 0 deletions
13
...llower/src/commonMain/kotlin/com.stslex.feature.follower/navigation/FollowerRouterImpl.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 com.stslex.feature.follower.navigation | ||
|
||
import com.stslex.core.ui.navigation.AppNavigator | ||
import com.stslex.feature.follower.ui.store.FollowerStoreComponent | ||
|
||
class FollowerRouterImpl( | ||
private val navigator: AppNavigator | ||
) : FollowerRouter { | ||
|
||
override fun invoke(event: FollowerStoreComponent.Navigation) { | ||
TODO("Not yet implemented") | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
feature/follower/src/commonMain/kotlin/com.stslex.feature.follower/ui/FollowerScreen.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,42 @@ | ||
package com.stslex.feature.follower.ui | ||
|
||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.collectAsState | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.remember | ||
import cafe.adriel.voyager.core.screen.Screen | ||
import cafe.adriel.voyager.koin.getScreenModel | ||
import com.stslex.feature.follower.ui.store.FollowerStore | ||
import com.stslex.feature.follower.ui.store.FollowerStoreComponent.Action | ||
import com.stslex.feature.follower.ui.store.FollowerStoreComponent.State | ||
|
||
data class FollowerScreen( | ||
val args: FollowerScreenArgs | ||
) : Screen { | ||
|
||
@Composable | ||
override fun Content() { | ||
val store = getScreenModel<FollowerStore>() | ||
val state by remember { store.state }.collectAsState() | ||
|
||
LaunchedEffect(key1 = Unit) { | ||
store.sendAction(Action.Init(args = args)) | ||
} | ||
|
||
FollowerScreen( | ||
state = state, | ||
onAction = store::sendAction | ||
) | ||
} | ||
} | ||
|
||
|
||
@Composable | ||
internal fun FollowerScreen( | ||
state: State, | ||
onAction: (Action) -> Unit | ||
) { | ||
Text("test") | ||
} |
12 changes: 12 additions & 0 deletions
12
feature/follower/src/commonMain/kotlin/com.stslex.feature.follower/ui/FollowerScreenArgs.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,12 @@ | ||
package com.stslex.feature.follower.ui | ||
|
||
sealed interface FollowerScreenArgs { | ||
|
||
data class Follower( | ||
val uuid: String | ||
) : FollowerScreenArgs | ||
|
||
data class Following( | ||
val uuid: String | ||
) : FollowerScreenArgs | ||
} |
Oops, something went wrong.