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

Clean code #22

Merged
merged 2 commits into from
Sep 4, 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 @@ -21,5 +21,5 @@ enum class DownloadLimit(val value: String) {
TWOHUNDREDFIFTY("250"),
ONEHUNDRED("100"),
TWENTY("20"),
ONE("1");
ONE("1"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ enum class EmailLanguage(val value: String) {
FRENCH("french"),
GERMAN("german"),
ITALIAN("italian"),
SPANISH("spanish");
SPANISH("spanish"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ package com.infomaniak.multiplatform_swisstransfer.common.models
enum class Theme(val value: String) {
SYSTEM("system"),
LIGHT("light"),
DARK("dark");
DARK("dark"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ enum class ValidityPeriod(val value: String) {
THIRTY("30"),
FIFTEEN("15"),
SEVEN("7"),
ONE("1");
ONE("1"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,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 @@ -67,7 +67,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 @@ -80,7 +80,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 @@ -93,7 +93,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 @@ -17,7 +17,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 @@ -26,10 +25,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 @@ -19,11 +19,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 @@ -18,11 +18,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
Loading