Skip to content

Commit bc5ea66

Browse files
committed
feat/#66: 로그아웃 기능 일부 구현
1 parent 608c656 commit bc5ea66

File tree

11 files changed

+69
-12
lines changed

11 files changed

+69
-12
lines changed

core/data-api/src/main/java/com/yapp/data_api/MyClass.kt

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.yapp.dataapi
2+
3+
interface AuthorizedUserRepository {
4+
suspend fun clearTokens()
5+
}

core/data-api/src/main/java/com/yapp/data_api/UnAuthorizedUserRepository.kt renamed to core/data-api/src/main/java/com/yapp/dataapi/UnAuthorizedUserRepository.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.yapp.data_api
1+
package com.yapp.dataapi
22

33
import com.yapp.model.SignUpInfo
44
import com.yapp.model.SignUpResult

core/data/src/main/java/com/yapp/core/data/data/di/RepositoryModule.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.yapp.core.data.data.di
22

3+
import com.yapp.core.data.data.repository.AuthorizedUserRepositoryImpl
34
import com.yapp.core.data.data.repository.UnAuthorizedUserRepositoryImpl
4-
import com.yapp.data_api.UnAuthorizedUserRepository
5+
import com.yapp.dataapi.AuthorizedUserRepository
6+
import com.yapp.dataapi.UnAuthorizedUserRepository
57
import dagger.Binds
68
import dagger.Module
79
import dagger.hilt.InstallIn
@@ -13,6 +15,11 @@ internal abstract class RepositoryModule {
1315

1416
@Binds
1517
abstract fun bindUnAuthorizedUserRepositoryImpl(
16-
unAuthorizedUserRepositoryImpl: UnAuthorizedUserRepositoryImpl,
18+
repositoryImpl: UnAuthorizedUserRepositoryImpl,
1719
): UnAuthorizedUserRepository
20+
21+
@Binds
22+
abstract fun bindAuthorizedUserRepositoryImpl(
23+
repositoryImpl: AuthorizedUserRepositoryImpl,
24+
): AuthorizedUserRepository
1825
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.yapp.core.data.data.repository
2+
3+
import com.yapp.core.data.local.SecurityPreferences
4+
import com.yapp.core.data.remote.api.UnAuthorizedUserApi
5+
import com.yapp.core.data.remote.model.request.toData
6+
import com.yapp.core.data.remote.model.response.toModel
7+
import com.yapp.dataapi.AuthorizedUserRepository
8+
import com.yapp.dataapi.UnAuthorizedUserRepository
9+
import com.yapp.model.SignUpInfo
10+
import com.yapp.model.SignUpResult
11+
import javax.inject.Inject
12+
import kotlin.jvm.optionals.getOrNull
13+
14+
internal class AuthorizedUserRepositoryImpl @Inject constructor(
15+
private val securityPreferences: SecurityPreferences,
16+
): AuthorizedUserRepository {
17+
18+
override suspend fun clearTokens() {
19+
securityPreferences.clearAll()
20+
}
21+
}

core/data/src/main/java/com/yapp/core/data/data/repository/UnAuthorizedUserRepositoryImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.yapp.core.data.local.SecurityPreferences
44
import com.yapp.core.data.remote.api.UnAuthorizedUserApi
55
import com.yapp.core.data.remote.model.request.toData
66
import com.yapp.core.data.remote.model.response.toModel
7-
import com.yapp.data_api.UnAuthorizedUserRepository
7+
import com.yapp.dataapi.UnAuthorizedUserRepository
88
import com.yapp.model.SignUpInfo
99
import com.yapp.model.SignUpResult
1010
import javax.inject.Inject
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.yapp.domain
2+
3+
import com.yapp.dataapi.AuthorizedUserRepository
4+
import javax.inject.Inject
5+
6+
class LogoutUseCase @Inject constructor(
7+
private val authorizedUserRepository: AuthorizedUserRepository,
8+
) {
9+
suspend operator fun invoke() = runCatchingIgnoreCancelled {
10+
authorizedUserRepository.clearTokens()
11+
}
12+
}

core/domain/src/main/java/com/yapp/domain/SignUpUseCase.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.yapp.domain
22

3-
import com.yapp.data_api.UnAuthorizedUserRepository
3+
import com.yapp.dataapi.UnAuthorizedUserRepository
44
import com.yapp.model.SignUpInfo
5-
import kotlinx.coroutines.delay
65
import javax.inject.Inject
76

87
class SignUpUseCase @Inject constructor(

feature/home/src/main/java/com/yapp/feature/home/setting/SettingContract.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ sealed interface SettingSideEffect {
2727
data object OpenPrivacyPolicy : SettingSideEffect
2828
data object OpenTerms : SettingSideEffect
2929
data object OpenInquiry : SettingSideEffect
30+
data object NavigateToLogin : SettingSideEffect
3031
}

feature/home/src/main/java/com/yapp/feature/home/setting/SettingScreen.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ fun SettingRoute(
5757

5858
SettingSideEffect.OpenInquiry -> {
5959
}
60+
61+
SettingSideEffect.NavigateToLogin -> {
62+
}
6063
}
6164
}
6265

0 commit comments

Comments
 (0)