Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Sep 3, 2024
1 parent 5cd1cd2 commit 905ed57
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AppSettingsManager internal constructor(
* @throws IllegalArgumentException If the provided theme is invalid.
* @throws CancellationException If the operation is cancelled.
*/
@Throws(IllegalArgumentException::class, CancellationException::class)
@Throws(IllegalArgumentException::class, CancellationException::class)
suspend fun setTheme(theme: Theme) = withContext(Dispatchers.IO) {
appSettingsController.setTheme(theme)
}
Expand All @@ -68,7 +68,7 @@ class AppSettingsManager internal constructor(
* @throws IllegalArgumentException If the provided validity period is invalid.
* @throws CancellationException If the operation is cancelled.
*/
@Throws(IllegalArgumentException::class, CancellationException::class)
@Throws(IllegalArgumentException::class, CancellationException::class)
suspend fun setValidityPeriod(validityPeriod: ValidityPeriod) = withContext(Dispatchers.IO) {
appSettingsController.setValidityPeriod(validityPeriod)
}
Expand All @@ -81,7 +81,7 @@ class AppSettingsManager internal constructor(
* @throws IllegalArgumentException If the provided download limit is invalid.
* @throws CancellationException If the operation is cancelled.
*/
@Throws(IllegalArgumentException::class, CancellationException::class)
@Throws(IllegalArgumentException::class, CancellationException::class)
suspend fun setDownloadLimit(downloadLimit: DownloadLimit) = withContext(Dispatchers.IO) {
appSettingsController.setDownloadLimit(downloadLimit)
}
Expand All @@ -94,7 +94,7 @@ class AppSettingsManager internal constructor(
* @throws IllegalArgumentException If the provided email language is invalid.
* @throws CancellationException If the operation is cancelled.
*/
@Throws(IllegalArgumentException::class, CancellationException::class)
@Throws(IllegalArgumentException::class, CancellationException::class)
suspend fun setEmailLanguage(emailLanguage: EmailLanguage) = withContext(Dispatchers.IO) {
appSettingsController.setEmailLanguage(emailLanguage)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package com.infomaniak.multiplatform_swisstransfer.database.cache.setting

import com.infomaniak.multiplatform_swisstransfer.common.interfaces.appSettings.AppSettings
import com.infomaniak.multiplatform_swisstransfer.common.models.DownloadLimit
import com.infomaniak.multiplatform_swisstransfer.common.models.EmailLanguage
import com.infomaniak.multiplatform_swisstransfer.common.models.Theme
Expand All @@ -27,10 +26,10 @@ import com.infomaniak.multiplatform_swisstransfer.database.RealmProvider
import com.infomaniak.multiplatform_swisstransfer.database.models.setting.AppSettingsDB
import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.ext.query
import kotlin.coroutines.cancellation.CancellationException
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.mapLatest
import kotlin.coroutines.cancellation.CancellationException

@OptIn(ExperimentalCoroutinesApi::class)
class AppSettingsController(private val realmProvider: RealmProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ package com.infomaniak.multiplatform_swisstransfer.network.requests

import com.infomaniak.multiplatform_swisstransfer.network.utils.ApiRoutes
import io.ktor.client.HttpClient
import io.ktor.client.request.delete
import io.ktor.client.request.get
import io.ktor.client.request.post
import io.ktor.client.request.put
import io.ktor.client.request.setBody
import io.ktor.client.request.*
import io.ktor.client.statement.HttpResponse
import io.ktor.client.statement.bodyAsText
import io.ktor.http.URLBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
package com.infomaniak.multiplatform_swisstransfer.network.serializers

import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.JsonTransformingSerializer
import kotlinx.serialization.json.int
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.*

internal object IntToBooleanSerializer : JsonTransformingSerializer<Boolean>(Boolean.serializer()) {
override fun transformDeserialize(element: JsonElement): JsonElement {
Expand Down

0 comments on commit 905ed57

Please sign in to comment.