Skip to content

Commit

Permalink
fix: Use a local variable instead for the default language
Browse files Browse the repository at this point in the history
  • Loading branch information
tevincent committed Nov 15, 2024
1 parent 5648df6 commit 61a89f0
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ import io.realm.kotlin.types.annotations.Ignore

class AppSettingsDB(): RealmObject, AppSettings {

@Ignore
private var defaultEmailLanguage = EmailLanguage.ENGLISH

constructor(defaultEmailLanguage: EmailLanguage): this() {
emailLanguage = defaultEmailLanguage
this.defaultEmailLanguage = defaultEmailLanguage
}

//region Options available in App Settings
Expand All @@ -50,9 +53,9 @@ class AppSettingsDB(): RealmObject, AppSettings {
_downloadLimit = value.value
}

private var _emailLanguage: String = DEFAULT_EMAIL_LANGUAGE.value
private var _emailLanguage: String = defaultEmailLanguage.value
override var emailLanguage: EmailLanguage
get() = EmailLanguage.entries.find { it.value == _emailLanguage } ?: DEFAULT_EMAIL_LANGUAGE
get() = EmailLanguage.entries.find { it.value == _emailLanguage } ?: defaultEmailLanguage
set(value) {
_emailLanguage = value.value
}
Expand All @@ -71,7 +74,6 @@ class AppSettingsDB(): RealmObject, AppSettings {
val DEFAULT_VALIDITY_PERIOD = ValidityPeriod.THIRTY
val DEFAULT_DOWNLOAD_LIMIT = DownloadLimit.TWO_HUNDRED_FIFTY
private val DEFAULT_THEME = Theme.SYSTEM
private val DEFAULT_EMAIL_LANGUAGE = EmailLanguage.ENGLISH

private val DEFAULT_TRANSFER_TYPE = TransferType.QR_CODE
}
Expand Down

0 comments on commit 61a89f0

Please sign in to comment.