Added screenshotsAllowed to data model but functionality is not implemented yet

This commit is contained in:
dankito 2020-10-17 20:23:56 +02:00
parent 93e348edc1
commit b283a3014b
5 changed files with 11 additions and 5 deletions

View File

@ -190,7 +190,7 @@ open class RoomBankingPersistence(protected open val applicationContext: Context
override fun saveOrUpdateAppSettings(appSettings: AppSettings) { override fun saveOrUpdateAppSettings(appSettings: AppSettings) {
val mapped = net.dankito.banking.persistence.model.AppSettings(appSettings.automaticallyUpdateAccountsAfterMinutes, val mapped = net.dankito.banking.persistence.model.AppSettings(appSettings.automaticallyUpdateAccountsAfterMinutes,
appSettings.lockAppAfterMinutes) appSettings.lockAppAfterMinutes, appSettings.screenshotsAllowed)
database.appSettingsDao().saveOrUpdate(mapped) database.appSettingsDao().saveOrUpdate(mapped)
saveOrUpdateTanMethodSettings(appSettings.flickerCodeSettings, FlickerCodeTanMethodSettingsId) saveOrUpdateTanMethodSettings(appSettings.flickerCodeSettings, FlickerCodeTanMethodSettingsId)
@ -214,6 +214,7 @@ open class RoomBankingPersistence(protected open val applicationContext: Context
database.appSettingsDao().getAll().firstOrNull { it.id == AppSettingsId }?.let { persistedSettings -> database.appSettingsDao().getAll().firstOrNull { it.id == AppSettingsId }?.let { persistedSettings ->
settings.automaticallyUpdateAccountsAfterMinutes = persistedSettings.automaticallyUpdateAccountsAfterMinutes settings.automaticallyUpdateAccountsAfterMinutes = persistedSettings.automaticallyUpdateAccountsAfterMinutes
settings.lockAppAfterMinutes = persistedSettings.lockAppAfterMinutes settings.lockAppAfterMinutes = persistedSettings.lockAppAfterMinutes
settings.screenshotsAllowed = persistedSettings.screenshotsAllowed
} }
settings.flickerCodeSettings = findTanMethodSettings(FlickerCodeTanMethodSettingsId, tanMethodSettings) settings.flickerCodeSettings = findTanMethodSettings(FlickerCodeTanMethodSettingsId, tanMethodSettings)

View File

@ -9,10 +9,11 @@ import net.dankito.banking.ui.model.settings.AppSettings
@Entity @Entity
open class AppSettings( open class AppSettings(
open var automaticallyUpdateAccountsAfterMinutes: Int? = AppSettings.DefaultAutomaticallyUpdateAccountsAfterMinutes, open var automaticallyUpdateAccountsAfterMinutes: Int? = AppSettings.DefaultAutomaticallyUpdateAccountsAfterMinutes,
open var lockAppAfterMinutes: Int? = null open var lockAppAfterMinutes: Int? = null,
open var screenshotsAllowed: Boolean = false
) { ) {
internal constructor() : this(AppSettings.DefaultAutomaticallyUpdateAccountsAfterMinutes, null) internal constructor() : this(AppSettings.DefaultAutomaticallyUpdateAccountsAfterMinutes, null, false)
@PrimaryKey @PrimaryKey
open var id: Int = RoomBankingPersistence.AppSettingsId open var id: Int = RoomBankingPersistence.AppSettingsId

View File

@ -6,6 +6,7 @@ import net.dankito.utils.multiplatform.UUID
open class AppSettings( open class AppSettings(
open var automaticallyUpdateAccountsAfterMinutes: Int? = DefaultAutomaticallyUpdateAccountsAfterMinutes, open var automaticallyUpdateAccountsAfterMinutes: Int? = DefaultAutomaticallyUpdateAccountsAfterMinutes,
open var lockAppAfterMinutes: Int? = null, open var lockAppAfterMinutes: Int? = null,
open var screenshotsAllowed: Boolean = false, // TODO: implement
open var flickerCodeSettings: TanMethodSettings? = null, open var flickerCodeSettings: TanMethodSettings? = null,
open var qrCodeSettings: TanMethodSettings? = null, open var qrCodeSettings: TanMethodSettings? = null,
open var photoTanSettings: TanMethodSettings? = null open var photoTanSettings: TanMethodSettings? = null
@ -16,7 +17,7 @@ open class AppSettings(
} }
internal constructor() : this(DefaultAutomaticallyUpdateAccountsAfterMinutes, null, null, null) // for object deserializers internal constructor() : this(DefaultAutomaticallyUpdateAccountsAfterMinutes, null, false, null, null) // for object deserializers
open var technicalId: String = UUID.random() open var technicalId: String = UUID.random()

View File

@ -39,6 +39,7 @@
<entity name="PersistedAppSettings" representedClassName="PersistedAppSettings" syncable="YES" codeGenerationType="class"> <entity name="PersistedAppSettings" representedClassName="PersistedAppSettings" syncable="YES" codeGenerationType="class">
<attribute name="automaticallyUpdateAccountsAfterMinutes" optional="YES" attributeType="Integer 32" defaultValueString="360" usesScalarValueType="NO"/> <attribute name="automaticallyUpdateAccountsAfterMinutes" optional="YES" attributeType="Integer 32" defaultValueString="360" usesScalarValueType="NO"/>
<attribute name="lockAppAfterMinutes" optional="YES" attributeType="Integer 32" defaultValueString="-1" usesScalarValueType="NO"/> <attribute name="lockAppAfterMinutes" optional="YES" attributeType="Integer 32" defaultValueString="-1" usesScalarValueType="NO"/>
<attribute name="screenshotsAllowed" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<relationship name="flickerCodeSettings" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="PersistedTanMethodSettings"/> <relationship name="flickerCodeSettings" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="PersistedTanMethodSettings"/>
<relationship name="photoTanSettings" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="PersistedTanMethodSettings"/> <relationship name="photoTanSettings" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="PersistedTanMethodSettings"/>
<relationship name="qrCodeSettings" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="PersistedTanMethodSettings"/> <relationship name="qrCodeSettings" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="PersistedTanMethodSettings"/>
@ -108,7 +109,7 @@
</entity> </entity>
<elements> <elements>
<element name="PersistedAccountTransaction" positionX="-36" positionY="45" width="128" height="553"/> <element name="PersistedAccountTransaction" positionX="-36" positionY="45" width="128" height="553"/>
<element name="PersistedAppSettings" positionX="-45" positionY="144" width="128" height="118"/> <element name="PersistedAppSettings" positionX="-45" positionY="144" width="128" height="133"/>
<element name="PersistedBankAccount" positionX="-54" positionY="63" width="128" height="418"/> <element name="PersistedBankAccount" positionX="-54" positionY="63" width="128" height="418"/>
<element name="PersistedBankData" positionX="-63" positionY="-18" width="128" height="298"/> <element name="PersistedBankData" positionX="-63" positionY="-18" width="128" height="298"/>
<element name="PersistedTanMedium" positionX="-45" positionY="144" width="128" height="28"/> <element name="PersistedTanMedium" positionX="-45" positionY="144" width="128" height="28"/>

View File

@ -321,6 +321,7 @@ class Mapper {
let mapped = AppSettings( let mapped = AppSettings(
automaticallyUpdateAccountsAfterMinutes: mapToInt(settings.automaticallyUpdateAccountsAfterMinutes), automaticallyUpdateAccountsAfterMinutes: mapToInt(settings.automaticallyUpdateAccountsAfterMinutes),
lockAppAfterMinutes: mapToInt(settings.lockAppAfterMinutes), lockAppAfterMinutes: mapToInt(settings.lockAppAfterMinutes),
screenshotsAllowed: settings.screenshotsAllowed,
flickerCodeSettings: map(settings.flickerCodeSettings), flickerCodeSettings: map(settings.flickerCodeSettings),
qrCodeSettings: map(settings.qrCodeSettings), qrCodeSettings: map(settings.qrCodeSettings),
photoTanSettings: map(settings.photoTanSettings)) photoTanSettings: map(settings.photoTanSettings))
@ -335,6 +336,7 @@ class Mapper {
mapped.automaticallyUpdateAccountsAfterMinutes = mapFromInt(settings.automaticallyUpdateAccountsAfterMinutes) mapped.automaticallyUpdateAccountsAfterMinutes = mapFromInt(settings.automaticallyUpdateAccountsAfterMinutes)
mapped.lockAppAfterMinutes = mapFromInt(settings.lockAppAfterMinutes) mapped.lockAppAfterMinutes = mapFromInt(settings.lockAppAfterMinutes)
mapped.screenshotsAllowed = settings.screenshotsAllowed
mapped.flickerCodeSettings = map(settings.flickerCodeSettings, context) mapped.flickerCodeSettings = map(settings.flickerCodeSettings, context)
mapped.qrCodeSettings = map(settings.qrCodeSettings, context) mapped.qrCodeSettings = map(settings.qrCodeSettings, context)