Skip to content

Commit

Permalink
much improved add view,
Browse files Browse the repository at this point in the history
  • Loading branch information
cdillard committed May 9, 2023
1 parent b8a8137 commit 635d4fe
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 132 deletions.
4 changes: 4 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ SwiftSage provides numerous features to accelerate software development and impr
## News, Changelog

---
05-08-2023

Multiple repositories can be downloaded to your device! Woo! Enjoy all those tasty codes even on the go in the tunnel. Stay tuned for the next updates folks.

05-07-2023
Introducing customizable Source Editor colors! Check it out in Settings :)

Expand Down
8 changes: 4 additions & 4 deletions SwiftSageiOS/SwiftSageiOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@
CODE_SIGN_ENTITLEMENTS = SwiftSageiOS/SwiftSageiOS.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SwiftSageiOS/Preview Content\"";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 72WEN2C47N;
Expand Down Expand Up @@ -921,7 +921,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.01;
MARKETING_VERSION = 1.1.2;
PRODUCT_BUNDLE_IDENTIFIER = com.chrisdillard.SwiftSageDev;
PRODUCT_NAME = LogicSageDev;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -942,7 +942,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = SwiftSageiOS/SwiftSageiOS.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SwiftSageiOS/Preview Content\"";
DEVELOPMENT_TEAM = 72WEN2C47N;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -970,7 +970,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.01;
MARKETING_VERSION = 1.1.2;
PRODUCT_BUNDLE_IDENTIFIER = com.chrisdillard.SwiftSage;
PRODUCT_NAME = LogicSage;
SDKROOT = auto;
Expand Down
110 changes: 64 additions & 46 deletions SwiftSageiOS/SwiftSageiOS/AddView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@ import SwiftUI


var windowIndex = 0
let listHeightFactor = 13.666

