forked from melod1n/fast-messenger
Release 0.1.7 (#136)
* Bump haze from 1.1.1 to 1.2.0 (#105) * Bump org.jetbrains.kotlinx:kotlinx-serialization-json from 1.7.3 to 1.8.0 (#104) * update gradle wrapper * Bump agp from 8.7.3 to 8.8.0 (#106) * Bump com.jraska.module.graph.assertion from 2.7.1 to 2.7.3 (#109) * Bump haze from 1.2.0 to 1.2.2 (#111) * Bump koin from 4.0.1 to 4.0.2 (#112) * little improvement * Bump kotlin from 2.1.0 to 2.1.10 (#113) * Bump androidx.compose:compose-bom from 2024.12.01 to 2025.02.00 (#115) * Bump androidx.navigation:navigation-compose from 2.8.5 to 2.8.7 (#119) * Bump haze from 1.2.2 to 1.3.1 (#118) * Bump ksp from 2.1.0-1.0.29 to 2.1.10-1.0.30 (#116) * Bump agp from 8.8.0 to 8.8.1 (#117) * Bump com.google.accompanist:accompanist-permissions (#121) * Rename the app's namespace and applicationId to `dev.meloda.fastvk`, and update the package name in `ACTION_MANAGE_UNKNOWN_APP_SOURCES` intent. Remove unnecessary `onLowMemory` method in the `OnlineService`. * Bump com.jraska.module.graph.assertion from 2.7.3 to 2.8.0 (#126) * Bump ksp from 2.1.10-1.0.30 to 2.1.10-1.0.31 (#125) * Bump haze from 1.3.1 to 1.4.0 (#124) * Bump agp from 8.8.1 to 8.8.2 (#123) * Bump androidx.navigation:navigation-compose from 2.8.7 to 2.8.8 (#122) * Bump haze from 1.4.0 to 1.5.0 (#128) * Bump agp from 8.8.2 to 8.9.0 (#127) * Bump androidx.navigation:navigation-compose from 2.8.8 to 2.8.9 (#130) * Bump androidx.compose:compose-bom from 2025.02.00 to 2025.03.00 (#129) * revert agp version to 8.8.2 * fix issues with package names * Bump haze from 1.5.0 to 1.5.1 (#133) * Bump com.google.guava:guava from 33.4.0-jre to 33.4.5-jre (#132) * russian translations * fixes and improvements --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
+36
-11
@@ -134,6 +134,7 @@ class ConversationsViewModelImpl(
|
||||
}
|
||||
|
||||
override fun onRefresh() {
|
||||
baseError.setValue { null }
|
||||
loadConversations(offset = 0)
|
||||
}
|
||||
|
||||
@@ -273,17 +274,7 @@ class ConversationsViewModelImpl(
|
||||
conversationsUseCase.getConversations(count = LOAD_COUNT, offset = offset)
|
||||
.listenValue(viewModelScope) { state ->
|
||||
state.processState(
|
||||
error = { error ->
|
||||
if (error is State.Error.ApiError) {
|
||||
when (error.errorCode) {
|
||||
VkErrorCode.USER_AUTHORIZATION_FAILED -> {
|
||||
baseError.setValue { BaseError.SessionExpired }
|
||||
}
|
||||
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
},
|
||||
error = ::handleError,
|
||||
success = { response ->
|
||||
val itemsCountSufficient = response.size == LOAD_COUNT
|
||||
canPaginate.setValue { itemsCountSufficient }
|
||||
@@ -339,6 +330,40 @@ class ConversationsViewModelImpl(
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleError(error: State.Error) {
|
||||
when (error) {
|
||||
is State.Error.ApiError -> {
|
||||
when (error.errorCode) {
|
||||
VkErrorCode.USER_AUTHORIZATION_FAILED -> {
|
||||
baseError.setValue { BaseError.SessionExpired }
|
||||
}
|
||||
|
||||
else -> {
|
||||
baseError.setValue {
|
||||
BaseError.SimpleError(message = error.errorMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
State.Error.ConnectionError -> {
|
||||
baseError.setValue {
|
||||
BaseError.SimpleError(message = "Connection error")
|
||||
}
|
||||
}
|
||||
State.Error.InternalError -> {
|
||||
baseError.setValue {
|
||||
BaseError.SimpleError(message = "Internal error")
|
||||
}
|
||||
}
|
||||
State.Error.UnknownError -> {
|
||||
baseError.setValue {
|
||||
BaseError.SimpleError(message = "Unknown error")
|
||||
}
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteConversation(peerId: Int) {
|
||||
conversationsUseCase.delete(peerId).listenValue(viewModelScope) { state ->
|
||||
state.processState(
|
||||
|
||||
+18
-6
@@ -339,12 +339,24 @@ fun ConversationsScreen(
|
||||
}
|
||||
) { padding ->
|
||||
when {
|
||||
baseError is BaseError.SessionExpired -> {
|
||||
ErrorView(
|
||||
text = "Session expired",
|
||||
buttonText = "Log out",
|
||||
onButtonClick = onSessionExpiredLogOutButtonClicked
|
||||
)
|
||||
baseError != null -> {
|
||||
when (baseError) {
|
||||
is BaseError.SessionExpired -> {
|
||||
ErrorView(
|
||||
text = "Session expired",
|
||||
buttonText = "Log out",
|
||||
onButtonClick = onSessionExpiredLogOutButtonClicked
|
||||
)
|
||||
}
|
||||
|
||||
is BaseError.SimpleError -> {
|
||||
ErrorView(
|
||||
text = baseError.message,
|
||||
buttonText = "Try again",
|
||||
onButtonClick = onRefresh
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
screenState.isLoading && screenState.conversations.isEmpty() -> FullScreenLoader()
|
||||
|
||||
Reference in New Issue
Block a user