-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature/#116] 앱 강제 업데이트 로직을 구현합니다. #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
eef3cb9
Feat: ForceUpdateDialog 컴포넌트 구현
wjdrjs00 86cd085
Feat: 앱 버전관리를 위한 컨벤션 플러그인 구현
wjdrjs00 265703e
feat: openAppInPlayStore 유틸 메소드 구현
wjdrjs00 eda2899
Feat: 강제 업데이트 도메인 로직 구현
wjdrjs00 498c2d2
Feat: 강제 업데이트 관련 mvi state 및 intent 추가
wjdrjs00 4ab63a0
Feat: 강제 업데이트 로직 구현
wjdrjs00 2b5155e
Feat: 강제 업데이트 api 연동
wjdrjs00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
37 changes: 37 additions & 0 deletions
37
...d-logic/convention/src/main/java/com/threegap/bitnagil/convention/extension/AppVersion.kt
This file contains hidden or 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,37 @@ | ||
| package com.threegap.bitnagil.convention.extension | ||
|
|
||
| import com.android.build.api.dsl.ApplicationExtension | ||
| import com.android.build.api.dsl.LibraryExtension | ||
| import org.gradle.api.Project | ||
| import org.gradle.api.artifacts.VersionCatalogsExtension | ||
| import org.gradle.kotlin.dsl.findByType | ||
| import org.gradle.kotlin.dsl.getByType | ||
|
|
||
| internal fun Project.configureAppVersion() { | ||
| val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
| val major = libs.findVersion("versionMajor").get().requiredVersion | ||
| val minor = libs.findVersion("versionMinor").get().requiredVersion | ||
| val patch = libs.findVersion("versionPatch").get().requiredVersion | ||
|
|
||
| extensions.findByType<ApplicationExtension>()?.let { appExtension -> | ||
| appExtension.defaultConfig { | ||
| versionName = "$major.$minor.$patch" | ||
| buildConfigField("int", "VERSION_MAJOR", major) | ||
| buildConfigField("int", "VERSION_MINOR", minor) | ||
| buildConfigField("int", "VERSION_PATCH", patch) | ||
| } | ||
| } | ||
|
|
||
| extensions.findByType<LibraryExtension>()?.let { libExtension -> | ||
| libExtension.apply { | ||
| defaultConfig { | ||
| buildConfigField("int", "VERSION_MAJOR", major) | ||
| buildConfigField("int", "VERSION_MINOR", minor) | ||
| buildConfigField("int", "VERSION_PATCH", patch) | ||
| } | ||
| buildFeatures { | ||
| buildConfig = true | ||
| } | ||
| } | ||
| } | ||
| } |
7 changes: 7 additions & 0 deletions
7
data/src/main/java/com/threegap/bitnagil/data/version/datasource/VersionDataSource.kt
This file contains hidden or 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.threegap.bitnagil.data.version.datasource | ||
|
|
||
| import com.threegap.bitnagil.data.version.model.response.VersionCheckResponseDto | ||
|
|
||
| interface VersionDataSource { | ||
| suspend fun checkVersion(): Result<VersionCheckResponseDto> | ||
| } |
22 changes: 22 additions & 0 deletions
22
.../src/main/java/com/threegap/bitnagil/data/version/datasourceImpl/VersionDataSourceImpl.kt
This file contains hidden or 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,22 @@ | ||
| package com.threegap.bitnagil.data.version.datasourceImpl | ||
|
|
||
| import com.threegap.bitnagil.data.BuildConfig | ||
| import com.threegap.bitnagil.data.common.safeApiCall | ||
| import com.threegap.bitnagil.data.version.datasource.VersionDataSource | ||
| import com.threegap.bitnagil.data.version.model.response.VersionCheckResponseDto | ||
| import com.threegap.bitnagil.data.version.service.VersionService | ||
| import javax.inject.Inject | ||
|
|
||
| class VersionDataSourceImpl @Inject constructor( | ||
| private val versionService: VersionService, | ||
| ) : VersionDataSource { | ||
|
|
||
| override suspend fun checkVersion(): Result<VersionCheckResponseDto> = | ||
| safeApiCall { | ||
| versionService.checkVersion( | ||
| majorVersion = BuildConfig.VERSION_MAJOR, | ||
| minorVersion = BuildConfig.VERSION_MINOR, | ||
| patchVersion = BuildConfig.VERSION_PATCH, | ||
| ) | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
...rc/main/java/com/threegap/bitnagil/data/version/model/response/VersionCheckResponseDto.kt
This file contains hidden or 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 @@ | ||
| package com.threegap.bitnagil.data.version.model.response | ||
|
|
||
| import com.threegap.bitnagil.domain.version.model.UpdateRequirement | ||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class VersionCheckResponseDto( | ||
| @SerialName("forceUpdateYn") | ||
| val forceUpdateYn: Boolean, | ||
| ) | ||
|
|
||
| fun VersionCheckResponseDto.toDomain() = | ||
| UpdateRequirement( | ||
| isForced = this.forceUpdateYn, | ||
| ) |
15 changes: 15 additions & 0 deletions
15
.../src/main/java/com/threegap/bitnagil/data/version/repositoryImpl/VersionRepositoryImpl.kt
This file contains hidden or 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,15 @@ | ||
| package com.threegap.bitnagil.data.version.repositoryImpl | ||
|
|
||
| import com.threegap.bitnagil.data.version.datasource.VersionDataSource | ||
| import com.threegap.bitnagil.data.version.model.response.toDomain | ||
| import com.threegap.bitnagil.domain.version.model.UpdateRequirement | ||
| import com.threegap.bitnagil.domain.version.repository.VersionRepository | ||
| import javax.inject.Inject | ||
|
|
||
| class VersionRepositoryImpl @Inject constructor( | ||
| private val versionDataSource: VersionDataSource, | ||
| ) : VersionRepository { | ||
|
|
||
| override suspend fun checkVersion(): Result<UpdateRequirement> = | ||
| versionDataSource.checkVersion().map { it.toDomain() } | ||
| } |
15 changes: 15 additions & 0 deletions
15
data/src/main/java/com/threegap/bitnagil/data/version/service/VersionService.kt
This file contains hidden or 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,15 @@ | ||
| package com.threegap.bitnagil.data.version.service | ||
|
|
||
| import com.threegap.bitnagil.data.version.model.response.VersionCheckResponseDto | ||
| import com.threegap.bitnagil.network.model.BaseResponse | ||
| import retrofit2.http.GET | ||
| import retrofit2.http.Query | ||
|
|
||
| interface VersionService { | ||
| @GET("/api/v1/version/android/check") | ||
| suspend fun checkVersion( | ||
| @Query("major") majorVersion: Int, | ||
| @Query("minor") minorVersion: Int, | ||
| @Query("patch") patchVersion: Int, | ||
| ): BaseResponse<VersionCheckResponseDto> | ||
| } |
5 changes: 5 additions & 0 deletions
5
domain/src/main/java/com/threegap/bitnagil/domain/version/model/UpdateRequirement.kt
This file contains hidden or 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,5 @@ | ||
| package com.threegap.bitnagil.domain.version.model | ||
|
|
||
| data class UpdateRequirement( | ||
| val isForced: Boolean, | ||
| ) |
7 changes: 7 additions & 0 deletions
7
domain/src/main/java/com/threegap/bitnagil/domain/version/repository/VersionRepository.kt
This file contains hidden or 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.threegap.bitnagil.domain.version.repository | ||
|
|
||
| import com.threegap.bitnagil.domain.version.model.UpdateRequirement | ||
|
|
||
| interface VersionRepository { | ||
| suspend fun checkVersion(): Result<UpdateRequirement> | ||
| } |
11 changes: 11 additions & 0 deletions
11
...c/main/java/com/threegap/bitnagil/domain/version/usecase/CheckUpdateRequirementUseCase.kt
This file contains hidden or 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 @@ | ||
| package com.threegap.bitnagil.domain.version.usecase | ||
|
|
||
| import com.threegap.bitnagil.domain.version.repository.VersionRepository | ||
| import javax.inject.Inject | ||
|
|
||
| class CheckUpdateRequirementUseCase @Inject constructor( | ||
| private val versionRepository: VersionRepository, | ||
| ) { | ||
| suspend operator fun invoke(): Result<Boolean> = | ||
| versionRepository.checkVersion().map { it.isForced } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.