From b283a3014b3c6f24ed162459ce26c75719e1347b Mon Sep 17 00:00:00 2001 From: dankito Date: Sat, 17 Oct 2020 20:23:56 +0200 Subject: [PATCH] Added screenshotsAllowed to data model but functionality is not implemented yet --- .../dankito/banking/persistence/RoomBankingPersistence.kt | 3 ++- .../net/dankito/banking/persistence/model/AppSettings.kt | 5 +++-- .../net/dankito/banking/ui/model/settings/AppSettings.kt | 3 ++- .../BankingiOSApp.xcdatamodel/contents | 3 ++- ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift | 2 ++ 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/RoomBankingPersistence.kt b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/RoomBankingPersistence.kt index 7a340264..aca6ca5f 100644 --- a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/RoomBankingPersistence.kt +++ b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/RoomBankingPersistence.kt @@ -190,7 +190,7 @@ open class RoomBankingPersistence(protected open val applicationContext: Context override fun saveOrUpdateAppSettings(appSettings: AppSettings) { val mapped = net.dankito.banking.persistence.model.AppSettings(appSettings.automaticallyUpdateAccountsAfterMinutes, - appSettings.lockAppAfterMinutes) + appSettings.lockAppAfterMinutes, appSettings.screenshotsAllowed) database.appSettingsDao().saveOrUpdate(mapped) 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 -> settings.automaticallyUpdateAccountsAfterMinutes = persistedSettings.automaticallyUpdateAccountsAfterMinutes settings.lockAppAfterMinutes = persistedSettings.lockAppAfterMinutes + settings.screenshotsAllowed = persistedSettings.screenshotsAllowed } settings.flickerCodeSettings = findTanMethodSettings(FlickerCodeTanMethodSettingsId, tanMethodSettings) diff --git a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/AppSettings.kt b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/AppSettings.kt index 49262216..2ac1388f 100644 --- a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/AppSettings.kt +++ b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/AppSettings.kt @@ -9,10 +9,11 @@ import net.dankito.banking.ui.model.settings.AppSettings @Entity open class AppSettings( 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 open var id: Int = RoomBankingPersistence.AppSettingsId diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/AppSettings.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/AppSettings.kt index 238dba1e..f5d998de 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/AppSettings.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/AppSettings.kt @@ -6,6 +6,7 @@ import net.dankito.utils.multiplatform.UUID open class AppSettings( open var automaticallyUpdateAccountsAfterMinutes: Int? = DefaultAutomaticallyUpdateAccountsAfterMinutes, open var lockAppAfterMinutes: Int? = null, + open var screenshotsAllowed: Boolean = false, // TODO: implement open var flickerCodeSettings: TanMethodSettings? = null, open var qrCodeSettings: 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() diff --git a/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents b/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents index b8f8f243..54a3821e 100644 --- a/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents +++ b/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents @@ -39,6 +39,7 @@ + @@ -108,7 +109,7 @@ - + diff --git a/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift b/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift index cf41e5da..6983aca3 100644 --- a/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift +++ b/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift @@ -321,6 +321,7 @@ class Mapper { let mapped = AppSettings( automaticallyUpdateAccountsAfterMinutes: mapToInt(settings.automaticallyUpdateAccountsAfterMinutes), lockAppAfterMinutes: mapToInt(settings.lockAppAfterMinutes), + screenshotsAllowed: settings.screenshotsAllowed, flickerCodeSettings: map(settings.flickerCodeSettings), qrCodeSettings: map(settings.qrCodeSettings), photoTanSettings: map(settings.photoTanSettings)) @@ -335,6 +336,7 @@ class Mapper { mapped.automaticallyUpdateAccountsAfterMinutes = mapFromInt(settings.automaticallyUpdateAccountsAfterMinutes) mapped.lockAppAfterMinutes = mapFromInt(settings.lockAppAfterMinutes) + mapped.screenshotsAllowed = settings.screenshotsAllowed mapped.flickerCodeSettings = map(settings.flickerCodeSettings, context) mapped.qrCodeSettings = map(settings.qrCodeSettings, context)