gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] branch master updated: switch views with sidebar


From: gnunet
Subject: [taler-taler-ios] branch master updated: switch views with sidebar
Date: Wed, 27 Jul 2022 08:12:50 +0200

This is an automated email from the git hooks/post-receive script.

jonathan-buchanan pushed a commit to branch master
in repository taler-ios.

The following commit(s) were added to refs/heads/master by this push:
     new 17a428e  switch views with sidebar
17a428e is described below

commit 17a428ec093c5f1a426c0041f95be05b612ca7fe
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Wed Jul 27 02:12:26 2022 -0400

    switch views with sidebar
---
 Taler.xcodeproj/project.pbxproj                    |   4 +
 .../UserInterfaceState.xcuserstate                 | Bin 141921 -> 0 bytes
 Taler/ContentView.swift                            |  88 +++++++++++++--------
 Taler/SettingsView.swift                           |  36 +++++++++
 4 files changed, 95 insertions(+), 33 deletions(-)

diff --git a/Taler.xcodeproj/project.pbxproj b/Taler.xcodeproj/project.pbxproj
index ee553cd..b1a7e6b 100644
--- a/Taler.xcodeproj/project.pbxproj
+++ b/Taler.xcodeproj/project.pbxproj
@@ -10,6 +10,7 @@
                AB1F87C82887C94700AB82A0 /* TalerApp.swift in Sources */ = {isa 
= PBXBuildFile; fileRef = AB1F87C72887C94700AB82A0 /* TalerApp.swift */; };
                AB1F87CA2887D2F400AB82A0 /* ContentView.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = AB1F87C92887D2F400AB82A0 /* ContentView.swift 
*/; };
                AB8C3807286A88A600E0A1DD /* WalletBackendTests.swift in Sources 
*/ = {isa = PBXBuildFile; fileRef = AB8C3806286A88A500E0A1DD /* 
WalletBackendTests.swift */; };
+               ABB762AD2891059600E88634 /* SettingsView.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = ABB762AC2891059600E88634 /* SettingsView.swift 
*/; };
                ABC13AA32859962800D23185 /* taler-swift in Frameworks */ = {isa 
= PBXBuildFile; productRef = ABC13AA22859962800D23185 /* taler-swift */; };
                ABE97B1D286D82BF00580772 /* AnyCodable in Frameworks */ = {isa 
= PBXBuildFile; productRef = ABE97B1C286D82BF00580772 /* AnyCodable */; };
                D112510026B12E3200D02E00 /* taler-wallet-embedded.js in 
CopyFiles */ = {isa = PBXBuildFile; fileRef = D11250FF26B12E3200D02E00 /* 
taler-wallet-embedded.js */; };
@@ -55,6 +56,7 @@
                AB1F87C92887D2F400AB82A0 /* ContentView.swift */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.swift; path = 
ContentView.swift; sourceTree = "<group>"; };
                AB710490285995B6008B04F0 /* taler-swift */ = {isa = 
PBXFileReference; lastKnownFileType = text; path = "taler-swift"; sourceTree = 
SOURCE_ROOT; };
                AB8C3806286A88A500E0A1DD /* WalletBackendTests.swift */ = {isa 
= PBXFileReference; lastKnownFileType = sourcecode.swift; path = 
WalletBackendTests.swift; sourceTree = "<group>"; };
+               ABB762AC2891059600E88634 /* SettingsView.swift */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.swift; path = 
SettingsView.swift; sourceTree = "<group>"; };
                D11250FF26B12E3200D02E00 /* taler-wallet-embedded.js */ = {isa 
= PBXFileReference; lastKnownFileType = sourcecode.javascript; path = 
"taler-wallet-embedded.js"; sourceTree = "<group>"; };
                D14AFD1D24D232B300C51073 /* Taler.app */ = {isa = 
PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; 
path = Taler.app; sourceTree = BUILT_PRODUCTS_DIR; };
                D14AFD2624D232B500C51073 /* Assets.xcassets */ = {isa = 
PBXFileReference; lastKnownFileType = folder.assetcatalog; path = 
Assets.xcassets; sourceTree = "<group>"; };
@@ -133,6 +135,7 @@
                                D14AFD2B24D232B500C51073 /* 
LaunchScreen.storyboard */,
                                D14AFD2E24D232B500C51073 /* Info.plist */,
                                AB1F87C72887C94700AB82A0 /* TalerApp.swift */,
+                               ABB762AC2891059600E88634 /* SettingsView.swift 
*/,
                        );
                        path = Taler;
                        sourceTree = "<group>";
