From afc8ce9ee926a4595a69b2faccee2bbe901ae6be Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 6 Jul 2020 23:55:33 +0200 Subject: [PATCH] Started AddAccountDialog --- .../Base.lproj/Localizable.strings | 9 ++++ .../BankingiOSApp/ContentView.swift | 5 +- ui/BankingiOSApp/BankingiOSApp/Info.plist | 4 ++ .../de.lproj/Localizable.strings | 9 ++++ .../BankingiOSApp/ui/ViewExtensions.swift | 13 +++++ .../BankingiOSApp/ui/views/AccountsTab.swift | 20 +++++++ .../ui/views/AddAccountDialog.swift | 53 +++++++++++++++++++ 7 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings create mode 100644 ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings create mode 100644 ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift create mode 100644 ui/BankingiOSApp/BankingiOSApp/ui/views/AccountsTab.swift create mode 100644 ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift diff --git a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings new file mode 100644 index 00000000..6ea8ffa6 --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings @@ -0,0 +1,9 @@ + +"Add" = "Add"; + +"Accounts" = "Accounts"; +"Add account" = "Add account"; + +"Bank code" = "Bank code"; +"Customer ID" = "Online banking login name"; +"Password" = "Online banking password"; diff --git a/ui/BankingiOSApp/BankingiOSApp/ContentView.swift b/ui/BankingiOSApp/BankingiOSApp/ContentView.swift index 833bbc64..38773b3d 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ContentView.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ContentView.swift @@ -6,12 +6,11 @@ struct ContentView: View { var body: some View { TabView(selection: $selection){ - Text("First View") - .font(.title) + AccountsTab() .tabItem { VStack { Image("first") - Text("First") + Text("Accounts") } } .tag(0) diff --git a/ui/BankingiOSApp/BankingiOSApp/Info.plist b/ui/BankingiOSApp/BankingiOSApp/Info.plist index 043afcea..c5d166da 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Info.plist +++ b/ui/BankingiOSApp/BankingiOSApp/Info.plist @@ -66,5 +66,9 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UTImportedTypeDeclarations + + + diff --git a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings new file mode 100644 index 00000000..ab7a217f --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings @@ -0,0 +1,9 @@ + +"Add" = "Hinzufügen"; + +"Accounts" = "Konten"; +"Add account" = "Konto hinzufügen"; + +"Bank code" = "Bankleitzahl"; +"Customer ID" = "Onlinebanking Login Name"; +"Password" = "Online banking password"; diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift b/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift new file mode 100644 index 00000000..ffa28958 --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift @@ -0,0 +1,13 @@ + +import SwiftUI + + +extension View { + + func hideNavigationBar() -> some View { + return self + .navigationBarHidden(true) + .navigationBarTitle("Title") + } + +} \ No newline at end of file diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountsTab.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountsTab.swift new file mode 100644 index 00000000..13aa7ee3 --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AccountsTab.swift @@ -0,0 +1,20 @@ + +import SwiftUI + +struct AccountsTab: View { + var body: some View { + NavigationView { + NavigationLink(destination: AddAccountDialog()) { + Text("Add account") + } + } + .navigationBarHidden(true) + } +} + + +struct AccountsTab_Previews: PreviewProvider { + static var previews: some View { + AccountsTab() + } +} \ No newline at end of file diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift new file mode 100644 index 00000000..df8791c4 --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift @@ -0,0 +1,53 @@ +import SwiftUI + + +struct AddAccountDialog: View { + + @State private var bankCode = "" + @State private var customerId = "" + @State private var password = "" + + var body: some View { + NavigationView { + Form { + Section { + TextField("Bank code", text: $bankCode) + } + + Section { + TextField("Customer ID", text: $customerId) + + SecureField("Password", text: $password) + } + + Section { + HStack { + Spacer() + Button(action: { self.addAccount() }, + label: { Text("Add") }) + .disabled(!self.isRequiredDataEntered()) + Spacer() + } + } + } + .hideNavigationBar() + } + } + + func isRequiredDataEntered() -> Bool { + return bankCode.isEmpty == false + && customerId.isEmpty == false + && password.isEmpty == false + } + + func addAccount() { + + } +} + + +struct AddAccountDialog_Previews: PreviewProvider { + static var previews: some View { + AddAccountDialog() + } +} \ No newline at end of file