diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/AddAccountDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/AddAccountDialog.kt
index e9a86000..07909e74 100644
--- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/AddAccountDialog.kt
+++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/AddAccountDialog.kt
@@ -70,11 +70,11 @@ open class AddAccountDialog : DialogFragment() {
initBankListAutocompletion(edtxtBank.actualEditText)
edtxtUserName.actualEditText.addTextChangedListener(otherEditTextChangedWatcher)
- edtxtPassword.actualEditText.addTextChangedListener(otherEditTextChangedWatcher)
+ bankCredentialsPassword.passwordBox.addTextChangedListener(otherEditTextChangedWatcher)
addAccountIfEnterPressed(edtxtBank.actualEditText)
addAccountIfEnterPressed(edtxtUserName.actualEditText)
- addAccountIfEnterPressed(edtxtPassword.actualEditText)
+ addAccountIfEnterPressed(bankCredentialsPassword.passwordBox)
btnAddAccount.setOnClickListener { addAccount() }
btnCancel.setOnClickListener { dismiss() }
@@ -112,12 +112,12 @@ open class AddAccountDialog : DialogFragment() {
protected open fun addAccount() {
selectedBank?.let { selectedBank -> // should always be non-null at this stage
val userName = edtxtUserName.text
- val password = edtxtPassword.text
+ val password = bankCredentialsPassword.password
btnAddAccount.isEnabled = false
pgrbrAddAccount.visibility = View.VISIBLE
- presenter.addAccountAsync(selectedBank, userName, password) { response ->
+ presenter.addAccountAsync(selectedBank, userName, password, bankCredentialsPassword.savePassword) { response ->
context?.asActivity()?.runOnUiThread {
btnAddAccount.isEnabled = true
pgrbrAddAccount.visibility = View.GONE
@@ -184,7 +184,7 @@ open class AddAccountDialog : DialogFragment() {
val requiredDataEntered = selectedBank != null
&& selectedBank?.supportsFinTs3_0 == true
&& edtxtUserName.text.isNotEmpty()
- && edtxtPassword.text.isNotEmpty()
+ && bankCredentialsPassword.password.isNotEmpty()
btnAddAccount.isEnabled = requiredDataEntered
}
diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt
index 1f836054..b89e7e1c 100644
--- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt
+++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankSettingsDialog.kt
@@ -4,9 +4,7 @@ import android.os.Bundle
import android.view.*
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentActivity
-import kotlinx.android.synthetic.main.dialog_bank_settings.edtxtBankName
-import kotlinx.android.synthetic.main.dialog_bank_settings.edtxtUserName
-import kotlinx.android.synthetic.main.dialog_bank_settings.edtxtPassword
+import kotlinx.android.synthetic.main.dialog_bank_settings.*
import kotlinx.android.synthetic.main.dialog_bank_settings.view.*
import kotlinx.android.synthetic.main.dialog_bank_settings.view.toolbar
import net.dankito.banking.ui.android.R
@@ -64,7 +62,8 @@ open class BankSettingsDialog : SettingsDialogBase() {
edtxtBankName.text = bank.displayName
edtxtUserName.text = bank.userName
- edtxtPassword.text = bank.password
+ bankCredentialsPassword.password = bank.password
+ bankCredentialsPassword.savePassword = bank.savePassword
val tanMethodItems = createTanMethodItems()
val tanMethodsAdapter = FastAdapterRecyclerView(rootView.rcyTanMethods, tanMethodItems)
@@ -127,13 +126,14 @@ open class BankSettingsDialog : SettingsDialogBase() {
override val hasUnsavedChanges: Boolean
get() = didChange(edtxtBankName, bank.displayName)
|| didChange(edtxtUserName, bank.userName)
- || didChange(edtxtPassword, bank.password)
+ || bankCredentialsPassword.password != bank.password
+ || bankCredentialsPassword.savePassword != bank.savePassword
|| bank.selectedTanMethod != selectedTanMethod
override fun saveChanges() {
bank.userSetDisplayName = edtxtBankName.text
- presenter.bankUpdated(bank, edtxtUserName.text, edtxtPassword.text, selectedTanMethod)
+ presenter.bankUpdated(bank, edtxtUserName.text, bankCredentialsPassword.password, bankCredentialsPassword.savePassword, selectedTanMethod)
}
protected open fun askUserToDeleteAccount() {
diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/BankCredentialsPasswordView.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/BankCredentialsPasswordView.kt
new file mode 100644
index 00000000..e349da37
--- /dev/null
+++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/BankCredentialsPasswordView.kt
@@ -0,0 +1,47 @@
+package net.dankito.banking.ui.android.views
+
+import android.content.Context
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.view.inputmethod.EditorInfo
+import android.widget.EditText
+import android.widget.LinearLayout
+import com.google.android.material.textfield.TextInputEditText
+import com.google.android.material.textfield.TextInputLayout
+import kotlinx.android.synthetic.main.view_bank_credentials_password.view.*
+import kotlinx.android.synthetic.main.view_form_edit_text.view.*
+import net.dankito.banking.ui.android.R
+import net.dankito.banking.ui.android.extensions.textString
+
+
+open class BankCredentialsPasswordView @JvmOverloads constructor(
+ context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
+) : LinearLayout(context, attrs, defStyleAttr) {
+
+
+ init {
+ setupUi(context, attrs)
+ }
+
+ private fun setupUi(context: Context, attrs: AttributeSet?) {
+ val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
+ inflater.inflate(R.layout.view_bank_credentials_password, this, true)
+ }
+
+
+ open var password: String
+ get() = edtxtPassword.text
+ set(value) {
+ edtxtPassword.text = value
+ }
+
+ open val passwordBox: TextInputEditText
+ get() = textInputEditText
+
+ open var savePassword: Boolean
+ get() = swtchSavePassword.isChecked
+ set(value) {
+ swtchSavePassword.isChecked = value
+ }
+
+}
\ No newline at end of file
diff --git a/ui/BankingAndroidApp/src/main/res/layout/dialog_add_account.xml b/ui/BankingAndroidApp/src/main/res/layout/dialog_add_account.xml
index 4a83c5c1..3b8e98ec 100644
--- a/ui/BankingAndroidApp/src/main/res/layout/dialog_add_account.xml
+++ b/ui/BankingAndroidApp/src/main/res/layout/dialog_add_account.xml
@@ -1,7 +1,6 @@
-
-
diff --git a/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_settings.xml b/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_settings.xml
index 0af979a0..c7a18ec2 100644
--- a/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_settings.xml
+++ b/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_settings.xml
@@ -78,13 +78,10 @@
android:inputType="text"
/>
-
diff --git a/ui/BankingAndroidApp/src/main/res/layout/view_bank_credentials_password.xml b/ui/BankingAndroidApp/src/main/res/layout/view_bank_credentials_password.xml
new file mode 100644
index 00000000..5877ea08
--- /dev/null
+++ b/ui/BankingAndroidApp/src/main/res/layout/view_bank_credentials_password.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ui/BankingAndroidApp/src/main/res/values-de/strings.xml b/ui/BankingAndroidApp/src/main/res/values-de/strings.xml
index cf2c38cd..fed53f69 100644
--- a/ui/BankingAndroidApp/src/main/res/values-de/strings.xml
+++ b/ui/BankingAndroidApp/src/main/res/values-de/strings.xml
@@ -24,6 +24,7 @@
Online-Banking Zugangsdaten
Login Name
Passwort
+ Password speichern (kommt noch)
Konten
Bankzugänge
diff --git a/ui/BankingAndroidApp/src/main/res/values/strings.xml b/ui/BankingAndroidApp/src/main/res/values/strings.xml
index 959693f9..749b5563 100644
--- a/ui/BankingAndroidApp/src/main/res/values/strings.xml
+++ b/ui/BankingAndroidApp/src/main/res/values/strings.xml
@@ -24,6 +24,7 @@
Online banking login data
Login name
Password
+ Save password (to be implemented)
Accounts
Bank credentials
diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt
index 07adf759..8cbb0ffa 100755
--- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt
+++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt
@@ -243,7 +243,7 @@ open class AddAccountDialog(protected val presenter: BankingPresenter) : Window(
isEnteredCredentialsResultVisible.value = false
selectedBank?.let {
- presenter.addAccountAsync(it, userName.value, password.value) { response ->
+ presenter.addAccountAsync(it, userName.value, password.value, true) { response ->
runLater { handleAddAccountResultOnUiThread(response) }
}
}
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 758e5be3..de8f16c8 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
@@ -164,8 +164,9 @@ open class BankingPresenter(
// TODO: move BankInfo out of fints4k
- open fun addAccountAsync(bankInfo: BankInfo, userName: String, password: String, callback: (AddAccountResponse) -> Unit) {
+ open fun addAccountAsync(bankInfo: BankInfo, userName: String, password: String, savePassword: Boolean = true, callback: (AddAccountResponse) -> Unit) {
val bank = modelCreator.createBank(bankInfo.bankCode, userName, password, bankInfo.pinTanAddress ?: "", bankInfo.name, bankInfo.bic, "")
+ bank.savePassword = savePassword
val newClient = bankingClientCreator.createClient(bank, dataFolder, asyncRunner, this.callback)
@@ -504,13 +505,14 @@ open class BankingPresenter(
callBanksChangedListeners()
}
- open fun bankUpdated(bank: TypedBankData, enteredUsername: String, enteredPassword: String, selectedTanMethod: TanMethod?) {
- val didCredentialsChange = bank.userName != enteredUsername || bank.password != enteredPassword
+ open fun bankUpdated(bank: TypedBankData, enteredUsername: String, enteredPassword: String, savePassword: Boolean, selectedTanMethod: TanMethod?) {
+ val didCredentialsChange = bank.userName != enteredUsername || bank.password != enteredPassword || bank.savePassword != savePassword
val didSelectedTanMethodChange = bank.selectedTanMethod != selectedTanMethod
if (didCredentialsChange) {
bank.userName = enteredUsername
bank.password = enteredPassword
+ bank.savePassword = savePassword
if (bank.wrongCredentialsEntered) {
bank.wrongCredentialsEntered = false // so that on next call its accounts are considered and so it gets checked if credentials are now correct
diff --git a/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj b/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj
index 71c3cf11..957f105c 100644
--- a/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj
+++ b/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj
@@ -34,6 +34,7 @@
3642F0182502723A005186FE /* UIKitButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F0172502723A005186FE /* UIKitButton.swift */; };
3642F01A2502931F005186FE /* RealTimeTransferInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F0192502931F005186FE /* RealTimeTransferInfoView.swift */; };
3642F04B25031157005186FE /* SectionHeaderWithRightAlignedEditButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F04A25031157005186FE /* SectionHeaderWithRightAlignedEditButton.swift */; };
+ 36671255253A761500BD2301 /* BankCredentialsPasswordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36671254253A761500BD2301 /* BankCredentialsPasswordView.swift */; };
36693A4E25280BCB00BB7AE5 /* InfoButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36693A4D25280BCB00BB7AE5 /* InfoButton.swift */; };
366FA4DA24C472A90094F009 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366FA4D924C472A90094F009 /* Extensions.swift */; };
366FA4DC24C479120094F009 /* BankInfoListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366FA4DB24C479120094F009 /* BankInfoListItem.swift */; };
@@ -197,6 +198,7 @@
3642F0172502723A005186FE /* UIKitButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitButton.swift; sourceTree = ""; };
3642F0192502931F005186FE /* RealTimeTransferInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealTimeTransferInfoView.swift; sourceTree = ""; };
3642F04A25031157005186FE /* SectionHeaderWithRightAlignedEditButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionHeaderWithRightAlignedEditButton.swift; sourceTree = ""; };
+ 36671254253A761500BD2301 /* BankCredentialsPasswordView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankCredentialsPasswordView.swift; sourceTree = ""; };
36693A4D25280BCB00BB7AE5 /* InfoButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoButton.swift; sourceTree = ""; };
366FA4D924C472A90094F009 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; };
366FA4DB24C479120094F009 /* BankInfoListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankInfoListItem.swift; sourceTree = ""; };
@@ -626,6 +628,7 @@
36750531252006C9006B13A0 /* TextWithScrollView.swift */,
36428CFE251BEC4C009DE1AE /* SectionWithoutBackground.swift */,
361282C125223D7700392A4D /* SelectableText.swift */,
+ 36671254253A761500BD2301 /* BankCredentialsPasswordView.swift */,
);
path = views;
sourceTree = "";
@@ -935,6 +938,7 @@
36FC92A124B39A05002B12E9 /* BankingiOSApp.xcdatamodeld in Sources */,
360782D324F429F80098FEFE /* FlickerCodeStripe.swift in Sources */,
36BE06C624D080C900CBBB68 /* FaviconType.swift in Sources */,
+ 36671255253A761500BD2301 /* BankCredentialsPasswordView.swift in Sources */,
360782CD24F1A57F0098FEFE /* LabelledUIKitTextFieldWithValidationLabel.swift in Sources */,
3642F00A2500F5AE005186FE /* Divider.swift in Sources */,
36BCF89324C25BC3005BEC29 /* Mapper.swift in Sources */,
diff --git a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings
index 5e5f13db..37799b09 100644
--- a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings
+++ b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings
@@ -77,6 +77,7 @@
"Enter Online banking login name" = "Enter login name";
"Online banking login password" = "Password";
"Enter Online banking login password" = "Enter password";
+"Save online banking login password" = "Save password (to be implemented)";
"Could not add account" = "Could not add account";
"Error message from your bank %@" = "Error message from your bank:\n\n%@";
diff --git a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings
index 5876d0c1..efab41ac 100644
--- a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings
+++ b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings
@@ -77,6 +77,7 @@
"Enter Online banking login name" = "Login Name eingeben";
"Online banking login password" = "Passwort";
"Enter Online banking login password" = "Passwort eingeben";
+"Save online banking login password" = "Password speichern (kommt noch)";
"Could not add account" = "Konto konnte nicht hinzugefügt werden.";
"Error message from your bank %@" = "Fehlermeldung Ihrer Bank:\n\n%@";
diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AddAccountDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AddAccountDialog.swift
index 4cab9b36..f274097e 100644
--- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AddAccountDialog.swift
+++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AddAccountDialog.swift
@@ -9,6 +9,7 @@ struct AddAccountDialog: View {
@State private var userName = ""
@State private var password = ""
+ @State private var savePassword: Bool = true
@State private var focusLoginNameTextField: Bool = false
@@ -45,8 +46,7 @@ struct AddAccountDialog: View {
LabelledUIKitTextField(label: "Online banking login name", text: $userName, placeholder: "Enter Online banking login name", autocapitalizationType: .none,
focusNextTextFieldOnReturnKeyPress: true, focusTextField: $focusLoginNameTextField, actionOnReturnKeyPress: handleReturnKeyPress)
- LabelledUIKitTextField(label: "Online banking login password", text: $password, placeholder: "Enter Online banking login password",
- autocapitalizationType: .none, isPasswordField: true, actionOnReturnKeyPress: handleReturnKeyPress)
+ BankCredentialsPasswordView($password, $savePassword, handleReturnKeyPress)
}
Section {
@@ -96,7 +96,7 @@ struct AddAccountDialog: View {
isTryingToAddAccount = true
UIApplication.hideKeyboard()
- presenter.addAccountAsync(bankInfo: bank, userName: userName, password: password) { (response) in
+ presenter.addAccountAsync(bankInfo: bank, userName: userName, password: password, savePassword: savePassword) { (response) in
self.handleAddAccountResponse(response)
}
}
diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankSettingsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankSettingsDialog.swift
index 91eb6c18..540a2089 100644
--- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankSettingsDialog.swift
+++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankSettingsDialog.swift
@@ -16,6 +16,7 @@ struct BankSettingsDialog: View {
@State private var userName: String
@State private var password: String
+ @State private var savePassword: Bool
@State private var selectedTanMethod: TanMethod?
@@ -39,6 +40,7 @@ struct BankSettingsDialog: View {
_userName = State(initialValue: bank.userName)
_password = State(initialValue: bank.password)
+ _savePassword = State(initialValue: bank.savePassword)
_selectedTanMethod = State(initialValue: bank.selectedTanMethod)
@@ -55,7 +57,8 @@ struct BankSettingsDialog: View {
Section(header: Text("Credentials")) {
LabelledUIKitTextField(label: "Online banking login name", text: $userName, autocapitalizationType: .none)
- LabelledUIKitTextField(label: "Online banking login password", text: $password, autocapitalizationType: .none, isPasswordField: true)
+
+ BankCredentialsPasswordView($password, $savePassword)
}
Section {
@@ -130,7 +133,7 @@ struct BankSettingsDialog: View {
if hasUnsavedData {
bank.userSetDisplayName = displayName
- presenter.bankUpdated(bank: bank, enteredUsername: userName, enteredPassword: password, selectedTanMethod: selectedTanMethod)
+ presenter.bankUpdated(bank: bank, enteredUsername: userName, enteredPassword: password, savePassword: savePassword, selectedTanMethod: selectedTanMethod)
}
closeDialog()
diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankCredentialsPasswordView.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankCredentialsPasswordView.swift
new file mode 100644
index 00000000..555dfa91
--- /dev/null
+++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankCredentialsPasswordView.swift
@@ -0,0 +1,38 @@
+import SwiftUI
+
+
+struct BankCredentialsPasswordView: View {
+
+ @Binding private var password: String
+
+ @Binding private var savePassword: Bool
+
+ private var handleReturnKeyPress: (() -> Bool)? = nil
+
+
+ init(_ password: Binding, _ showPassword: Binding, _ handleReturnKeyPress: (() -> Bool)? = nil) {
+ self._password = password
+ self._savePassword = showPassword
+ self.handleReturnKeyPress = handleReturnKeyPress
+ }
+
+
+ @ViewBuilder
+ var body: some View {
+ LabelledUIKitTextField(label: "Online banking login password", text: $password, placeholder: "Enter Online banking login password",
+ autocapitalizationType: .none, isPasswordField: true, actionOnReturnKeyPress: handleReturnKeyPress)
+
+ Toggle("Save online banking login password", isOn: $savePassword)
+ .disabled(true)
+ }
+
+}
+
+
+struct BankCredentialsPasswordView_Previews: PreviewProvider {
+
+ static var previews: some View {
+ BankCredentialsPasswordView(.constant(""), .constant(true))
+ }
+
+}