Added info popup to explain what 'Fetch all transactions' means (TODO: displays only data of first account for which not all transactions have been fetched, display all)

This commit is contained in:
dankito 2020-10-03 04:17:44 +02:00
parent 3c5f63dcd2
commit 7f14215907
16 changed files with 208 additions and 76 deletions

View File

@ -5,7 +5,6 @@ import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.text.TextWatcher
import android.text.method.DigitsKeyListener
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -33,8 +32,8 @@ import net.dankito.banking.ui.model.responses.BankingClientResponse
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.banking.util.InputValidator
import net.dankito.banking.bankfinder.BankInfo
import net.dankito.banking.ui.android.extensions.hideKeyboard
import net.dankito.banking.ui.android.extensions.isEllipsized
import net.dankito.banking.ui.android.views.InfoPopupWindow
import net.dankito.banking.util.ValidationResult
import net.dankito.utils.multiplatform.toBigDecimal
import net.dankito.utils.android.extensions.asActivity
@ -155,7 +154,7 @@ open class TransferMoneyDialog : DialogFragment() {
val decimalSeparator = DecimalFormatSymbols.getInstance().getDecimalSeparator()
rootView.edtxtAmount.keyListener = DigitsKeyListener.getInstance("0123456789$decimalSeparator")
rootView.btnShowRealTimeTransferInfo.setOnClickListener { showRealTimeTransferInfo(rootView.btnShowRealTimeTransferInfo, rootView) }
rootView.btnShowRealTimeTransferInfo.setOnClickListener { showRealTimeTransferInfo(rootView.btnShowRealTimeTransferInfo) }
setRealTimeTransferControlsVisibility(rootView)
@ -192,21 +191,8 @@ open class TransferMoneyDialog : DialogFragment() {
}
}
protected open fun showRealTimeTransferInfo(btnShowRealTimeTransferInfo: ImageButton, rootView: View) {
requireActivity().layoutInflater.inflate(R.layout.view_real_time_transfer_info, null)?.let { contentView ->
requireContext().hideKeyboard(lytRealTimeTransfer)
val popupWindow = PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
popupWindow.isFocusable = true
popupWindow.isOutsideTouchable = true
contentView.findViewById<Button>(R.id.btnDismissPopup)?.setOnClickListener { popupWindow.dismiss() }
popupWindow.showAtLocation(btnShowRealTimeTransferInfo, Gravity.TOP, 0, 0)
popupWindow.showAsDropDown(btnShowRealTimeTransferInfo)
}
protected open fun showRealTimeTransferInfo(btnShowRealTimeTransferInfo: ImageButton) {
InfoPopupWindow(requireActivity(), R.string.dialog_transfer_money_real_time_transfer_info).show(btnShowRealTimeTransferInfo)
}
private fun transferMoneyIfEnterPressed(editText: EditText) {

View File

@ -6,6 +6,7 @@ import android.os.Bundle
import android.view.*
import android.view.inputmethod.EditorInfo
import android.widget.EditText
import android.widget.ImageButton
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.SearchView
import androidx.fragment.app.Fragment
@ -19,6 +20,7 @@ import net.dankito.banking.ui.android.adapter.AccountTransactionAdapter
import net.dankito.banking.ui.android.di.BankingComponent
import net.dankito.banking.ui.android.extensions.addHorizontalItemDivider
import net.dankito.banking.ui.android.extensions.showAmount
import net.dankito.banking.ui.android.views.InfoPopupWindow
import net.dankito.banking.ui.model.TransactionsRetrievalState
import net.dankito.banking.ui.model.TypedBankAccount
import net.dankito.banking.ui.model.parameters.TransferMoneyData
@ -99,6 +101,8 @@ class HomeFragment : Fragment() {
fetchAllTransactions()
}
rootView.btnShowFetchAllTransactionsInfo.setOnClickListener { showFetchAllTransactionsInfo(rootView.btnShowFetchAllTransactionsInfo) }
rootView.btnHideTopFetchAllTransactionsView.setOnClickListener {
hideTopFetchAllTransactionsView()
}
@ -318,6 +322,15 @@ class HomeFragment : Fragment() {
setFetchAllTransactionsView()
}
private fun showFetchAllTransactionsInfo(btnShowFetchAllTransactionsInfo: ImageButton) {
val account = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched.first()
val dateOfFirstRetrievedTransaction = account.retrievedTransactionsFromOn?.let { presenter.formatToMediumDate(it) } ?: ""
val info = requireContext().getString(R.string.popup_fetch_all_transactions_info, dateOfFirstRetrievedTransaction,
account.countDaysForWhichTransactionsAreKept, presenter.formatToMediumDate(presenter.getDayOfFirstTransactionStoredOnBankServer(account)))
InfoPopupWindow(requireActivity(), info).show(btnShowFetchAllTransactionsInfo, Gravity.BOTTOM)
}
private fun fetchTransactions() {
presenter.fetchTransactionsOfSelectedAccounts()

View File

@ -0,0 +1,38 @@
package net.dankito.banking.ui.android.views
import android.app.Activity
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.PopupWindow
import androidx.annotation.StringRes
import kotlinx.android.synthetic.main.view_info_popup.view.*
import net.dankito.banking.ui.android.R
import net.dankito.banking.ui.android.extensions.hideKeyboard
open class InfoPopupWindow(open val activity: Activity, open val info: String) {
constructor(activity: Activity, @StringRes infoStringResId: Int) : this(activity, activity.getString(infoStringResId))
open fun show(atLocationOf: View, gravity: Int = Gravity.TOP) {
activity.layoutInflater.inflate(R.layout.view_info_popup, null)?.let { contentView ->
activity.hideKeyboard(atLocationOf)
contentView.txtInfo.text = info
val popupWindow = PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
popupWindow.isFocusable = true
popupWindow.isOutsideTouchable = true
contentView.findViewById<Button>(R.id.btnDismissPopup)?.setOnClickListener { popupWindow.dismiss() }
popupWindow.showAtLocation(atLocationOf, gravity, 0, 0)
popupWindow.showAsDropDown(atLocationOf)
}
}
}

View File

@ -154,8 +154,8 @@
<ImageButton
android:id="@+id/btnShowRealTimeTransferInfo"
android:layout_width="@dimen/dialog_transfer_money_real_time_transfer_show_info_button_size"
android:layout_height="@dimen/dialog_transfer_money_real_time_transfer_show_info_button_size"
android:layout_width="@dimen/info_button_size"
android:layout_height="@dimen/info_button_size"
android:layout_weight="0"
android:layout_gravity="start|center_vertical"
android:layout_marginLeft="@dimen/dialog_transfer_money_real_time_transfer_show_info_button_margin_start"

View File

@ -65,10 +65,10 @@
android:gravity="center"
>
<Button
android:id="@+id/btnTopFetchAllTransactions"
android:layout_width="match_parent"
android:layout_height="@dimen/fragment_account_transaction_fetch_all_transactions_button_height"
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
@ -76,12 +76,36 @@
android:layout_toLeftOf="@+id/btnHideTopFetchAllTransactionsView"
android:layout_toStartOf="@+id/btnHideTopFetchAllTransactionsView"
android:gravity="center"
android:textAlignment="gravity"
style="?android:attr/buttonBarButtonStyle"
android:textAllCaps="false"
android:textColor="@color/linkColor"
android:text="@string/fragment_home_fetch_all_account_transactions"
/>
>
<Button
android:id="@+id/btnTopFetchAllTransactions"
android:layout_width="wrap_content"
android:layout_height="@dimen/fragment_account_transaction_fetch_all_transactions_button_height"
android:paddingRight="@dimen/fragment_account_transaction_fetch_transactions_button_end"
android:paddingEnd="@dimen/fragment_account_transaction_fetch_transactions_button_end"
android:gravity="center"
android:textAlignment="gravity"
style="?android:attr/buttonBarButtonStyle"
android:textSize="@dimen/fragment_account_transaction_fetch_all_transactions_button_text_size"
android:textAllCaps="false"
android:textColor="@color/linkColor"
android:text="@string/fragment_home_fetch_all_account_transactions"
/>
<ImageButton
android:id="@+id/btnShowFetchAllTransactionsInfo"
android:layout_width="@dimen/info_button_size"
android:layout_height="@dimen/info_button_size"
android:layout_gravity="start|center_vertical"
android:layout_marginRight="@dimen/fragment_account_transaction_show_fetch_all_transactions_info_button_margin_end"
android:layout_marginEnd="@dimen/fragment_account_transaction_show_fetch_all_transactions_info_button_margin_end"
android:background="@null"
app:srcCompat="@drawable/ic_baseline_info_24"
android:tint="@color/infoIconColor"
/>
</LinearLayout>
<ImageButton
android:id="@+id/btnHideTopFetchAllTransactionsView"
@ -96,7 +120,7 @@
android:layout_marginRight="@dimen/fragment_account_transaction_hide_fetch_all_transactions_button_margin_start_and_end"
android:layout_marginEnd="@dimen/fragment_account_transaction_hide_fetch_all_transactions_button_margin_start_and_end"
android:background="@null"
android:tint="#000000"
android:tint="@color/textColorSecondary"
app:srcCompat="@drawable/ic_baseline_close_24"
/>

View File

@ -15,11 +15,11 @@
>
<TextView
android:id="@+id/txtInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.AppCompat.Medium"
android:textSize="@dimen/view_real_time_transfer_info_text_size"
android:text="@string/dialog_transfer_money_real_time_transfer_info"
android:textSize="@dimen/view_info_popup_text_size"
/>
</ScrollView>
@ -27,14 +27,14 @@
<LinearLayout
android:id="@+id/lytButtonBar"
android:layout_width="match_parent"
android:layout_height="@dimen/view_real_time_info_dismiss_button_height"
android:layout_height="@dimen/view_info_popup_dismiss_button_height"
android:layout_alignParentBottom="true"
android:gravity="center"
>
<Button
android:id="@+id/btnDismissPopup"
android:layout_width="@dimen/view_real_time_transfer_info_dismiss_button_width"
android:layout_width="@dimen/view_info_popup_dismiss_button_width"
android:layout_height="match_parent"
style="?android:attr/buttonBarButtonStyle"
android:text="@android:string/ok"

View File

@ -60,7 +60,13 @@
<string name="fragment_home_transactions_retrieval_state_no_transactions_in_retrieved_period">Empfangener Zeitraum vom %1$s - %2$s enthält keine Umsätze</string>
<string name="fragment_home_transfer_money_to">Neue Überweisung an %s</string>
<string name="fragment_home_transfer_money_with_same_data">Neue Überweisung mit gleichen Daten</string>
<string name="fragment_home_fetch_all_account_transactions">Ältere Umsätze abrufen (erfordert TAN)</string>
<string name="fragment_home_fetch_all_account_transactions">Alle Umsätze abrufen (erfordert TAN)</string>
<string name="popup_fetch_all_transactions_info">Bisher wurden nur die Umsätze seit dem %1$s abgerufen.
\n\nFür dieses Konto können die Umsätze der letzten %2$d Tage, also bis zum %3$s, abgerufen werden.
\n\nWenn Sie dies tun möchten, klicken Sie einfach auf den links stehenden Button.
\n\nMöchten Sie hingegen den Button für dieses Konto nicht mehr angezeigt bekommen, klicken Sie auf das \'x\' rechts. Der Button wird dann immer noch am Ende der Umsatzlist angezeigt, falls Sie die älteren Umsätze später doch noch abrufen möchten.
</string>
<string name="dialog_add_account_enter_bank">Bank (Suche auch mittels Bankleitzahl oder Ort):</string>
<string name="dialog_add_account_add">Hinzufügen</string>

View File

@ -34,6 +34,8 @@
<dimen name="form_on_off_value_height">30dp</dimen>
<dimen name="form_on_off_value_label_text_size">15sp</dimen>
<dimen name="info_button_size">20dp</dimen>
<dimen name="activity_login_app_logo_size">70dp</dimen>
<dimen name="activity_login_app_logo_margin_bottom">40dp</dimen>
<dimen name="activity_login_enter_password_margin_top">30dp</dimen>
@ -52,10 +54,13 @@
<dimen name="fragment_account_transaction_transactions_summary_margin_bottom">6dp</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_end">12dp</dimen>
<dimen name="fragment_account_transaction_show_fetch_all_transactions_info_button_margin_end">12dp</dimen>
<dimen name="fragment_account_transaction_add_account_button_height">40dp</dimen>
<dimen name="fragment_account_transaction_fetch_all_transactions_layout_height">48dp</dimen>
<dimen name="fragment_account_transaction_fetch_all_transactions_button_height">40dp</dimen>
<dimen name="fragment_account_transaction_hide_fetch_all_transactions_button_height_and_width">30dp</dimen>
<dimen name="fragment_account_transaction_fetch_all_transactions_button_text_size">15sp</dimen>
<dimen name="fragment_account_transaction_hide_fetch_all_transactions_button_height_and_width">40dp</dimen>
<dimen name="fragment_account_transaction_hide_fetch_all_transactions_button_margin_start_and_end">2dp</dimen>
<dimen name="list_item_account_transaction_height">74dp</dimen>
@ -104,7 +109,6 @@
<dimen name="dialog_transfer_money_real_time_transfer_text_size">14sp</dimen>
<dimen name="dialog_transfer_money_real_time_transfer_margin_top">6dp</dimen>
<dimen name="dialog_transfer_money_real_time_transfer_margin_bottom">6dp</dimen>
<dimen name="dialog_transfer_money_real_time_transfer_show_info_button_size">20dp</dimen>
<dimen name="dialog_transfer_money_real_time_transfer_show_info_button_margin_start">6dp</dimen>
<dimen name="dialog_transfer_money_real_time_transfer_show_info_button_margin_end">12dp</dimen>
<dimen name="dialog_transfer_money_buttons_width">120dp</dimen>
@ -117,10 +121,9 @@
<dimen name="list_item_recipient_padding">4dp</dimen>
<dimen name="list_item_recipient_space_between_fields">4dp</dimen>
<dimen name="view_real_time_transfer_info_padding">8dp</dimen>
<dimen name="view_real_time_transfer_info_text_size">15sp</dimen>
<dimen name="view_real_time_transfer_info_dismiss_button_width">150dp</dimen>
<dimen name="view_real_time_info_dismiss_button_height">40dp</dimen>
<dimen name="view_info_popup_text_size">15sp</dimen>
<dimen name="view_info_popup_dismiss_button_width">150dp</dimen>
<dimen name="view_info_popup_dismiss_button_height">40dp</dimen>
<dimen name="view_tan_image_controls_buttons_height">40dp</dimen>
<dimen name="view_tan_image_controls_buttons_width">40dp</dimen>

View File

@ -60,7 +60,13 @@
<string name="fragment_home_transactions_retrieval_state_no_transactions_in_retrieved_period">There haven\'t been any transactions in retrieved period from %1$s - %2$s</string>
<string name="fragment_home_transfer_money_to">Transfer money to %s</string>
<string name="fragment_home_transfer_money_with_same_data">New transfer with same data</string>
<string name="fragment_home_fetch_all_account_transactions">Fetch earlier transactions (requires TAN)</string>
<string name="fragment_home_fetch_all_account_transactions">Fetch all transactions (requires TAN)</string>
<string name="popup_fetch_all_transactions_info">Until now only the transactions since the %1$s were retrieved.
\n\nFor this account the transactions of the last %2$d days, i.e. up to %3$s, can be retrieved.
\n\nIf you want to do this, simply click on the button to the left.
\n\nIf you no longer wish to see this button for this account, click on the \'x\' on the right. The button will still be displayed at the end of the list of transactions, in case you want to retrieve the earlier transactions later.
</string>
<string name="dialog_add_account_enter_bank">Bank (find also by bank code or city):</string>
<string name="dialog_add_account_add">Add</string>

View File

@ -427,15 +427,17 @@ open class BankingPresenter(
protected open fun didFetchAllTransactionsStoredOnBankServer(account: IBankAccount<IAccountTransaction>, fetchedTransactions: Collection<IAccountTransaction>): Boolean {
account.countDaysForWhichTransactionsAreKept?.let { countDaysForWhichTransactionsAreKept ->
(account.retrievedTransactionsFromOn ?: getDateOfFirstRetrievedTransaction(account.bookedTransactions) ?: getDateOfFirstRetrievedTransaction(fetchedTransactions))?.let { retrievedTransactionsFromOn ->
val dayOfFirstTransactionStoredOnBankServer = Date(Date.today.millisSinceEpoch - countDaysForWhichTransactionsAreKept * OneDayMillis)
return retrievedTransactionsFromOn.isBeforeOrEquals(dayOfFirstTransactionStoredOnBankServer)
return retrievedTransactionsFromOn.isBeforeOrEquals(getDayOfFirstTransactionStoredOnBankServer(account))
}
}
return false
}
open fun getDayOfFirstTransactionStoredOnBankServer(account: IBankAccount<IAccountTransaction>): Date {
return Date(Date.today.millisSinceEpoch - (account.countDaysForWhichTransactionsAreKept ?: 0) * OneDayMillis)
}
protected open fun getDateOfFirstRetrievedTransaction(transactions: Collection<IAccountTransaction>): Date? {
return transactions.map { it.valueDate }.minBy { it.millisSinceEpoch }
}

View File

@ -32,6 +32,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 */; };
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 */; };
366FA4E024C4924A0094F009 /* RecipientListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366FA4DF24C4924A0094F009 /* RecipientListItem.swift */; };
@ -186,6 +187,7 @@
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>"; };
3642F04A25031157005186FE /* SectionHeaderWithRightAlignedEditButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionHeaderWithRightAlignedEditButton.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>"; };
366FA4DB24C479120094F009 /* BankInfoListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankInfoListItem.swift; sourceTree = "<group>"; };
366FA4DF24C4924A0094F009 /* RecipientListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipientListItem.swift; sourceTree = "<group>"; };
@ -568,6 +570,7 @@
36BE06B424CF85A300CBBB68 /* AmountLabel.swift */,
360782CE24F3D6610098FEFE /* InfoLabel.swift */,
360782C224E49FF70098FEFE /* ValidationLabel.swift */,
36693A4D25280BCB00BB7AE5 /* InfoButton.swift */,
3642F0192502931F005186FE /* RealTimeTransferInfoView.swift */,
36BE065C24CB08FB00CBBB68 /* LazyView.swift */,
36C4009A24D2F9E4005227AD /* IconedTitleView.swift */,
@ -832,6 +835,7 @@
3675052C251FFE98006B13A0 /* AccountTransactionDetailsDialog.swift in Sources */,
36B8A44B2503D1E800C15359 /* BiometricAuthenticationService.swift in Sources */,
36FC929E24B39A05002B12E9 /* SceneDelegate.swift in Sources */,
36693A4E25280BCB00BB7AE5 /* InfoButton.swift in Sources */,
3607829924E148D40098FEFE /* AdaptsToKeyboard.swift in Sources */,
36750532252006C9006B13A0 /* TextWithScrollView.swift in Sources */,
36E21ECF24DA0EEE00649DC8 /* IconView.swift in Sources */,

View File

@ -78,7 +78,11 @@
"%@ transactions" = "%@ transactions";
"Fetch all account transactions" = "Fetch earlier transactions (requires TAN)";
"Fetch all account transactions" = "Fetch all transactions (requires TAN)";
"Fetch all transactions info %@ %@ %@" = "Until now only the transactions since the %@ were retrieved.
\n\nFor this account the transactions of the last %@ days, i.e. up to %@, can be retrieved.
\n\nIf you want to do this, simply click on the button to the left.
\n\nIf you no longer wish to see this button for this account, click on the \'x\' on the right. The button will still be displayed at the end of the list of transactions, in case you want to retrieve the earlier transactions later.";
"Fetch transactions" = "Fetch transactions";
"Account type not supported by app" = "Account type not supported by app";

View File

@ -78,7 +78,11 @@
"%@ transactions" = "%@ Umsätze";
"Fetch all account transactions" = "Ältere Umsätze laden (erfordert TAN)";
"Fetch all account transactions" = "Alle Umsätze abrufen (erfordert TAN)";
"Fetch all transactions info %@ %@ %@" = "Bisher wurden nur die Umsätze seit dem %@ abgerufen.
\n\nFür dieses Konto können die Umsätze der letzten %@ Tage, also bis zum %@, abgerufen werden.
\n\nWenn Sie dies tun möchten, klicken Sie einfach auf den links stehenden Button.
\n\nMöchten Sie hingegen den Button für dieses Konto nicht mehr angezeigt bekommen, klicken Sie auf das \'x\' rechts. Der Button wird dann immer noch am Ende der Umsatzlist angezeigt, falls Sie die älteren Umsätze später doch noch abrufen möchten.";
"Fetch transactions" = "Umsätze abrufen";
"Account type not supported by app" = "Kontotyp wird von App nicht unterstützt";

View File

@ -98,6 +98,9 @@ struct AccountTransactionsDialog: View {
fetchAllTransactionsButton
.padding(.horizontal, 0)
InfoButton(getFetchAllTransactionsInfoText(), .bottom)
.padding(.horizontal, 8)
}
.padding(.horizontal, 0)
.padding(.trailing, Self.HideTopFetchAllTransactionsViewButtonWidth)
@ -185,11 +188,20 @@ struct AccountTransactionsDialog: View {
private var fetchAllTransactionsButton: some View {
Button(action: { self.fetchAllTransactions() } ) {
Text("Fetch all account transactions")
.font(.callout)
.multilineTextAlignment(.center)
}
.foregroundColor(Color.blue)
}
private func getFetchAllTransactionsInfoText() -> LocalizedStringKey {
let account = presenter.selectedAccountsForWhichNotAllTransactionsHaveBeenFetched.first!
let dateOfFirstRetrievedTransaction = account.retrievedTransactionsFromOn != nil ? presenter.formatToMediumDate(date: account.retrievedTransactionsFromOn!) : ""
return LocalizedStringKey("Fetch all transactions info \(dateOfFirstRetrievedTransaction) \(account.countDaysForWhichTransactionsAreKept ?? 0) \(presenter.formatToMediumDate(date: presenter.getDayOfFirstTransactionStoredOnBankServer(account: account)))")
}
private var hideTopFetchAllTransactionsViewButton: some View {
// do not set Button's action as then if any of the two buttons get pressed, both actions get executed (bug in iOS). Use .onTapGesture() instead
Button("X") { }

View File

@ -0,0 +1,57 @@
import SwiftUI
struct InfoButton: View {
@State private var showInfoPopover = false
private let infoText: LocalizedStringKey
private let arrowEdge: Edge
init(_ infoText: LocalizedStringKey, _ arrowEdge: Edge = .leading) {
self.infoText = infoText
self.arrowEdge = arrowEdge
}
var body: some View {
UIKitButton(.infoLight) { self.showInfoPopover = true }
.frame(width: 15, height: 15)
.popover(isPresented: $showInfoPopover, arrowEdge: arrowEdge ) {
if UIDevice.isRunningOniPad {
ScrollView {
Text(infoText)
.padding()
.detailForegroundColor()
}
}
else {
VStack {
Text(infoText)
.padding()
.detailForegroundColor()
HStack {
Spacer()
Button("OK") { self.showInfoPopover = false }
Spacer()
}
}
}
}
}
}
struct InfoButton_Previews: PreviewProvider {
static var previews: some View {
InfoButton("Info")
}
}

View File

@ -3,8 +3,6 @@ import SwiftUI
struct RealTimeTransferInfoView: View {
@State private var showRealTimeTransferInfoPopover = false
var body: some View {
HStack {
@ -15,32 +13,7 @@ struct RealTimeTransferInfoView: View {
.minimumScaleFactor(0.5)
.padding(.horizontal, 0)
UIKitButton(.infoLight) { self.showRealTimeTransferInfoPopover = true }
.frame(width: 15, height: 15)
.popover(isPresented: $showRealTimeTransferInfoPopover, arrowEdge: .leading ) {
if UIDevice.isRunningOniPad {
ScrollView {
Text("Real-time transfer information")
.padding()
.detailForegroundColor()
}
}
else {
VStack {
Text("Real-time transfer information")
.padding()
.detailForegroundColor()
HStack {
Spacer()
Button("OK") { self.showRealTimeTransferInfoPopover = false }
Spacer()
}
}
}
}
InfoButton("Real-time transfer information")
}
}