forked from github/szkolny
[App] Fix crashes while deserializing AppData and Config.
This commit is contained in:
parent
5150467372
commit
40ed5a221f
4
app/proguard-rules.pro
vendored
4
app/proguard-rules.pro
vendored
@ -22,6 +22,7 @@
|
|||||||
-keep class android.support.v7.widget.** { *; }
|
-keep class android.support.v7.widget.** { *; }
|
||||||
|
|
||||||
-keep class pl.szczodrzynski.edziennik.utils.models.** { *; }
|
-keep class pl.szczodrzynski.edziennik.utils.models.** { *; }
|
||||||
|
-keep class pl.szczodrzynski.edziennik.data.db.enums.* { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.data.db.entity.Event { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.entity.Event { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.data.db.full.EventFull { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.full.EventFull { *; }
|
||||||
-keep class pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage { *; }
|
-keep class pl.szczodrzynski.edziennik.data.db.entity.FeedbackMessage { *; }
|
||||||
@ -31,6 +32,9 @@
|
|||||||
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.timetable.WidgetTimetableProvider
|
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.timetable.WidgetTimetableProvider
|
||||||
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.notifications.WidgetNotificationsProvider
|
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.notifications.WidgetNotificationsProvider
|
||||||
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.luckynumber.WidgetLuckyNumberProvider
|
-keepnames class pl.szczodrzynski.edziennik.ui.widgets.luckynumber.WidgetLuckyNumberProvider
|
||||||
|
-keep class pl.szczodrzynski.edziennik.config.AppData { *; }
|
||||||
|
-keep class pl.szczodrzynski.edziennik.config.AppData$** { *; }
|
||||||
|
-keep class pl.szczodrzynski.edziennik.utils.managers.TextStylingManager$HtmlMode { *; }
|
||||||
|
|
||||||
-keepnames class androidx.appcompat.view.menu.MenuBuilder { setHeaderTitleInt(java.lang.CharSequence); }
|
-keepnames class androidx.appcompat.view.menu.MenuBuilder { setHeaderTitleInt(java.lang.CharSequence); }
|
||||||
-keepnames class androidx.appcompat.view.menu.MenuPopupHelper { showPopup(int, int, boolean, boolean); }
|
-keepnames class androidx.appcompat.view.menu.MenuPopupHelper { showPopup(int, int, boolean, boolean); }
|
||||||
|
@ -190,12 +190,6 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
Iconics.init(applicationContext)
|
Iconics.init(applicationContext)
|
||||||
Iconics.respectFontBoundsDefault = true
|
Iconics.respectFontBoundsDefault = true
|
||||||
|
|
||||||
if (devMode) {
|
|
||||||
HyperLog.initialize(this)
|
|
||||||
HyperLog.setLogLevel(Log.VERBOSE)
|
|
||||||
HyperLog.setLogFormat(DebugLogFormat(this))
|
|
||||||
}
|
|
||||||
|
|
||||||
// initialize companion object values
|
// initialize companion object values
|
||||||
AppData.read(this)
|
AppData.read(this)
|
||||||
App.db = AppDb(this)
|
App.db = AppDb(this)
|
||||||
@ -204,6 +198,12 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
|||||||
devMode = config.devMode ?: debugMode
|
devMode = config.devMode ?: debugMode
|
||||||
enableChucker = config.enableChucker ?: devMode
|
enableChucker = config.enableChucker ?: devMode
|
||||||
|
|
||||||
|
if (devMode) {
|
||||||
|
HyperLog.initialize(this)
|
||||||
|
HyperLog.setLogLevel(Log.VERBOSE)
|
||||||
|
HyperLog.setLogFormat(DebugLogFormat(this))
|
||||||
|
}
|
||||||
|
|
||||||
if (!profileLoadById(config.lastProfileId)) {
|
if (!profileLoadById(config.lastProfileId)) {
|
||||||
val success = db.profileDao().firstId?.let { profileLoadById(it) }
|
val success = db.profileDao().firstId?.let { profileLoadById(it) }
|
||||||
if (success != true)
|
if (success != true)
|
||||||
|
@ -50,13 +50,13 @@ inline fun <reified E : Enum<E>> Int.toEnum() = when (E::class.java) {
|
|||||||
} as E
|
} as E
|
||||||
|
|
||||||
fun <E : Enum<E>> Int.toEnum(type: Class<*>) = when (type) {
|
fun <E : Enum<E>> Int.toEnum(type: Class<*>) = when (type) {
|
||||||
// enums commented out are not really used in Bundles
|
// this is used for Config so all enums are here
|
||||||
FeatureType::class.java -> this.asFeatureType()
|
FeatureType::class.java -> this.asFeatureType()
|
||||||
// LoginMethod::class.java -> this.asLoginMethod()
|
LoginMethod::class.java -> this.asLoginMethod()
|
||||||
LoginMode::class.java -> this.asLoginMode()
|
LoginMode::class.java -> this.asLoginMode()
|
||||||
LoginType::class.java -> this.asLoginType()
|
LoginType::class.java -> this.asLoginType()
|
||||||
// MetadataType::class.java -> this.asMetadataType()
|
MetadataType::class.java -> this.asMetadataType()
|
||||||
// NotificationType::class.java -> this.asNotificationType()
|
NotificationType::class.java -> this.asNotificationType()
|
||||||
NavTarget::class.java -> this.asNavTarget()
|
NavTarget::class.java -> this.asNavTarget()
|
||||||
else -> throw IllegalArgumentException("Unknown type $type")
|
else -> throw IllegalArgumentException("Unknown type $type")
|
||||||
} as E
|
} as E
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
},
|
},
|
||||||
"university": {
|
"university": {
|
||||||
"configOverrides": {
|
"configOverrides": {
|
||||||
|
"timetableTrimHourRange": true,
|
||||||
"timetableColorSubjectName": true
|
"timetableColorSubjectName": true
|
||||||
},
|
},
|
||||||
"uiConfig": {
|
"uiConfig": {
|
||||||
|
Loading…
Reference in New Issue
Block a user