Added properties for saving window state (but not using them yet)
This commit is contained in:
parent
2d472d1683
commit
b4ea02bbd8
|
@ -33,12 +33,22 @@ open class SqliteBankingRepository(
|
||||||
|
|
||||||
|
|
||||||
override fun getAppSettings(): AppSettings? =
|
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))
|
AppSettings(mapToEnum(authenticationMethod, AppAuthenticationMethod.entries), hashedPassword, updateAccountsOnAppStart, mapToInt(updateAccountsIfNoUpdatedForHours))
|
||||||
}.executeAsOneOrNull()
|
}.executeAsOneOrNull()
|
||||||
|
|
||||||
override suspend fun saveAppSettings(settings: AppSettings) {
|
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
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,17 @@ CREATE TABLE IF NOT EXISTS AppSettings (
|
||||||
hashedPassword TEXT,
|
hashedPassword TEXT,
|
||||||
|
|
||||||
updateAccountsOnAppStart INTEGER AS Boolean NOT NULL,
|
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;
|
SELECT * FROM AppSettings WHERE id = 1;
|
||||||
|
|
||||||
upsertAppSettings:
|
upsertAppSettings:
|
||||||
INSERT OR REPLACE INTO AppSettings(id, authenticationMethod, hashedPassword, updateAccountsOnAppStart, updateAccountsIfNoUpdatedForHours)
|
INSERT OR REPLACE INTO AppSettings(
|
||||||
VALUES (1, ?, ?, ?, ?);
|
id,
|
||||||
|
|
||||||
|
authenticationMethod, hashedPassword, updateAccountsOnAppStart, updateAccountsIfNoUpdatedForHours,
|
||||||
|
|
||||||
|
sideMenuWidth,
|
||||||
|
|
||||||
|
windowPositionX, windowPositionY, windowWidth, windowHeight,
|
||||||
|
|
||||||
|
windowState
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
1,
|
||||||
|
|
||||||
|
?, ?, ?, ?,
|
||||||
|
|
||||||
|
?,
|
||||||
|
|
||||||
|
?, ?,
|
||||||
|
?, ?,
|
||||||
|
|
||||||
|
?
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue