diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 4ae50412..e0cf4361 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,6 +1,4 @@ import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties -import java.io.FileInputStream -import java.util.Properties @Suppress("DSL_SCOPE_VIOLATION") plugins { @@ -30,7 +28,7 @@ android { } buildConfigField("String", "NATIVE_APP_KEY", getApiKey("native_app_key")) } - buildFeatures{ + buildFeatures { buildConfig = true } @@ -74,6 +72,7 @@ dependencies { implementation(libs.androidx.activity.compose) implementation(libs.androidx.compose.material3) + implementation(libs.lifecycle.runtime.compose) implementation(libs.orbit.core) implementation(libs.orbit.compose) implementation(libs.orbit.viewModel) @@ -85,6 +84,6 @@ dependencies { androidTestImplementation(libs.androidx.test.espresso.core) } -fun getApiKey(propertyKey : String): String { +fun getApiKey(propertyKey: String): String { return gradleLocalProperties(rootDir).getProperty(propertyKey) } diff --git a/app/src/main/java/com/moneymong/moneymong/MainActivity.kt b/app/src/main/java/com/moneymong/moneymong/MainActivity.kt index c9a08ade..5691b777 100644 --- a/app/src/main/java/com/moneymong/moneymong/MainActivity.kt +++ b/app/src/main/java/com/moneymong/moneymong/MainActivity.kt @@ -1,33 +1,30 @@ package com.moneymong.moneymong +import android.content.Intent +import android.net.Uri import android.os.Bundle -import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.MutableState +import androidx.activity.viewModels +import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf -import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.lifecycle.compose.LifecycleStartEffect import com.moneymong.moneymong.common.event.EventTracker -import dagger.hilt.android.AndroidEntryPoint +import com.moneymong.moneymong.design_system.error.ErrorDialog import com.moneymong.moneymong.design_system.theme.MMTheme -import com.moneymong.moneymong.domain.repository.TokenRepository -import com.moneymong.moneymong.domain.repository.user.UserRepository -import com.moneymong.moneymong.feature.sign.LoginScreen -import com.moneymong.moneymong.feature.sign.SignUpScreen -import com.moneymong.moneymong.ocr.OCRScreen +import com.moneymong.moneymong.domain.repository.token.TokenRepository import com.moneymong.moneymong.ui.MoneyMongApp -import kotlinx.coroutines.CoroutineDispatcher +import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch +import org.orbitmvi.orbit.compose.collectAsState import javax.inject.Inject -import kotlin.coroutines.CoroutineContext @AndroidEntryPoint class MainActivity : ComponentActivity() { + private val viewModel: MainViewModel by viewModels() @Inject lateinit var tokenRepository: TokenRepository @@ -41,7 +38,32 @@ class MainActivity : ComponentActivity() { eventTracker.initialize() setContent { + val context = LocalContext.current + val state by viewModel.collectAsState() + + val shouldUpdate = state.shouldUpdate + LifecycleStartEffect(key1 = Unit, effects = { + viewModel.checkShouldUpdate(version = BuildConfig.VERSION_NAME) + onStopOrDispose { } + }) + MMTheme { + if (shouldUpdate) { + ErrorDialog( + message = "안정적인 머니몽 사용을 위해\n최신 버전으로 업데이트가 필요해요!", + confirmText = "업데이트", + onConfirm = { + val playStoreUrl = + "https://play.google.com/store/apps/details?id=${BuildConfig.APPLICATION_ID}" + val intent = Intent(Intent.ACTION_VIEW).apply { + data = Uri.parse(playStoreUrl) + setPackage("com.android.vending") + } + context.startActivity(intent) + } + ) + } + MoneyMongApp(expired.value) { expired.value = false } @@ -54,12 +76,4 @@ class MainActivity : ComponentActivity() { } } } -} - -@Composable -fun Greeting(name: String, modifier: Modifier = Modifier) { - Text( - text = "Hello $name!", - modifier = modifier - ) } \ No newline at end of file diff --git a/app/src/main/java/com/moneymong/moneymong/MainState.kt b/app/src/main/java/com/moneymong/moneymong/MainState.kt index 9bf31b26..e52687e3 100644 --- a/app/src/main/java/com/moneymong/moneymong/MainState.kt +++ b/app/src/main/java/com/moneymong/moneymong/MainState.kt @@ -3,5 +3,5 @@ package com.moneymong.moneymong import com.moneymong.moneymong.common.base.State data class MainState( - val something: Any? = null // TODO + val shouldUpdate: Boolean = false ): State diff --git a/app/src/main/java/com/moneymong/moneymong/MainViewModel.kt b/app/src/main/java/com/moneymong/moneymong/MainViewModel.kt index 2ca3d14b..98c163c6 100644 --- a/app/src/main/java/com/moneymong/moneymong/MainViewModel.kt +++ b/app/src/main/java/com/moneymong/moneymong/MainViewModel.kt @@ -1,9 +1,22 @@ package com.moneymong.moneymong import com.moneymong.moneymong.common.base.BaseViewModel +import com.moneymong.moneymong.domain.usecase.version.CheckVersionUpdateUseCase import dagger.hilt.android.lifecycle.HiltViewModel +import org.orbitmvi.orbit.syntax.simple.intent +import org.orbitmvi.orbit.syntax.simple.reduce import javax.inject.Inject @HiltViewModel -class MainViewModel @Inject constructor() : BaseViewModel(MainState()) { +class MainViewModel @Inject constructor( + val checkVersionUpdateUseCase: CheckVersionUpdateUseCase +) : BaseViewModel(MainState()) { + + fun checkShouldUpdate(version: String) = intent { + val shouldUpdate = + checkVersionUpdateUseCase(version = version).isFailure + reduce { + state.copy(shouldUpdate = shouldUpdate) + } + } } \ No newline at end of file diff --git a/core/design-system/src/main/java/com/moneymong/moneymong/design_system/error/ErrorDialog.kt b/core/design-system/src/main/java/com/moneymong/moneymong/design_system/error/ErrorDialog.kt index 57300d88..67de4534 100644 --- a/core/design-system/src/main/java/com/moneymong/moneymong/design_system/error/ErrorDialog.kt +++ b/core/design-system/src/main/java/com/moneymong/moneymong/design_system/error/ErrorDialog.kt @@ -44,7 +44,8 @@ fun ErrorDialog( modifier: Modifier = Modifier, message: String, description: String = "", - onConfirm: () -> Unit + confirmText: String = "확인", + onConfirm: () -> Unit, ) { val horizontalPadding = 22.dp val buttonWidth = 276.dp @@ -93,7 +94,7 @@ fun ErrorDialog( MDSButton( modifier = Modifier.width(buttonWidth), onClick = onConfirm, - text = "확인", + text = confirmText, type = MDSButtonType.PRIMARY, size = MDSButtonSize.LARGE, ) diff --git a/core/model/src/main/java/com/moneymong/moneymong/model/version/VersionRequest.kt b/core/model/src/main/java/com/moneymong/moneymong/model/version/VersionRequest.kt new file mode 100644 index 00000000..db626795 --- /dev/null +++ b/core/model/src/main/java/com/moneymong/moneymong/model/version/VersionRequest.kt @@ -0,0 +1,5 @@ +package com.moneymong.moneymong.model.version + +data class VersionRequest( + val version: String +) \ No newline at end of file diff --git a/core/network/src/main/java/com/moneymong/moneymong/network/adapter/ResultCallAdapter.kt b/core/network/src/main/java/com/moneymong/moneymong/network/adapter/ResultCallAdapter.kt index 0bd65743..eaf09456 100644 --- a/core/network/src/main/java/com/moneymong/moneymong/network/adapter/ResultCallAdapter.kt +++ b/core/network/src/main/java/com/moneymong/moneymong/network/adapter/ResultCallAdapter.kt @@ -48,12 +48,16 @@ private class ResultCall( return Result.failure(MoneyMongError.UnExpectedError) } - val errorResponse = fromJsonToErrorResponse(errorBody) - val httpError = getErrorByStatusCode( - statusCode = errorResponse.status, - message = errorResponse.message - ) - return Result.failure(httpError) + return try { + val errorResponse = fromJsonToErrorResponse(errorBody) + val httpError = getErrorByStatusCode( + statusCode = errorResponse.status, + message = errorResponse.message + ) + Result.failure(httpError) + } catch (e: Exception) { + Result.failure(MoneyMongError.UnExpectedError) + } } override fun onFailure(call: Call, t: Throwable) { diff --git a/core/network/src/main/java/com/moneymong/moneymong/network/api/MoneyMongApi.kt b/core/network/src/main/java/com/moneymong/moneymong/network/api/MoneyMongApi.kt index ff7f9798..e6519991 100644 --- a/core/network/src/main/java/com/moneymong/moneymong/network/api/MoneyMongApi.kt +++ b/core/network/src/main/java/com/moneymong/moneymong/network/api/MoneyMongApi.kt @@ -3,8 +3,8 @@ package com.moneymong.moneymong.network.api import com.moneymong.moneymong.model.ocr.FileUploadResponse import okhttp3.MultipartBody import retrofit2.http.Multipart -import retrofit2.http.Part import retrofit2.http.POST +import retrofit2.http.Part interface MoneyMongApi { diff --git a/core/network/src/main/java/com/moneymong/moneymong/network/api/VersionApi.kt b/core/network/src/main/java/com/moneymong/moneymong/network/api/VersionApi.kt new file mode 100644 index 00000000..b709d84a --- /dev/null +++ b/core/network/src/main/java/com/moneymong/moneymong/network/api/VersionApi.kt @@ -0,0 +1,13 @@ +package com.moneymong.moneymong.network.api + +import com.moneymong.moneymong.model.version.VersionRequest +import retrofit2.http.Body +import retrofit2.http.POST + +interface VersionApi { + + @POST("api/v1/version") + suspend fun checkUpdate( + @Body version: VersionRequest + ): Result +} \ No newline at end of file diff --git a/core/network/src/main/java/com/moneymong/moneymong/network/di/NetworkModule.kt b/core/network/src/main/java/com/moneymong/moneymong/network/di/NetworkModule.kt index 683c179a..b73dc026 100644 --- a/core/network/src/main/java/com/moneymong/moneymong/network/di/NetworkModule.kt +++ b/core/network/src/main/java/com/moneymong/moneymong/network/di/NetworkModule.kt @@ -17,6 +17,7 @@ import com.moneymong.moneymong.network.api.MemberApi import com.moneymong.moneymong.network.api.MoneyMongApi import com.moneymong.moneymong.network.api.UniversityApi import com.moneymong.moneymong.network.api.UserApi +import com.moneymong.moneymong.network.api.VersionApi import com.moneymong.moneymong.network.util.AuthInterceptor import com.moneymong.moneymong.network.util.MoneyMongTokenAuthenticator import dagger.Module @@ -143,6 +144,10 @@ object NetworkModule { fun provideMemberApi(@MoneyMongRetrofit retrofit: Retrofit): MemberApi = retrofit.create(MemberApi::class.java) + @Provides + fun provideVersionApi(@MoneyMongRetrofit retrofit: Retrofit): VersionApi = + retrofit.create(VersionApi::class.java) + @Provides fun provideClovaApi(@ClovaRetrofit retrofit: Retrofit): ClovaApi = retrofit.create(ClovaApi::class.java) diff --git a/core/network/src/main/java/com/moneymong/moneymong/network/response/ErrorResponse.kt b/core/network/src/main/java/com/moneymong/moneymong/network/response/ErrorResponse.kt index 0e070acb..51b304fd 100644 --- a/core/network/src/main/java/com/moneymong/moneymong/network/response/ErrorResponse.kt +++ b/core/network/src/main/java/com/moneymong/moneymong/network/response/ErrorResponse.kt @@ -1,7 +1,6 @@ package com.moneymong.moneymong.network.response import com.google.gson.Gson -import com.google.gson.annotations.SerializedName data class ErrorResponse( val status: Int, diff --git a/core/network/src/main/java/com/moneymong/moneymong/network/util/AuthInterceptor.kt b/core/network/src/main/java/com/moneymong/moneymong/network/util/AuthInterceptor.kt index 924232e0..06193943 100644 --- a/core/network/src/main/java/com/moneymong/moneymong/network/util/AuthInterceptor.kt +++ b/core/network/src/main/java/com/moneymong/moneymong/network/util/AuthInterceptor.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.network.util -import com.moneymong.moneymong.domain.repository.TokenRepository +import com.moneymong.moneymong.domain.repository.token.TokenRepository import com.moneymong.moneymong.network.BuildConfig import kotlinx.coroutines.runBlocking import okhttp3.Interceptor @@ -24,9 +24,11 @@ class AuthInterceptor @Inject constructor( tokenRepository.getAccessToken() } - val newRequest = originalRequest.newBuilder() - .addHeader("Authorization", "Bearer ${accessToken.getOrNull()}") - .build() + val newRequest = originalRequest.newBuilder().apply { + accessToken.getOrNull()?.let { + addHeader("Authorization", "Bearer $it") + } ?: addHeader("Authorization", "null") + }.build() return chain.proceed(newRequest) } diff --git a/core/network/src/main/java/com/moneymong/moneymong/network/util/MoneyMongTokenAuthenticator.kt b/core/network/src/main/java/com/moneymong/moneymong/network/util/MoneyMongTokenAuthenticator.kt index ed06a406..24123b6e 100644 --- a/core/network/src/main/java/com/moneymong/moneymong/network/util/MoneyMongTokenAuthenticator.kt +++ b/core/network/src/main/java/com/moneymong/moneymong/network/util/MoneyMongTokenAuthenticator.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.network.util -import com.moneymong.moneymong.domain.repository.TokenRepository +import com.moneymong.moneymong.domain.repository.token.TokenRepository import com.moneymong.moneymong.network.BuildConfig import kotlinx.coroutines.runBlocking import okhttp3.Authenticator diff --git a/core/ui/src/main/java/com/moneymong/moneymong/ui/RippleEffect.kt b/core/ui/src/main/java/com/moneymong/moneymong/ui/RippleEffect.kt deleted file mode 100644 index 39161fb8..00000000 --- a/core/ui/src/main/java/com/moneymong/moneymong/ui/RippleEffect.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.moneymong.moneymong.ui - -import androidx.compose.material.ripple.RippleAlpha -import androidx.compose.material.ripple.RippleTheme -import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color - -object NoRippleTheme : RippleTheme { - @Composable - override fun defaultColor() = Color.Unspecified - - @Composable - override fun rippleAlpha(): RippleAlpha = RippleAlpha( - draggedAlpha = 0.0f, - focusedAlpha = 0.0f, - hoveredAlpha = 0.0f, - pressedAlpha = 0.0f - ) -} \ No newline at end of file diff --git a/data/src/main/java/com/moneymong/moneymong/data/datasource/version/VersionRemoteDataSource.kt b/data/src/main/java/com/moneymong/moneymong/data/datasource/version/VersionRemoteDataSource.kt new file mode 100644 index 00000000..ebc32476 --- /dev/null +++ b/data/src/main/java/com/moneymong/moneymong/data/datasource/version/VersionRemoteDataSource.kt @@ -0,0 +1,6 @@ +package com.moneymong.moneymong.data.datasource.version + +interface VersionRemoteDataSource { + + suspend fun checkUpdate(version: String): Result +} \ No newline at end of file diff --git a/data/src/main/java/com/moneymong/moneymong/data/datasource/version/VersionRemoteDataSourceImpl.kt b/data/src/main/java/com/moneymong/moneymong/data/datasource/version/VersionRemoteDataSourceImpl.kt new file mode 100644 index 00000000..847feef0 --- /dev/null +++ b/data/src/main/java/com/moneymong/moneymong/data/datasource/version/VersionRemoteDataSourceImpl.kt @@ -0,0 +1,13 @@ +package com.moneymong.moneymong.data.datasource.version + +import com.moneymong.moneymong.model.version.VersionRequest +import com.moneymong.moneymong.network.api.VersionApi +import javax.inject.Inject + +class VersionRemoteDataSourceImpl @Inject constructor( + private val versionApi: VersionApi +) : VersionRemoteDataSource { + override suspend fun checkUpdate(version: String): Result { + return versionApi.checkUpdate(VersionRequest(version = version)) + } +} \ No newline at end of file diff --git a/data/src/main/java/com/moneymong/moneymong/data/di/DataSourceModule.kt b/data/src/main/java/com/moneymong/moneymong/data/di/DataSourceModule.kt index 65ac8784..958c058d 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/di/DataSourceModule.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/di/DataSourceModule.kt @@ -24,6 +24,8 @@ import com.moneymong.moneymong.data.datasource.user.UserLocalDataSource import com.moneymong.moneymong.data.datasource.user.UserLocalDataSourceImpl import com.moneymong.moneymong.data.datasource.user.UserRemoteDataSource import com.moneymong.moneymong.data.datasource.user.UserRemoteDataSourceImpl +import com.moneymong.moneymong.data.datasource.version.VersionRemoteDataSource +import com.moneymong.moneymong.data.datasource.version.VersionRemoteDataSourceImpl import dagger.Binds import dagger.Module import dagger.hilt.InstallIn @@ -92,4 +94,9 @@ interface DataSourceModule { fun bindLedgerDetailRemoteDataSource( ledgerDetailRemoteDataSourceImpl: LedgerDetailRemoteDataSourceImpl ): LedgerDetailRemoteDataSource + + @Binds + fun bindVersionRemoteDataSource( + versionRemoteDataSourceImpl: VersionRemoteDataSourceImpl + ): VersionRemoteDataSource } \ No newline at end of file diff --git a/data/src/main/java/com/moneymong/moneymong/data/di/RepositoryModule.kt b/data/src/main/java/com/moneymong/moneymong/data/di/RepositoryModule.kt index 911bffe9..512fcdcd 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/di/RepositoryModule.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/di/RepositoryModule.kt @@ -8,14 +8,16 @@ import com.moneymong.moneymong.data.repository.ocr.OCRRepositoryImpl import com.moneymong.moneymong.data.repository.signup.UnivRepositoryImpl import com.moneymong.moneymong.data.repository.token.TokenRepositoryImpl import com.moneymong.moneymong.data.repository.user.UserRepositoryImpl -import com.moneymong.moneymong.domain.repository.AgencyRepository -import com.moneymong.moneymong.domain.repository.TokenRepository -import com.moneymong.moneymong.domain.repository.UnivRepository +import com.moneymong.moneymong.data.repository.version.VersionRepositoryImpl +import com.moneymong.moneymong.domain.repository.agency.AgencyRepository import com.moneymong.moneymong.domain.repository.ledger.LedgerRepository import com.moneymong.moneymong.domain.repository.ledgerdetail.LedgerDetailRepository import com.moneymong.moneymong.domain.repository.member.MemberRepository import com.moneymong.moneymong.domain.repository.ocr.OCRRepository +import com.moneymong.moneymong.domain.repository.token.TokenRepository +import com.moneymong.moneymong.domain.repository.univ.UnivRepository import com.moneymong.moneymong.domain.repository.user.UserRepository +import com.moneymong.moneymong.domain.repository.version.VersionRepository import dagger.Binds import dagger.Module import dagger.hilt.InstallIn @@ -48,22 +50,27 @@ interface RepositoryModule { ): UserRepository @Binds - fun provideOCRRepository( + fun bindOCRRepository( ocrRepositoryImpl: OCRRepositoryImpl ): OCRRepository @Binds - fun provideLedgerRepository( + fun bindLedgerRepository( ledgerRepositoryImpl: LedgerRepositoryImpl ): LedgerRepository @Binds - fun provideLedgerDetailRepository( + fun bindLedgerDetailRepository( ledgerDetailRepositoryImpl: LedgerDetailRepositoryImpl ): LedgerDetailRepository @Binds - fun provideMemberRepository( + fun bindMemberRepository( memberRepositoryImpl: MemberRepositoryImpl ): MemberRepository + + @Binds + fun bindVersionRepository( + versionRepositoryImpl: VersionRepositoryImpl + ): VersionRepository } \ No newline at end of file diff --git a/data/src/main/java/com/moneymong/moneymong/data/repository/agency/AgencyRepositoryImpl.kt b/data/src/main/java/com/moneymong/moneymong/data/repository/agency/AgencyRepositoryImpl.kt index d350b5dd..225ea34b 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/repository/agency/AgencyRepositoryImpl.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/repository/agency/AgencyRepositoryImpl.kt @@ -6,7 +6,7 @@ import androidx.paging.PagingData import com.moneymong.moneymong.data.datasource.agency.AgencyLocalDataSource import com.moneymong.moneymong.data.datasource.agency.AgencyRemoteDataSource import com.moneymong.moneymong.data.pagingsource.AgencyPagingSource -import com.moneymong.moneymong.domain.repository.AgencyRepository +import com.moneymong.moneymong.domain.repository.agency.AgencyRepository import com.moneymong.moneymong.model.agency.AgencyGetResponse import com.moneymong.moneymong.model.agency.AgencyJoinRequest import com.moneymong.moneymong.model.agency.AgencyJoinResponse diff --git a/data/src/main/java/com/moneymong/moneymong/data/repository/signup/UnivRepositoryImpl.kt b/data/src/main/java/com/moneymong/moneymong/data/repository/signup/UnivRepositoryImpl.kt index 7c5fb33d..7c885b53 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/repository/signup/UnivRepositoryImpl.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/repository/signup/UnivRepositoryImpl.kt @@ -1,7 +1,7 @@ package com.moneymong.moneymong.data.repository.signup import com.moneymong.moneymong.data.datasource.signup.UnivRemoteDataSource -import com.moneymong.moneymong.domain.repository.UnivRepository +import com.moneymong.moneymong.domain.repository.univ.UnivRepository import com.moneymong.moneymong.model.sign.SearchQueryRequest import com.moneymong.moneymong.model.sign.UnivRequest import com.moneymong.moneymong.model.sign.UnivResponse diff --git a/data/src/main/java/com/moneymong/moneymong/data/repository/token/TokenRepositoryImpl.kt b/data/src/main/java/com/moneymong/moneymong/data/repository/token/TokenRepositoryImpl.kt index 2694d89f..56f222ff 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/repository/token/TokenRepositoryImpl.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/repository/token/TokenRepositoryImpl.kt @@ -2,7 +2,7 @@ package com.moneymong.moneymong.data.repository.token import com.moneymong.moneymong.data.datasource.login.LoginLocalDataSource import com.moneymong.moneymong.data.datasource.login.TokenRemoteDataSource -import com.moneymong.moneymong.domain.repository.TokenRepository +import com.moneymong.moneymong.domain.repository.token.TokenRepository import com.moneymong.moneymong.model.sign.LoginType import com.moneymong.moneymong.model.sign.RefreshTokenRequest import com.moneymong.moneymong.model.sign.RefreshTokenResponse diff --git a/data/src/main/java/com/moneymong/moneymong/data/repository/version/VersionRepositoryImpl.kt b/data/src/main/java/com/moneymong/moneymong/data/repository/version/VersionRepositoryImpl.kt new file mode 100644 index 00000000..c052a8ac --- /dev/null +++ b/data/src/main/java/com/moneymong/moneymong/data/repository/version/VersionRepositoryImpl.kt @@ -0,0 +1,14 @@ +package com.moneymong.moneymong.data.repository.version + +import com.moneymong.moneymong.data.datasource.version.VersionRemoteDataSource +import com.moneymong.moneymong.domain.repository.version.VersionRepository +import javax.inject.Inject + +class VersionRepositoryImpl @Inject constructor( + private val versionRemoteDataSource: VersionRemoteDataSource +) : VersionRepository { + + override suspend fun checkUpdate(version: String): Result { + return versionRemoteDataSource.checkUpdate(version = version) + } +} \ No newline at end of file diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/repository/AgencyRepository.kt b/domain/src/main/java/com/moneymong/moneymong/domain/repository/agency/AgencyRepository.kt similarity index 93% rename from domain/src/main/java/com/moneymong/moneymong/domain/repository/AgencyRepository.kt rename to domain/src/main/java/com/moneymong/moneymong/domain/repository/agency/AgencyRepository.kt index 9812c479..1515676b 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/repository/AgencyRepository.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/repository/agency/AgencyRepository.kt @@ -1,4 +1,4 @@ -package com.moneymong.moneymong.domain.repository +package com.moneymong.moneymong.domain.repository.agency import androidx.paging.PagingData import com.moneymong.moneymong.model.agency.AgencyGetResponse diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/repository/TokenRepository.kt b/domain/src/main/java/com/moneymong/moneymong/domain/repository/token/TokenRepository.kt similarity index 95% rename from domain/src/main/java/com/moneymong/moneymong/domain/repository/TokenRepository.kt rename to domain/src/main/java/com/moneymong/moneymong/domain/repository/token/TokenRepository.kt index ca1e7464..2dec49e2 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/repository/TokenRepository.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/repository/token/TokenRepository.kt @@ -1,4 +1,4 @@ -package com.moneymong.moneymong.domain.repository +package com.moneymong.moneymong.domain.repository.token import com.moneymong.moneymong.model.sign.LoginType import com.moneymong.moneymong.model.sign.RefreshTokenRequest diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/repository/UnivRepository.kt b/domain/src/main/java/com/moneymong/moneymong/domain/repository/univ/UnivRepository.kt similarity index 89% rename from domain/src/main/java/com/moneymong/moneymong/domain/repository/UnivRepository.kt rename to domain/src/main/java/com/moneymong/moneymong/domain/repository/univ/UnivRepository.kt index fadba50c..2e94a323 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/repository/UnivRepository.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/repository/univ/UnivRepository.kt @@ -1,4 +1,4 @@ -package com.moneymong.moneymong.domain.repository +package com.moneymong.moneymong.domain.repository.univ import com.moneymong.moneymong.model.sign.SearchQueryRequest import com.moneymong.moneymong.model.sign.UnivRequest diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/repository/version/VersionRepository.kt b/domain/src/main/java/com/moneymong/moneymong/domain/repository/version/VersionRepository.kt new file mode 100644 index 00000000..bae12785 --- /dev/null +++ b/domain/src/main/java/com/moneymong/moneymong/domain/repository/version/VersionRepository.kt @@ -0,0 +1,5 @@ +package com.moneymong.moneymong.domain.repository.version + +interface VersionRepository { + suspend fun checkUpdate(version: String): Result +} \ No newline at end of file diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/AgencyJoinUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/AgencyJoinUseCase.kt index eec9217c..3fab295c 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/AgencyJoinUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/AgencyJoinUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.agency -import com.moneymong.moneymong.domain.repository.AgencyRepository +import com.moneymong.moneymong.domain.repository.agency.AgencyRepository import com.moneymong.moneymong.model.agency.AgencyJoinRequest import com.moneymong.moneymong.model.agency.AgencyJoinResponse import javax.inject.Inject diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyIdUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyIdUseCase.kt index 820eccb8..e6ea9313 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyIdUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyIdUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.agency -import com.moneymong.moneymong.domain.repository.AgencyRepository +import com.moneymong.moneymong.domain.repository.agency.AgencyRepository import javax.inject.Inject class FetchAgencyIdUseCase @Inject constructor( diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchMyAgencyListUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchMyAgencyListUseCase.kt index c4970f9b..4ffe07f5 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchMyAgencyListUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchMyAgencyListUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.agency -import com.moneymong.moneymong.domain.repository.AgencyRepository +import com.moneymong.moneymong.domain.repository.agency.AgencyRepository import com.moneymong.moneymong.model.agency.MyAgencyResponse import javax.inject.Inject diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/GetAgenciesUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/GetAgenciesUseCase.kt index c704a206..ef420be5 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/GetAgenciesUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/GetAgenciesUseCase.kt @@ -1,7 +1,7 @@ package com.moneymong.moneymong.domain.usecase.agency import androidx.paging.PagingData -import com.moneymong.moneymong.domain.repository.AgencyRepository +import com.moneymong.moneymong.domain.repository.agency.AgencyRepository import com.moneymong.moneymong.model.agency.AgencyGetResponse import kotlinx.coroutines.flow.Flow import javax.inject.Inject diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/RegisterAgencyUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/RegisterAgencyUseCase.kt index 7da92b1a..d8161cab 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/RegisterAgencyUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/RegisterAgencyUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.agency -import com.moneymong.moneymong.domain.repository.AgencyRepository +import com.moneymong.moneymong.domain.repository.agency.AgencyRepository import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.agency.RegisterAgencyResponse import javax.inject.Inject diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/SaveAgencyIdUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/SaveAgencyIdUseCase.kt index b2d30f30..28821b98 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/SaveAgencyIdUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/SaveAgencyIdUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.agency -import com.moneymong.moneymong.domain.repository.AgencyRepository +import com.moneymong.moneymong.domain.repository.agency.AgencyRepository import javax.inject.Inject class SaveAgencyIdUseCase @Inject constructor( diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/signup/SchoolInfoUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/signup/SchoolInfoUseCase.kt index 49c0c685..1f0956e1 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/signup/SchoolInfoUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/signup/SchoolInfoUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.signup -import com.moneymong.moneymong.domain.repository.TokenRepository +import com.moneymong.moneymong.domain.repository.token.TokenRepository import javax.inject.Inject class SchoolInfoUseCase @Inject constructor( diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/token/PostAccessTokenUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/token/PostAccessTokenUseCase.kt index a0955c18..23ebbe7a 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/token/PostAccessTokenUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/token/PostAccessTokenUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.token -import com.moneymong.moneymong.domain.repository.TokenRepository +import com.moneymong.moneymong.domain.repository.token.TokenRepository import com.moneymong.moneymong.domain.repository.user.UserRepository import com.moneymong.moneymong.model.sign.LoginType import com.moneymong.moneymong.model.sign.TokenResponse diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/token/TokenUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/token/TokenUseCase.kt index 7aafbe6d..4a2009a8 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/token/TokenUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/token/TokenUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.token -import com.moneymong.moneymong.domain.repository.TokenRepository +import com.moneymong.moneymong.domain.repository.token.TokenRepository import com.moneymong.moneymong.model.sign.UserDataStoreInfoResponse import javax.inject.Inject diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/CreateUniveristyUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/CreateUniveristyUseCase.kt index 6e474301..16560051 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/CreateUniveristyUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/CreateUniveristyUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.university -import com.moneymong.moneymong.domain.repository.UnivRepository +import com.moneymong.moneymong.domain.repository.univ.UnivRepository import com.moneymong.moneymong.model.sign.UnivRequest import javax.inject.Inject diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/FetchMyUniversityUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/FetchMyUniversityUseCase.kt index e4145337..deec9d28 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/FetchMyUniversityUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/FetchMyUniversityUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.university -import com.moneymong.moneymong.domain.repository.UnivRepository +import com.moneymong.moneymong.domain.repository.univ.UnivRepository import com.moneymong.moneymong.model.sign.UnivResponse import javax.inject.Inject diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/SearchUniversityUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/SearchUniversityUseCase.kt index 2247bc43..5089a1a3 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/SearchUniversityUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/university/SearchUniversityUseCase.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.domain.usecase.university -import com.moneymong.moneymong.domain.repository.UnivRepository +import com.moneymong.moneymong.domain.repository.univ.UnivRepository import com.moneymong.moneymong.model.sign.SearchQueryRequest import com.moneymong.moneymong.model.sign.UniversitiesResponse import javax.inject.Inject diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/version/CheckVersionUpdateUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/version/CheckVersionUpdateUseCase.kt new file mode 100644 index 00000000..f2f96b75 --- /dev/null +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/version/CheckVersionUpdateUseCase.kt @@ -0,0 +1,13 @@ +package com.moneymong.moneymong.domain.usecase.version + +import com.moneymong.moneymong.domain.repository.version.VersionRepository +import javax.inject.Inject + +class CheckVersionUpdateUseCase @Inject constructor( + private val versionRepository: VersionRepository +) { + + suspend operator fun invoke(version: String): Result { + return versionRepository.checkUpdate(version = version) + } +} \ No newline at end of file diff --git a/feature/ledger/src/main/java/com/moneymong/moneymong/ledger/view/LedgerAgencyEmptyView.kt b/feature/ledger/src/main/java/com/moneymong/moneymong/ledger/view/LedgerAgencyEmptyView.kt index c9298ef1..32c3f681 100644 --- a/feature/ledger/src/main/java/com/moneymong/moneymong/ledger/view/LedgerAgencyEmptyView.kt +++ b/feature/ledger/src/main/java/com/moneymong/moneymong/ledger/view/LedgerAgencyEmptyView.kt @@ -1,6 +1,7 @@ package com.moneymong.moneymong.ledger.view import androidx.compose.foundation.Image +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -20,6 +21,7 @@ import com.moneymong.moneymong.design_system.component.button.MDSButtonSize import com.moneymong.moneymong.design_system.component.button.MDSButtonType import com.moneymong.moneymong.design_system.theme.Body4 import com.moneymong.moneymong.design_system.theme.Gray08 +import com.moneymong.moneymong.design_system.theme.White import com.moneymong.moneymong.ledger.R @Composable @@ -28,7 +30,9 @@ fun LedgerAgencyEmptyView( onClickFindAgency: () -> Unit ) { Column( - modifier = modifier.fillMaxSize(), + modifier = modifier + .fillMaxSize() + .background(color = White), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { diff --git a/feature/ledger/src/main/java/com/moneymong/moneymong/ledger/view/onboarding/LedgerOnboardingAddPage.kt b/feature/ledger/src/main/java/com/moneymong/moneymong/ledger/view/onboarding/LedgerOnboardingAddPage.kt index 0e548d0c..e7e93b12 100644 --- a/feature/ledger/src/main/java/com/moneymong/moneymong/ledger/view/onboarding/LedgerOnboardingAddPage.kt +++ b/feature/ledger/src/main/java/com/moneymong/moneymong/ledger/view/onboarding/LedgerOnboardingAddPage.kt @@ -7,7 +7,8 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.material.ripple.LocalRippleTheme +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.LocalRippleConfiguration import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Alignment @@ -18,9 +19,9 @@ import androidx.compose.ui.unit.dp import com.moneymong.moneymong.design_system.R import com.moneymong.moneymong.design_system.component.button.MDSFloatingActionButton import com.moneymong.moneymong.design_system.theme.Mint03 -import com.moneymong.moneymong.ui.NoRippleTheme import com.moneymong.moneymong.ui.pxToDp +@OptIn(ExperimentalMaterial3Api::class) @Composable internal fun LedgerOnboardingAddPage( modifier: Modifier = Modifier, @@ -48,7 +49,7 @@ internal fun LedgerOnboardingAddPage( horizontalArrowPosition = HorizontalArrowPosition.END ) - CompositionLocalProvider(LocalRippleTheme provides NoRippleTheme) { + CompositionLocalProvider(LocalRippleConfiguration provides null) { MDSFloatingActionButton( modifier = Modifier .size( diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SplashScreen.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SplashScreen.kt index 00b9bb2b..d6bc8f4c 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SplashScreen.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SplashScreen.kt @@ -1,6 +1,5 @@ package com.moneymong.moneymong.feature.sign -import android.util.Log import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.tween import androidx.compose.foundation.Image @@ -34,9 +33,9 @@ fun SplashScreen( val state = viewModel.collectAsState().value LaunchedEffect(key1 = state.isTokenValid) { - if (state.isTokenValid == true ) { + if (state.isTokenValid == true) { navigateToLedger() - } else if(state.isTokenValid == false ) { + } else if (state.isTokenValid == false) { navigateToLogin() } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4bfe10cf..0843f6f5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,8 +6,7 @@ androidxActivity = "1.8.0" androidxFragment = "1.5.5" androidxKtx = "1.9.0" androidxRuntimeKtx = "2.6.1" -androidxLifecycle = "2.6.1" -androidxComposeBom = "2023.10.01" +androidxComposeBom = "2024.10.00" androidxComposeCompiler = "1.5.3" androidxComposeMaterial = "1.3.1" androidxComposeMaterial3 = "1.1.0-alpha07" @@ -36,7 +35,7 @@ retrofit = "2.9.0" secretsGradlePlugin = "2.0.1" appcompat = "1.6.1" material = "1.10.0" -lifecycle-runtime-ktx = "2.6.2" +lifecycle = "2.8.6" constraintlayout = "2.1.4" paging = "3.2.1" kakao-sdk = "2.20.3" @@ -62,7 +61,7 @@ androidx-core-fragment = { group = "androidx.fragment", name = "fragment-ktx", v androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxKtx" } androidx-datastore = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "androidxDatastore" } androidx-datastore-core = { group = "androidx.datastore", name = "datastore-preferences-core", version.ref = "androidxDatastore" } -androidx-lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "androidxLifecycle" } +androidx-lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycle" } androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigation" } androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidxEspresso" } chucker-debug = { group = "com.github.chuckerteam.chucker", name = "library", version.ref = "chucker-android" } @@ -94,7 +93,8 @@ ksp-gradlePlugin = { group = "com.google.devtools.ksp", name = "com.google.devto androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidxJunit" } appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } material = { group = "com.google.android.material", name = "material", version.ref = "material" } -lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle-runtime-ktx" } +lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" } +lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" } ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }