-
Notifications
You must be signed in to change notification settings - Fork 0
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
#142 [feat] 버전에 따른 다이얼로그 #149
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6f735c1
#142 [ui] 유연한 업데이트 dialog xml
stellar-halo 5e4f45a
#142 [ui] 강제 업데이트 dialog xml
stellar-halo 7bf8316
#142 [ui] 유연한 업데이트 id명 변경
stellar-halo 1d22c03
#142 [ui] version에 따라 dialog가 다르게 뜨게 로직 추가
stellar-halo f8e0363
#142 [ui] viewModel의 값에 따라 dialog의 버튼 로직 처리
stellar-halo 44f15fa
#142 [chore] 버튼 그림자 삭제 및 dialog 백그라운드 설정
stellar-halo 76b206f
#142 [chore] 함수 정리 및 companion object선언으로 magic number 제거
stellar-halo 96e02fa
#142 [chore] UseCase 재 폴더링
stellar-halo f7ee885
#142 [feat] 버전 정보 api 연결(ft. 헤더 차이로 인한 module 추가)
stellar-halo e20c851
#142 [chore] 제곱으로 곱해주던 Exponent 삭제
stellar-halo 0b2c9f6
Merge remote-tracking branch 'origin/develop' into feature/#142-link-…
stellar-halo 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 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
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/sopetit/softie/data/entity/response/VersionResponse.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,32 @@ | ||
package com.sopetit.softie.data.entity.response | ||
|
||
import com.sopetit.softie.domain.entity.UpdateVersion | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class VersionResponse( | ||
@SerialName("iosVersion") | ||
val iosVersion: UpdateVersionEntity, | ||
@SerialName("androidVersion") | ||
val androidVersion: UpdateVersionEntity, | ||
@SerialName("notificationTitle") | ||
val notificationTitle: String, | ||
@SerialName("notificationContent") | ||
val notificationContent: String | ||
) { | ||
@Serializable | ||
data class UpdateVersionEntity( | ||
@SerialName("appVersion") | ||
val appVersion: String, | ||
@SerialName("forceUpdateVersion") | ||
val forceUpdateVersion: String | ||
) | ||
|
||
fun toUpdateVersion(): UpdateVersion = UpdateVersion( | ||
storeAppVersion = this.androidVersion.appVersion, | ||
forceAppVersion = this.androidVersion.forceUpdateVersion, | ||
notificationTitle = this.notificationTitle, | ||
notificationContent = this.notificationContent | ||
) | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/sopetit/softie/data/repositoryImpl/VersionRepositoryImpl.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,15 @@ | ||
package com.sopetit.softie.data.repositoryImpl | ||
|
||
import com.sopetit.softie.data.source.VersionDataSource | ||
import com.sopetit.softie.domain.entity.UpdateVersion | ||
import com.sopetit.softie.domain.repository.VersionRepository | ||
import javax.inject.Inject | ||
|
||
class VersionRepositoryImpl @Inject constructor( | ||
private val versionDataSource: VersionDataSource | ||
) : VersionRepository { | ||
override suspend fun getUpdateVersion(): Result<UpdateVersion> = | ||
runCatching { versionDataSource.getUpdateVersion() }.map { response -> | ||
requireNotNull(response.data).toUpdateVersion() | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/sopetit/softie/data/service/VersionService.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.sopetit.softie.data.service | ||
|
||
import com.sopetit.softie.data.entity.BaseResponse | ||
import com.sopetit.softie.data.entity.response.VersionResponse | ||
import retrofit2.http.GET | ||
|
||
interface VersionService { | ||
@GET("api/v1/versions/client/app") | ||
suspend fun getUpdateVersion(): BaseResponse<VersionResponse> | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/sopetit/softie/data/source/VersionDataSource.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,14 @@ | ||
package com.sopetit.softie.data.source | ||
|
||
import com.sopetit.softie.data.entity.BaseResponse | ||
import com.sopetit.softie.data.entity.response.VersionResponse | ||
import com.sopetit.softie.data.service.VersionService | ||
import javax.inject.Inject | ||
|
||
class VersionDataSource @Inject constructor( | ||
private val versionService: VersionService | ||
) { | ||
|
||
suspend fun getUpdateVersion(): BaseResponse<VersionResponse> = | ||
versionService.getUpdateVersion() | ||
} |
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,69 @@ | ||
package com.sopetit.softie.di | ||
|
||
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory | ||
import com.sopetit.softie.BuildConfig | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import kotlinx.serialization.json.Json | ||
import okhttp3.Interceptor | ||
import okhttp3.MediaType.Companion.toMediaType | ||
import okhttp3.OkHttpClient | ||
import okhttp3.logging.HttpLoggingInterceptor | ||
import retrofit2.Retrofit | ||
import java.util.concurrent.TimeUnit | ||
import javax.inject.Qualifier | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object VersionModule { | ||
private val json = Json { ignoreUnknownKeys = true } | ||
private const val CONTENT_TYPE = "Content-Type" | ||
private const val APPLICATION_JSON = "application/json" | ||
|
||
@Qualifier | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class VersionType | ||
|
||
@Provides | ||
@Singleton | ||
@VersionType | ||
fun providesVersionInterceptor(): Interceptor = Interceptor { chain -> | ||
val request = chain.request() | ||
var response = chain.proceed( | ||
request | ||
.newBuilder() | ||
.addHeader(CONTENT_TYPE, APPLICATION_JSON) | ||
.build() | ||
) | ||
response | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
@VersionType | ||
fun providesVersionOkHttpClient(@VersionType interceptor: Interceptor): OkHttpClient = | ||
OkHttpClient.Builder() | ||
.connectTimeout(10, TimeUnit.SECONDS) | ||
.writeTimeout(10, TimeUnit.SECONDS) | ||
.readTimeout(10, TimeUnit.SECONDS) | ||
.addInterceptor(interceptor) | ||
.addInterceptor( | ||
HttpLoggingInterceptor().apply { | ||
level = | ||
if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE | ||
} | ||
).build() | ||
|
||
@Provides | ||
@Singleton | ||
@VersionType | ||
fun providesVersionRetrofit(@VersionType okHttpClient: OkHttpClient): Retrofit = | ||
Retrofit.Builder() | ||
.baseUrl(BuildConfig.BASE_URL) | ||
.client(okHttpClient) | ||
.addConverterFactory(json.asConverterFactory(APPLICATION_JSON.toMediaType())) | ||
.build() | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/sopetit/softie/domain/entity/UpdateType.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,5 @@ | ||
package com.sopetit.softie.domain.entity | ||
|
||
enum class UpdateType { | ||
FORCE, RECOMMEND, NONE | ||
} |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/sopetit/softie/domain/entity/UpdateVersion.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,8 @@ | ||
package com.sopetit.softie.domain.entity | ||
|
||
data class UpdateVersion( | ||
val storeAppVersion: String, | ||
val forceAppVersion: String, | ||
val notificationTitle: String, | ||
val notificationContent: String | ||
) |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/sopetit/softie/domain/repository/VersionRepository.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,8 @@ | ||
package com.sopetit.softie.domain.repository | ||
|
||
import com.sopetit.softie.domain.entity.UpdateVersion | ||
|
||
interface VersionRepository { | ||
|
||
suspend fun getUpdateVersion(): Result<UpdateVersion> | ||
} |
2 changes: 1 addition & 1 deletion
2
...softie/domain/usecase/PostLoginUseCase.kt → ...e/domain/usecase/auth/PostLoginUseCase.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
2 changes: 1 addition & 1 deletion
2
...secase/GetRoutineDailyThemeListUseCase.kt → ...outine/GetRoutineDailyThemeListUseCase.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
2 changes: 1 addition & 1 deletion
2
...ftie/domain/usecase/GetBearTypeUseCase.kt → ...omain/usecase/local/GetBearTypeUseCase.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
2 changes: 1 addition & 1 deletion
2
...ftie/domain/usecase/GetSignedUpUseCase.kt → ...omain/usecase/local/GetSignedUpUseCase.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
2 changes: 1 addition & 1 deletion
2
.../domain/usecase/InitSIgnUpStateUseCase.kt → ...n/usecase/local/InitSIgnUpStateUseCase.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
2 changes: 1 addition & 1 deletion
2
...softie/domain/usecase/InitTokenUseCase.kt → .../domain/usecase/local/InitTokenUseCase.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
2 changes: 1 addition & 1 deletion
2
...main/usecase/member/SetBearTypeUseCase.kt → ...omain/usecase/local/SetBearTypeUseCase.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
2 changes: 1 addition & 1 deletion
2
...t/softie/domain/usecase/GetHomeUseCase.kt → ...e/domain/usecase/member/GetHomeUseCase.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
2 changes: 1 addition & 1 deletion
2
...ftie/domain/usecase/PatchCottonUseCase.kt → ...main/usecase/member/PatchCottonUseCase.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
6 changes: 3 additions & 3 deletions
6
...main/usecase/DeleteDailyRoutineUseCase.kt → ...dailyroutine/DeleteDailyRoutineUseCase.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,11 @@ | ||
package com.sopetit.softie.domain.usecase | ||
package com.sopetit.softie.domain.usecase.memberdailyroutine | ||
|
||
import com.sopetit.softie.domain.repository.DailyRoutineRepository | ||
import javax.inject.Inject | ||
|
||
class DeleteDailyRoutineUseCase @Inject constructor( | ||
private val deleteDailyRoutine: DailyRoutineRepository | ||
private val dailyRoutineRepository: DailyRoutineRepository | ||
) { | ||
suspend operator fun invoke(routineIdList: List<Int>) = | ||
deleteDailyRoutine.deleteDailyRoutine(routineIdList) | ||
dailyRoutineRepository.deleteDailyRoutine(routineIdList) | ||
} |
2 changes: 1 addition & 1 deletion
2
.../domain/usecase/GetDailyRoutineUseCase.kt → ...berdailyroutine/GetDailyRoutineUseCase.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
2 changes: 1 addition & 1 deletion
2
...omain/usecase/PatchAchieveDailyUseCase.kt → ...rdailyroutine/PatchAchieveDailyUseCase.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
2 changes: 1 addition & 1 deletion
2
...ain/usecase/PostAddDailyRoutineUseCase.kt → ...ailyroutine/PostAddDailyRoutineUseCase.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
2 changes: 1 addition & 1 deletion
2
...secase/DeleteMemberHappyRoutineUseCase.kt → ...outine/DeleteMemberHappyRoutineUseCase.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
2 changes: 1 addition & 1 deletion
2
...e/happyroutine/GetHappyProgressUseCase.kt → ...ppinessroutine/GetHappyProgressUseCase.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
2 changes: 1 addition & 1 deletion
2
...ine/PatchMemberHappinessAchieveUseCase.kt → ...ine/PatchMemberHappinessAchieveUseCase.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
2 changes: 1 addition & 1 deletion
2
...yroutine/PostMemberHappyRoutineUseCase.kt → ...sroutine/PostMemberHappyRoutineUseCase.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
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/sopetit/softie/domain/usecase/version/GetUpdateVersionUseCase.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,11 @@ | ||
package com.sopetit.softie.domain.usecase.version | ||
|
||
import com.sopetit.softie.domain.repository.VersionRepository | ||
import javax.inject.Inject | ||
|
||
class GetUpdateVersionUseCase @Inject constructor( | ||
private val versionRepository: VersionRepository | ||
) { | ||
suspend operator fun invoke() = | ||
versionRepository.getUpdateVersion() | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...rc/main/java/com/sopetit/softie/ui/dailyroutine/complete/DailyRoutineCompleteViewModel.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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
모듈까지 새로 만드느라 고생하셧슴다,!