diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt index 5758f89..91de99f 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/dataaccess/SqliteBankingRepository.kt @@ -33,12 +33,22 @@ open class SqliteBankingRepository( override fun getAppSettings(): AppSettings? = - settingsQueries.getAppSettings { _, authenticationMethod, hashedPassword, updateAccountsOnAppStart, updateAccountsIfNoUpdatedForHours -> + settingsQueries.getAppSettings { _, + authenticationMethod, hashedPassword, updateAccountsOnAppStart, updateAccountsIfNoUpdatedForHours, + sideMenuWidth, + windowPositionX, windowPositionY, windowWidth, windowHeight, + windowState + -> AppSettings(mapToEnum(authenticationMethod, AppAuthenticationMethod.entries), hashedPassword, updateAccountsOnAppStart, mapToInt(updateAccountsIfNoUpdatedForHours)) }.executeAsOneOrNull() override suspend fun saveAppSettings(settings: AppSettings) { - settingsQueries.upsertAppSettings(mapEnum(settings.authenticationMethod), settings.hashedPassword, settings.updateAccountsOnAppStart, mapInt(settings.updateAccountsIfNoUpdatedForHours)) + settingsQueries.upsertAppSettings( + mapEnum(settings.authenticationMethod), settings.hashedPassword, settings.updateAccountsOnAppStart, mapInt(settings.updateAccountsIfNoUpdatedForHours), + 0, + 0, 0, 0, 0, + null + ) } diff --git a/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/Settings.sq b/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/Settings.sq index e978ea1..a7f32b3 100644 --- a/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/Settings.sq +++ b/composeApp/src/commonMain/sqldelight/net/codinux/banking/ui/Settings.sq @@ -8,7 +8,17 @@ CREATE TABLE IF NOT EXISTS AppSettings ( hashedPassword TEXT, updateAccountsOnAppStart INTEGER AS Boolean NOT NULL, - updateAccountsIfNoUpdatedForHours INTEGER NOT NULL + updateAccountsIfNoUpdatedForHours INTEGER NOT NULL, + + sideMenuWidth INTEGER NOT NULL, + + windowPositionX INTEGER NOT NULL, + windowPositionY INTEGER NOT NULL, + + windowWidth INTEGER NOT NULL, + windowHeight INTEGER NOT NULL, + + windowState TEXT ); @@ -16,8 +26,29 @@ getAppSettings: SELECT * FROM AppSettings WHERE id = 1; upsertAppSettings: -INSERT OR REPLACE INTO AppSettings(id, authenticationMethod, hashedPassword, updateAccountsOnAppStart, updateAccountsIfNoUpdatedForHours) -VALUES (1, ?, ?, ?, ?); +INSERT OR REPLACE INTO AppSettings( + id, + + authenticationMethod, hashedPassword, updateAccountsOnAppStart, updateAccountsIfNoUpdatedForHours, + + sideMenuWidth, + + windowPositionX, windowPositionY, windowWidth, windowHeight, + + windowState +) +VALUES ( + 1, + + ?, ?, ?, ?, + + ?, + + ?, ?, + ?, ?, + + ? +);