@@ -347,6 +350,7 @@
                                AB1F87C82887C94700AB82A0 /* TalerApp.swift in 
Sources */,
                                AB1F87CA2887D2F400AB82A0 /* ContentView.swift 
in Sources */,
                                D1D65B9826992E4600C1012A /* WalletBackend.swift 
in Sources */,
+                               ABB762AD2891059600E88634 /* SettingsView.swift 
in Sources */,
                                D14CE1B426C3A2D400612DBE /* BalanceList.swift 
in Sources */,
                                D14CE1B226C39E5D00612DBE /* BalanceRow.swift in 
Sources */,
                        );
diff --git 
a/Taler.xcodeproj/project.xcworkspace/xcuserdata/jonathan.xcuserdatad/UserInterfaceState.xcuserstate
 
b/Taler.xcodeproj/project.xcworkspace/xcuserdata/jonathan.xcuserdatad/UserInterfaceState.xcuserstate
deleted file mode 100644
index 15c81a9..0000000
Binary files 
a/Taler.xcodeproj/project.xcworkspace/xcuserdata/jonathan.xcuserdatad/UserInterfaceState.xcuserstate
 and /dev/null differ
diff --git a/Taler/ContentView.swift b/Taler/ContentView.swift
index 0eb1477..415de47 100644
--- a/Taler/ContentView.swift
+++ b/Taler/ContentView.swift
@@ -1,53 +1,75 @@
-//
-//  ContentView.swift
-//  Taler
-//
-//  Created by Jonathan Buchanan on 7/20/22.
-//  Copyright © 2022 Taler. All rights reserved.
-//
+/*
+ * This file is part of GNU Taler
+ * (C) 2022 Taler Systems S.A.
+ *
+ * GNU Taler is free software; you can redistribute it and/or modify it under 
the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3, or (at your option) any later version.
+ *
+ * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR
+ * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
 
 import SwiftUI
 
-struct SidebarView: View {
-    var onClose: () -> Void
-    
-    init(_onClose: @escaping () -> Void) {
-        self.onClose = _onClose
-    }
-    
-    var body: some View {
-        VStack {
-            Button(action: self.onClose) {
-                Text("Close")
-            }
-            Divider()
-            Text("Hello, World!")
-            Divider()
-            Spacer()
-        }
-        .background(Color.gray)
-    }
+struct SidebarItem {
+    var name: String
+    var view: AnyView
 }
 
 struct ContentView: View {
     @State var sidebarVisible: Bool = false
+    var views: [SidebarItem] {[
+        SidebarItem(name: "Main",
+            view: AnyView(Button { [self] in
+                self.sidebarVisible = true
+            } label: {
+                Text("Open Sidebar")
+            })),
+        SidebarItem(name: "Settings",
+            view: AnyView(SettingsView {
+                self.sidebarVisible = true
+            }))
+    ]}
+    @State var currentView: Int = 0
     
     var body: some View {
         ZStack(alignment: .leading) {
             
-            Button {
-                sidebarVisible = !sidebarVisible
-            } label: {
-                Text("dothething")
-            }
+            views[currentView].view
                 .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: 
.center)
 
-            SidebarView {
-                self.sidebarVisible = false
+            VStack {
+                Spacer()
+                
+                Button {
+                    self.sidebarVisible = false
+                } label: {
+                    Text("Close")
+                }
+                Divider()
+                
+                ForEach(0..<views.count, id: \.self) { i in
+                    Button {
+                        self.sidebarVisible = false
+                        self.currentView = i
+                    } label: {
+                        Text(views[i].name)
+                    }
+                    Divider()
+                }
+                
+                Spacer()
             }
+                .background(Color.gray)
                 .frame(width: 100, alignment: .center)
                 .offset(x: sidebarVisible ? 0 : -100)
                 .animation(.easeInOut, value: sidebarVisible)
+                .ignoresSafeArea()
         }
     }
 }
diff --git a/Taler/SettingsView.swift b/Taler/SettingsView.swift
new file mode 100644
index 0000000..38cf996
--- /dev/null
+++ b/Taler/SettingsView.swift
@@ -0,0 +1,36 @@
+//
+//  SettingsView.swift
+//  Taler
+//
+//  Created by Jonathan Buchanan on 7/27/22.
+//  Copyright © 2022 Taler. All rights reserved.
+//
+
+import SwiftUI
+
+struct SettingsView: View {
+    var showSidebar: () -> Void
+    var body: some View {
+        NavigationView {
+            Text("Settings")
+                .navigationTitle("Settings")
+                .navigationBarItems(
+                    leading: Button(action: self.showSidebar, label: {
+                        Image(systemName: "line.3.horizontal")
+                    })
+                )
+        }
+    }
+    
+    init(_showSidebar: @escaping () -> Void) {
+        self.showSidebar = _showSidebar
+    }
+}
+
+struct SettingsView_Previews: PreviewProvider {
+    static var previews: some View {
+        SettingsView {
+            
+        }
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]