From a3bcfd0a4301d6a4446ee71c98e4ae4bf6d1598d Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Wed, 4 Dec 2024 16:01:34 +0100 Subject: [PATCH 1/3] refactor: Update AppSettingsDB space --- .../database/models/appSettings/AppSettingsDB.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/appSettings/AppSettingsDB.kt b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/appSettings/AppSettingsDB.kt index 1ff88e04..40e87d2b 100644 --- a/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/appSettings/AppSettingsDB.kt +++ b/STDatabase/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/database/models/appSettings/AppSettingsDB.kt @@ -69,7 +69,7 @@ class AppSettingsDB() : RealmObject, AppSettings { companion object { val DEFAULT_VALIDITY_PERIOD = ValidityPeriod.THIRTY val DEFAULT_DOWNLOAD_LIMIT = DownloadLimit.TWO_HUNDRED_FIFTY - + private val DEFAULT_EMAIL_LANGUAGE = EmailLanguage.ENGLISH private val DEFAULT_THEME = Theme.SYSTEM private val DEFAULT_TRANSFER_TYPE = TransferType.QR_CODE From 17fd931813a5d373f81505eff30be60bac5d903d Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Wed, 4 Dec 2024 16:03:57 +0100 Subject: [PATCH 2/3] fix: Handle all request call exceptions --- .../network/ApiClientProvider.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/ApiClientProvider.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/ApiClientProvider.kt index 2a776260..74b9e97d 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/ApiClientProvider.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/ApiClientProvider.kt @@ -98,9 +98,9 @@ class ApiClientProvider internal constructor( is IOException -> throw NetworkException("Network error: ${cause.message}") is ApiException, is UnexpectedApiErrorFormatException -> throw cause else -> { - val response = request.call.response - val bodyResponse = response.bodyAsText() - val statusCode = response.status.value + val response = runCatching { request.call.response }.getOrNull() + val bodyResponse = response?.bodyAsText() ?: cause.message ?: "" + val statusCode = response?.status?.value ?: -1 throw UnexpectedApiErrorFormatException(statusCode, bodyResponse, cause) } } From efb96eee43afbad0bbce0e2ae2be3d7e6752e044 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Wed, 4 Dec 2024 16:07:51 +0100 Subject: [PATCH 3/3] fix: Handle all ktor exceptions manually --- .../multiplatform_swisstransfer/network/ApiClientProvider.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/ApiClientProvider.kt b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/ApiClientProvider.kt index 74b9e97d..9f55dbdf 100644 --- a/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/ApiClientProvider.kt +++ b/STNetwork/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/network/ApiClientProvider.kt @@ -57,7 +57,6 @@ class ApiClientProvider internal constructor( fun createHttpClient(engine: HttpClientEngineFactory<*>?): HttpClient { val block: HttpClientConfig<*>.() -> Unit = { - expectSuccess = true install(UserAgent) { agent = userAgent }