From 4d96707a5130cbb737428423b7bbb6ad73d32ee4 Mon Sep 17 00:00:00 2001 From: Odweta Date: Sat, 30 Nov 2024 12:15:36 +0100 Subject: [PATCH] fixed settings file read error --- mobile/app/src/main/java/com/odweta/solon/Launch.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mobile/app/src/main/java/com/odweta/solon/Launch.kt b/mobile/app/src/main/java/com/odweta/solon/Launch.kt index b2dd288..b78d53e 100644 --- a/mobile/app/src/main/java/com/odweta/solon/Launch.kt +++ b/mobile/app/src/main/java/com/odweta/solon/Launch.kt @@ -61,7 +61,8 @@ fun fetchNewData(ctx: Context, coscope: CoroutineScope) { val role = if (Parsing.userIsParent()) { " – Rodič" } else { - " – Student" + //TODO: remove + " – Student #############################################" } // display the full name of the user in the toolbar @@ -166,7 +167,9 @@ private suspend fun launchPhase1(ctx: Context) { marks = Parsing.parseMarksJSON(marksJSON) // set the settings - settingsData = Util.stringToSettingsData(Util.fileToString(settingsDataFilePath)) + if (Util.fileExists(settingsDataFilePath) && !Util.fileIsEmpty(settingsDataFilePath)) { + settingsData = Util.stringToSettingsData(Util.fileToString(settingsDataFilePath)) + } // else load the default settigns // continue to launch phase 2 done = true