Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feature/implement-onbo…
Browse files Browse the repository at this point in the history
…arding-api

# Conflicts:
#	feature/main/src/main/java/com/goalpanzi/mission_mate/core/main/component/MainNavHost.kt
#	feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/OnboardingScreen.kt
  • Loading branch information
eshc123 committed Aug 12, 2024
2 parents 94c2b0f + 4d31be8 commit 6bdc27b
Show file tree
Hide file tree
Showing 43 changed files with 906 additions and 101 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.goalpanzi.mission_mate.core.data.di

import com.goalpanzi.mission_mate.core.data.repository.LoginRepositoryImpl
import com.goalpanzi.mission_mate.core.data.repository.AuthRepositoryImpl
import com.goalpanzi.mission_mate.core.data.repository.OnboardingRepositoryImpl
import com.goalpanzi.mission_mate.core.data.repository.ProfileRepositoryImpl
import com.goalpanzi.mission_mate.core.domain.repository.LoginRepository
import com.goalpanzi.mission_mate.core.domain.repository.AuthRepository
import com.goalpanzi.mission_mate.core.domain.repository.OnboardingRepository
import com.goalpanzi.mission_mate.core.domain.repository.ProfileRepository
import dagger.Binds
Expand All @@ -16,7 +16,7 @@ import dagger.hilt.components.SingletonComponent
internal abstract class DataModule {

@Binds
abstract fun bindLoginRepository(impl: LoginRepositoryImpl): LoginRepository
abstract fun bindLoginRepository(impl: AuthRepositoryImpl): AuthRepository

@Binds
abstract fun bindProfileRepository(impl: ProfileRepositoryImpl): ProfileRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
package com.goalpanzi.mission_mate.core.data.repository

import com.goalpanzi.mission_mate.core.domain.repository.LoginRepository
import com.goalpanzi.mission_mate.core.domain.repository.AuthRepository
import com.goalpanzi.mission_mate.core.network.service.LoginService
import com.luckyoct.core.model.GoogleLogin
import com.luckyoct.core.model.base.NetworkResult
import com.luckyoct.core.model.request.GoogleLoginRequest
import javax.inject.Inject

class LoginRepositoryImpl @Inject constructor(
class AuthRepositoryImpl @Inject constructor(
private val loginService: LoginService
): LoginRepository {
): AuthRepository {

override suspend fun requestGoogleLogin(email: String) = handleResult {
val request = GoogleLoginRequest(email = email)
loginService.requestGoogleLogin(request)
}

override suspend fun requestLogout(): NetworkResult<Unit> = handleResult {
loginService.requestLogout()
}

override suspend fun requestAccountDelete(): NetworkResult<Unit> = handleResult {
loginService.requestDeleteAccount()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.goalpanzi.mission_mate.core.datastore.datasource

import android.util.Log
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.edit
Expand Down Expand Up @@ -41,5 +40,4 @@ class AuthDataSourceImpl @Inject constructor(
}
emit(Unit)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.goalpanzi.mission_mate.core.datastore.datasource

import kotlinx.coroutines.flow.Flow

interface DefaultDataSource {
fun clearUserData() : Flow<Unit>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.goalpanzi.mission_mate.core.datastore.datasource

import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.edit
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class DefaultDataSourceImpl @Inject constructor(
private val dataStore: DataStore<Preferences>
) : DefaultDataSource {
override fun clearUserData(): Flow<Unit> = flow {
dataStore.edit { preferences ->
preferences.clear()
}
emit(Unit)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.goalpanzi.mission_mate.core.datastore.di

import com.goalpanzi.mission_mate.core.datastore.datasource.AuthDataSource
import com.goalpanzi.mission_mate.core.datastore.datasource.AuthDataSourceImpl
import com.goalpanzi.mission_mate.core.datastore.datasource.DefaultDataSource
import com.goalpanzi.mission_mate.core.datastore.datasource.DefaultDataSourceImpl
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand All @@ -15,4 +17,10 @@ abstract class DataSourceModule {
abstract fun bindAuthDataSource(
authDataSource: AuthDataSourceImpl
): AuthDataSource

@Binds
abstract fun bindDefaultDataSource(
defaultDataSource: DefaultDataSourceImpl
): DefaultDataSource

}
10 changes: 10 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_arrow_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M7.736,3.701L13.653,9.406C13.902,9.646 13.902,10.034 13.653,10.274L7.736,15.979C7.376,16.327 6.791,16.327 6.43,15.979C6.07,15.632 6.07,15.068 6.43,14.721L11.492,9.84L6.43,4.96C6.07,4.612 6.07,4.048 6.43,3.701C6.791,3.353 7.376,3.353 7.736,3.701Z"
android:fillColor="#B3B3B3"
android:fillType="evenOdd"/>
</vector>
Binary file modified core/designsystem/src/main/res/drawable/image_jeju_success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import com.goalpanzi.mission_mate.core.network.ResultHandler
import com.luckyoct.core.model.GoogleLogin
import com.luckyoct.core.model.base.NetworkResult

interface LoginRepository : ResultHandler {
interface AuthRepository : ResultHandler {
suspend fun requestGoogleLogin(email: String): NetworkResult<GoogleLogin>
suspend fun requestLogout(): NetworkResult<Unit>
suspend fun requestAccountDelete(): NetworkResult<Unit>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.goalpanzi.mission_mate.core.domain.usecase

import com.goalpanzi.mission_mate.core.datastore.datasource.DefaultDataSource
import com.goalpanzi.mission_mate.core.domain.repository.AuthRepository
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class AccountDeleteUseCase @Inject constructor(
private val authRepository: AuthRepository,
private val defaultDataSource: DefaultDataSource
) {
operator fun invoke() = flow {
authRepository.requestAccountDelete()
defaultDataSource.clearUserData().first()
emit(Unit)
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package com.goalpanzi.mission_mate.core.domain.usecase

import com.goalpanzi.mission_mate.core.datastore.datasource.AuthDataSource
import com.goalpanzi.mission_mate.core.domain.repository.LoginRepository
import com.goalpanzi.mission_mate.core.domain.repository.AuthRepository
import com.luckyoct.core.model.GoogleLogin
import com.luckyoct.core.model.base.NetworkResult
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class LoginUseCase @Inject constructor(
private val loginRepository: LoginRepository,
private val authRepository: AuthRepository,
private val authDataSource: AuthDataSource
) {
suspend fun requestGoogleLogin(email: String): GoogleLogin? {
return when (val response = loginRepository.requestGoogleLogin(email)) {
return when (val response = authRepository.requestGoogleLogin(email)) {
is NetworkResult.Success -> {
response.data.also {
authDataSource.setAccessToken(it.accessToken).first()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.goalpanzi.mission_mate.core.domain.usecase

import com.goalpanzi.mission_mate.core.datastore.datasource.DefaultDataSource
import com.goalpanzi.mission_mate.core.domain.repository.AuthRepository
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class LogoutUseCase @Inject constructor(
private val authRepository: AuthRepository,
private val defaultDataSource: DefaultDataSource
) {
operator fun invoke() = flow {
authRepository.requestLogout()
defaultDataSource.clearUserData().first()
emit(Unit)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ sealed interface RouteModel {
@Serializable
data object Create : Profile
@Serializable
data object Change : Profile
data object Setting : Profile
}

@Serializable
data object Setting : RouteModel
}

sealed interface OnboardingRouteModel {
Expand All @@ -27,4 +30,16 @@ sealed interface OnboardingRouteModel {

@Serializable
data object InvitationCode : OnboardingRouteModel
}

sealed interface SettingRouteModel {

@Serializable
data object Inquiry : SettingRouteModel

@Serializable
data object ServicePolicy : SettingRouteModel

@Serializable
data object PrivacyPolicy : SettingRouteModel
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.luckyoct.core.model.GoogleLogin
import com.luckyoct.core.model.request.GoogleLoginRequest
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.POST

interface LoginService {
Expand All @@ -12,4 +13,10 @@ interface LoginService {
suspend fun requestGoogleLogin(
@Body request: GoogleLoginRequest
): Response<GoogleLogin>

@POST("/api/auth/logout")
suspend fun requestLogout(): Response<Unit>

@DELETE("/api/member")
suspend fun requestDeleteAccount(): Response<Unit>
}
1 change: 1 addition & 0 deletions feature/main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ dependencies {
implementation(project(":feature:login"))
implementation(project(":feature:onboarding"))
implementation(project(":feature:profile"))
implementation(project(":feature:setting"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ import com.goalpanzi.mission_mate.feature.onboarding.boardSetupNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.boardSetupSuccessNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.invitationCodeNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.onboardingNavGraph
import com.luckyoct.feature.profile.ProfileSettingType
import com.luckyoct.feature.profile.profileNavGraph
import com.luckyoct.feature.setting.navigation.inquiryNavGraph
import com.luckyoct.feature.setting.navigation.privacyPolicyNavGraph
import com.luckyoct.feature.setting.navigation.servicePolicyNavGraph
import com.luckyoct.feature.setting.navigation.settingNavGraph

@Composable
internal fun MainNavHost(
Expand All @@ -37,10 +40,10 @@ internal fun MainNavHost(
onboardingNavGraph(
onClickBoardSetup = { navigator.navigationToBoardSetup() },
onClickInvitationCode = { navigator.navigationToInvitationCode() },
onClickSetting = { },
onNavigateMissionBoard = { missionId ->

}
},
onClickSetting = { navigator.navigationToSetting() }
)
boardSetupNavGraph(
onSuccess = {
Expand All @@ -64,7 +67,25 @@ internal fun MainNavHost(
}
)
profileNavGraph(
onSaveSuccess = { navigator.navigationToOnboarding() }
onSaveSuccess = { navigator.navigationToOnboarding() },
onBackClick = { navigator.popBackStack() }
)
settingNavGraph(
onBackClick = { navigator.popBackStack() },
onClickProfileSetting = { navigator.navigateToProfileSetting() },
onClickInquiry = { navigator.navigationToInquiry() },
onClickServicePolicy = { navigator.navigationToServicePolicy() },
onClickPrivacyPolicy = { navigator.navigationToPrivacyPolicy() },
onClickLogout = { navigator.navigateToLogin() }
)
inquiryNavGraph(
onBackClick = { navigator.popBackStack() }
)
servicePolicyNavGraph(
onBackClick = { navigator.popBackStack() }
)
privacyPolicyNavGraph(
onBackClick = { navigator.popBackStack() }
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import com.goalpanzi.mission_mate.feature.onboarding.navigateToBoardSetupSuccess
import com.goalpanzi.mission_mate.feature.onboarding.navigateToInvitationCode
import com.goalpanzi.mission_mate.feature.onboarding.navigateToOnboarding
import com.luckyoct.feature.profile.navigateToProfileCreate
import com.luckyoct.feature.profile.navigateToProfileSetting
import com.luckyoct.feature.setting.navigation.navigateToInquiry
import com.luckyoct.feature.setting.navigation.navigateToPrivacyPolicy
import com.luckyoct.feature.setting.navigation.navigateToServicePolicy
import com.luckyoct.feature.setting.navigation.navigateToSetting

class MainNavigator(
val navController: NavHostController
Expand All @@ -31,6 +36,10 @@ class MainNavigator(
navController.navigateToProfileCreate()
}

fun navigateToProfileSetting() {
navController.navigateToProfileSetting()
}

fun navigationToOnboarding() {
navController.navigateToOnboarding()
}
Expand All @@ -46,6 +55,22 @@ class MainNavigator(
fun navigationToInvitationCode() {
navController.navigateToInvitationCode()
}

fun navigationToSetting() {
navController.navigateToSetting()
}

fun navigationToInquiry() {
navController.navigateToInquiry()
}

fun navigationToServicePolicy() {
navController.navigateToServicePolicy()
}

fun navigationToPrivacyPolicy() {
navController.navigateToPrivacyPolicy()
}
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ fun DatePickerDialog(
selectableStartDate: LocalDate?,
selectableEndDate: LocalDate?,
onSuccess: (Long) -> Unit,
onDismiss: () -> Unit
onDismiss: () -> Unit,
initialDisplayedMonthMillis : Long? = null,
) {
val datePickerState = rememberDatePickerState(
initialSelectedDateMillis = selectedDate?.let { localDateToMillis(it) },
initialDisplayedMonthMillis = initialDisplayedMonthMillis,
selectableDates = object : SelectableDates {
override fun isSelectableDate(utcTimeMillis: Long): Boolean {
val startMillis = localDateToMillis(selectableStartDate)
Expand Down
Loading

0 comments on commit 6bdc27b

Please sign in to comment.