Implemented persisting for which account prominent (top) fetch all transactions view shouldn't be displayed anymore
This commit is contained in:
parent
51044a257c
commit
1d09789d38
|
@ -66,6 +66,9 @@ open class BankAccount(
|
||||||
override var displayIndex: Int = 0
|
override var displayIndex: Int = 0
|
||||||
|
|
||||||
|
|
||||||
|
override var doNotShowStrikingFetchAllTransactionsView = false
|
||||||
|
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return stringRepresentation
|
return stringRepresentation
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,8 @@ open class BankAccountEntity(
|
||||||
override var userSetDisplayName: String? = null,
|
override var userSetDisplayName: String? = null,
|
||||||
override var haveAllTransactionsBeenRetrieved: Boolean = false,
|
override var haveAllTransactionsBeenRetrieved: Boolean = false,
|
||||||
override var isAccountTypeSupportedByApplication: Boolean = true,
|
override var isAccountTypeSupportedByApplication: Boolean = true,
|
||||||
override var displayIndex: Int = 0
|
override var displayIndex: Int = 0,
|
||||||
|
override var doNotShowStrikingFetchAllTransactionsView: Boolean = false
|
||||||
|
|
||||||
) : IBankAccount<AccountTransactionEntity> {
|
) : IBankAccount<AccountTransactionEntity> {
|
||||||
|
|
||||||
|
|
|
@ -293,8 +293,8 @@ class HomeFragment : Fragment() {
|
||||||
|
|
||||||
private fun setFetchAllTransactionsView() {
|
private fun setFetchAllTransactionsView() {
|
||||||
accountsForWhichNotAllTransactionsHaveBeenFetched = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched
|
accountsForWhichNotAllTransactionsHaveBeenFetched = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched
|
||||||
val showFetchAllTransactionsView = accountsForWhichNotAllTransactionsHaveBeenFetched.isNotEmpty()
|
showTopFetchAllTransactionsView = presenter.showStrikingFetchAllTransactionsViewForSelectedAccounts
|
||||||
|| presenter.selectedAccountsTransactionRetrievalState == TransactionsRetrievalState.RetrievedTransactions
|
val showFetchAllTransactionsView = presenter.showFetchAllTransactionsViewForSelectedAccounts
|
||||||
|
|
||||||
if (showFetchAllTransactionsView && showTopFetchAllTransactionsView) {
|
if (showFetchAllTransactionsView && showTopFetchAllTransactionsView) {
|
||||||
lytTopFetchAllTransactions.visibility = View.VISIBLE
|
lytTopFetchAllTransactions.visibility = View.VISIBLE
|
||||||
|
@ -313,9 +313,7 @@ class HomeFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideTopFetchAllTransactionsView() {
|
private fun hideTopFetchAllTransactionsView() {
|
||||||
// TODO: persist
|
presenter.doNotShowStrikingFetchAllTransactionsViewAnymore(accountsForWhichNotAllTransactionsHaveBeenFetched)
|
||||||
|
|
||||||
showTopFetchAllTransactionsView = false
|
|
||||||
|
|
||||||
setFetchAllTransactionsView()
|
setFetchAllTransactionsView()
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,10 @@ open class BankAccount @JvmOverloads constructor(
|
||||||
override var displayIndex: Int = 0
|
override var displayIndex: Int = 0
|
||||||
|
|
||||||
|
|
||||||
|
override var doNotShowStrikingFetchAllTransactionsView = false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return stringRepresentation
|
return stringRepresentation
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ interface IBankAccount<TTransaction: IAccountTransaction> : OrderedDisplayable {
|
||||||
var haveAllTransactionsBeenRetrieved: Boolean
|
var haveAllTransactionsBeenRetrieved: Boolean
|
||||||
var isAccountTypeSupportedByApplication: Boolean
|
var isAccountTypeSupportedByApplication: Boolean
|
||||||
var userSetDisplayName: String?
|
var userSetDisplayName: String?
|
||||||
|
var doNotShowStrikingFetchAllTransactionsView: Boolean
|
||||||
|
|
||||||
|
|
||||||
override val displayName: String
|
override val displayName: String
|
||||||
|
|
|
@ -471,6 +471,16 @@ open class BankingPresenter(
|
||||||
callBanksChangedListeners()
|
callBanksChangedListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun doNotShowStrikingFetchAllTransactionsViewAnymore(accounts: List<TypedBankAccount>) {
|
||||||
|
accounts.forEach { account ->
|
||||||
|
account.doNotShowStrikingFetchAllTransactionsView = true
|
||||||
|
|
||||||
|
persistBankAsync(account.bank)
|
||||||
|
}
|
||||||
|
|
||||||
|
callBanksChangedListeners()
|
||||||
|
}
|
||||||
|
|
||||||
protected open fun persistBankAsync(bank: IBankData<*, *>) {
|
protected open fun persistBankAsync(bank: IBankData<*, *>) {
|
||||||
asyncRunner.runAsync {
|
asyncRunner.runAsync {
|
||||||
persistBankOffUiThread(bank)
|
persistBankOffUiThread(bank)
|
||||||
|
@ -680,6 +690,13 @@ open class BankingPresenter(
|
||||||
open val selectedAccountsForWhichNotAllTransactionsHaveBeenFetched: List<TypedBankAccount>
|
open val selectedAccountsForWhichNotAllTransactionsHaveBeenFetched: List<TypedBankAccount>
|
||||||
get() = selectedAccounts.filter { it.haveAllTransactionsBeenRetrieved == false && it.isAccountTypeSupportedByApplication }
|
get() = selectedAccounts.filter { it.haveAllTransactionsBeenRetrieved == false && it.isAccountTypeSupportedByApplication }
|
||||||
|
|
||||||
|
open val showFetchAllTransactionsViewForSelectedAccounts: Boolean
|
||||||
|
get() = selectedAccountsForWhichNotAllTransactionsHaveBeenFetched.isNotEmpty()
|
||||||
|
&& selectedAccountsTransactionRetrievalState == TransactionsRetrievalState.RetrievedTransactions
|
||||||
|
|
||||||
|
open val showStrikingFetchAllTransactionsViewForSelectedAccounts: Boolean
|
||||||
|
get() = selectedAccountsForWhichNotAllTransactionsHaveBeenFetched.any { it.doNotShowStrikingFetchAllTransactionsView == false }
|
||||||
|
|
||||||
open val selectedAccountsTransactionRetrievalState: TransactionsRetrievalState
|
open val selectedAccountsTransactionRetrievalState: TransactionsRetrievalState
|
||||||
get() = getAccountsTransactionRetrievalState(selectedAccounts)
|
get() = getAccountsTransactionRetrievalState(selectedAccounts)
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
<attribute name="balance" attributeType="Decimal" defaultValueString="0.0"/>
|
<attribute name="balance" attributeType="Decimal" defaultValueString="0.0"/>
|
||||||
<attribute name="currency" attributeType="String"/>
|
<attribute name="currency" attributeType="String"/>
|
||||||
<attribute name="displayIndex" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="displayIndex" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
|
<attribute name="doNotShowStrikingFetchAllTransactionsView" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||||
<attribute name="haveAllTransactionsBeenRetrieved" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
<attribute name="haveAllTransactionsBeenRetrieved" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||||
<attribute name="iban" optional="YES" attributeType="String"/>
|
<attribute name="iban" optional="YES" attributeType="String"/>
|
||||||
<attribute name="identifier" attributeType="String"/>
|
<attribute name="identifier" attributeType="String"/>
|
||||||
|
@ -90,7 +91,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="PersistedBankAccount" positionX="-54" positionY="63" width="128" height="358"/>
|
<element name="PersistedBankAccount" positionX="-54" positionY="63" width="128" height="28"/>
|
||||||
<element name="PersistedBankData" positionX="-63" positionY="-18" width="128" height="283"/>
|
<element name="PersistedBankData" positionX="-63" positionY="-18" width="128" height="283"/>
|
||||||
<element name="PersistedTanMedium" positionX="-45" positionY="144" width="128" height="28"/>
|
<element name="PersistedTanMedium" positionX="-45" positionY="144" width="128" height="28"/>
|
||||||
<element name="PersistedTanMethod" positionX="-54" positionY="135" width="128" height="118"/>
|
<element name="PersistedTanMethod" positionX="-54" positionY="135" width="128" height="118"/>
|
||||||
|
|
|
@ -66,6 +66,8 @@ class Mapper {
|
||||||
mapped.userSetDisplayName = account.userSetDisplayName
|
mapped.userSetDisplayName = account.userSetDisplayName
|
||||||
mapped.displayIndex = account.displayIndex
|
mapped.displayIndex = account.displayIndex
|
||||||
|
|
||||||
|
mapped.doNotShowStrikingFetchAllTransactionsView = account.doNotShowStrikingFetchAllTransactionsView
|
||||||
|
|
||||||
mapped.bookedTransactions = map(mapped, account.transactions as? Set<PersistedAccountTransaction>)
|
mapped.bookedTransactions = map(mapped, account.transactions as? Set<PersistedAccountTransaction>)
|
||||||
|
|
||||||
mapped.technicalId = account.objectIDAsString
|
mapped.technicalId = account.objectIDAsString
|
||||||
|
@ -103,6 +105,8 @@ class Mapper {
|
||||||
mapped.userSetDisplayName = account.userSetDisplayName
|
mapped.userSetDisplayName = account.userSetDisplayName
|
||||||
mapped.displayIndex = account.displayIndex
|
mapped.displayIndex = account.displayIndex
|
||||||
|
|
||||||
|
mapped.doNotShowStrikingFetchAllTransactionsView = account.doNotShowStrikingFetchAllTransactionsView
|
||||||
|
|
||||||
mapped.transactions = NSSet(array: map(mapped, account.bookedTransactions, context))
|
mapped.transactions = NSSet(array: map(mapped, account.bookedTransactions, context))
|
||||||
|
|
||||||
return mapped
|
return mapped
|
||||||
|
|
|
@ -165,8 +165,8 @@ struct AccountTransactionsDialog: View {
|
||||||
let haveTransactionsForSelectedAccountsBeenRetrieved = transactionsRetrievalState == .retrievedtransactions
|
let haveTransactionsForSelectedAccountsBeenRetrieved = transactionsRetrievalState == .retrievedtransactions
|
||||||
|
|
||||||
self.accountsForWhichNotAllTransactionsHaveBeenFetched = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched
|
self.accountsForWhichNotAllTransactionsHaveBeenFetched = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched
|
||||||
self.showFetchAllTransactionsView = accountsForWhichNotAllTransactionsHaveBeenFetched.isNotEmpty && haveTransactionsForSelectedAccountsBeenRetrieved
|
self.showFetchAllTransactionsView = presenter.showFetchAllTransactionsViewForSelectedAccounts
|
||||||
//self.showFetchAllTransactionsViewAtTop = true // TODO: read from database
|
self.showFetchAllTransactionsViewAtTop = presenter.showStrikingFetchAllTransactionsViewForSelectedAccounts
|
||||||
|
|
||||||
|
|
||||||
self.showTransactionsList = haveTransactionsForSelectedAccountsBeenRetrieved
|
self.showTransactionsList = haveTransactionsForSelectedAccountsBeenRetrieved
|
||||||
|
@ -176,12 +176,9 @@ struct AccountTransactionsDialog: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func hideTopFetchAllTransactionsView() {
|
private func hideTopFetchAllTransactionsView() {
|
||||||
// TODO: save that we shouldn't show showFetchAllTransactionsView at top anymore in database
|
presenter.doNotShowStrikingFetchAllTransactionsViewAnymore(accounts: accountsForWhichNotAllTransactionsHaveBeenFetched)
|
||||||
for account in accountsForWhichNotAllTransactionsHaveBeenFetched {
|
|
||||||
//UserDefaults.standard.set(true, forKey: Self.DoNotShowFetchAllTransactionsOverlayForUserDefaultsKeyPrefix + account.technicalId)
|
|
||||||
}
|
|
||||||
|
|
||||||
self.showFetchAllTransactionsViewAtTop = false
|
setTransactionsView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue