Don't showing an overlay anymore but button to fetch all transactions directly above transactions list
This commit is contained in:
parent
06c5f58d4c
commit
5ded582c78
|
@ -53,8 +53,6 @@ class HomeFragment : Fragment() {
|
||||||
|
|
||||||
private var accountsForWhichNotAllTransactionsHaveBeenFetched = listOf<TypedBankAccount>()
|
private var accountsForWhichNotAllTransactionsHaveBeenFetched = listOf<TypedBankAccount>()
|
||||||
|
|
||||||
private var doNotShowFetchAllTransactionsOverlay = false
|
|
||||||
|
|
||||||
|
|
||||||
private val transactionAdapter: AccountTransactionAdapter
|
private val transactionAdapter: AccountTransactionAdapter
|
||||||
|
|
||||||
|
@ -99,11 +97,6 @@ class HomeFragment : Fragment() {
|
||||||
fetchAllTransactions()
|
fetchAllTransactions()
|
||||||
}
|
}
|
||||||
|
|
||||||
rootView.btnHideFetchAllTransactionsOverlay.setOnClickListener {
|
|
||||||
doNotShowFetchAllTransactionsOverlay = true
|
|
||||||
setFetchAllTransactionsView()
|
|
||||||
}
|
|
||||||
|
|
||||||
rootView.btnRetrieveTransactions.setOnClickListener { fetchTransactions() }
|
rootView.btnRetrieveTransactions.setOnClickListener { fetchTransactions() }
|
||||||
rootView.btnAddAccount.setOnClickListener { presenter.showAddAccountDialog() }
|
rootView.btnAddAccount.setOnClickListener { presenter.showAddAccountDialog() }
|
||||||
|
|
||||||
|
@ -275,7 +268,7 @@ class HomeFragment : Fragment() {
|
||||||
btnRetrieveTransactions.visibility = if (TransactionsCannotBeRetrievedStates.contains(transactionsRetrievalState)) View.GONE else View.VISIBLE
|
btnRetrieveTransactions.visibility = if (TransactionsCannotBeRetrievedStates.contains(transactionsRetrievalState)) View.GONE else View.VISIBLE
|
||||||
btnAddAccount.visibility = if (noAccountsAddedYet) View.VISIBLE else View.GONE
|
btnAddAccount.visibility = if (noAccountsAddedYet) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
var messageArgs = mutableListOf<String>()
|
val messageArgs = mutableListOf<String>()
|
||||||
val transactionsRetrievalStateMessageId = when (transactionsRetrievalState) {
|
val transactionsRetrievalStateMessageId = when (transactionsRetrievalState) {
|
||||||
TransactionsRetrievalState.AccountTypeNotSupported -> R.string.fragment_home_transactions_retrieval_state_account_type_not_supported
|
TransactionsRetrievalState.AccountTypeNotSupported -> R.string.fragment_home_transactions_retrieval_state_account_type_not_supported
|
||||||
TransactionsRetrievalState.AccountDoesNotSupportFetchingTransactions -> R.string.fragment_home_transactions_retrieval_state_account_does_not_support_retrieving_transactions
|
TransactionsRetrievalState.AccountDoesNotSupportFetchingTransactions -> R.string.fragment_home_transactions_retrieval_state_account_does_not_support_retrieving_transactions
|
||||||
|
@ -294,19 +287,14 @@ class HomeFragment : Fragment() {
|
||||||
private fun setFetchAllTransactionsView() {
|
private fun setFetchAllTransactionsView() {
|
||||||
accountsForWhichNotAllTransactionsHaveBeenFetched = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched
|
accountsForWhichNotAllTransactionsHaveBeenFetched = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched
|
||||||
|
|
||||||
var floatingActionMenuBottomMarginResourceId = R.dimen.fab_margin_bottom_without_toolbar
|
val hideFetchAllTransactionsView = accountsForWhichNotAllTransactionsHaveBeenFetched.isEmpty()
|
||||||
|
|| presenter.selectedAccountsTransactionRetrievalState != TransactionsRetrievalState.RetrievedTransactions
|
||||||
|
|
||||||
if (doNotShowFetchAllTransactionsOverlay || accountsForWhichNotAllTransactionsHaveBeenFetched.isEmpty()
|
if (hideFetchAllTransactionsView) {
|
||||||
|| presenter.selectedAccountsTransactionRetrievalState != TransactionsRetrievalState.RetrievedTransactions) {
|
lytFetchAllTransactions.visibility = View.GONE
|
||||||
lytFetchAllTransactionsOverlay.visibility = View.GONE
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lytFetchAllTransactionsOverlay.visibility = View.VISIBLE
|
lytFetchAllTransactions.visibility = View.VISIBLE
|
||||||
floatingActionMenuBottomMarginResourceId = R.dimen.fab_margin_bottom_with_fetch_all_transactions_overlay
|
|
||||||
}
|
|
||||||
|
|
||||||
(requireActivity().findViewById<View>(R.id.floatingActionMenu).layoutParams as? ViewGroup.MarginLayoutParams)?.let { params ->
|
|
||||||
params.bottomMargin = requireContext().getDimension(floatingActionMenuBottomMarginResourceId)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,22 +12,23 @@
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
>
|
>
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/lytTransactionsTopBar"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/fragment_account_transaction_margin_start_and_end"
|
|
||||||
android:layout_marginEnd="@dimen/fragment_account_transaction_margin_start_and_end"
|
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_above="@+id/lytFetchAllTransactionsOverlay"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/lytTransactionsSummary"
|
android:id="@+id/lytTransactionsSummary"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/fragment_account_transaction_transactions_summary_height"
|
android:layout_height="@dimen/fragment_account_transaction_transactions_summary_height"
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_marginLeft="@dimen/fragment_account_transaction_margin_start_and_end"
|
||||||
|
android:layout_marginStart="@dimen/fragment_account_transaction_margin_start_and_end"
|
||||||
|
android:layout_marginRight="@dimen/fragment_account_transaction_margin_start_and_end"
|
||||||
|
android:layout_marginEnd="@dimen/fragment_account_transaction_margin_start_and_end"
|
||||||
>
|
>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -56,113 +57,93 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rcyvwAccountTransactions"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/lytTransactionsSummary"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:id="@+id/lytNoTransactionsFetched"
|
android:id="@+id/lytFetchAllTransactions"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/fragment_account_transaction_fetch_all_transactions_layout_height"
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:visibility="gone"
|
android:background="@color/formSectionDivideColor"
|
||||||
>
|
>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/txtNoTransactionsFetchedMessage"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textAlignment="gravity"
|
|
||||||
style="@style/TextAppearance.AppCompat.Medium"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnRetrieveTransactions"
|
android:id="@+id/btnFetchAllTransactions"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/fragment_account_transaction_fetch_transactions_button_height"
|
android:layout_height="@dimen/fragment_account_transaction_fetch_all_transactions_button_height"
|
||||||
android:layout_marginTop="@dimen/fragment_account_transaction_fetch_transactions_button_margin_top"
|
android:gravity="center_horizontal"
|
||||||
android:gravity="center"
|
android:textAlignment="center"
|
||||||
android:textAlignment="gravity"
|
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
android:textSize="@dimen/textAppearanceMediumTextSize"
|
android:textAllCaps="false"
|
||||||
android:textColor="@color/linkColor"
|
android:textColor="@color/linkColor"
|
||||||
android:text="@string/fragment_home_fetch_transactions"
|
android:text="@string/fragment_home_fetch_all_account_transactions"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rcyvwAccountTransactions"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/lytTransactionsTopBar"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginLeft="@dimen/fragment_account_transaction_margin_start_and_end"
|
||||||
|
android:layout_marginStart="@dimen/fragment_account_transaction_margin_start_and_end"
|
||||||
|
android:layout_marginRight="@dimen/fragment_account_transaction_margin_start_and_end"
|
||||||
|
android:layout_marginEnd="@dimen/fragment_account_transaction_margin_start_and_end"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/lytNoTransactionsFetched"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="gone"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtNoTransactionsFetchedMessage"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAlignment="gravity"
|
||||||
|
style="@style/TextAppearance.AppCompat.Medium"
|
||||||
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnAddAccount"
|
android:id="@+id/btnRetrieveTransactions"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/fragment_account_transaction_fetch_transactions_button_height"
|
android:layout_height="@dimen/fragment_account_transaction_fetch_transactions_button_height"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_marginTop="@dimen/fragment_account_transaction_fetch_transactions_button_margin_top"
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textAlignment="gravity"
|
android:textAlignment="gravity"
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
android:textSize="@dimen/textAppearanceMediumTextSize"
|
android:textSize="@dimen/textAppearanceMediumTextSize"
|
||||||
android:textColor="@color/linkColor"
|
android:textColor="@color/linkColor"
|
||||||
android:text="@string/add_account"
|
android:text="@string/fragment_home_fetch_transactions"
|
||||||
android:visibility="gone"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<Button
|
||||||
android:id="@+id/lytFetchAllTransactionsOverlay"
|
android:id="@+id/btnAddAccount"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/fragment_account_transaction_fetch_all_transactions_overlay_height"
|
android:layout_height="@dimen/fragment_account_transaction_fetch_transactions_button_height"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center"
|
||||||
android:background="@color/snackbarBackground"
|
android:textAlignment="gravity"
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:textSize="@dimen/textAppearanceMediumTextSize"
|
||||||
|
android:textColor="@color/linkColor"
|
||||||
|
android:text="@string/add_account"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
>
|
/>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnFetchAllTransactions"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_toLeftOf="@+id/btnHideFetchAllTransactionsOverlay"
|
|
||||||
android:layout_toStartOf="@+id/btnHideFetchAllTransactionsOverlay"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:gravity="center"
|
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
|
||||||
android:textColor="@color/linkColor"
|
|
||||||
android:text="@string/fragment_home_fetch_all_account_transactions"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/btnHideFetchAllTransactionsOverlay"
|
|
||||||
android:layout_width="@dimen/fragment_account_transaction_button_close_fetch_all_transactions_overlay_size"
|
|
||||||
android:layout_height="@dimen/fragment_account_transaction_button_close_fetch_all_transactions_overlay_size"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_marginRight="@dimen/fragment_account_transaction_button_close_fetch_all_transactions_overlay_margin_end"
|
|
||||||
android:layout_marginEnd="@dimen/fragment_account_transaction_button_close_fetch_all_transactions_overlay_margin_end"
|
|
||||||
android:background="@null"
|
|
||||||
android:tint="#FFFFFF"
|
|
||||||
app:srcCompat="@drawable/ic_baseline_close_24"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,8 @@
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_toLeftOf="@+id/lytAmountAndDate"
|
android:layout_toLeftOf="@+id/lytAmountAndDate"
|
||||||
android:layout_toStartOf="@+id/lytAmountAndDate"
|
android:layout_toStartOf="@+id/lytAmountAndDate"
|
||||||
android:layout_marginLeft="@dimen/list_item_account_transaction_transaction_text_margin_left_and_right"
|
android:layout_marginRight="@dimen/list_item_account_transaction_transaction_text_margin_end"
|
||||||
android:layout_marginStart="@dimen/list_item_account_transaction_transaction_text_margin_left_and_right"
|
android:layout_marginEnd="@dimen/list_item_account_transaction_transaction_text_margin_end"
|
||||||
android:layout_marginRight="@dimen/list_item_account_transaction_transaction_text_margin_left_and_right"
|
|
||||||
android:layout_marginEnd="@dimen/list_item_account_transaction_transaction_text_margin_left_and_right"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
<dimen name="fab_margin">16dp</dimen>
|
||||||
<dimen name="fab_margin_bottom_without_toolbar">16dp</dimen>
|
<dimen name="fab_margin_bottom_without_toolbar">16dp</dimen>
|
||||||
<dimen name="fab_margin_bottom_with_toolbar">42dp</dimen>
|
<dimen name="fab_margin_bottom_with_toolbar">42dp</dimen>
|
||||||
<dimen name="fab_margin_bottom_with_fetch_all_transactions_overlay">64dp</dimen>
|
|
||||||
|
|
||||||
<dimen name="form_padding">12dp</dimen>
|
<dimen name="form_padding">12dp</dimen>
|
||||||
<dimen name="form_section_height">60dp</dimen>
|
<dimen name="form_section_height">60dp</dimen>
|
||||||
|
@ -30,9 +29,8 @@
|
||||||
<dimen name="fragment_account_transaction_fetch_transactions_button_height">40dp</dimen>
|
<dimen name="fragment_account_transaction_fetch_transactions_button_height">40dp</dimen>
|
||||||
<dimen name="fragment_account_transaction_fetch_transactions_button_margin_top">18dp</dimen>
|
<dimen name="fragment_account_transaction_fetch_transactions_button_margin_top">18dp</dimen>
|
||||||
<dimen name="fragment_account_transaction_add_account_button_height">40dp</dimen>
|
<dimen name="fragment_account_transaction_add_account_button_height">40dp</dimen>
|
||||||
<dimen name="fragment_account_transaction_fetch_all_transactions_overlay_height">48dp</dimen>
|
<dimen name="fragment_account_transaction_fetch_all_transactions_layout_height">48dp</dimen>
|
||||||
<dimen name="fragment_account_transaction_button_close_fetch_all_transactions_overlay_size">20dp</dimen>
|
<dimen name="fragment_account_transaction_fetch_all_transactions_button_height">40dp</dimen>
|
||||||
<dimen name="fragment_account_transaction_button_close_fetch_all_transactions_overlay_margin_end">6dp</dimen>
|
|
||||||
|
|
||||||
<dimen name="list_item_account_transaction_height">74dp</dimen>
|
<dimen name="list_item_account_transaction_height">74dp</dimen>
|
||||||
<dimen name="list_item_account_transaction_padding">0dp</dimen>
|
<dimen name="list_item_account_transaction_padding">0dp</dimen>
|
||||||
|
@ -45,7 +43,7 @@
|
||||||
<dimen name="list_item_account_transaction_amount_width">70dp</dimen>
|
<dimen name="list_item_account_transaction_amount_width">70dp</dimen>
|
||||||
<dimen name="list_item_account_transaction_date_margin_top">2dp</dimen>
|
<dimen name="list_item_account_transaction_date_margin_top">2dp</dimen>
|
||||||
<dimen name="list_item_account_transaction_date_margin_bottom">0dp</dimen>
|
<dimen name="list_item_account_transaction_date_margin_bottom">0dp</dimen>
|
||||||
<dimen name="list_item_account_transaction_transaction_text_margin_left_and_right">4dp</dimen>
|
<dimen name="list_item_account_transaction_transaction_text_margin_end">4dp</dimen>
|
||||||
|
|
||||||
<dimen name="dialog_add_account_padding">4dp</dimen>
|
<dimen name="dialog_add_account_padding">4dp</dimen>
|
||||||
<dimen name="dialog_add_account_label_height">24dp</dimen>
|
<dimen name="dialog_add_account_label_height">24dp</dimen>
|
||||||
|
|
|
@ -4,8 +4,6 @@ import BankingUiSwift
|
||||||
|
|
||||||
struct AccountTransactionsDialog: View {
|
struct AccountTransactionsDialog: View {
|
||||||
|
|
||||||
static private let DoNotShowFetchAllTransactionsOverlayForUserDefaultsKeyPrefix = "DoNotShowFetchAllTransactionsOverlayFor_"
|
|
||||||
|
|
||||||
static private let RetrievedTransactionsPeriodDateFormat = DateFormatter()
|
static private let RetrievedTransactionsPeriodDateFormat = DateFormatter()
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,17 +12,13 @@ struct AccountTransactionsDialog: View {
|
||||||
private let showBankIcons: Bool
|
private let showBankIcons: Bool
|
||||||
|
|
||||||
|
|
||||||
@State private var haveTransactionsBeenRetrievedForSelectedAccounts = true
|
|
||||||
|
|
||||||
@State private var haveAllTransactionsBeenFetched: Bool = false
|
|
||||||
|
|
||||||
@State private var showTransactionsList = true
|
@State private var showTransactionsList = true
|
||||||
|
|
||||||
@State private var noTransactionsFetchedMessage: LocalizedStringKey = ""
|
@State private var noTransactionsFetchedMessage: LocalizedStringKey = ""
|
||||||
|
|
||||||
@State private var showFetchTransactionsButton = true
|
@State private var showFetchTransactionsButton = true
|
||||||
|
|
||||||
@State private var showFetchAllTransactionsOverlay: Bool = false
|
@State private var showFetchAllTransactionsView: Bool = false
|
||||||
|
|
||||||
@State private var accountsForWhichNotAllTransactionsHaveBeenFetched: [IBankAccount] = []
|
@State private var accountsForWhichNotAllTransactionsHaveBeenFetched: [IBankAccount] = []
|
||||||
|
|
||||||
|
@ -88,14 +82,30 @@ struct AccountTransactionsDialog: View {
|
||||||
HStack {
|
HStack {
|
||||||
Text("\(String(self.filteredTransactions.count)) transactions")
|
Text("\(String(self.filteredTransactions.count)) transactions")
|
||||||
.styleAsDetail()
|
.styleAsDetail()
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
AmountLabel(amount: self.balanceOfFilteredTransactions)
|
AmountLabel(amount: self.balanceOfFilteredTransactions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if showFetchAllTransactionsView {
|
||||||
|
Section {
|
||||||
|
HStack(alignment: .center) {
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
fetchAllTransactionsButton
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding(.horizontal, 6)
|
||||||
|
}
|
||||||
|
.frame(maxWidth: .infinity, minHeight: 44) // has to have at least a height of 44 (iOS 14; iOS 13: 40), otherwise a white line at bottom gets displayed
|
||||||
|
.systemGroupedBackground() // TODO: extract with below .removeSectionBackground() (or create View?)
|
||||||
|
.listRowInsets(EdgeInsets()) // TODO: extract remove list insets
|
||||||
|
}
|
||||||
|
|
||||||
if showTransactionsList {
|
if showTransactionsList {
|
||||||
Section {
|
Section {
|
||||||
ForEach(filteredTransactions, id: \.technicalId) { transaction in
|
ForEach(filteredTransactions, id: \.technicalId) { transaction in
|
||||||
|
@ -114,49 +124,8 @@ struct AccountTransactionsDialog: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if haveAllTransactionsBeenFetched == false && showFetchAllTransactionsOverlay == false && haveTransactionsBeenRetrievedForSelectedAccounts {
|
|
||||||
Section {
|
|
||||||
HStack {
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
fetchAllTransactionsButton
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.frame(maxWidth: .infinity, minHeight: 40)
|
|
||||||
.systemGroupedBackground()
|
|
||||||
.listRowInsets(EdgeInsets())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.systemGroupedBackground()
|
.systemGroupedBackground()
|
||||||
|
|
||||||
if showFetchAllTransactionsOverlay {
|
|
||||||
VStack {
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
HStack(alignment: .center) {
|
|
||||||
Button(action: { self.doNotShowFetchAllTransactionsOverlayAnymore() }) {
|
|
||||||
Text("x")
|
|
||||||
.bold()
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
fetchAllTransactionsButton
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
.padding(.horizontal, 6)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
.frame(height: 40)
|
|
||||||
.padding(0)
|
|
||||||
.systemGroupedBackground()
|
|
||||||
.overlay(Divider(color: Color.gray), alignment: .top)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.executeMutatingMethod {
|
.executeMutatingMethod {
|
||||||
self.setInitialValues()
|
self.setInitialValues()
|
||||||
|
@ -177,14 +146,13 @@ struct AccountTransactionsDialog: View {
|
||||||
|
|
||||||
private func setTransactionsView() {
|
private func setTransactionsView() {
|
||||||
let transactionsRetrievalState = presenter.selectedAccountsTransactionRetrievalState
|
let transactionsRetrievalState = presenter.selectedAccountsTransactionRetrievalState
|
||||||
self.haveTransactionsBeenRetrievedForSelectedAccounts = transactionsRetrievalState == .retrievedtransactions
|
let haveTransactionsForSelectedAccountsBeenRetrieved = transactionsRetrievalState == .retrievedtransactions
|
||||||
|
|
||||||
self.accountsForWhichNotAllTransactionsHaveBeenFetched = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched
|
self.accountsForWhichNotAllTransactionsHaveBeenFetched = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched
|
||||||
self.haveAllTransactionsBeenFetched = self.accountsForWhichNotAllTransactionsHaveBeenFetched.isEmpty
|
self.showFetchAllTransactionsView = shouldShowFetchAllTransactionsView && haveTransactionsForSelectedAccountsBeenRetrieved
|
||||||
self.showFetchAllTransactionsOverlay = shouldShowFetchAllTransactionsOverlay && haveTransactionsBeenRetrievedForSelectedAccounts
|
|
||||||
|
|
||||||
|
|
||||||
self.showTransactionsList = haveTransactionsBeenRetrievedForSelectedAccounts
|
self.showTransactionsList = haveTransactionsForSelectedAccountsBeenRetrieved
|
||||||
|
|
||||||
self.noTransactionsFetchedMessage = getNoTransactionsFetchedMessage(transactionsRetrievalState)
|
self.noTransactionsFetchedMessage = getNoTransactionsFetchedMessage(transactionsRetrievalState)
|
||||||
self.showFetchTransactionsButton = transactionsRetrievalState != .accountdoesnotsupportfetchingtransactions && transactionsRetrievalState != .accounttypenotsupported
|
self.showFetchTransactionsButton = transactionsRetrievalState != .accountdoesnotsupportfetchingtransactions && transactionsRetrievalState != .accounttypenotsupported
|
||||||
|
@ -280,24 +248,8 @@ struct AccountTransactionsDialog: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private func doNotShowFetchAllTransactionsOverlayAnymore() {
|
private var shouldShowFetchAllTransactionsView: Bool {
|
||||||
for account in accountsForWhichNotAllTransactionsHaveBeenFetched {
|
return accountsForWhichNotAllTransactionsHaveBeenFetched.isNotEmpty
|
||||||
UserDefaults.standard.set(true, forKey: Self.DoNotShowFetchAllTransactionsOverlayForUserDefaultsKeyPrefix + account.technicalId)
|
|
||||||
}
|
|
||||||
|
|
||||||
showFetchAllTransactionsOverlay = false
|
|
||||||
}
|
|
||||||
|
|
||||||
private var shouldShowFetchAllTransactionsOverlay: Bool {
|
|
||||||
if accountsForWhichNotAllTransactionsHaveBeenFetched.isNotEmpty {
|
|
||||||
var copy = accountsForWhichNotAllTransactionsHaveBeenFetched
|
|
||||||
|
|
||||||
copy.removeAll { UserDefaults.standard.bool(forKey: Self.DoNotShowFetchAllTransactionsOverlayForUserDefaultsKeyPrefix + $0.technicalId, defaultValue: false) }
|
|
||||||
|
|
||||||
return copy.isNotEmpty
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue