mirror of
https://github.com/neon443/NearFuture.git
synced 2026-03-11 06:49:12 +00:00
can now edit events, need to make it apply on the fly
added about window
This commit is contained in:
40
MacNearFuture/AboutView.swift
Normal file
40
MacNearFuture/AboutView.swift
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// AboutView.swift
|
||||
// MacNearFuture
|
||||
//
|
||||
// Created by neon443 on 28/05/2025.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AboutView: View {
|
||||
var body: some View {
|
||||
VStack(alignment: .center) {
|
||||
Image(nsImage: #imageLiteral(resourceName: "NearFutureIcon.png"))
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 100)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 25))
|
||||
Text("Near Future")
|
||||
.bold()
|
||||
.monospaced()
|
||||
.font(.title)
|
||||
Text("Version " + getVersion() + " (\(getBuildID()))")
|
||||
.padding(.bottom)
|
||||
Text("© 2024-2025 neon443, Inc")
|
||||
.padding(.bottom)
|
||||
Link("Developer Website", destination: URL(string: "https://neon443.xyz")!)
|
||||
}
|
||||
.padding()
|
||||
.padding()
|
||||
.containerBackground(.ultraThinMaterial, for: .window)
|
||||
.toolbar(removing: .title)
|
||||
.toolbarBackground(.hidden, for: .windowToolbar)
|
||||
.windowMinimizeBehavior(.disabled)
|
||||
.windowFullScreenBehavior(.disabled)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
AboutView()
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import SwiftUI
|
||||
|
||||
@main
|
||||
struct NearFutureApp: App {
|
||||
@Environment(\.openWindow) var openWindow
|
||||
@StateObject var viewModel: EventViewModel = EventViewModel()
|
||||
@StateObject var settingsModel: SettingsViewModel = SettingsViewModel()
|
||||
|
||||
@@ -22,13 +23,41 @@ struct NearFutureApp: App {
|
||||
}
|
||||
.defaultSize(width: 550, height: 650)
|
||||
.commands {
|
||||
CommandGroup(replacing: CommandGroupPlacement.appInfo) {
|
||||
Button("about nf") {
|
||||
openWindow(id: "about")
|
||||
}
|
||||
}
|
||||
NearFutureCommands()
|
||||
}
|
||||
|
||||
Window("About Near Future", id: "about") {
|
||||
|
||||
WindowGroup("edit Event", for: Event.ID.self) { $eventID in
|
||||
EditEventView(
|
||||
viewModel: viewModel,
|
||||
event: Binding(
|
||||
get: {
|
||||
viewModel.events.first(where: {$0.id == eventID})!
|
||||
},
|
||||
set: { newValue in
|
||||
if let eventIndex = viewModel.events.firstIndex(where: {
|
||||
$0.id == eventID
|
||||
}) {
|
||||
viewModel.events[eventIndex] = newValue
|
||||
}
|
||||
viewModel.saveEvents()
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Window("About Near Future", id: "about") {
|
||||
AboutView()
|
||||
}
|
||||
.windowBackgroundDragBehavior(.enabled)
|
||||
.windowResizability(.contentSize)
|
||||
.restorationBehavior(.disabled)
|
||||
.defaultPosition(UnitPoint.center)
|
||||
|
||||
Settings {
|
||||
Text("wip")
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import SwiftUI
|
||||
|
||||
struct NearFutureCommands: Commands {
|
||||
var body: some Commands {
|
||||
|
||||
CommandGroup(after: CommandGroupPlacement.appInfo) {
|
||||
Text("hi")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ struct EventListView: View {
|
||||
@State var largeTick: Bool = false
|
||||
@State var hovering: Bool = false
|
||||
|
||||
@Environment(\.openWindow) var openWindow
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color.black.opacity(hovering ? 0.5 : 0.0)
|
||||
@@ -130,6 +132,9 @@ struct EventListView: View {
|
||||
hovering.toggle()
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
openWindow(value: event.id)
|
||||
}
|
||||
.contextMenu() {
|
||||
Button(role: .destructive) {
|
||||
let eventToModify = viewModel.events.firstIndex() { currEvent in
|
||||
|
||||
@@ -12,19 +12,6 @@ struct EditEventView: View {
|
||||
@ObservedObject var viewModel: EventViewModel
|
||||
@Binding var event: Event
|
||||
|
||||
fileprivate func saveEdits() {
|
||||
//if there is an event in vM.events with the id of the event we r editing,
|
||||
//firstindex - loops through the arr and finds first element where that events id matches editing event's id
|
||||
if let index = viewModel.events.firstIndex(where: { xEvent in
|
||||
xEvent.id == event.id
|
||||
}) {
|
||||
viewModel.events[index] = event
|
||||
}
|
||||
viewModel.saveEvents()
|
||||
|
||||
dismiss()
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
AddEventView(
|
||||
viewModel: viewModel,
|
||||
@@ -42,7 +29,7 @@ struct EditEventView: View {
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
Button() {
|
||||
saveEdits()
|
||||
dismiss()
|
||||
} label: {
|
||||
Text("Done")
|
||||
.bold()
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
A98C20CC2DE730740008D61C /* EditEventViewMac.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98C20C92DE730740008D61C /* EditEventViewMac.swift */; };
|
||||
A98C20CE2DE7308E0008D61C /* ArchiveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98C20CD2DE7308E0008D61C /* ArchiveView.swift */; };
|
||||
A98C20D02DE731BD0008D61C /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98C20CF2DE731BD0008D61C /* HomeView.swift */; };
|
||||
A98C20D42DE7339E0008D61C /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98C20D32DE7339E0008D61C /* AboutView.swift */; };
|
||||
A98C20D52DE7339E0008D61C /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98C20D32DE7339E0008D61C /* AboutView.swift */; };
|
||||
A9FC7EEA2D2823920020D75B /* NearFutureWidgets.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9FC7EE92D28238A0020D75B /* NearFutureWidgets.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@@ -65,6 +67,13 @@
|
||||
remoteGlobalIDString = A979F6012D270AF00094C0B3;
|
||||
remoteInfo = NearFutureWidgetsExtension;
|
||||
};
|
||||
A98C20D12DE732B10008D61C /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = A920C27C2D24011300E4F9B1 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = A979F6012D270AF00094C0B3;
|
||||
remoteInfo = NearFutureWidgetsExtension;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@@ -125,6 +134,7 @@
|
||||
A98C20CA2DE730740008D61C /* EventListViewMac.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventListViewMac.swift; sourceTree = "<group>"; };
|
||||
A98C20CD2DE7308E0008D61C /* ArchiveView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchiveView.swift; sourceTree = "<group>"; };
|
||||
A98C20CF2DE731BD0008D61C /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; };
|
||||
A98C20D32DE7339E0008D61C /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
|
||||
A9FC7EE92D28238A0020D75B /* NearFutureWidgets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NearFutureWidgets.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -168,6 +178,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A90D495A2DDE2EDB00781124 /* MacNearFutureApp.swift */,
|
||||
A98C20D32DE7339E0008D61C /* AboutView.swift */,
|
||||
A90D495D2DDE3C7400781124 /* NFCommands.swift */,
|
||||
A90D493F2DDE10EC00781124 /* Views */,
|
||||
A90D49342DDE0FAF00781124 /* MacNearFuture.entitlements */,
|
||||
@@ -363,6 +374,7 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
A98C20D22DE732B10008D61C /* PBXTargetDependency */,
|
||||
A90D494D2DDE2C6000781124 /* PBXTargetDependency */,
|
||||
);
|
||||
name = MacNearFuture;
|
||||
@@ -498,6 +510,7 @@
|
||||
A98C20CC2DE730740008D61C /* EditEventViewMac.swift in Sources */,
|
||||
A90D494B2DDE2C2900781124 /* AddEventView.swift in Sources */,
|
||||
A90D495E2DDE3C7400781124 /* NFCommands.swift in Sources */,
|
||||
A98C20D42DE7339E0008D61C /* AboutView.swift in Sources */,
|
||||
A98C20CE2DE7308E0008D61C /* ArchiveView.swift in Sources */,
|
||||
A98C20D02DE731BD0008D61C /* HomeView.swift in Sources */,
|
||||
A90D495B2DDE2EDB00781124 /* MacNearFutureApp.swift in Sources */,
|
||||
@@ -513,6 +526,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A920C28C2D24011400E4F9B1 /* Events.swift in Sources */,
|
||||
A98C20D52DE7339E0008D61C /* AboutView.swift in Sources */,
|
||||
A949F84B2DCAABE00064DCA0 /* ArchiveView.swift in Sources */,
|
||||
A914FA4F2DD276D200856265 /* AboutView.swift in Sources */,
|
||||
A949F84C2DCAABE00064DCA0 /* AddEventView.swift in Sources */,
|
||||
@@ -560,6 +574,11 @@
|
||||
target = A979F6012D270AF00094C0B3 /* NearFutureWidgetsExtension */;
|
||||
targetProxy = A979F6122D270AF90094C0B3 /* PBXContainerItemProxy */;
|
||||
};
|
||||
A98C20D22DE732B10008D61C /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = A979F6012D270AF00094C0B3 /* NearFutureWidgetsExtension */;
|
||||
targetProxy = A98C20D12DE732B10008D61C /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
@@ -583,7 +602,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 15.5;
|
||||
MACOSX_DEPLOYMENT_TARGET = 15;
|
||||
MARKETING_VERSION = "$(VERSION)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.NearFuture;
|
||||
PRODUCT_NAME = "Near Future";
|
||||
@@ -614,7 +633,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 15.5;
|
||||
MACOSX_DEPLOYMENT_TARGET = 15;
|
||||
MARKETING_VERSION = "$(VERSION)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.NearFuture;
|
||||
PRODUCT_NAME = "Near Future";
|
||||
@@ -888,8 +907,9 @@
|
||||
REGISTER_APP_GROUPS = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -925,8 +945,9 @@
|
||||
REGISTER_APP_GROUPS = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1640"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES"
|
||||
buildArchitectures = "Automatic">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A90D49252DDE0FA400781124"
|
||||
BuildableName = "Near Future.app"
|
||||
BlueprintName = "MacNearFuture"
|
||||
ReferencedContainer = "container:NearFuture.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A90D49252DDE0FA400781124"
|
||||
BuildableName = "Near Future.app"
|
||||
BlueprintName = "MacNearFuture"
|
||||
ReferencedContainer = "container:NearFuture.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A90D49252DDE0FA400781124"
|
||||
BuildableName = "Near Future.app"
|
||||
BlueprintName = "MacNearFuture"
|
||||
ReferencedContainer = "container:NearFuture.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -7,7 +7,7 @@
|
||||
<key>MacNearFuture.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>NearFuture.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
@@ -17,11 +17,16 @@
|
||||
<key>NearFutureWidgetsExtension.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>A90D49252DDE0FA400781124</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>A920C2832D24011300E4F9B1</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
|
||||
@@ -25,9 +25,6 @@ struct ContentView: View {
|
||||
@State var selection: Tab = .home
|
||||
|
||||
var body: some View {
|
||||
if #available(iOS 17.5, *) {
|
||||
YouAsked()
|
||||
}
|
||||
TabView(selection: $selection) {
|
||||
HomeView(viewModel: viewModel, settingsModel: settingsModel)
|
||||
.tabItem {
|
||||
|
||||
Reference in New Issue
Block a user