Added properties for saving window state (but not using them yet)

This commit is contained in:
dankito 2024-09-17 03:57:40 +02:00
parent 2d472d1683
commit b4ea02bbd8
2 changed files with 46 additions and 5 deletions

View File

@ -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
)
}

View File

@ -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,
?, ?, ?, ?,
?,
?, ?,
?, ?,
?
);