-
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
…recated-function #278 [refactor] deprecated된 함수 수정 및 네트워크 에러 분기처리
- Loading branch information
Showing
62 changed files
with
520 additions
and
511 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
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/sopt/peekabookaos/data/entity/response/ForcedUpdateResponse.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,10 @@ | ||
package com.sopt.peekabookaos.data.entity.response | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ForcedUpdateResponse( | ||
val imageUrl: String, | ||
val androidForceVersion: String, | ||
val text: String | ||
) |
20 changes: 0 additions & 20 deletions
20
app/src/main/java/com/sopt/peekabookaos/data/entity/response/VersionResponse.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
15 changes: 0 additions & 15 deletions
15
app/src/main/java/com/sopt/peekabookaos/data/repository/ForceUpdateRepositoryImpl.kt
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/sopt/peekabookaos/data/repository/ForcedUpdateRepositoryImpl.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,25 @@ | ||
package com.sopt.peekabookaos.data.repository | ||
|
||
import com.sopt.peekabookaos.data.source.remote.ForcedUpdateDataSource | ||
import com.sopt.peekabookaos.domain.entity.ForcedUpdate | ||
import com.sopt.peekabookaos.domain.entity.UpdateInformation | ||
import com.sopt.peekabookaos.domain.entity.Version | ||
import com.sopt.peekabookaos.domain.repository.ForcedUpdateRepository | ||
import javax.inject.Inject | ||
|
||
class ForcedUpdateRepositoryImpl @Inject constructor( | ||
private val forcedUpdateDataSource: ForcedUpdateDataSource | ||
) : ForcedUpdateRepository { | ||
override suspend fun hasForceUpdateVersion( | ||
currentVersion: String | ||
): Result<ForcedUpdate> = kotlin.runCatching { | ||
forcedUpdateDataSource.getForcedUpdateVersion() | ||
}.map { response -> | ||
val (imageUrl, androidForceVersion, text) = requireNotNull(response.data) | ||
if (Version.of(androidForceVersion).greaterThan(Version.of(currentVersion))) { | ||
return@map ForcedUpdate.Need(UpdateInformation(imageUrl, text)) | ||
} else { | ||
return@map ForcedUpdate.None | ||
} | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
app/src/main/java/com/sopt/peekabookaos/data/service/ForceUpdateService.kt
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/sopt/peekabookaos/data/service/ForcedUpdateService.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,10 @@ | ||
package com.sopt.peekabookaos.data.service | ||
|
||
import com.sopt.peekabookaos.data.entity.BaseResponse | ||
import com.sopt.peekabookaos.data.entity.response.ForcedUpdateResponse | ||
import retrofit2.http.GET | ||
|
||
interface ForcedUpdateService { | ||
@GET("user/v1/version") | ||
suspend fun getVersion(): BaseResponse<ForcedUpdateResponse> | ||
} |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/sopt/peekabookaos/data/source/local/LocalSignedUpDataSource.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,17 @@ | ||
package com.sopt.peekabookaos.data.source.local | ||
|
||
import android.content.SharedPreferences | ||
import androidx.core.content.edit | ||
import javax.inject.Inject | ||
|
||
class LocalSignedUpDataSource @Inject constructor( | ||
private val prefs: SharedPreferences | ||
) { | ||
var isSignedUp: Boolean | ||
set(value) = prefs.edit { putBoolean(SIGNED_UP, value) } | ||
get() = prefs.getBoolean(SIGNED_UP, false) | ||
|
||
companion object { | ||
private const val SIGNED_UP = "signed up" | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
app/src/main/java/com/sopt/peekabookaos/data/source/local/LocalSplashDataSource.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
app/src/main/java/com/sopt/peekabookaos/data/source/remote/ForceUpdateDataSource.kt
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/sopt/peekabookaos/data/source/remote/ForcedUpdateDataSource.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.sopt.peekabookaos.data.source.remote | ||
|
||
import com.sopt.peekabookaos.data.entity.BaseResponse | ||
import com.sopt.peekabookaos.data.entity.response.ForcedUpdateResponse | ||
import com.sopt.peekabookaos.data.service.ForcedUpdateService | ||
import javax.inject.Inject | ||
|
||
class ForcedUpdateDataSource @Inject constructor( | ||
private val forcedUpdateService: ForcedUpdateService | ||
) { | ||
suspend fun getForcedUpdateVersion(): BaseResponse<ForcedUpdateResponse> = | ||
forcedUpdateService.getVersion() | ||
} |
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
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/sopt/peekabookaos/domain/entity/ForcedUpdate.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,6 @@ | ||
package com.sopt.peekabookaos.domain.entity | ||
|
||
sealed class ForcedUpdate { | ||
data object None : ForcedUpdate() | ||
data class Need(val updateInformation: UpdateInformation) : ForcedUpdate() | ||
} |
5 changes: 0 additions & 5 deletions
5
app/src/main/java/com/sopt/peekabookaos/domain/entity/SplashState.kt
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/sopt/peekabookaos/domain/entity/SplashUiState.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,10 @@ | ||
package com.sopt.peekabookaos.domain.entity | ||
|
||
sealed class SplashUiState { | ||
data object Idle : SplashUiState() | ||
data object Error : SplashUiState() | ||
data object ShowSplash : SplashUiState() | ||
data object CanStartOnboarding : SplashUiState() | ||
data object CanStartMain : SplashUiState() | ||
data class ForceUpdate(val data: UpdateInformation) : SplashUiState() | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/sopt/peekabookaos/domain/entity/UpdateInformation.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,10 @@ | ||
package com.sopt.peekabookaos.domain.entity | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
data class UpdateInformation( | ||
val imageUrl: String = "", | ||
val text: String = "" | ||
) : Parcelable |
25 changes: 17 additions & 8 deletions
25
app/src/main/java/com/sopt/peekabookaos/domain/entity/Version.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,20 @@ | ||
package com.sopt.peekabookaos.domain.entity | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
class Version private constructor( | ||
private val major: Int, | ||
private val minor: Int | ||
) { | ||
|
||
@Parcelize | ||
data class Version( | ||
val imageUrl: String = "", | ||
val androidForceVersion: String = "", | ||
val versionText: String = "" | ||
) : Parcelable | ||
fun greaterThan(other: Version): Boolean = other.major < major || other.minor < minor | ||
|
||
companion object { | ||
private const val VERSION_SPLIT_SIGN = "." | ||
private const val MAJOR_POSITION = 0 | ||
private const val MINOR_POSITION = 1 | ||
fun of(version: String) = version.split(VERSION_SPLIT_SIGN).map { | ||
it.toInt() | ||
}.let { | ||
Version(it[MAJOR_POSITION], it[MINOR_POSITION]) | ||
} | ||
} | ||
} |
6 changes: 0 additions & 6 deletions
6
app/src/main/java/com/sopt/peekabookaos/domain/entity/VersionDetail.kt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
app/src/main/java/com/sopt/peekabookaos/domain/entity/VersionState.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.