diff --git a/app/src/main/java/org/openedx/app/data/storage/PreferencesManager.kt b/app/src/main/java/org/openedx/app/data/storage/PreferencesManager.kt index ae36968d2..efd2d16b2 100644 --- a/app/src/main/java/org/openedx/app/data/storage/PreferencesManager.kt +++ b/app/src/main/java/org/openedx/app/data/storage/PreferencesManager.kt @@ -145,10 +145,12 @@ class PreferencesManager(context: Context) : CorePreferences, ProfilePreferences saveString(APP_CONFIG, appConfigJson) } get() { - val appConfigString = getString(APP_CONFIG) + val appConfigString = getString(APP_CONFIG, getDefaultAppConfig()) return Gson().fromJson(appConfigString, AppConfig::class.java) } + private fun getDefaultAppConfig() = Gson().toJson(AppConfig()) + override var lastWhatsNewVersion: String set(value) { saveString(LAST_WHATS_NEW_VERSION, value) diff --git a/core/src/main/java/org/openedx/core/domain/model/AppConfig.kt b/core/src/main/java/org/openedx/core/domain/model/AppConfig.kt index 596fd0619..97750957f 100644 --- a/core/src/main/java/org/openedx/core/domain/model/AppConfig.kt +++ b/core/src/main/java/org/openedx/core/domain/model/AppConfig.kt @@ -3,12 +3,12 @@ package org.openedx.core.domain.model import java.io.Serializable data class AppConfig( - val courseDatesCalendarSync: CourseDatesCalendarSync, + val courseDatesCalendarSync: CourseDatesCalendarSync = CourseDatesCalendarSync(), ) : Serializable data class CourseDatesCalendarSync( - val isEnabled: Boolean, - val isSelfPacedEnabled: Boolean, - val isInstructorPacedEnabled: Boolean, - val isDeepLinkEnabled: Boolean, + val isEnabled: Boolean = false, + val isSelfPacedEnabled: Boolean = false, + val isInstructorPacedEnabled: Boolean = false, + val isDeepLinkEnabled: Boolean = false, ) : Serializable