Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
58F2EB03292FB2B0004A9BDE /* Documentation.docc in Sources */ = {isa = PBXBuildFile; fileRef = 58F2EACE292FB2B0004A9BDE /* Documentation.docc */; };
58F2EB1E292FB954004A9BDE /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 58F2EB1D292FB954004A9BDE /* Sparkle */; };
5E4485612DF600D9008BBE69 /* AboutWindow in Frameworks */ = {isa = PBXBuildFile; productRef = 5E4485602DF600D9008BBE69 /* AboutWindow */; };
5EACE6222DF4BF08005E08B8 /* WelcomeWindow in Frameworks */ = {isa = PBXBuildFile; productRef = 5EACE6212DF4BF08005E08B8 /* WelcomeWindow */; };
6C0617D62BDB4432008C9C42 /* LogStream in Frameworks */ = {isa = PBXBuildFile; productRef = 6C0617D52BDB4432008C9C42 /* LogStream */; };
6C0824A12C5C0C9700A0751E /* SwiftTerm in Frameworks */ = {isa = PBXBuildFile; productRef = 6C0824A02C5C0C9700A0751E /* SwiftTerm */; };
6C147C4529A329350089B630 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = 6C147C4429A329350089B630 /* OrderedCollections */; };
Expand Down Expand Up @@ -182,6 +183,7 @@
6C73A6D32D4F1E550012D95C /* CodeEditSourceEditor in Frameworks */,
2816F594280CF50500DD548B /* CodeEditSymbols in Frameworks */,
30CB64942C16CA9100CC8A9E /* LanguageClient in Frameworks */,
5EACE6222DF4BF08005E08B8 /* WelcomeWindow in Frameworks */,
6C6BD6F829CD14D100235D17 /* CodeEditKit in Frameworks */,
6C0824A12C5C0C9700A0751E /* SwiftTerm in Frameworks */,
6C81916B29B41DD300B75C92 /* DequeModule in Frameworks */,
Expand Down Expand Up @@ -319,6 +321,7 @@
6CB94D022CA1205100E8651C /* AsyncAlgorithms */,
6CC00A8A2CBEF150004E8134 /* CodeEditSourceEditor */,
6C73A6D22D4F1E550012D95C /* CodeEditSourceEditor */,
5EACE6212DF4BF08005E08B8 /* WelcomeWindow */,
5E4485602DF600D9008BBE69 /* AboutWindow */,
);
productName = CodeEdit;
Expand Down Expand Up @@ -423,6 +426,7 @@
6C4E37FA2C73E00700AEE7B5 /* XCRemoteSwiftPackageReference "SwiftTerm" */,
6CB94D012CA1205100E8651C /* XCRemoteSwiftPackageReference "swift-async-algorithms" */,
6CF368562DBBD274006A77FD /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */,
5EACE6202DF4BF08005E08B8 /* XCRemoteSwiftPackageReference "WelcomeWindow" */,
5E44855F2DF600D9008BBE69 /* XCRemoteSwiftPackageReference "AboutWindow" */,
);
preferredProjectObjectVersion = 55;
Expand Down Expand Up @@ -1699,8 +1703,16 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/AboutWindow";
requirement = {
branch = main;
kind = branch;
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
5EACE6202DF4BF08005E08B8 /* XCRemoteSwiftPackageReference "WelcomeWindow" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/WelcomeWindow";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
6C0617D42BDB4432008C9C42 /* XCRemoteSwiftPackageReference "LogStream" */ = {
Expand Down Expand Up @@ -1808,6 +1820,11 @@
package = 5E44855F2DF600D9008BBE69 /* XCRemoteSwiftPackageReference "AboutWindow" */;
productName = AboutWindow;
};
5EACE6212DF4BF08005E08B8 /* WelcomeWindow */ = {
isa = XCSwiftPackageProductDependency;
package = 5EACE6202DF4BF08005E08B8 /* XCRemoteSwiftPackageReference "WelcomeWindow" */;
productName = WelcomeWindow;
};
6C0617D52BDB4432008C9C42 /* LogStream */ = {
isa = XCSwiftPackageProductDependency;
package = 6C0617D42BDB4432008C9C42 /* XCRemoteSwiftPackageReference "LogStream" */;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1640"
LastUpgradeVersion = "1620"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
Expand Down
13 changes: 12 additions & 1 deletion CodeEdit/CodeEditApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import SwiftUI
import WelcomeWindow
import AboutWindow

@main
Expand All @@ -28,7 +29,17 @@ struct CodeEditApp: App {

var body: some Scene {
Group {
WelcomeWindow()
WelcomeWindow(
subtitleView: { WelcomeSubtitleView() },
actions: { dismissWindow in
NewFileButton(dismissWindow: dismissWindow)
GitCloneButton(dismissWindow: dismissWindow)
OpenFileOrFolderButton(dismissWindow: dismissWindow)
},
onDrop: { url, dismissWindow in
Task { CodeEditDocumentController.shared.openDocument(at: url, onCompletion: { dismissWindow() }) }
}
)

ExtensionManagerWindow()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Cocoa
import SwiftUI
import WelcomeWindow

final class CodeEditDocumentController: NSDocumentController {
@Environment(\.openWindow)
Expand All @@ -16,6 +17,26 @@ final class CodeEditDocumentController: NSDocumentController {

private let fileManager = FileManager.default

@MainActor
func createAndOpenNewDocument(onCompletion: @escaping () -> Void) {
guard let newDocumentUrl = self.newDocumentUrl else { return }

let createdFile = self.fileManager.createFile(
atPath: newDocumentUrl.path,
contents: nil,
attributes: [FileAttributeKey.creationDate: Date()]
)

guard createdFile else {
print("Failed to create new document")
return
}

self.openDocument(withContentsOf: newDocumentUrl, display: true) { _, _, _ in
onCompletion()
}
}

override func newDocument(_ sender: Any?) {
guard let newDocumentUrl = self.newDocumentUrl else { return }

Expand Down Expand Up @@ -71,7 +92,7 @@ final class CodeEditDocumentController: NSDocumentController {
print("Unable to open document '\(url)': \(errorMessage)")
}

RecentProjectsStore.shared.documentOpened(at: url)
RecentsStore.documentOpened(at: url)
completionHandler(document, documentWasAlreadyOpen, error)
}
}
Expand Down
45 changes: 45 additions & 0 deletions CodeEdit/Features/Welcome/GitCloneButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// GitCloneButton.swift
// CodeEdit
//
// Created by Giorgi Tchelidze on 07.06.25.
//

import SwiftUI
import WelcomeWindow

struct GitCloneButton: View {

@State private var showGitClone = false
@State private var showCheckoutBranchItem: URL?

var dismissWindow: () -> Void

var body: some View {
WelcomeButton(
iconName: "square.and.arrow.down.on.square",
title: "Clone Git Repository...",
action: {
showGitClone = true
}
)
.sheet(isPresented: $showGitClone) {
GitCloneView(
openBranchView: { url in
showCheckoutBranchItem = url
},
openDocument: { url in
CodeEditDocumentController.shared.openDocument(at: url, onCompletion: { dismissWindow() })
}
)
}
.sheet(item: $showCheckoutBranchItem) { url in
GitCheckoutBranchView(
repoLocalPath: url,
openDocument: { url in
CodeEditDocumentController.shared.openDocument(at: url, onCompletion: { dismissWindow() })
}
)
}
}
}
133 changes: 0 additions & 133 deletions CodeEdit/Features/Welcome/Model/RecentProjectsStore.swift

This file was deleted.

25 changes: 25 additions & 0 deletions CodeEdit/Features/Welcome/NewFileButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// NewFileButton.swift
// CodeEdit
//
// Created by Giorgi Tchelidze on 07.06.25.
//

import SwiftUI
import WelcomeWindow

struct NewFileButton: View {

var dismissWindow: () -> Void

var body: some View {
WelcomeButton(
iconName: "plus.square",
title: "Create New File...",
action: {
let documentController = CodeEditDocumentController()
documentController.createAndOpenNewDocument(onCompletion: { dismissWindow() })
}
)
}
}
Loading