struct AddView: View {
@Binding var showAddView: Bool
@ObservedObject var settingsViewModel: SettingsViewModel
@EnvironmentObject var windowManager: WindowManager
@State var currentRoot: GitHubContent?

var body: some View {
GeometryReader { geometry in

ScrollView {
VStack(alignment: .leading, spacing: 20) {
HStack {
Text("Open menu:")
VStack(spacing: 4) {

HStack(spacing: 4) {
Text("open menu:")
.font(.body)
.foregroundColor(settingsViewModel.buttonColor)

Expand All @@ -32,30 +36,30 @@ struct AddView: View {

.padding(.bottom)
}
Button("New File") {
Button("new file") {
print("open new File")
#if !os(macOS)

if consoleManager.isVisible {
consoleManager.isVisible = false
}
#endif
// For all windowzzz...

showAddView.toggle()
#if !os(macOS)
//let defSize = CGRect(x: 0, y: 0, width: geometry.size.width - geometry.size.width / 3, height: geometry.size.height - geometry.size.height / 3)
windowManager.addWindow(windowType: .file, frame: defSize, zIndex: 0)
#endif
#endif
}
.foregroundColor(settingsViewModel.buttonColor)
.border(settingsViewModel.buttonColor, width: 2)

.font(.body)
.font(.title2)
.lineLimit(nil)
.fontWeight(.bold)
.padding(.bottom)

Button("New WebView") {
Button("new webview: \(settingsViewModel.defaultURL)") {
#if !os(macOS)

if consoleManager.isVisible {
Expand All @@ -67,30 +71,33 @@ struct AddView: View {
showAddView.toggle()

#if !os(macOS)
// let defSize = CGRect(x: 0, y: 0, width: geometry.size.width - geometry.size.width / 3, height: geometry.size.height - geometry.size.height / 3)
// let defSize = CGRect(x: 0, y: 0, width: geometry.size.width - geometry.size.width / 3, height: geometry.size.height - geometry.size.height / 3)

windowManager.addWindow(windowType: .webView, frame: defSize, zIndex: 0, url: settingsViewModel.defaultURL)
#endif

}
.foregroundColor(settingsViewModel.buttonColor)

.font(.body)
.font(.title2)
.lineLimit(nil)
.fontWeight(.bold)
.padding(.bottom)
.border(settingsViewModel.buttonColor, width: 2)

Text("Current repo = \("\(settingsViewModel.gitUser)/\(settingsViewModel.gitRepo)/\(settingsViewModel.gitBranch)")")
if !settingsViewModel.isLoading {
Button("|Download Repo|") {
Button("dl repo") {

print("Downloading repo...")
settingsViewModel.syncGithubRepo()
}
.foregroundColor(settingsViewModel.buttonColor)
.font(.body)
.font(.largeTitle)
.lineLimit(nil)
.fontWeight(.bold)
.padding(.bottom)
.border(settingsViewModel.buttonColor, width: 2)



}
else {
Expand All @@ -102,80 +109,91 @@ struct AddView: View {
showAddView.toggle()
}
}) {
Text("Close")
Text("close")
.foregroundColor(settingsViewModel.buttonColor)

.font(.body)
.font(.title2)
.lineLimit(nil)
.fontWeight(.bold)
// .foregroundColor(.white)
// .padding(.horizontal, 40)
// .padding(.vertical, 12)
// .background(settingsViewModel.buttonColor)
// .cornerRadius(8)
}
.padding(.bottom)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.border(settingsViewModel.buttonColor, width: 2)

.padding(geometry.size.width * 0.01)
#if !os(macOS)

.background(settingsViewModel.backgroundColor)
#endif
.cornerRadius(16)
// .foregroundColor(.white)
// .padding(.horizontal, 40)
// .padding(.vertical, 12)
// .background(settingsViewModel.buttonColor)
// .cornerRadius(8)
}

VStack {
if !settingsViewModel.isLoading {

let val = settingsViewModel.loadDirectories().count
Text("Downloaded Repositories")
.font(.body)
.font(.title3)
.lineLimit(nil)
.fontWeight(.bold)

NavigationView {
RepositoriesListView(settingsViewModel: settingsViewModel)
// .frame(maxWidth: .infinity, maxHeight: .infinity)


.environmentObject(windowManager)

}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: geometry.size.height/listHeightFactor * Double(val), maxHeight: geometry.size.height/listHeightFactor * Double(val))
.navigationViewStyle(StackNavigationViewStyle())
}
if !settingsViewModel.isLoading {

Text("Open Repo Tree")
.font(.body)
.font(.title3)
.lineLimit(nil)
.fontWeight(.bold)
NavigationView {
RepositoryTreeView(settingsViewModel: settingsViewModel, accessToken: "")
// .frame(maxWidth: .infinity, maxHeight: .infinity)

.environmentObject(windowManager)

}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: geometry.size.height/listHeightFactor * Double(settingsViewModel.rootFiles.count), maxHeight: geometry.size.height/listHeightFactor * Double(settingsViewModel.rootFiles.count))

.navigationViewStyle(StackNavigationViewStyle())
.navigationTitle("Repository Tree")
}
// .frame(maxWidth: .infinity, maxHeight: .infinity)
Text("Window List")
.font(.body)
.font(.title3)
.lineLimit(nil)
.fontWeight(.bold)

NavigationView {

WindowList(showAddView: $showAddView)
// .frame(maxWidth: .infinity, maxHeight: .infinity)

.environmentObject(windowManager)
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: geometry.size.height/listHeightFactor * Double(windowManager.windows.count), maxHeight: geometry.size.height/listHeightFactor * Double(settingsViewModel.rootFiles.count))

.navigationViewStyle(StackNavigationViewStyle())
.navigationTitle("Window List:")
Spacer()
}
.padding(.bottom, geometry.size.height / 8)

#if !os(macOS)

Spacer()
.background(settingsViewModel.backgroundColor)
#endif
.cornerRadius(16)
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)


// }
// .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
// .padding(geometry.size.width * 0.01)
// .padding(.bottom, 30)
//#if !os(macOS)
//
// .background(settingsViewModel.backgroundColor)
//#endif
}
.scrollIndicators(.visible)
}
// .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
}
}
39 changes: 14 additions & 25 deletions SwiftSageiOS/SwiftSageiOS/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,17 @@ struct ContentView: View {
@ObservedObject var settingsViewModel = SettingsViewModel.shared

@StateObject private var windowManager = WindowManager()
@State private var selectedColor: Color = .black

var body: some View {

GeometryReader { geometry in
ZStack {
// SOURCE CODE EDITOR HANDLE
ZStack {
ColorPicker("", selection: $selectedColor)
.opacity(0.0) // Set the opacity to 0 to hide the ColorPicker
.frame(width: 0, height: 0) // Set the frame size to 0 to avoid taking up any space

// MAC OS SPECIFIC PANE FOR OPENING TERMINALS AND POTENTIALLY MORE.
#if os(macOS)
VStack {
VStack(alignment: .leading, spacing: 8) {
Button(action: {
openTerminal()
}) {
Expand Down Expand Up @@ -190,25 +186,7 @@ struct ContentView: View {

resizableButtonImage(systemName: "plus.rectangle", size: geometry.size)
}
.popover(isPresented: $settingsViewModel.showAddView, arrowEdge: .top) {

#if !os(macOS)

if UIDevice.current.userInterfaceIdiom == .pad {
AddView(showAddView: $settingsViewModel.showAddView, settingsViewModel: settingsViewModel)
.frame(width: geometry.size.width * 0.75, height: geometry.size.height * 0.75)
.environmentObject(windowManager)
}
else {
AddView(showAddView: $settingsViewModel.showAddView, settingsViewModel: settingsViewModel)
.frame(maxWidth: .infinity, maxHeight: .infinity)

.environmentObject(windowManager)

}
#endif

}

Button(action: {
#if !os(macOS)
Expand Down Expand Up @@ -249,15 +227,26 @@ struct ContentView: View {
}
.background(

VStack {
ZStack {
#if !os(macOS)

AddView(showAddView: $settingsViewModel.showAddView, settingsViewModel: settingsViewModel, currentRoot: nil)
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.opacity(settingsViewModel.showAddView ? 1.0 : 0.0)

.environmentObject(windowManager)
SettingsView(showSettings: $showSettings, settingsViewModel: settingsViewModel)
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.opacity(showSettings ? 1.0 : 0.0)
Spacer()


#endif

}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)

)
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)

// .onAppear {
// keyboardObserver.startObserve(height: geometry.size.height)
Expand Down
5 changes: 0 additions & 5 deletions SwiftSageiOS/SwiftSageiOS/InstructionsPopup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,14 @@ struct InstructionsPopup: View {

Text("You will start in `mobile` mode. Check out Settings to set your key. Set up server to use computer mode. computer mode allows you to use Xcode from your iOS device.")
}
Text("PLEASE READ ****")
Text("Due to this being an alpha please do this on launch:\n1. Force quit / restart app.\nrTap gear, set terminal bg, terminal font color, button color, set font size. Then Force quit / restart app one last time. Restart the app and you should have your custom colors :)")

Text("Check out the repo for info on setting up server.")

Text("To Run The server: Make sure you have at minimum taken these steps:")
Text("0. Set your Computers API Key for A.I. in GPT-Info.plist and enabled feature flag swiftSageIOSEnabled before building and running the LogicSage Xcode project.")
Text("1. Running SwiftSage Swifty-GPT cmd line target on your command line Mac.")
Text("2. Running the vapor server.")
}
Text("Without these 3 steps, the LogicSage server will not work.")

Text("Tips: - You can dock terminals to side of screen to get them out of way.")
}
.background(.green)
.opacity(0.7)
Expand Down
Loading

0 comments on commit 635d4fe

Please sign in to comment.