Skip to content

Commit

Permalink
Feat: [:core:network] - Migrated to KMP (#1772)
Browse files Browse the repository at this point in the history
* Feat: [:core:network] - Migrated to KMP

* Feat: [:core:data] - Migrated to KMP Library
  • Loading branch information
niyajali authored Sep 30, 2024
1 parent f03a2a0 commit 278da28
Show file tree
Hide file tree
Showing 179 changed files with 2,570 additions and 4,890 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class KotlinInjectConventionPlugin: Plugin<Project> {
// add("kspWasmJs", libs.findLibrary("kotlin.inject.compiler.ksp").get())
add("kspAndroid", libs.findLibrary("kotlin.inject.compiler.ksp").get())
add("kspJvm", libs.findLibrary("kotlin.inject.compiler.ksp").get())
add("kspMacosX64", libs.findLibrary("kotlin.inject.compiler.ksp").get())
add("kspMacosArm64", libs.findLibrary("kotlin.inject.compiler.ksp").get())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.mifospay.core.common

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart

sealed interface Result<out T> {
data class Success<T>(val data: T) : Result<T>
data class Error(val exception: Throwable) : Result<Nothing>
data object Loading : Result<Nothing>
}

fun <T> Flow<T>.asResult(): Flow<Result<T>> = map<T, Result<T>> { Result.Success(it) }
.onStart { emit(Result.Loading) }
.catch { emit(Result.Error(it)) }

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 278da28

Please sign in to comment.