-
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
…end-version #142 [feat] 버전에 따른 다이얼로그
- Loading branch information
Showing
48 changed files
with
662 additions
and
57 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
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.