Implemented displaying a switch to be able to set if password should be saved or not, but there's not logic behind it yet
This commit is contained in:
parent
197a984353
commit
a7b47665a5
|
@ -70,11 +70,11 @@ open class AddAccountDialog : DialogFragment() {
|
||||||
initBankListAutocompletion(edtxtBank.actualEditText)
|
initBankListAutocompletion(edtxtBank.actualEditText)
|
||||||
|
|
||||||
edtxtUserName.actualEditText.addTextChangedListener(otherEditTextChangedWatcher)
|
edtxtUserName.actualEditText.addTextChangedListener(otherEditTextChangedWatcher)
|
||||||
edtxtPassword.actualEditText.addTextChangedListener(otherEditTextChangedWatcher)
|
bankCredentialsPassword.passwordBox.addTextChangedListener(otherEditTextChangedWatcher)
|
||||||
|
|
||||||
addAccountIfEnterPressed(edtxtBank.actualEditText)
|
addAccountIfEnterPressed(edtxtBank.actualEditText)
|
||||||
addAccountIfEnterPressed(edtxtUserName.actualEditText)
|
addAccountIfEnterPressed(edtxtUserName.actualEditText)
|
||||||
addAccountIfEnterPressed(edtxtPassword.actualEditText)
|
addAccountIfEnterPressed(bankCredentialsPassword.passwordBox)
|
||||||
|
|
||||||
btnAddAccount.setOnClickListener { addAccount() }
|
btnAddAccount.setOnClickListener { addAccount() }
|
||||||
btnCancel.setOnClickListener { dismiss() }
|
btnCancel.setOnClickListener { dismiss() }
|
||||||
|
@ -112,12 +112,12 @@ open class AddAccountDialog : DialogFragment() {
|
||||||
protected open fun addAccount() {
|
protected open fun addAccount() {
|
||||||
selectedBank?.let { selectedBank -> // should always be non-null at this stage
|
selectedBank?.let { selectedBank -> // should always be non-null at this stage
|
||||||
val userName = edtxtUserName.text
|
val userName = edtxtUserName.text
|
||||||
val password = edtxtPassword.text
|
val password = bankCredentialsPassword.password
|
||||||
|
|
||||||
btnAddAccount.isEnabled = false
|
btnAddAccount.isEnabled = false
|
||||||
pgrbrAddAccount.visibility = View.VISIBLE
|
pgrbrAddAccount.visibility = View.VISIBLE
|
||||||
|
|
||||||
presenter.addAccountAsync(selectedBank, userName, password) { response ->
|
presenter.addAccountAsync(selectedBank, userName, password, bankCredentialsPassword.savePassword) { response ->
|
||||||
context?.asActivity()?.runOnUiThread {
|
context?.asActivity()?.runOnUiThread {
|
||||||
btnAddAccount.isEnabled = true
|
btnAddAccount.isEnabled = true
|
||||||
pgrbrAddAccount.visibility = View.GONE
|
pgrbrAddAccount.visibility = View.GONE
|
||||||
|
@ -184,7 +184,7 @@ open class AddAccountDialog : DialogFragment() {
|
||||||
val requiredDataEntered = selectedBank != null
|
val requiredDataEntered = selectedBank != null
|
||||||
&& selectedBank?.supportsFinTs3_0 == true
|
&& selectedBank?.supportsFinTs3_0 == true
|
||||||
&& edtxtUserName.text.isNotEmpty()
|
&& edtxtUserName.text.isNotEmpty()
|
||||||
&& edtxtPassword.text.isNotEmpty()
|
&& bankCredentialsPassword.password.isNotEmpty()
|
||||||
|
|
||||||
btnAddAccount.isEnabled = requiredDataEntered
|
btnAddAccount.isEnabled = requiredDataEntered
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,7 @@ import android.os.Bundle
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import kotlinx.android.synthetic.main.dialog_bank_settings.edtxtBankName
|
import kotlinx.android.synthetic.main.dialog_bank_settings.*
|
||||||
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.view.*
|
import kotlinx.android.synthetic.main.dialog_bank_settings.view.*
|
||||||
import kotlinx.android.synthetic.main.dialog_bank_settings.view.toolbar
|
import kotlinx.android.synthetic.main.dialog_bank_settings.view.toolbar
|
||||||
import net.dankito.banking.ui.android.R
|
import net.dankito.banking.ui.android.R
|
||||||
|
@ -64,7 +62,8 @@ open class BankSettingsDialog : SettingsDialogBase() {
|
||||||
|
|
||||||
edtxtBankName.text = bank.displayName
|
edtxtBankName.text = bank.displayName
|
||||||
edtxtUserName.text = bank.userName
|
edtxtUserName.text = bank.userName
|
||||||
edtxtPassword.text = bank.password
|
bankCredentialsPassword.password = bank.password
|
||||||
|
bankCredentialsPassword.savePassword = bank.savePassword
|
||||||
|
|
||||||
val tanMethodItems = createTanMethodItems()
|
val tanMethodItems = createTanMethodItems()
|
||||||
val tanMethodsAdapter = FastAdapterRecyclerView(rootView.rcyTanMethods, tanMethodItems)
|
val tanMethodsAdapter = FastAdapterRecyclerView(rootView.rcyTanMethods, tanMethodItems)
|
||||||
|
@ -127,13 +126,14 @@ open class BankSettingsDialog : SettingsDialogBase() {
|
||||||
override val hasUnsavedChanges: Boolean
|
override val hasUnsavedChanges: Boolean
|
||||||
get() = didChange(edtxtBankName, bank.displayName)
|
get() = didChange(edtxtBankName, bank.displayName)
|
||||||
|| didChange(edtxtUserName, bank.userName)
|
|| didChange(edtxtUserName, bank.userName)
|
||||||
|| didChange(edtxtPassword, bank.password)
|
|| bankCredentialsPassword.password != bank.password
|
||||||
|
|| bankCredentialsPassword.savePassword != bank.savePassword
|
||||||
|| bank.selectedTanMethod != selectedTanMethod
|
|| bank.selectedTanMethod != selectedTanMethod
|
||||||
|
|
||||||
override fun saveChanges() {
|
override fun saveChanges() {
|
||||||
bank.userSetDisplayName = edtxtBankName.text
|
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() {
|
protected open fun askUserToDeleteAccount() {
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -34,14 +33,10 @@
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<net.dankito.banking.ui.android.views.BankCredentialsPasswordView
|
||||||
<net.dankito.banking.ui.android.views.FormEditText
|
android:id="@+id/bankCredentialsPassword"
|
||||||
android:id="@+id/edtxtPassword"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:showPasswordToggle="true"
|
|
||||||
android:hint="@string/online_banking_credentials_password"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,10 @@
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<net.dankito.banking.ui.android.views.FormEditText
|
<net.dankito.banking.ui.android.views.BankCredentialsPasswordView
|
||||||
android:id="@+id/edtxtPassword"
|
android:id="@+id/bankCredentialsPassword"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:showPasswordToggle="true"
|
|
||||||
android:hint="@string/online_banking_credentials_password"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
|
<net.dankito.banking.ui.android.views.FormEditText
|
||||||
|
android:id="@+id/edtxtPassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:showPasswordToggle="true"
|
||||||
|
android:hint="@string/online_banking_credentials_password"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/swtchSavePassword"
|
||||||
|
style="@style/FormSwitchStyle"
|
||||||
|
android:text="@string/online_banking_credentials_save_password"
|
||||||
|
android:checked="true"
|
||||||
|
android:enabled="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -24,6 +24,7 @@
|
||||||
<string name="online_banking_credentials_section_title">Online-Banking Zugangsdaten</string>
|
<string name="online_banking_credentials_section_title">Online-Banking Zugangsdaten</string>
|
||||||
<string name="online_banking_credentials_login_name">Login Name</string>
|
<string name="online_banking_credentials_login_name">Login Name</string>
|
||||||
<string name="online_banking_credentials_password">Passwort</string>
|
<string name="online_banking_credentials_password">Passwort</string>
|
||||||
|
<string name="online_banking_credentials_save_password">Password speichern (kommt noch)</string>
|
||||||
|
|
||||||
<string name="accounts">Konten</string>
|
<string name="accounts">Konten</string>
|
||||||
<string name="bank_credentials">Bankzugänge</string>
|
<string name="bank_credentials">Bankzugänge</string>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<string name="online_banking_credentials_section_title">Online banking login data</string>
|
<string name="online_banking_credentials_section_title">Online banking login data</string>
|
||||||
<string name="online_banking_credentials_login_name">Login name</string>
|
<string name="online_banking_credentials_login_name">Login name</string>
|
||||||
<string name="online_banking_credentials_password">Password</string>
|
<string name="online_banking_credentials_password">Password</string>
|
||||||
|
<string name="online_banking_credentials_save_password">Save password (to be implemented)</string>
|
||||||
|
|
||||||
<string name="accounts">Accounts</string>
|
<string name="accounts">Accounts</string>
|
||||||
<string name="bank_credentials">Bank credentials</string>
|
<string name="bank_credentials">Bank credentials</string>
|
||||||
|
|
|
@ -243,7 +243,7 @@ open class AddAccountDialog(protected val presenter: BankingPresenter) : Window(
|
||||||
isEnteredCredentialsResultVisible.value = false
|
isEnteredCredentialsResultVisible.value = false
|
||||||
|
|
||||||
selectedBank?.let {
|
selectedBank?.let {
|
||||||
presenter.addAccountAsync(it, userName.value, password.value) { response ->
|
presenter.addAccountAsync(it, userName.value, password.value, true) { response ->
|
||||||
runLater { handleAddAccountResultOnUiThread(response) }
|
runLater { handleAddAccountResultOnUiThread(response) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,8 +164,9 @@ open class BankingPresenter(
|
||||||
|
|
||||||
|
|
||||||
// TODO: move BankInfo out of fints4k
|
// 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, "")
|
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)
|
val newClient = bankingClientCreator.createClient(bank, dataFolder, asyncRunner, this.callback)
|
||||||
|
|
||||||
|
@ -504,13 +505,14 @@ open class BankingPresenter(
|
||||||
callBanksChangedListeners()
|
callBanksChangedListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun bankUpdated(bank: TypedBankData, enteredUsername: String, enteredPassword: String, selectedTanMethod: TanMethod?) {
|
open fun bankUpdated(bank: TypedBankData, enteredUsername: String, enteredPassword: String, savePassword: Boolean, selectedTanMethod: TanMethod?) {
|
||||||
val didCredentialsChange = bank.userName != enteredUsername || bank.password != enteredPassword
|
val didCredentialsChange = bank.userName != enteredUsername || bank.password != enteredPassword || bank.savePassword != savePassword
|
||||||
val didSelectedTanMethodChange = bank.selectedTanMethod != selectedTanMethod
|
val didSelectedTanMethodChange = bank.selectedTanMethod != selectedTanMethod
|
||||||
|
|
||||||
if (didCredentialsChange) {
|
if (didCredentialsChange) {
|
||||||
bank.userName = enteredUsername
|
bank.userName = enteredUsername
|
||||||
bank.password = enteredPassword
|
bank.password = enteredPassword
|
||||||
|
bank.savePassword = savePassword
|
||||||
|
|
||||||
if (bank.wrongCredentialsEntered) {
|
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
|
bank.wrongCredentialsEntered = false // so that on next call its accounts are considered and so it gets checked if credentials are now correct
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
3642F0182502723A005186FE /* UIKitButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F0172502723A005186FE /* UIKitButton.swift */; };
|
3642F0182502723A005186FE /* UIKitButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F0172502723A005186FE /* UIKitButton.swift */; };
|
||||||
3642F01A2502931F005186FE /* RealTimeTransferInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F0192502931F005186FE /* RealTimeTransferInfoView.swift */; };
|
3642F01A2502931F005186FE /* RealTimeTransferInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F0192502931F005186FE /* RealTimeTransferInfoView.swift */; };
|
||||||
3642F04B25031157005186FE /* SectionHeaderWithRightAlignedEditButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F04A25031157005186FE /* SectionHeaderWithRightAlignedEditButton.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 */; };
|
36693A4E25280BCB00BB7AE5 /* InfoButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36693A4D25280BCB00BB7AE5 /* InfoButton.swift */; };
|
||||||
366FA4DA24C472A90094F009 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366FA4D924C472A90094F009 /* Extensions.swift */; };
|
366FA4DA24C472A90094F009 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366FA4D924C472A90094F009 /* Extensions.swift */; };
|
||||||
366FA4DC24C479120094F009 /* BankInfoListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366FA4DB24C479120094F009 /* BankInfoListItem.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 = "<group>"; };
|
3642F0172502723A005186FE /* UIKitButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitButton.swift; sourceTree = "<group>"; };
|
||||||
3642F0192502931F005186FE /* RealTimeTransferInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealTimeTransferInfoView.swift; sourceTree = "<group>"; };
|
3642F0192502931F005186FE /* RealTimeTransferInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealTimeTransferInfoView.swift; sourceTree = "<group>"; };
|
||||||
3642F04A25031157005186FE /* SectionHeaderWithRightAlignedEditButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionHeaderWithRightAlignedEditButton.swift; sourceTree = "<group>"; };
|
3642F04A25031157005186FE /* SectionHeaderWithRightAlignedEditButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionHeaderWithRightAlignedEditButton.swift; sourceTree = "<group>"; };
|
||||||
|
36671254253A761500BD2301 /* BankCredentialsPasswordView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankCredentialsPasswordView.swift; sourceTree = "<group>"; };
|
||||||
36693A4D25280BCB00BB7AE5 /* InfoButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoButton.swift; sourceTree = "<group>"; };
|
36693A4D25280BCB00BB7AE5 /* InfoButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoButton.swift; sourceTree = "<group>"; };
|
||||||
366FA4D924C472A90094F009 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
|
366FA4D924C472A90094F009 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
|
||||||
366FA4DB24C479120094F009 /* BankInfoListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankInfoListItem.swift; sourceTree = "<group>"; };
|
366FA4DB24C479120094F009 /* BankInfoListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankInfoListItem.swift; sourceTree = "<group>"; };
|
||||||
|
@ -626,6 +628,7 @@
|
||||||
36750531252006C9006B13A0 /* TextWithScrollView.swift */,
|
36750531252006C9006B13A0 /* TextWithScrollView.swift */,
|
||||||
36428CFE251BEC4C009DE1AE /* SectionWithoutBackground.swift */,
|
36428CFE251BEC4C009DE1AE /* SectionWithoutBackground.swift */,
|
||||||
361282C125223D7700392A4D /* SelectableText.swift */,
|
361282C125223D7700392A4D /* SelectableText.swift */,
|
||||||
|
36671254253A761500BD2301 /* BankCredentialsPasswordView.swift */,
|
||||||
);
|
);
|
||||||
path = views;
|
path = views;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -935,6 +938,7 @@
|
||||||
36FC92A124B39A05002B12E9 /* BankingiOSApp.xcdatamodeld in Sources */,
|
36FC92A124B39A05002B12E9 /* BankingiOSApp.xcdatamodeld in Sources */,
|
||||||
360782D324F429F80098FEFE /* FlickerCodeStripe.swift in Sources */,
|
360782D324F429F80098FEFE /* FlickerCodeStripe.swift in Sources */,
|
||||||
36BE06C624D080C900CBBB68 /* FaviconType.swift in Sources */,
|
36BE06C624D080C900CBBB68 /* FaviconType.swift in Sources */,
|
||||||
|
36671255253A761500BD2301 /* BankCredentialsPasswordView.swift in Sources */,
|
||||||
360782CD24F1A57F0098FEFE /* LabelledUIKitTextFieldWithValidationLabel.swift in Sources */,
|
360782CD24F1A57F0098FEFE /* LabelledUIKitTextFieldWithValidationLabel.swift in Sources */,
|
||||||
3642F00A2500F5AE005186FE /* Divider.swift in Sources */,
|
3642F00A2500F5AE005186FE /* Divider.swift in Sources */,
|
||||||
36BCF89324C25BC3005BEC29 /* Mapper.swift in Sources */,
|
36BCF89324C25BC3005BEC29 /* Mapper.swift in Sources */,
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
"Enter Online banking login name" = "Enter login name";
|
"Enter Online banking login name" = "Enter login name";
|
||||||
"Online banking login password" = "Password";
|
"Online banking login password" = "Password";
|
||||||
"Enter Online banking login password" = "Enter 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";
|
"Could not add account" = "Could not add account";
|
||||||
"Error message from your bank %@" = "Error message from your bank:\n\n%@";
|
"Error message from your bank %@" = "Error message from your bank:\n\n%@";
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
"Enter Online banking login name" = "Login Name eingeben";
|
"Enter Online banking login name" = "Login Name eingeben";
|
||||||
"Online banking login password" = "Passwort";
|
"Online banking login password" = "Passwort";
|
||||||
"Enter Online banking login password" = "Passwort eingeben";
|
"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.";
|
"Could not add account" = "Konto konnte nicht hinzugefügt werden.";
|
||||||
"Error message from your bank %@" = "Fehlermeldung Ihrer Bank:\n\n%@";
|
"Error message from your bank %@" = "Fehlermeldung Ihrer Bank:\n\n%@";
|
||||||
|
|
|
@ -9,6 +9,7 @@ struct AddAccountDialog: View {
|
||||||
|
|
||||||
@State private var userName = ""
|
@State private var userName = ""
|
||||||
@State private var password = ""
|
@State private var password = ""
|
||||||
|
@State private var savePassword: Bool = true
|
||||||
|
|
||||||
@State private var focusLoginNameTextField: Bool = false
|
@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,
|
LabelledUIKitTextField(label: "Online banking login name", text: $userName, placeholder: "Enter Online banking login name", autocapitalizationType: .none,
|
||||||
focusNextTextFieldOnReturnKeyPress: true, focusTextField: $focusLoginNameTextField, actionOnReturnKeyPress: handleReturnKeyPress)
|
focusNextTextFieldOnReturnKeyPress: true, focusTextField: $focusLoginNameTextField, actionOnReturnKeyPress: handleReturnKeyPress)
|
||||||
|
|
||||||
LabelledUIKitTextField(label: "Online banking login password", text: $password, placeholder: "Enter Online banking login password",
|
BankCredentialsPasswordView($password, $savePassword, handleReturnKeyPress)
|
||||||
autocapitalizationType: .none, isPasswordField: true, actionOnReturnKeyPress: handleReturnKeyPress)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
|
@ -96,7 +96,7 @@ struct AddAccountDialog: View {
|
||||||
isTryingToAddAccount = true
|
isTryingToAddAccount = true
|
||||||
UIApplication.hideKeyboard()
|
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)
|
self.handleAddAccountResponse(response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ struct BankSettingsDialog: View {
|
||||||
|
|
||||||
@State private var userName: String
|
@State private var userName: String
|
||||||
@State private var password: String
|
@State private var password: String
|
||||||
|
@State private var savePassword: Bool
|
||||||
|
|
||||||
@State private var selectedTanMethod: TanMethod?
|
@State private var selectedTanMethod: TanMethod?
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ struct BankSettingsDialog: View {
|
||||||
|
|
||||||
_userName = State(initialValue: bank.userName)
|
_userName = State(initialValue: bank.userName)
|
||||||
_password = State(initialValue: bank.password)
|
_password = State(initialValue: bank.password)
|
||||||
|
_savePassword = State(initialValue: bank.savePassword)
|
||||||
|
|
||||||
_selectedTanMethod = State(initialValue: bank.selectedTanMethod)
|
_selectedTanMethod = State(initialValue: bank.selectedTanMethod)
|
||||||
|
|
||||||
|
@ -55,7 +57,8 @@ struct BankSettingsDialog: View {
|
||||||
Section(header: Text("Credentials")) {
|
Section(header: Text("Credentials")) {
|
||||||
LabelledUIKitTextField(label: "Online banking login name", text: $userName, autocapitalizationType: .none)
|
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 {
|
Section {
|
||||||
|
@ -130,7 +133,7 @@ struct BankSettingsDialog: View {
|
||||||
if hasUnsavedData {
|
if hasUnsavedData {
|
||||||
bank.userSetDisplayName = displayName
|
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()
|
closeDialog()
|
||||||
|
|
|
@ -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<String>, _ showPassword: Binding<Bool>, _ 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))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue