Skip to content

Commit

Permalink
#68 [FIX] : fix fcm logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sohyun127 committed Sep 5, 2024
1 parent 4f232d1 commit f762007
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions feature/home/src/main/java/com/teamwable/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(FragmentHomeBinding::i
is HomeUiState.Loading -> findNavController().navigate(HomeFragmentDirections.actionHomeToLoading())
is HomeUiState.Error -> (activity as Navigation).navigateToErrorFragment()
is HomeUiState.Success -> Unit
is HomeUiState.AddPushAlarmPermission -> initPushAlarmPermissionAlert()
is HomeUiState.AddPushAlarmPermission -> if (uiState.isAllowed == null) initPushAlarmPermissionAlert()
}
}
}
Expand All @@ -72,7 +72,7 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(FragmentHomeBinding::i
when (sideEffect) {
is HomeSideEffect.ShowSnackBar -> Snackbar.make(binding.root, sideEffect.type).show()
is HomeSideEffect.DismissBottomSheet -> findNavController().popBackStack()
is HomeSideEffect.SaveIsPushAllowed -> viewModel.saveIsPushAlarmAllowed(sideEffect.isAllowed)
else -> Unit
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class HomeViewModel @Inject constructor(
private var authId = -1L

init {
fetchIsPushAlarmAllowed()
fetchAuthId()
fetchIsPushAlarmAllowed()
}

private fun fetchAuthId() {
Expand Down Expand Up @@ -149,7 +149,7 @@ class HomeViewModel @Inject constructor(
}
}

fun fetchIsPushAlarmAllowed() {
private fun fetchIsPushAlarmAllowed() {
viewModelScope.launch {
userInfoRepository.getIsPushAlarmAllowed().collectLatest { _uiState.value = HomeUiState.AddPushAlarmPermission(it) }
}
Expand All @@ -163,7 +163,7 @@ sealed interface HomeUiState {

data class Error(val errorMessage: String) : HomeUiState

data class AddPushAlarmPermission(val isAllowed: Boolean) : HomeUiState
data class AddPushAlarmPermission(val isAllowed: Boolean?) : HomeUiState
}

sealed interface HomeSideEffect {
Expand Down

0 comments on commit f762007

Please sign in to comment.