-
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.
Browse files
Browse the repository at this point in the history
Feature/#54 version config & refactor
- Loading branch information
Showing
26 changed files
with
230 additions
and
134 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
7 changes: 7 additions & 0 deletions
7
domain/src/main/java/com/velogm/domain/NetworkErrorHandling.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.velogm.domain | ||
|
||
sealed class NetworkErrorHandling { | ||
object Unauthorized : NetworkErrorHandling() | ||
object ServerError : NetworkErrorHandling() | ||
object OtherError : NetworkErrorHandling() | ||
} |
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.velogm.domain | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
sealed class OutResult<out T> { | ||
data class Success<T>(val data: T) : OutResult<T>() | ||
data class Failure<T>(val error: Throwable?) : OutResult<T>() | ||
} | ||
|
||
suspend fun <T> Flow<OutResult<T>>.collectOutResult( | ||
handleSuccess: (OutResult.Success<T>) -> Unit = {}, | ||
handleFail: (OutResult.Failure<T>) -> Unit = {}, | ||
) { | ||
collect { outcome -> | ||
when (outcome) { | ||
is OutResult.Success -> handleSuccess(outcome) | ||
is OutResult.Failure -> handleFail(outcome) | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ package com.velogm.domain | |
|
||
interface SharedPreferenceToken { | ||
var token:String | ||
var checkLogin: Boolean | ||
} |
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
3 changes: 2 additions & 1 deletion
3
domain/src/main/java/com/velogm/domain/repository/TagRepository.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
3 changes: 2 additions & 1 deletion
3
domain/src/main/java/com/velogm/domain/usecase/GetTagUseCase.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,12 +1,13 @@ | ||
package com.velogm.domain.usecase | ||
|
||
import com.velogm.domain.OutResult | ||
import com.velogm.domain.model.Tag | ||
import com.velogm.domain.repository.TagRepository | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
class GetTagUseCase( | ||
private val repository: TagRepository | ||
) { | ||
suspend operator fun invoke(): Flow<List<Tag>> = | ||
suspend operator fun invoke(): Flow<OutResult<List<Tag>>> = | ||
repository.getTag() | ||
} |
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
Oops, something went wrong.