-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f031d8
commit 7060c7b
Showing
10 changed files
with
163 additions
and
43 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
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
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
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
40 changes: 40 additions & 0 deletions
40
feature/setting/src/main/java/store/newsbriefing/app/feature/setting/SettingViewModel.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,40 @@ | ||
package store.newsbriefing.app.feature.setting | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.flow.first | ||
import kotlinx.coroutines.launch | ||
import store.newsbriefing.app.core.common.util.EventFlow | ||
import store.newsbriefing.app.core.common.util.MutableEventFlow | ||
import store.newsbriefing.app.core.common.util.asEventFlow | ||
import store.newsbriefing.app.core.data.repository.MemberRepository | ||
import store.newsbriefing.app.core.data.repository.MemberTokenRepository | ||
import javax.inject.Inject | ||
|
||
sealed class SettingEvent { | ||
data class ErrorOccurred(val message: String) : SettingEvent() | ||
data object Logout : SettingEvent() | ||
data object DeleteMember : SettingEvent() | ||
} | ||
|
||
@HiltViewModel | ||
class SettingViewModel @Inject constructor( | ||
private val memberRepository: MemberRepository, | ||
private val memberTokenRepository: MemberTokenRepository | ||
) : ViewModel() { | ||
val eventFlow: EventFlow<SettingEvent> | ||
get() = _eventFlow.asEventFlow() | ||
private val _eventFlow = MutableEventFlow<SettingEvent>() | ||
|
||
fun logout() = viewModelScope.launch { | ||
memberTokenRepository.clearMemberToken() | ||
_eventFlow.emit(SettingEvent.Logout) | ||
} | ||
|
||
fun deleteMember() = viewModelScope.launch { | ||
val userId = memberTokenRepository.getMemberToken().first().memberId | ||
memberRepository.deleteMember(userId) | ||
_eventFlow.emit(SettingEvent.DeleteMember) | ||
} | ||
} |
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,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="setting_title">설정</string> | ||
<string name="subscription_service">구독 서비스</string> | ||
<string name="briefing_premium">Briefing Premium</string> | ||
<string name="app_information">앱 정보</string> | ||
<string name="app_version">앱 버전</string> | ||
<string name="feedback_and_inquiry">피드백 및 문의하기</string> | ||
<string name="version_note">버전 노트</string> | ||
<string name="privacy_policy">개인 정보 보호</string> | ||
<string name="terms_of_service">이용 약관</string> | ||
<string name="data_processing_policy">개인정보처리방침</string> | ||
<string name="precautions">유의 사항</string> | ||
<string name="user_management">회원 관리</string> | ||
<string name="logout">로그아웃</string> | ||
<string name="withdrawal">회원 탈퇴</string> | ||
</resources> |