Skip to content
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

DEP-000 fix: 로그아웃, 회원탈퇴시 앱에 저장된 데이터 모두 삭제 #199

Merged
merged 2 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,10 @@ abstract class RepositoryModule {
abstract fun bindsDeviceUniqueIdRepository(
repository: DeviceUniqueIdRepositoryImpl,
): DeviceUniqueIdRepository

@Binds
@Singleton
abstract fun bindsLocalDataRepository(
repository: LocalDataRepositoryImpl,
): LocalDataRepository
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.depromeet.threedays.data.repository

import com.depromeet.threedays.data.datasource.datastore.DataStoreDataSource
import com.depromeet.threedays.domain.repository.LocalDataRepository
import javax.inject.Inject

class LocalDataRepositoryImpl @Inject constructor(
private val dataStoreDataSource: DataStoreDataSource,
) : LocalDataRepository {
override suspend fun removeAll() {
dataStoreDataSource.resetDataStore()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.depromeet.threedays.domain.repository

interface LocalDataRepository {
suspend fun removeAll()
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package com.depromeet.threedays.domain.usecase.member

import com.depromeet.threedays.domain.repository.AuthRepository
import com.depromeet.threedays.domain.repository.DeviceUniqueIdRepository
import com.depromeet.threedays.domain.repository.LocalDataRepository
import com.depromeet.threedays.domain.repository.MemberRepository
import javax.inject.Inject

class LogoutUseCase @Inject constructor(
private val memberRepository: MemberRepository,
private val deviceUniqueIdRepository: DeviceUniqueIdRepository,
private val authRepository: AuthRepository,
private val localDataRepository: LocalDataRepository,
) {
suspend operator fun invoke() {
// TODO: deviceId 조회 기능 추가
val deviceId = "identificationKey"
memberRepository.logout(deviceId = deviceId)
deviceUniqueIdRepository.findOne()?.let { deviceId ->
memberRepository.logout(deviceId = deviceId)
}
authRepository.removeTokensFromLocal()
// TODO: notification permission 삭제
localDataRepository.removeAll()
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package com.depromeet.threedays.domain.usecase.member

import com.depromeet.threedays.domain.repository.AuthRepository
import com.depromeet.threedays.domain.repository.LocalDataRepository
import com.depromeet.threedays.domain.repository.MemberRepository
import javax.inject.Inject

class WithdrawUseCase @Inject constructor(
private val memberRepository: MemberRepository,
private val authRepository: AuthRepository,
private val localDataRepository: LocalDataRepository,
) {
suspend operator fun invoke() {
memberRepository.withdraw()
authRepository.removeTokensFromLocal()
// TODO: notification permission 삭제
localDataRepository.removeAll()
}
}