diff --git a/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Extensions.kt b/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Extensions.kt
index f1a30fbd..0d2f84bf 100644
--- a/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Extensions.kt
+++ b/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Extensions.kt
@@ -1,6 +1,10 @@
package net.dankito.utils.multiplatform
+fun String?.toFile(): java.io.File? {
+ return this?.let { File(it) }
+}
+
fun java.util.Date.toDate(): Date {
return Date(this.time)
}
\ No newline at end of file
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 2aad2925..250d7f05 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.screenshotsAllowed, appSettings.lastSelectedExportFolder)
+ appSettings.lockAppAfterMinutes, appSettings.screenshotsAllowed, appSettings.lastSelectedOpenPdfFolder, appSettings.lastSelectedImportFolder, appSettings.lastSelectedExportFolder)
database.appSettingsDao().saveOrUpdate(mapped)
saveOrUpdateTanMethodSettings(appSettings.flickerCodeSettings, FlickerCodeTanMethodSettingsId)
@@ -215,6 +215,8 @@ open class RoomBankingPersistence(protected open val applicationContext: Context
settings.automaticallyUpdateAccountsAfterMinutes = persistedSettings.automaticallyUpdateAccountsAfterMinutes
settings.lockAppAfterMinutes = persistedSettings.lockAppAfterMinutes
settings.screenshotsAllowed = persistedSettings.screenshotsAllowed
+ settings.lastSelectedOpenPdfFolder = persistedSettings.lastSelectedOpenPdfFolder
+ settings.lastSelectedImportFolder = persistedSettings.lastSelectedImportFolder
settings.lastSelectedExportFolder = persistedSettings.lastSelectedExportFolder
}
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 ebc8e81a..64fd8d0c 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
@@ -11,6 +11,8 @@ open class AppSettings(
open var automaticallyUpdateAccountsAfterMinutes: Int? = AppSettings.DefaultAutomaticallyUpdateAccountsAfterMinutes,
open var lockAppAfterMinutes: Int? = null,
open var screenshotsAllowed: Boolean = false,
+ open var lastSelectedOpenPdfFolder: String? = null,
+ open var lastSelectedImportFolder: String? = null,
open var lastSelectedExportFolder: String? = null
) {
diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/SettingsDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/SettingsDialog.kt
index 3216542d..743b3b21 100644
--- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/SettingsDialog.kt
+++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/SettingsDialog.kt
@@ -19,6 +19,7 @@ import net.dankito.banking.ui.model.TypedBankData
import net.dankito.filechooserdialog.FileChooserDialog
import net.dankito.filechooserdialog.model.FileChooserDialogConfig
import net.dankito.utils.android.permissions.IPermissionsService
+import net.dankito.utils.multiplatform.toFile
import java.io.File
import java.text.SimpleDateFormat
import javax.inject.Inject
@@ -123,7 +124,7 @@ open class SettingsDialog : SettingsDialogBase() {
protected open fun exportAccountTransactions() {
- val initialDirectory = presenter.appSettings.lastSelectedExportFolder?.let { File(it) }
+ val initialDirectory = presenter.appSettings.lastSelectedExportFolder.toFile()
val suggestedFilename = getExportCsvSuggestedFilename()
// val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/MainActivityFloatingActionMenuButton.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/MainActivityFloatingActionMenuButton.kt
index 3a4bc322..82cc9ce8 100644
--- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/MainActivityFloatingActionMenuButton.kt
+++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/MainActivityFloatingActionMenuButton.kt
@@ -33,8 +33,6 @@ open class MainActivityFloatingActionMenuButton(
protected lateinit var fabTransferMoneyFromPdf: FloatingActionButton
- protected var lastSelectedFolder: File? = null
-
init {
setupButtons(floatingActionMenu)
@@ -98,12 +96,10 @@ open class MainActivityFloatingActionMenuButton(
protected open fun showTransferMoneyDialogWithDataFromPdf() {
(floatingActionMenu.context.asActivity() as? FragmentActivity)?.let { activity ->
- val config = FileChooserDialogConfig(listOf("*.pdf"), lastSelectedFolder)
+ val config = FileChooserDialogConfig(listOf("*.pdf"), presenter.appSettings.lastSelectedOpenPdfFolder.toFile())
FileChooserDialog().showOpenSingleFileDialog(activity, permissionsService, config) { _, selectedFile ->
selectedFile?.let {
- lastSelectedFolder = selectedFile.parentFile
-
val result = presenter.showTransferMoneyDialogWithDataFromPdf(selectedFile.toFile())
if (result.type != ExtractTransferMoneyDataFromPdfResultType.Success) {
diff --git a/ui/BankingJavaFxApp/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/mainwindow/controls/MainMenuBar.kt b/ui/BankingJavaFxApp/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/mainwindow/controls/MainMenuBar.kt
index acfdef2d..d617ec16 100644
--- a/ui/BankingJavaFxApp/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/mainwindow/controls/MainMenuBar.kt
+++ b/ui/BankingJavaFxApp/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/mainwindow/controls/MainMenuBar.kt
@@ -28,8 +28,6 @@ open class MainMenuBar(protected val presenter: BankingPresenter) : View() {
protected val areAccountsThatCanTransferMoneyAdded = SimpleBooleanProperty()
- protected var lastSelectedFolder: File? = null
-
init {
presenter.addBanksChangedListener {
@@ -89,12 +87,10 @@ open class MainMenuBar(protected val presenter: BankingPresenter) : View() {
protected open fun showTransferMoneyDialogWithDataFromPdf() {
val fileChooser = FileChooser()
- fileChooser.initialDirectory = lastSelectedFolder
+ fileChooser.initialDirectory = presenter.appSettings.lastSelectedOpenPdfFolder.toFile()
fileChooser.extensionFilters.add(FileChooser.ExtensionFilter("PDFs (*.pdf)", "*.pdf"))
fileChooser.showOpenDialog(currentStage)?.let { pdfFile ->
- lastSelectedFolder = pdfFile.parentFile
-
val result = presenter.showTransferMoneyDialogWithDataFromPdf(pdfFile.toFile())
if (result.type != ExtractTransferMoneyDataFromPdfResultType.Success) {
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 43094700..fd47bbe3 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
@@ -10,6 +10,8 @@ open class AppSettings(
open var flickerCodeSettings: TanMethodSettings? = null,
open var qrCodeSettings: TanMethodSettings? = null,
open var photoTanSettings: TanMethodSettings? = null,
+ open var lastSelectedOpenPdfFolder: String? = null, // File is not that easily persistable so modeled it as string
+ open var lastSelectedImportFolder: String? = null, // File is not that easily persistable so modeled it as string
open var lastSelectedExportFolder: String? = null // File is not that easily persistable so modeled it as string
) {
diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt
index 8fcb9912..3e5e413a 100644
--- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt
+++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt
@@ -630,6 +630,9 @@ open class BankingPresenter(
}
open fun showTransferMoneyDialogWithDataFromPdf(pdf: File): ExtractTransferMoneyDataFromPdfResult {
+ appSettings.lastSelectedOpenPdfFolder = pdf.parent?.getAbsolutePath()
+ appSettingsChanged()
+
val extractionResult = textExtractorRegistry.extractTextWithBestExtractorForFile(pdf)
if (extractionResult.couldExtractText == false || extractionResult.text == null) {
diff --git a/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents b/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents
index 9db108b9..1ecf575c 100644
--- a/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents
+++ b/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents
@@ -39,6 +39,8 @@
+
+
@@ -110,7 +112,7 @@
-
+
diff --git a/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift b/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift
index e877a71f..acdfe622 100644
--- a/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift
+++ b/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift
@@ -325,6 +325,8 @@ class Mapper {
flickerCodeSettings: map(settings.flickerCodeSettings),
qrCodeSettings: map(settings.qrCodeSettings),
photoTanSettings: map(settings.photoTanSettings),
+ lastSelectedOpenPdfFolder: settings.lastSelectedOpenPdfFolder,
+ lastSelectedImportFolder: settings.lastSelectedImportFolder,
lastSelectedExportFolder: settings.lastSelectedExportFolder)
mapped.technicalId = settings.objectIDAsString
@@ -343,6 +345,8 @@ class Mapper {
mapped.qrCodeSettings = map(settings.qrCodeSettings, context)
mapped.photoTanSettings = map(settings.photoTanSettings, context)
+ mapped.lastSelectedOpenPdfFolder = settings.lastSelectedOpenPdfFolder
+ mapped.lastSelectedImportFolder = settings.lastSelectedImportFolder
mapped.lastSelectedExportFolder = settings.lastSelectedExportFolder
return mapped