8 Commits

Author SHA1 Message Date
neon443
2ef000458f minor concurrency improvements 2025-05-29 18:32:54 +01:00
neon443
69047010d7 made it better 2025-05-28 15:47:55 +01:00
neon443
dfb1dae545 added a cancel button, extract logic 2025-05-28 14:52:43 +01:00
neon443
0f3b86fe8c New: custom alert for merge/replace imported events 2025-05-28 14:47:05 +01:00
neon443
1902c5102c can now edit events, need to make it apply on the fly
added about window
2025-05-28 13:42:53 +01:00
neon443
1179810ac2 move to contentview
add homeView
respect show completed events in home
archive view
move inot contentview
new mac icon
remove mac icons from the variants
2025-05-28 12:59:35 +01:00
neon443
dfc3a9290a mac icons for all the color variants 2025-05-28 11:47:37 +01:00
neon443
7236f0640e asset catalog: add mac &watchos icons 2025-05-28 11:32:08 +01:00
34 changed files with 509 additions and 191 deletions

View 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()
}

View File

@@ -10,49 +10,53 @@ import SwiftUI
@main
struct NearFutureApp: App {
@Environment(\.openWindow) var openWindow
@StateObject var viewModel: EventViewModel = EventViewModel()
@StateObject var settingsModel: SettingsViewModel = SettingsViewModel()
var body: some Scene {
WindowGroup {
NavigationSplitView {
List {
NavigationLink {
} label: {
Image(systemName: "house")
Text("Home")
}
NavigationLink {
} label: {
Image(systemName: "tray.full")
Text("Archive")
}
}
} detail: {
ContentView(
viewModel: EventViewModel(),
viewModel: viewModel,
settingsModel: settingsModel
)
}
.tint(settingsModel.settings.tint.color)
.frame(minWidth: 450, minHeight: 550)
.containerBackground(.ultraThinMaterial, for: .window)
}
.defaultSize(width: 550, height: 650)
.commands {
CommandGroup(replacing: CommandGroupPlacement.appInfo) {
Button("about nf") {
openWindow(id: "about")
}
}
NearFutureCommands()
Menu("hi") {
Button("hi") {
}
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")

View File

@@ -10,6 +10,8 @@ import SwiftUI
struct NearFutureCommands: Commands {
var body: some Commands {
CommandGroup(after: CommandGroupPlacement.appInfo) {
Text("hi")
}
}
}

View File

@@ -0,0 +1,33 @@
//
// ArchiveView.swift
// MacNearFuture
//
// Created by neon443 on 28/05/2025.
//
import SwiftUI
struct ArchiveView: View {
@StateObject var viewModel: EventViewModel
@StateObject var settingsModel: SettingsViewModel
var filteredEvents: [Event] {
return viewModel.events.filter { $0.complete }
}
var body: some View {
ScrollView {
ForEach(filteredEvents) { event in
EventListView(viewModel: viewModel, event: event)
}
}
.scrollContentBackground(.hidden)
}
}
#Preview {
ArchiveView(
viewModel: dummyEventViewModel(),
settingsModel: dummySettingsViewModel()
)
}

View File

@@ -8,16 +8,37 @@
import SwiftUI
struct ContentView: View {
@ObservedObject var viewModel: EventViewModel
@ObservedObject var settingsModel: SettingsViewModel
@StateObject var viewModel: EventViewModel
@StateObject var settingsModel: SettingsViewModel
var body: some View {
ScrollView {
ForEach(viewModel.events) { event in
EventListView(viewModel: viewModel, event: event)
NavigationSplitView(preferredCompactColumn: .constant(.sidebar)) {
List {
NavigationLink {
HomeView(
viewModel: viewModel,
settingsModel: settingsModel
)
} label: {
Image(systemName: "house")
Text("Home")
}
NavigationLink {
ArchiveView(
viewModel: viewModel,
settingsModel: settingsModel
)
} label: {
Image(systemName: "tray.full")
Text("Archive")
}
}
.scrollContentBackground(.hidden)
} detail: {
}
.tint(settingsModel.settings.tint.color)
.frame(minWidth: 450, minHeight: 550)
.containerBackground(.ultraThinMaterial, for: .window)
}
}

View File

@@ -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

View File

@@ -0,0 +1,37 @@
//
// HomeView.swift
// MacNearFuture
//
// Created by neon443 on 28/05/2025.
//
import SwiftUI
struct HomeView: View {
@StateObject var viewModel: EventViewModel
@StateObject var settingsModel: SettingsViewModel
var filteredEvents: [Event] {
switch settingsModel.settings.showCompletedInHome {
case true:
return viewModel.events
case false:
return viewModel.events.filter { !$0.complete }
}
}
var body: some View {
ScrollView {
ForEach(filteredEvents) { event in
EventListView(viewModel: viewModel, event: event)
}
}
.scrollContentBackground(.hidden)
}
}
#Preview {
HomeView(
viewModel: dummyEventViewModel(),
settingsModel: dummySettingsViewModel()
)
}

View File

@@ -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()

View File

@@ -15,18 +15,15 @@
A90D49452DDE1C7600781124 /* Tints.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A90D49432DDE1C1100781124 /* Tints.xcassets */; };
A90D49462DDE1C7A00781124 /* Tints.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A90D49432DDE1C1100781124 /* Tints.xcassets */; };
A90D494B2DDE2C2900781124 /* AddEventView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949F83C2DCAABE00064DCA0 /* AddEventView.swift */; };
A90D494F2DDE2C8500781124 /* EditEventViewMac.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D494E2DDE2C8500781124 /* EditEventViewMac.swift */; };
A90D49522DDE2D0000781124 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D49512DDE2D0000781124 /* Extensions.swift */; };
A90D49532DDE2D0000781124 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D49512DDE2D0000781124 /* Extensions.swift */; };
A90D49562DDE2D5800781124 /* SFSymbolsPicker in Frameworks */ = {isa = PBXBuildFile; productRef = A90D49552DDE2D5800781124 /* SFSymbolsPicker */; };
A90D49582DDE2DBD00781124 /* EventListViewMac.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D49572DDE2DBD00781124 /* EventListViewMac.swift */; };
A90D495B2DDE2EDB00781124 /* MacNearFutureApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D495A2DDE2EDB00781124 /* MacNearFutureApp.swift */; };
A90D495E2DDE3C7400781124 /* NFCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D495D2DDE3C7400781124 /* NFCommands.swift */; };
A90D495F2DDE3C7400781124 /* NFCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D495D2DDE3C7400781124 /* NFCommands.swift */; };
A90D49612DDE626300781124 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D49602DDE626300781124 /* Settings.swift */; };
A90D49622DDE626300781124 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D49602DDE626300781124 /* Settings.swift */; };
A90D49632DDE626300781124 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D49602DDE626300781124 /* Settings.swift */; };
A90D49672DDE6FAF00781124 /* YouAsked.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90D49662DDE6FAF00781124 /* YouAsked.swift */; };
A914FA4B2DD26C6800856265 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A914FA4A2DD26C0F00856265 /* HomeView.swift */; };
A914FA4D2DD2768900856265 /* WhatsNewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A914FA4C2DD2768900856265 /* WhatsNewView.swift */; };
A914FA4F2DD276D200856265 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A914FA4E2DD276D200856265 /* AboutView.swift */; };
@@ -53,6 +50,11 @@
A979F6102D270AF90094C0B3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A979F60F2D270AF80094C0B3 /* Assets.xcassets */; };
A979F6142D270AF90094C0B3 /* NearFutureWidgetsExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = A979F6022D270AF00094C0B3 /* NearFutureWidgetsExtension.appex */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
A979F6182D2714310094C0B3 /* Events.swift in Sources */ = {isa = PBXBuildFile; fileRef = A920C28B2D24011400E4F9B1 /* Events.swift */; };
A98C20CB2DE730740008D61C /* EventListViewMac.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98C20CA2DE730740008D61C /* EventListViewMac.swift */; };
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 */; };
A9FC7EEA2D2823920020D75B /* NearFutureWidgets.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9FC7EE92D28238A0020D75B /* NearFutureWidgets.swift */; };
/* End PBXBuildFile section */
@@ -64,6 +66,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 */
@@ -86,14 +95,11 @@
A90D49332DDE0FAF00781124 /* ContentViewMac.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentViewMac.swift; sourceTree = "<group>"; };
A90D49342DDE0FAF00781124 /* MacNearFuture.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MacNearFuture.entitlements; sourceTree = "<group>"; };
A90D49432DDE1C1100781124 /* Tints.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Tints.xcassets; sourceTree = "<group>"; };
A90D494E2DDE2C8500781124 /* EditEventViewMac.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EditEventViewMac.swift; path = MacNearFuture/Views/EditEventViewMac.swift; sourceTree = SOURCE_ROOT; };
A90D49512DDE2D0000781124 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
A90D49572DDE2DBD00781124 /* EventListViewMac.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventListViewMac.swift; sourceTree = "<group>"; };
A90D495A2DDE2EDB00781124 /* MacNearFutureApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MacNearFutureApp.swift; path = MacNearFuture/MacNearFutureApp.swift; sourceTree = SOURCE_ROOT; };
A90D495D2DDE3C7400781124 /* NFCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NFCommands.swift; sourceTree = "<group>"; };
A90D49602DDE626300781124 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
A90D49652DDE658100781124 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A90D49662DDE6FAF00781124 /* YouAsked.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YouAsked.swift; sourceTree = "<group>"; };
A90FDE222DC0D4310012790C /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
A914FA4A2DD26C0F00856265 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; };
A914FA4C2DD2768900856265 /* WhatsNewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WhatsNewView.swift; path = NearFuture/Views/Settings/WhatsNewView.swift; sourceTree = SOURCE_ROOT; };
@@ -123,6 +129,11 @@
A979F6092D270AF00094C0B3 /* NearFutureWidgetsBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NearFutureWidgetsBundle.swift; sourceTree = "<group>"; };
A979F60B2D270AF00094C0B3 /* NearFutureWidgetsLiveActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NearFutureWidgetsLiveActivity.swift; sourceTree = "<group>"; };
A979F60F2D270AF80094C0B3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
A98C20C92DE730740008D61C /* EditEventViewMac.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditEventViewMac.swift; sourceTree = "<group>"; };
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 */
@@ -166,6 +177,7 @@
isa = PBXGroup;
children = (
A90D495A2DDE2EDB00781124 /* MacNearFutureApp.swift */,
A98C20D32DE7339E0008D61C /* AboutView.swift */,
A90D495D2DDE3C7400781124 /* NFCommands.swift */,
A90D493F2DDE10EC00781124 /* Views */,
A90D49342DDE0FAF00781124 /* MacNearFuture.entitlements */,
@@ -177,8 +189,10 @@
isa = PBXGroup;
children = (
A90D49332DDE0FAF00781124 /* ContentViewMac.swift */,
A90D49572DDE2DBD00781124 /* EventListViewMac.swift */,
A90D494E2DDE2C8500781124 /* EditEventViewMac.swift */,
A98C20CF2DE731BD0008D61C /* HomeView.swift */,
A98C20CA2DE730740008D61C /* EventListViewMac.swift */,
A98C20CD2DE7308E0008D61C /* ArchiveView.swift */,
A98C20C82DE730420008D61C /* Modification */,
);
path = Views;
sourceTree = "<group>";
@@ -306,7 +320,6 @@
isa = PBXGroup;
children = (
A949F83F2DCAABE00064DCA0 /* ContentView.swift */,
A90D49662DDE6FAF00781124 /* YouAsked.swift */,
A949F8422DCAABE00064DCA0 /* Home */,
A949F83E2DCAABE00064DCA0 /* Events */,
A949F83B2DCAABE00064DCA0 /* Archive */,
@@ -338,6 +351,14 @@
path = NearFutureWidgets;
sourceTree = "<group>";
};
A98C20C82DE730420008D61C /* Modification */ = {
isa = PBXGroup;
children = (
A98C20C92DE730740008D61C /* EditEventViewMac.swift */,
);
path = Modification;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -352,6 +373,7 @@
buildRules = (
);
dependencies = (
A98C20D22DE732B10008D61C /* PBXTargetDependency */,
A90D494D2DDE2C6000781124 /* PBXTargetDependency */,
);
name = MacNearFuture;
@@ -483,15 +505,18 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A98C20CB2DE730740008D61C /* EventListViewMac.swift in Sources */,
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 */,
A90D49522DDE2D0000781124 /* Extensions.swift in Sources */,
A90D49422DDE114100781124 /* Events.swift in Sources */,
A90D49382DDE0FAF00781124 /* ContentViewMac.swift in Sources */,
A90D49622DDE626300781124 /* Settings.swift in Sources */,
A90D494F2DDE2C8500781124 /* EditEventViewMac.swift in Sources */,
A90D49582DDE2DBD00781124 /* EventListViewMac.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -515,7 +540,6 @@
A949F8512DCAABE00064DCA0 /* ExportView.swift in Sources */,
A90D49532DDE2D0000781124 /* Extensions.swift in Sources */,
A949F8522DCAABE00064DCA0 /* iCloudSettingsView.swift in Sources */,
A90D49672DDE6FAF00781124 /* YouAsked.swift in Sources */,
A949F8532DCAABE00064DCA0 /* ImportView.swift in Sources */,
A949F8542DCAABE00064DCA0 /* SettingsView.swift in Sources */,
A949F8552DCAABE00064DCA0 /* StatsView.swift in Sources */,
@@ -548,6 +572,11 @@
target = A979F6012D270AF00094C0B3 /* NearFutureWidgetsExtension */;
targetProxy = A979F6122D270AF90094C0B3 /* PBXContainerItemProxy */;
};
A98C20D22DE732B10008D61C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = A979F6012D270AF00094C0B3 /* NearFutureWidgetsExtension */;
targetProxy = A98C20D12DE732B10008D61C /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@@ -571,7 +600,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";
@@ -602,7 +631,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";
@@ -876,8 +905,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";
@@ -913,8 +943,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";

View File

@@ -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>

View File

@@ -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>

View File

@@ -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 {

View File

@@ -15,17 +15,13 @@ struct ImportView: View {
@State private var text: String = "Ready..."
@State private var fgColor: Color = .yellow
var body: some View {
List {
Section("Status") {
Label(text, systemImage: image)
.contentTransition(.numericText())
.foregroundStyle(fgColor)
}
TextField("", text: $importStr)
Button() {
@State private var showAlert: Bool = false
@State private var replaceCurrentEvents: Bool = false
fileprivate func importEvents() {
do throws {
try viewModel.importEvents(importStr)
try viewModel.importEvents(importStr, replace: replaceCurrentEvents)
withAnimation {
image = "checkmark.circle.fill"
text = "Complete"
@@ -44,6 +40,21 @@ struct ImportView: View {
fgColor = .red
}
}
}
var body: some View {
ZStack(alignment: .center) {
List {
Section("Status") {
Label(text, systemImage: image)
.contentTransition(.numericText())
.foregroundStyle(fgColor)
}
TextField("", text: $importStr)
Button() {
withAnimation {
showAlert.toggle()
}
} label: {
Label("Import", systemImage: "tray.and.arrow.down.fill")
}
@@ -55,7 +66,67 @@ struct ImportView: View {
fgColor = .yellow
}
}
.blur(radius: showAlert ? 2 : 0)
Group {
Rectangle()
.frame(maxWidth: .infinity, maxHeight: .infinity)
.foregroundStyle(replaceCurrentEvents ? .red.opacity(0.25) : .black.opacity(0.2))
.animation(.default, value: replaceCurrentEvents)
.ignoresSafeArea()
ZStack {
Rectangle()
.background(.ultraThinMaterial)
.clipShape(RoundedRectangle(cornerRadius: 25))
VStack(alignment: .center) {
Text("Are you sure?")
.font(.largeTitle)
.bold()
.foregroundStyle(replaceCurrentEvents ? .red : .two)
.animation(.default, value: replaceCurrentEvents)
Text("This will replace your current events!")
.lineLimit(nil)
.multilineTextAlignment(.center)
.opacity(replaceCurrentEvents ? 1 : 0)
.animation(.default, value: replaceCurrentEvents)
.foregroundStyle(.two)
Toggle("Replace Events", isOn: $replaceCurrentEvents)
.foregroundStyle(.two)
Spacer()
HStack {
Button() {
withAnimation {
showAlert.toggle()
}
importEvents()
} label: {
Text("cancel")
.font(.title2)
.bold()
}
.buttonStyle(BorderedProminentButtonStyle())
Spacer()
Button() {
withAnimation {
showAlert.toggle()
}
importEvents()
} label: {
Text("yes")
.font(.title2)
.bold()
}
.buttonStyle(BorderedProminentButtonStyle())
}
.padding()
}
.padding()
}
.frame(maxWidth: 250, maxHeight: 250)
}
.opacity(showAlert ? 1 : 0)
}
}
}

View File

@@ -95,8 +95,11 @@ struct SettingsView: View {
List {
if !settingsModel.notifsGranted {
Button("Request Notifications") {
Task {
settingsModel.notifsGranted = await requestNotifs()
Task.detached {
let requestNotifsResult = await requestNotifs()
await MainActor.run {
settingsModel.notifsGranted = requestNotifsResult
}
}
}
Text("\(Image(systemName: "xmark")) Notifications disabled for Near Future")

View File

@@ -1,44 +0,0 @@
//
// YouAsked.swift
// NearFuture
//
// Created by neon443 on 21/05/2025.
//
import SwiftUI
import AudioToolbox
@available(iOS 17.5, *)
struct YouAsked: View {
let startDate: Date = Date()
@State var timeElapsed: Int = 0
let timer = Timer.publish(every: 0.3, on: .current, in: .common).autoconnect()
var body: some View {
Text("\(timeElapsed)")
.onReceive(timer) { firedDate in
timeElapsed = Int(firedDate.timeIntervalSince(startDate))
}
.sensoryFeedback(.alignment, trigger: timeElapsed)
.sensoryFeedback(.decrease, trigger: timeElapsed)
.sensoryFeedback(.error, trigger: timeElapsed)
.sensoryFeedback(.impact, trigger: timeElapsed)
.sensoryFeedback(.increase, trigger: timeElapsed)
.sensoryFeedback(.levelChange, trigger: timeElapsed)
.sensoryFeedback(.pathComplete, trigger: timeElapsed)
.sensoryFeedback(.selection, trigger: timeElapsed)
.sensoryFeedback(.start, trigger: timeElapsed)
.sensoryFeedback(.stop, trigger: timeElapsed)
.sensoryFeedback(.success, trigger: timeElapsed)
.sensoryFeedback(.warning, trigger: timeElapsed)
.sensoryFeedback(.warning, trigger: timeElapsed)
}
}
#Preview {
if #available(iOS 17.5, *) {
YouAsked()
} else {
Text("update to ios 17 lil bro")
}
}

View File

@@ -31,54 +31,70 @@
"size" : "1024x1024"
},
{
"filename" : "MacNearFutureIcon16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "MacNearFutureIcon32.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "MacNearFutureIcon32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "MacNearFutureIcon64.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "MacNearFutureIcon128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "MacNearFutureIcon256.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "MacNearFutureIcon256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "MacNearFutureIcon512.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "MacNearFutureIcon512.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "MacNearFutureIcon.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
},
{
"filename" : "NearFutureIcon.png",
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -29,6 +29,12 @@
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"filename" : "bloo.png",
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {

View File

@@ -29,6 +29,12 @@
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"filename" : "blue.png",
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {

View File

@@ -29,6 +29,12 @@
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"filename" : "green.png",
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {

View File

@@ -29,6 +29,12 @@
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"filename" : "pink.png",
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {

View File

@@ -29,6 +29,12 @@
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"filename" : "purple.png",
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {

View File

@@ -29,6 +29,12 @@
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"filename" : "red.png",
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {

View File

@@ -29,6 +29,12 @@
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"filename" : "yellow.png",
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {

View File

Binary file not shown.

View File

@@ -248,8 +248,8 @@ class EventViewModel: ObservableObject, @unchecked Sendable {
updateSyncStatus()
loadEvents()
Task {
await checkPendingNotifs(getNotifs())
Task.detached {
await self.checkPendingNotifs(self.getNotifs())
}
WidgetCenter.shared.reloadAllTimelines()//reload all widgets when saving events
objectWillChange.send()
@@ -325,14 +325,18 @@ class EventViewModel: ObservableObject, @unchecked Sendable {
return ""
}
func importEvents(_ imported: String) throws {
func importEvents(_ imported: String, replace: Bool) throws {
guard let data = Data(base64Encoded: imported) else {
throw importError.invalidB64
}
let decoder = JSONDecoder()
do {
let decoded = try decoder.decode([Event].self, from: data)
if replace {
self.events = decoded
} else {
self.events = self.events + decoded
}
saveEvents()
} catch {
throw error
@@ -526,7 +530,7 @@ func getDevice() -> (sf: String, label: String) {
return (sf: "iphone", label: "iPhone")
#elseif canImport(AppKit)
return (sf: "", label: "")
return (sf: "desktopcomputer", label: "Mac")
#endif
}

View File

@@ -12,10 +12,10 @@ import AppKit
#endif
struct NFSettings: Codable, Equatable {
var showCompletedInHome: Bool
var tint: ColorCodable
var showWhatsNew: Bool
var prevAppVersion: String
var showCompletedInHome: Bool = false
var tint: ColorCodable = ColorCodable(.accentColor)
var showWhatsNew: Bool = true
var prevAppVersion: String = getVersion()+getBuildID()
}
class AccentIcon {
@@ -53,21 +53,7 @@ class AccentIcon {
}
class SettingsViewModel: ObservableObject {
#if canImport(UIKit)
@Published var settings: NFSettings = NFSettings(
showCompletedInHome: false,
tint: ColorCodable(uiColor: UIColor(named: "AccentColor")!),
showWhatsNew: true,
prevAppVersion: getVersion()+getBuildID()
)
#elseif canImport(AppKit)
@Published var settings: NFSettings = NFSettings(
showCompletedInHome: false,
tint: ColorCodable(nsColor: NSColor(named: "AccentColor")!),
showWhatsNew: true,
prevAppVersion: getVersion()+getBuildID()
)
#endif
@Published var settings: NFSettings = NFSettings()
@Published var notifsGranted: Bool = false
@@ -90,7 +76,7 @@ class SettingsViewModel: ObservableObject {
self.device = getDevice()
if load {
loadSettings()
Task {
Task.detached {
let requestResult = await requestNotifs()
await MainActor.run {
self.notifsGranted = requestResult