diff --git a/ui/BankingiOSApp/BankingiOSApp/Assets.xcassets/TransferMoney.imageset/Contents.json b/ui/BankingiOSApp/BankingiOSApp/Assets.xcassets/TransferMoney.imageset/Contents.json new file mode 100644 index 00000000..77aed8ef --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/Assets.xcassets/TransferMoney.imageset/Contents.json @@ -0,0 +1,15 @@ +{ + "images" : [ + { + "filename" : "transfer_money_2.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true + } +} diff --git a/ui/BankingiOSApp/BankingiOSApp/Assets.xcassets/TransferMoney.imageset/transfer_money_2.pdf b/ui/BankingiOSApp/BankingiOSApp/Assets.xcassets/TransferMoney.imageset/transfer_money_2.pdf new file mode 100644 index 00000000..098aa5c3 --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/Assets.xcassets/TransferMoney.imageset/transfer_money_2.pdf @@ -0,0 +1,119 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 5.000000 26.000000 cm +0.000000 0.000000 0.000000 scn +0.000000 5.000000 m +0.000000 5.552285 0.447715 6.000000 1.000000 6.000000 c +10.000000 6.000000 l +10.552285 6.000000 11.000000 5.552285 11.000000 5.000000 c +11.000000 1.000000 l +11.000000 0.447715 10.552284 0.000000 10.000000 0.000000 c +1.000000 0.000000 l +0.447715 0.000000 0.000000 0.447715 0.000000 1.000000 c +0.000000 5.000000 l +h +f +n +Q +q +-1.000000 -0.000000 -0.000000 1.000000 29.000000 8.000000 cm +0.000000 0.000000 0.000000 scn +0.000000 5.000000 m +0.000000 5.552285 0.447715 6.000000 1.000000 6.000000 c +10.000000 6.000000 l +10.552285 6.000000 11.000000 5.552285 11.000000 5.000000 c +11.000000 1.000000 l +11.000000 0.447715 10.552284 0.000000 10.000000 0.000000 c +1.000000 0.000000 l +0.447715 0.000000 0.000000 0.447715 0.000000 1.000000 c +0.000000 5.000000 l +h +f +n +Q +q +-0.000000 -1.000000 1.000000 -0.000000 16.871948 40.000000 cm +0.000000 0.000000 0.000000 scn +9.267950 14.128052 m +10.037750 15.461385 11.962252 15.461386 12.732052 14.128053 c +18.794230 3.628055 l +19.564030 2.294721 18.601780 0.628054 17.062180 0.628054 c +4.937824 0.628054 l +3.398223 0.628054 2.435971 2.294721 3.205772 3.628054 c +9.267950 14.128052 l +h +f +n +Q +q +0.000000 -1.000000 -1.000000 -0.000000 17.128052 22.000000 cm +0.000000 0.000000 0.000000 scn +9.267950 14.128052 m +10.037750 15.461385 11.962252 15.461386 12.732052 14.128053 c +18.794230 3.628055 l +19.564030 2.294721 18.601780 0.628054 17.062180 0.628054 c +4.937824 0.628054 l +3.398223 0.628054 2.435971 2.294721 3.205772 3.628054 c +9.267950 14.128052 l +h +f +n +Q + +endstream +endobj + +3 0 obj + 1620 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 34.000000 40.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Type /Catalog + /Pages 5 0 R + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000001710 00000 n +0000001733 00000 n +0000001906 00000 n +0000001980 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +2039 +%%EOF \ No newline at end of file diff --git a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings index 20439fb5..a2f03fee 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings +++ b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings @@ -33,8 +33,16 @@ "Error message from your bank %@" = "Error message from your bank:\n\n%@"; +/* AccountTransactionsDialog */ + +"Transfer money to %@" = "Transfer money to %@"; + + +/* New action sheet */ + "Show transfer money dialog" = "Transfer money"; + /* TransferMoneyDialog */ "Transfer Money Dialog Title" = "Überweisung"; diff --git a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings index f4912bce..f4b744bb 100644 --- a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings +++ b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings @@ -33,8 +33,16 @@ "Error message from your bank %@" = "Fehlermeldung Ihrer Bank:\n\n%@"; +/* AccountTransactionsDialog */ + +"Transfer money to %@" = "Neue Überweisung an %@"; + + +/* New action sheet */ + "Show transfer money dialog" = "Überweisung"; + /* TransferMoneyDialog */ "Transfer Money Dialog Title" = "Überweisung"; diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift index 4432b6e8..50eceb88 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountTransactionListItem.swift @@ -14,6 +14,9 @@ struct AccountTransactionListItem: View { private let transaction: AccountTransaction + + + private var transferMoneyData: TransferMoneyData @Inject private var presenter: BankingPresenterSwift @@ -21,6 +24,8 @@ struct AccountTransactionListItem: View { init(_ transaction: AccountTransaction) { self.transaction = transaction + + self.transferMoneyData = TransferMoneyData.Companion().fromAccountTransaction(transaction: transaction) } @@ -48,6 +53,17 @@ struct AccountTransactionListItem: View { .styleAsDetail() } } + .contextMenu { + if transaction.otherPartyAccountId != nil && transaction.bankAccount.supportsTransferringMoney { + NavigationLink(destination: LazyView(TransferMoneyDialog(preselectedBankAccount: self.transaction.bankAccount, preselectedValues: self.transferMoneyData))) { + HStack { + Text("Transfer money to \(transaction.otherPartyName ?? "")") + + Image("TransferMoney") + } + } + } + } } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift index 87fb3b67..fa176b1a 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/TransferMoneyDialog.swift @@ -56,6 +56,26 @@ struct TransferMoneyDialog: View { self.showAccounts = self.accountsSupportingTransferringMoney.count > 1 } + init(preselectedBankAccount: BankAccount, preselectedValues: TransferMoneyData) { + self.init() + + self._selectedAccountIndex = State(initialValue: accountsSupportingTransferringMoney.firstIndex(where: { account in account == preselectedBankAccount }) ?? 0) + + self._remitteeName = State(initialValue: preselectedValues.creditorName) + self._remitteeBic = State(initialValue: preselectedValues.creditorBic) + self._remitteeIban = State(initialValue: preselectedValues.creditorIban) + + self._usage = State(initialValue: preselectedValues.usage) + + if preselectedValues.amount.decimal != NSDecimalNumber.zero { + self._amount = State(initialValue: preselectedValues.amount.format(countDecimalPlaces: 2)) + } + + if preselectedBankAccount.supportsInstantPaymentMoneyTransfer { + self._instantPayment = State(initialValue: preselectedValues.instantPayment) + } + } + var body: some View { Form {