Skip to content
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 @@ -22,7 +22,7 @@ import com.afternote.feature.setting.presentation.account.social.requestGoogleId
import com.afternote.feature.setting.presentation.account.social.toKakaoAuthResult

@Composable
fun ConnectedAccountsScreen(
internal fun ConnectedAccountsScreen(
onBack: () -> Unit,
modifier: Modifier = Modifier,
viewModel: ConnectedAccountsViewModel = hiltViewModel(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.afternote.feature.setting.presentation.account

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.afternote.core.common.result.runCatchingCancellable
import com.afternote.core.model.user.UserConnectedAccount
import com.afternote.feature.setting.domain.SettingAccountRepository
import com.afternote.feature.setting.presentation.R
Expand All @@ -15,7 +16,7 @@ import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class ConnectedAccountsViewModel
internal class ConnectedAccountsViewModel
@Inject
constructor(
private val accountRepository: SettingAccountRepository,
Expand All @@ -32,7 +33,7 @@ class ConnectedAccountsViewModel

private fun loadConnectedAccounts() {
viewModelScope.launch {
runCatching { accountRepository.getConnectedAccounts() }
runCatchingCancellable { accountRepository.getConnectedAccounts() }
.onSuccess { accounts ->
_uiState.update { it.copy(isLoading = false, accounts = accounts.toStateList()) }
}.onFailure {
Expand Down Expand Up @@ -61,15 +62,15 @@ class ConnectedAccountsViewModel
accessToken: String,
) {
viewModelScope.launch {
runCatching { accountRepository.linkConnectedAccount(provider, accessToken) }
runCatchingCancellable { accountRepository.linkConnectedAccount(provider, accessToken) }
.onSuccess { accounts -> _uiState.update { it.copy(accounts = accounts.toStateList()) } }
.onFailure { _uiState.update { it.copy(errorMessage = "계정 연결에 실패했습니다.") } }
}
}

private fun unlink(provider: String) {
viewModelScope.launch {
runCatching { accountRepository.unlinkConnectedAccount(provider) }
runCatchingCancellable { accountRepository.unlinkConnectedAccount(provider) }
.onSuccess { accounts -> _uiState.update { it.copy(accounts = accounts.toStateList()) } }
.onFailure { _uiState.update { it.copy(errorMessage = "계정 연결 해제에 실패했습니다.") } }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.afternote.feature.setting.presentation.home

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.afternote.core.common.result.runCatchingCancellable
import com.afternote.core.domain.repository.MyProfileRepository
import com.afternote.core.domain.repository.auth.AuthRepository
import com.afternote.feature.setting.domain.SettingAccountRepository
Expand Down Expand Up @@ -42,7 +43,7 @@ sealed interface WithdrawUiState {
* 로컬 토큰은 결과 무관하게 정리하도록 위임돼 있다. 호출처는 토큰 정리 여부를 신경 쓸 필요 없음.
*/
@HiltViewModel
class SettingViewModel
internal class SettingViewModel
@Inject
constructor(
private val authRepository: AuthRepository,
Expand All @@ -63,7 +64,7 @@ class SettingViewModel

private fun loadProfile() {
viewModelScope.launch {
runCatching { myProfileRepository.getMyProfile() }
runCatchingCancellable { myProfileRepository.getMyProfile() }
.onSuccess { profile ->
_uiState.value =
SettingUiState.Success(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.afternote.core.ui.popup.PopupType
import com.afternote.feature.setting.presentation.R

@Composable
fun WithdrawConfirmScreen(
internal fun WithdrawConfirmScreen(
uiState: SettingUiState,
onBackClick: () -> Unit,
onWithdrawSuccess: () -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import com.afternote.feature.setting.presentation.notification.component.DeviceA
import com.afternote.feature.setting.presentation.shared.component.SettingMenuItem

@Composable
fun NotificationSettingScreen(
internal fun NotificationSettingScreen(
onBack: () -> Unit,
onPushNotificationClick: () -> Unit,
viewModel: PushNotificationViewModel = hiltViewModel(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.afternote.feature.setting.presentation.notification.component.DeviceA
import com.afternote.feature.setting.presentation.notification.component.PushToggleSection

@Composable
fun PushNotificationScreen(
internal fun PushNotificationScreen(
onBack: () -> Unit,
viewModel: PushNotificationViewModel = hiltViewModel(),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch

@HiltViewModel
class PushNotificationViewModel
internal class PushNotificationViewModel
@Inject
constructor(
@ApplicationContext private val context: Context,
Expand Down Expand Up @@ -84,7 +84,7 @@ class PushNotificationViewModel
private fun loadMarketingConsents() {
viewModelScope.launch {
Log.d(TAG, "loadMarketingConsents: start")
runCatching { notificationRepository.getMyMarketingConsents() }
runCatchingCancellable { notificationRepository.getMyMarketingConsents() }
.onSuccess { consent ->
Log.d(TAG, "loadMarketingConsents: success=$consent")
_uiState.update {
Expand Down
Loading
Loading