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

[HOTFIX/#427] Recommend / 카톡 친구 불러오기 실패 이슈 해결 #428

Merged
merged 4 commits into from
Mar 13, 2024
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 @@ -19,12 +19,12 @@ import com.el.yello.presentation.main.recommend.list.RecommendItemDecoration
import com.el.yello.presentation.main.recommend.list.RecommendViewHolder
import com.el.yello.util.extension.BaseLinearRcvItemDeco
import com.el.yello.util.extension.setPullToScrollColor
import com.el.yello.util.manager.AmplitudeManager
import com.el.yello.util.extension.yelloSnackbar
import com.el.yello.util.manager.AmplitudeManager
import com.example.domain.entity.RecommendListModel
import com.example.ui.base.BindingFragment
import com.example.ui.state.UiState
import com.example.ui.extension.setOnSingleClickListener
import com.example.ui.state.UiState
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.launchIn
Expand Down Expand Up @@ -165,9 +165,15 @@ class RecommendKakaoFragment :

private fun observeKakaoError() {
viewModel.getKakaoErrorResult.flowWithLifecycle(lifecycle).onEach { result ->
if (result) {
yelloSnackbar(requireView(), getString(R.string.internet_connection_error_msg))
showShimmerView(isLoading = true, hasList = true)
when (result) {
0 -> return@onEach

3 -> {
yelloSnackbar(requireView(), getString(R.string.kakao_connection_error_msg))
showShimmerView(isLoading = false, hasList = false)
}

else -> viewModel.getIdListFromKakao()
}
}.launchIn(lifecycleScope)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class RecommendKakaoViewModel @Inject constructor(
private val authRepository: AuthRepository,
) : ViewModel() {

private val _getKakaoErrorResult = MutableStateFlow(false)
val getKakaoErrorResult: StateFlow<Boolean> = _getKakaoErrorResult
private val _getKakaoErrorResult = MutableStateFlow(0)
val getKakaoErrorResult: StateFlow<Int> = _getKakaoErrorResult

private val _postFriendsListState = MutableStateFlow<UiState<RecommendListModel>>(UiState.Empty)
val postFriendsListState: StateFlow<UiState<RecommendListModel>> = _postFriendsListState
Expand Down Expand Up @@ -65,7 +65,7 @@ class RecommendKakaoViewModel @Inject constructor(
totalPage = Int.MAX_VALUE
_postFriendsListState.value = UiState.Empty
_addFriendState.value = UiState.Empty
_getKakaoErrorResult.value = false
_getKakaoErrorResult.value = 0
}

fun getIdListFromKakao() {
Expand All @@ -76,9 +76,10 @@ class RecommendKakaoViewModel @Inject constructor(
_postFriendsListState.value = UiState.Loading
isFirstFriendsListPage = false
}
if (currentOffset <= 0) currentOffset = 0
TalkApiClient.instance.friends(offset = currentOffset, limit = 100) { friends, error ->
if (error != null) {
_getKakaoErrorResult.value = true
_getKakaoErrorResult.value += 1
} else if (friends != null) {
totalPage = ceil((friends.totalCount * 0.01)).toInt() - 1
if (totalPage == currentPage) isPagingFinish = true
Expand All @@ -98,6 +99,7 @@ class RecommendKakaoViewModel @Inject constructor(
.onSuccess {
it ?: return@launch
_postFriendsListState.value = UiState.Success(it)
_postFriendsListState.value = UiState.Empty
}
.onFailure {
_postFriendsListState.value = UiState.Failure(it.message.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class RecommendSchoolViewModel @Inject constructor(
totalPage = ceil((it.totalCount * 0.01)).toInt() - 1
if (totalPage == currentPage) isPagingFinish = true
_postFriendsListState.value = UiState.Success(it)
_postFriendsListState.value = UiState.Empty
}
.onFailure {
_postFriendsListState.value = UiState.Failure(it.message.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class SearchViewModel @Inject constructor(
totalPage = ceil((it.totalCount * 0.1)).toInt() - 1
if (totalPage == currentPage) isPagingFinish = true
_postFriendsListState.value = UiState.Success(it)
_postFriendsListState.value = UiState.Empty
}
.onFailure { t ->
_postFriendsListState.value = UiState.Failure(t.message.toString())
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<string name="token_expire_error_msg">로그인 상태를 확인해주세요!</string>
<string name="internet_connection_error_msg">인터넷 연결을 확인해주세요!</string>
<string name="kakao_connection_error_msg">카카오톡 연동에 문제가 발생했습니다.</string>
<string name="adapter_not_initialized_error_msg">Adapter is not initialized</string>
<string name="manager_not_initialized_error_msg">Billing Manager is not initialized</string>

Expand Down
2 changes: 1 addition & 1 deletion build-logic/convention/src/main/kotlin/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object Constants {
const val compileSdk = 33
const val minSdk = 28
const val targetSdk = 33
const val versionCode = 42
const val versionCode = 43
const val versionName = "2.0"
const val jvmVersion = "17"
}
Loading