Merge branch 'master' into devel

master
Koitharu 1 year ago
commit 19f398d309
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

1
.gitignore vendored

@ -26,3 +26,4 @@
.cxx .cxx
/.idea/deviceManager.xml /.idea/deviceManager.xml
/.kotlin/ /.kotlin/
/.idea/AndroidProjectSystem.xml

@ -41,11 +41,13 @@ import org.koitharu.kotatsu.scrobbling.common.domain.ScrobblerAuthRequiredExcept
import java.io.ObjectOutputStream import java.io.ObjectOutputStream
import java.net.ConnectException import java.net.ConnectException
import java.net.NoRouteToHostException import java.net.NoRouteToHostException
import java.net.SocketException
import java.net.SocketTimeoutException import java.net.SocketTimeoutException
import java.net.UnknownHostException import java.net.UnknownHostException
import java.util.Locale import java.util.Locale
private const val MSG_NO_SPACE_LEFT = "No space left on device" private const val MSG_NO_SPACE_LEFT = "No space left on device"
private const val MSG_CONNECTION_RESET = "Connection reset"
private const val IMAGE_FORMAT_NOT_SUPPORTED = "Image format not supported" private const val IMAGE_FORMAT_NOT_SUPPORTED = "Image format not supported"
fun Throwable.getDisplayMessage(resources: Resources): String = getDisplayMessageOrNull(resources) fun Throwable.getDisplayMessage(resources: Resources): String = getDisplayMessageOrNull(resources)
@ -117,7 +119,7 @@ private fun Throwable.getDisplayMessageOrNull(resources: Resources): String? = w
is HttpException -> getHttpDisplayMessage(response.code, resources) is HttpException -> getHttpDisplayMessage(response.code, resources)
is HttpStatusException -> getHttpDisplayMessage(statusCode, resources) is HttpStatusException -> getHttpDisplayMessage(statusCode, resources)
else -> getDisplayMessage(message, resources) ?: message else -> mapDisplayMessage(message, resources) ?: message
}.takeUnless { it.isNullOrBlank() } }.takeUnless { it.isNullOrBlank() }
@DrawableRes @DrawableRes
@ -154,10 +156,11 @@ private fun getHttpDisplayMessage(statusCode: Int, resources: Resources): String
else -> null else -> null
} }
private fun getDisplayMessage(msg: String?, resources: Resources): String? = when { private fun mapDisplayMessage(msg: String?, resources: Resources): String? = when {
msg.isNullOrEmpty() -> null msg.isNullOrEmpty() -> null
msg.contains(MSG_NO_SPACE_LEFT) -> resources.getString(R.string.error_no_space_left) msg.contains(MSG_NO_SPACE_LEFT) -> resources.getString(R.string.error_no_space_left)
msg.contains(IMAGE_FORMAT_NOT_SUPPORTED) -> resources.getString(R.string.error_corrupted_file) msg.contains(IMAGE_FORMAT_NOT_SUPPORTED) -> resources.getString(R.string.error_corrupted_file)
msg == MSG_CONNECTION_RESET -> resources.getString(R.string.error_connection_reset)
msg == FILTER_MULTIPLE_GENRES_NOT_SUPPORTED -> resources.getString(R.string.error_multiple_genres_not_supported) msg == FILTER_MULTIPLE_GENRES_NOT_SUPPORTED -> resources.getString(R.string.error_multiple_genres_not_supported)
msg == FILTER_MULTIPLE_STATES_NOT_SUPPORTED -> resources.getString(R.string.error_multiple_states_not_supported) msg == FILTER_MULTIPLE_STATES_NOT_SUPPORTED -> resources.getString(R.string.error_multiple_states_not_supported)
msg == SEARCH_NOT_SUPPORTED -> resources.getString(R.string.error_search_not_supported) msg == SEARCH_NOT_SUPPORTED -> resources.getString(R.string.error_search_not_supported)
@ -184,6 +187,7 @@ fun Throwable.isReportable(): Boolean {
|| this is WrongPasswordException || this is WrongPasswordException
|| this is TooManyRequestExceptions || this is TooManyRequestExceptions
|| this is HttpStatusException || this is HttpStatusException
|| this is SocketException
) { ) {
return false return false
} }

@ -661,5 +661,5 @@
<string name="invalid_server_address_message">mangatime.org</string> <string name="invalid_server_address_message">mangatime.org</string>
<string name="retry">حاول مجدداً</string> <string name="retry">حاول مجدداً</string>
<string name="pages_saved">الصفحات المحفوظة</string> <string name="pages_saved">الصفحات المحفوظة</string>
<string name="too_many_requests_message_retry">هنالك الكثير من الطلبات. حاول مرة أخرى بعد% s</string> <string name="too_many_requests_message_retry">هنالك الكثير من الطلبات. حاول مرة أخرى بعد%s</string>
</resources> </resources>

@ -777,4 +777,5 @@
<string name="show_slider">Show slider</string> <string name="show_slider">Show slider</string>
<!-- Button label, should be as short as possible --> <!-- Button label, should be as short as possible -->
<string name="incognito">Incognito</string> <string name="incognito">Incognito</string>
<string name="error_connection_reset">Connection reset by remote host</string>
</resources> </resources>

@ -7,6 +7,7 @@ avifDecoder = "1.1.1.14d8e3c4"
biometric = "1.2.0-alpha05" biometric = "1.2.0-alpha05"
coil = "3.0.4" coil = "3.0.4"
collections = "1.4.5" collections = "1.4.5"
#noinspection GradleDependency - 2.5.3 cause crashes
conscrypt = "2.5.2" conscrypt = "2.5.2"
constraintlayout = "2.2.0" constraintlayout = "2.2.0"
coreKtx = "1.15.0" coreKtx = "1.15.0"
@ -30,7 +31,7 @@ material = "1.13.0-alpha08"
moshi = "1.15.1" moshi = "1.15.1"
okhttp = "4.12.0" okhttp = "4.12.0"
okio = "3.9.1" okio = "3.9.1"
parsers = "883886bc32" parsers = "fece09b781"
preference = "1.2.1" preference = "1.2.1"
recyclerview = "1.3.2" recyclerview = "1.3.2"
room = "2.6.1" room = "2.6.1"

Loading…
Cancel
Save